(BluetoothGattCharacteristic c)
| 137 | } |
| 138 | |
| 139 | private void readHeartRateMeasurement(BluetoothGattCharacteristic c) { |
| 140 | int offset = 0; |
| 141 | final int flags = c.getIntValue(c.FORMAT_UINT8, offset); |
| 142 | ++offset; |
| 143 | |
| 144 | final boolean bpm16 = (flags & 0x1) != 0; |
| 145 | |
| 146 | final int bpm = bpm16 |
| 147 | ? c.getIntValue(c.FORMAT_UINT16, offset) |
| 148 | : c.getIntValue(c.FORMAT_UINT8, offset); |
| 149 | |
| 150 | listener.onHeartRateSensor(bpm); |
| 151 | } |
| 152 | |
| 153 | static long toUnsignedLong(int x) { |
| 154 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) |
no test coverage detected