I am trying to write an iOS app in Swift that uses the CoreBluetooth framework. I know how to initiate and obtain the values and subscribe to the values I want from the Bluetooth BLE peripheral that I'm using and I'm receiving the values properly. I was looking for help in understanding how to convert the hex code values to a signed floating point number.
Here is the data characteristic information:
Here are a couple data examples:
- The gauge displays 0.52705 inches and I receive 0xc0ec063f0100.
- The gauge displays -0.41250 and I receive 0x3333d3be0100.
I understand the last 2 bytes (bytes 5 and 6).
I just can't figure out how to convert the first 4 bytes back to the values shown on the gauge display. Thank you!