Thanks!
I've just given some useful links to Jose.
I hope it will be helpful.
Massimo
I've just given some useful links to Jose.
I hope it will be helpful.
Massimo
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
private static final int PEDAL_POWER_BALANCE_PRESENT = 0x0001;
private static final int ACCUMULATED_TORQUE_PRESENT = 0x0004;
private static final int WHEEL_REVOLUTION_DATA_PRESENT = 0x0010;
private static final int CRANK_REVOLUTION_DATA_PRESENT = 0x0020;
private static final int EXTREME_FORCE_MAGNITUDES_PRESENT = 0x0040;
private static final int EXTREME_TORQUE_MAGNITUDES_PRESENT = 0x0080;
private static final int EXTREME_ANGLES_PRESENT = 0x0100;
private static final int TOP_DEAD_SPOT_ANGLE_PRESENT = 0x0200;
private static final int BOTTOM_DEAD_SPOT_ANGLE_PRESENT = 0x0400;
private static final int ACCUMULATED_ENERGY_PRESENT = 0x0800;
.
.
.
if (characteristic.getUuid().toString().equalsIgnoreCase(CHARACTERISTIC_UUID_CYCLING_POWER)) {
// Read flags
int flag = characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT16, 0);
// read istantaneous power (always present)
int power = characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_SINT16, 2);
// Read optional fields
int offset = 4;
if ((flag & PEDAL_POWER_BALANCE_PRESENT) != 0) {
power_balance = characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT8, offset);
offset +=1;
}
if ((flag & ACCUMULATED_TORQUE_PRESENT) != 0) {
accumulatedTorque = characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT16, offset);
offset +=2;
}
if ((flag & WHEEL_REVOLUTION_DATA_PRESENT) != 0) {
wheel_revolutions = characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, offset);
offset +=4;
last_wheel_event_time = characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT16, offset);
offset +=2;
}
if ((flag & CRANK_REVOLUTION_DATA_PRESENT) != 0) {
crank_revolutions = characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT16, offset);
offset +=2;
last_crank_event_time = characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT16, offset);
offset +=2;
}
.
.
.
then do the same for all the other fields in the following order:
Extreme Force Magnitudes - Maximum Force Magnitude
Etreme Force Magnitudes - Minimum Force Magnitude
Extreme Torque Magnitudes- Maximum Torque Magnitude
Extreme Torque Magnitudes- Minimum Torque Magnitude
Extreme Angles - Maximum Angle
Extreme Angles - Minimum Angle
Top Dead Spot Angle
Bottom Dead Spot Angle
Accumulated Energy
}