Oh how annoying and frustrating that I cannot post more images or create more replies - you really don't help do you.
I've shown in these blocks how to get the information on what services and characteristics the sensor supports - but lot of info is sent so I used a text box to show it.
So there is the register a service and the readShorts - and that was another gotcha. You'd have thought it would send an integer value. But no, it sends a short (2 byte value 16 bits) (and it's unsigned because it's not a positive or negative number) and the big gotcha is that this data is in a list object and that the index for a list object starts at 1, not zero like just about every other programming language I've used (apart from dear old BASIC). It seems to me that getting just the first element will do the job - but I maybe wrong, I couldn't see any other elements in the list when I debugged it.
Anyway, when you've done these steps then you need an actual listener to respond to the data that is sent (arbitrarily/asynchronously?) from the sensor.
So what is the format of this short:
Well if I just output the short to a label I was getting a number like 23312 and similar.
In binary this is
0 1 0 1 1 0 1 1 0 0 0 1 0 0 0 0
Split this into a most significant byte and a least significant byte
0 1 0 1 1 0 1 1 and 0 0 0 1 0 0 0 0
Now look at the least significant bit at the far right. If this is a 0 then the heart rate is in the most significant byte (8 bits) and if a 1 then the data is 16 bits (and I don't know what you look at!
So 0 1 0 1 1 0 1 1 is 91 in decimal - a bit fast, but I was excited!!!
How get that most significant byte? In assembly language and up you would shift the short 2 bytes to the right by 8 bits, which is the same as dividing by 256 and losing any fraction - hence the format to 0 decimal places.
Anyhow the main code looks like the following and hacked from some code by Jose Luis Núñez (I think his app is on the Play Store but needs the newest BLE extension and some refactoring. It's also somewhere else as an aia but I can't remember where.)
Anyhow I hope this helps others who are taking their first steps. It took me four days of effort to get to this and it was really frustrating. But now it's done and I can move on to my speed and cadence sensors.
HeartRateMonitorGM.aia (314.5 KB)