How to get raw ECG data with BLE - swift

I'm currently working on a holter monitor. I can successfully show the heart rate (bpm) using the Heart Rate Measurement (0x2A37) characteristic of Bluetooth. But I want to show an ECG line graph so I need the raw heart data, with the voltage amounts specified. I can reach some other information such as RR-interval and sensor contact status (with this characteristic) but I don't know how to get the raw data itself. Is it possible that I'm missing a feature of this characteristic, or is there any other way I can get this data? I'm using an AD8232 heart monitor.

The GATT Heart Rate Service doesn't provide access to the raw signal (see Gatt specifications).
If you have access to the hardware platform you will have to write a custom service and characteristic that supports notification, and forward the data from the sensor onto this.
You'll then have to write the matching app-side code to get this data and convert it into a usable format.

Related

Beacon Detection in Swift

I am building an app in swift that helps me detect beacons and display their RSSI values. I was using the native CoreLocations library from apple to detect beacons but noticed that the rate of detection is set to 1 second and it cannot be changed. Is there a way to reduce the detection interval to say 100-500ms so that I can get more RSSI values?
You can also use CoreBluetooth APIs to detect beacons, which give you a separate RSSI measurement for each packet detected. For a beacon advertising at 10 times per second, this would give you an RSSI update approximately every 100ms.
There are two big catches to using CoreBluetooth:
It cannot detect iBeacon because Apple blocks it. CoreBluetooth can detect AltBeacon and Eddystone.
The API is harder to use with beacons — you have to parse out the identifiers from the packets manually.
Also, be aware that the RSSI value returned by CoreLocation once per second is actually an average based on all packets received over the previous second, so it is more stable than individual samples taken at a higher frequency. Depending on what you want the samples for, you may find the higher variation is a problem.
Finally, be aware that the max rate at which you get samples with CoreBluetooth depends on the beacon transmission rate. Some beacons advertise only once per second. If you are working with such a beacon, you will not get any more samples with CoreBluetooth.

Movesense Peak detectiion trigger

On the Maxim EKG chip, INT2B can be set as a peak detection trigger. How do I send a BT notification, preferably with a timestamp as soon as possible through the Nordic platform? Thank you.
In Movesense architecture there is no direct access to hardware, everything happens via Movesense API (defined in MovesenseCoreLib/resources/movesense-api as ".yaml"-files).
The Maxim 30003 peak detection is accessed via /Meas/HR -resource which gives notification each time a peak is detected. That resource can be subscribed to directly from the mobile (via the MDS library, see: movesense-mobile-lib). The delay from the actual peak to the mobile notification should be relatively constant and dominated by Maxim chips detection delay (read: I have not measured). The BLE connection causes itself some delay that should be 20-100ms or so depending on the BLE connection parameters etc. This is the way I'd go for since later when we add the timestamp to /Meas/HR (it has been requested from us already) it's a simple modification to use the included timestamp.
Alternatively you can write your own sensor app (firmware) with its own API, that can subscribe to /Meas/HR and for each notification do GET to /Time/Detailed and return just the timestamp each time a peak is detected. For a starting point for that I'd recommend the jumpmeter_app and modify it accordingly.
Full disclaimer: I work for Movesense team

Where are the beacon information registered in Google's Proximity API available?

I know iBeacon only broadcasts UUID signal. What I'm reading about Proximity Beacon API is confusing. We must register:
Advertised ID (required)
Status
Stability
Latitude and longitude
Indoor floor level
Google Places API Place ID.
Text description
Arbitrary properties as key/value pairs
Does Eddystone broadcast all the information above, as shown on this image?
Beacons broadcast very little information themselves — typically only a Proximity UUID + major + minor (for iBeacons) or a BeaconID + transmission power (for Eddystone UID beacons).
The Proximity Beacon API is a service that allows you to "register" a beacon along with additional information for it. Some of this information, such as:
PlaceID
Building level
Stability
Lat/Lng
Description
Properties
are entirely optional are only for the registering beacon owner's own uses. You can choose to specify exactly where a beacon is with a lat/lng and a PlaceID, or you can skip these.
The Proximity Beacon API also lets you associate little pieces of data called "attachments" to your beacon. These are things that people can see when they run into your beacons in the wild. The content and format of these are entirely up to you.
So, if you want to register a beacon with the PB API, the only thing you MUST specify is the advertisementId.
For an Eddystone beacon, this will be 16 bytes (The BeaconID from the UID Frame) whereas for iBeacons, this will be 20 bytes (16 byte iBeacon Proximity UUID + 2 byte major + 2 byte minor).
Note that as per my answer to another question, what you upload to the register function for the beacon is a base64 encoded string representing the underlying BINARY data. So, get a Buffer or byte array representing the advertisement ID and then base64 encode that.
As you noted, the beacon itself only broadcasts its identifier—i.e., UUID + Major + Minor for iBeacon, and Namespace + Instance for Eddystone.
These additional fields that you register with Google's Proximity API are stored entirely on their server, and not broadcast by the beacon.
When you detect a beacon, you can read its identifier from the advertising packet, and use it to retrieve the additional data from Proximity API.
Imagine you have a beacon with identifier X. You upload the beacon's data to Proximity API, e.g., Advertised ID = X, description = "My beacon". Later, when your app detects that beacon, it can go to the Proximity API and say "give me data for beacon X", and that's how you gain access to the extra information, e.g., the "My beacon" description.
The image you've linked to is from a Proximity API tutorial I remember seeing on the Internet, and it's just a simplification, because strictly speaking, the beacon doesn't broadcast all this information, only the identifier. But this identifier is enough to fetch the extra data from Proximity API (providing you have Internet connection), so one can think about Proximity API as something that extends what you know about the beacon, and I think that's the reason why the image shows it this way.

Using XMPP - PEP/PubSub for sensor readings

I'm planning to setup some sensors for a project I am working on. I plan to use a simple xmpp client on each device hosting sensors and posting the readings via PEP/PubSub.
I would like to run a program which dynamically displays this sensor data upon receiving the push notifications from the sensor clients.
I intend to communicate on a LAN with 100Mbs connections and several WIFI APs as needed for the sensor locations.
Is XMPP a good choice for a backend?
Would this scale well at say 100 devices running 6-24 sensors each updating every 15-30 seconds?
XMPP would certainly be able to handle this use case, and seems a good fit based on the small set of requirements you have shown. I am assuming that the sensor data is small amounts of textual information.
From what I can see, I would not use PEP though, just straight up pubsub with a single node for all the sensors to publish to. Pretty much as simple as it gets.
I would think that any XMPP server should be able to easily handle that load. I know I was able to publish 800,000-1,000,000 items to a persistent node in Openfire in about 5 minutes (3.7.2 alpha version). A non persistent node would probably do a little better.

How to retrive cellular network information from XCode, iPhone?

Is there any APIs available in which can provide me with the following details:
Signal Quality
Country Code
Network Code
Area Code
Cell ID
Base Station ID
GPRS Cell ID
GPRS Base Station ID
Signal Strength;
Max Signal Strength
But what I need if it is not available to retrive Signal Strength in dbm
Note: I can get this information manually by dialing 3001#12345# as shown in the following screen shot from my iPhone (Signal Strength showed in the upper left corner in dbm):
https://picasaweb.google.com/lh/photo/Qf6MBY2jtfpWImTyTHk4Gg?feat=directlink
Apple has not officially provided any API to calculate the signal strength.
But you can refer to official Core Telephony framework (CTCarrier Class) to get some of the details such as Country Code,Network Code etc.