Search in sources :

Example 1 with UIntBitWriter

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();
}
Also used : UIntBitWriter(nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.UIntBitWriter)

Example 2 with UIntBitWriter

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();
}
Also used : UIntBitWriter(nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.UIntBitWriter) ByteArrayWriter(nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.ByteArrayWriter)

Example 3 with UIntBitWriter

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();
}
Also used : UIntBitWriter(nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.UIntBitWriter) ByteArrayWriter(nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.ByteArrayWriter)

Aggregations

UIntBitWriter (nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.UIntBitWriter)3 ByteArrayWriter (nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.ByteArrayWriter)2