use of nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.UIntBitWriter in project Gadgetbridge by Freeyourgadget.
the class AlarmRepeat method toInt.
public int toInt() {
UIntBitWriter uIntBitWriter = new UIntBitWriter(7);
uIntBitWriter.appendBoolean(this.repeat[6]);
uIntBitWriter.appendBoolean(this.repeat[5]);
uIntBitWriter.appendBoolean(this.repeat[4]);
uIntBitWriter.appendBoolean(this.repeat[3]);
uIntBitWriter.appendBoolean(this.repeat[2]);
uIntBitWriter.appendBoolean(this.repeat[1]);
uIntBitWriter.appendBoolean(this.repeat[0]);
return (int) uIntBitWriter.getValue();
}
use of nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.UIntBitWriter in project Gadgetbridge by Freeyourgadget.
the class BandAlarms method toByteArray.
public byte[] toByteArray() {
ByteArrayWriter byteArrayWriter = new ByteArrayWriter();
if (this.alarms.size() == 0) {
byteArrayWriter.appendUint32(1073741824L);
} else {
for (BandAlarm bandAlarm : this.alarms) {
UIntBitWriter uIntBitWriter = new UIntBitWriter(32);
uIntBitWriter.append(2, 0);
uIntBitWriter.append(4, bandAlarm.index);
uIntBitWriter.append(2, bandAlarm.state.value);
uIntBitWriter.append(4, bandAlarm.interval);
uIntBitWriter.append(6, bandAlarm.hour);
uIntBitWriter.append(6, bandAlarm.minute);
uIntBitWriter.append(1, 0);
uIntBitWriter.append(7, bandAlarm.repeat.toInt());
byteArrayWriter.appendUint32(uIntBitWriter.getValue());
}
}
return byteArrayWriter.getByteArray();
}
use of nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.UIntBitWriter in project Gadgetbridge by Freeyourgadget.
the class ControlPointLowVibration method toByteArray.
public final byte[] toByteArray() {
final UIntBitWriter uIntBitWriter = new UIntBitWriter(16);
uIntBitWriter.append(13, 0);
uIntBitWriter.appendBoolean(this.smartWakeUp);
uIntBitWriter.appendBoolean(this.incomingCall);
uIntBitWriter.appendBoolean(this.notification);
final ByteArrayWriter byteArrayWriter = this.getValueWriter();
byteArrayWriter.appendUint16((int) uIntBitWriter.getValue());
return byteArrayWriter.getByteArray();
}
Aggregations