use of com.welie.blessed.BluetoothBytesParser in project openScale by oliexdev.
the class BluetoothStandardWeightProfile method writeHeight.
protected void writeHeight() {
BluetoothBytesParser parser = new BluetoothBytesParser();
int height = (int) this.selectedUser.getBodyHeight();
Timber.d(String.format("height: %d", height));
parser.setIntValue(height, FORMAT_UINT16);
writeBytes(BluetoothGattUuid.SERVICE_USER_DATA, BluetoothGattUuid.CHARACTERISTIC_USER_HEIGHT, parser.getValue());
}
use of com.welie.blessed.BluetoothBytesParser in project openScale by oliexdev.
the class BluetoothStandardWeightProfile method setUser.
protected void setUser(int userIndex, int consentCode) {
BluetoothBytesParser parser = new BluetoothBytesParser(new byte[] { 0, 0, 0, 0 });
parser.setIntValue(UDS_CP_CONSENT, FORMAT_UINT8, 0);
parser.setIntValue(userIndex, FORMAT_UINT8, 1);
parser.setIntValue(consentCode, FORMAT_UINT16, 2);
Timber.d(String.format("setUser userIndex: %d, consentCode: %d", userIndex, consentCode));
writeBytes(BluetoothGattUuid.SERVICE_USER_DATA, BluetoothGattUuid.CHARACTERISTIC_USER_CONTROL_POINT, parser.getValue());
}
use of com.welie.blessed.BluetoothBytesParser in project openScale by oliexdev.
the class BluetoothStandardWeightProfile method deleteUser.
protected void deleteUser() {
BluetoothBytesParser parser = new BluetoothBytesParser(new byte[] { 0 });
parser.setIntValue(UDS_CP_DELETE_USER_DATA, FORMAT_UINT8, 0);
writeBytes(BluetoothGattUuid.SERVICE_USER_DATA, BluetoothGattUuid.CHARACTERISTIC_USER_CONTROL_POINT, parser.getValue());
}
use of com.welie.blessed.BluetoothBytesParser in project openScale by oliexdev.
the class BluetoothStandardWeightProfile method setChangeIncrement.
protected void setChangeIncrement() {
BluetoothBytesParser parser = new BluetoothBytesParser();
parser.setIntValue(1, FORMAT_UINT8);
writeBytes(BluetoothGattUuid.SERVICE_USER_DATA, BluetoothGattUuid.CHARACTERISTIC_CHANGE_INCREMENT, parser.getValue());
}
use of com.welie.blessed.BluetoothBytesParser in project openScale by oliexdev.
the class BluetoothStandardWeightProfile method writeGender.
protected void writeGender() {
BluetoothBytesParser parser = new BluetoothBytesParser();
int gender = this.selectedUser.getGender().toInt();
Timber.d(String.format("gender: %d", gender));
parser.setIntValue(gender, FORMAT_UINT8);
writeBytes(BluetoothGattUuid.SERVICE_USER_DATA, BluetoothGattUuid.CHARACTERISTIC_USER_GENDER, parser.getValue());
}
Aggregations