Search in sources :

Example 1 with BluetoothBytesParser

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());
}
Also used : BluetoothBytesParser(com.welie.blessed.BluetoothBytesParser)

Example 2 with BluetoothBytesParser

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());
}
Also used : BluetoothBytesParser(com.welie.blessed.BluetoothBytesParser)

Example 3 with BluetoothBytesParser

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());
}
Also used : BluetoothBytesParser(com.welie.blessed.BluetoothBytesParser)

Example 4 with BluetoothBytesParser

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());
}
Also used : BluetoothBytesParser(com.welie.blessed.BluetoothBytesParser)

Example 5 with BluetoothBytesParser

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());
}
Also used : BluetoothBytesParser(com.welie.blessed.BluetoothBytesParser)

Aggregations

BluetoothBytesParser (com.welie.blessed.BluetoothBytesParser)22 Date (java.util.Date)3 ScaleMeasurement (com.health.openscale.core.datatypes.ScaleMeasurement)2 ScaleUser (com.health.openscale.core.datatypes.ScaleUser)2 Converters (com.health.openscale.core.utils.Converters)1 GregorianCalendar (java.util.GregorianCalendar)1