Search in sources :

Example 1 with ByteArrayWriter

use of nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.ByteArrayWriter in project Gadgetbridge by Freeyourgadget.

the class BandTime method toByteArray.

public byte[] toByteArray() {
    ByteArrayWriter byteArrayWriter = new ByteArrayWriter();
    byteArrayWriter.appendUint16(this.year);
    byteArrayWriter.appendUint8(this.month);
    byteArrayWriter.appendUint8(this.dayOfMonth);
    byteArrayWriter.appendUint8(this.hour);
    byteArrayWriter.appendUint8(this.min);
    byteArrayWriter.appendUint8(this.sec);
    byteArrayWriter.appendUint8(this.dayOfWeek);
    byteArrayWriter.appendValue(this.timeZone.key, IntFormat.SINT8);
    byteArrayWriter.appendUint8(this.dst.key);
    return byteArrayWriter.getByteArray();
}
Also used : ByteArrayWriter(nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.ByteArrayWriter)

Example 2 with ByteArrayWriter

use of nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.ByteArrayWriter in project Gadgetbridge by Freeyourgadget.

the class EventBase method getValueWriter.

protected ByteArrayWriter getValueWriter() {
    ByteArrayWriter byteArrayWriter = new ByteArrayWriter();
    byteArrayWriter.appendUint8(this.eventCode.value);
    return byteArrayWriter;
}
Also used : ByteArrayWriter(nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.ByteArrayWriter)

Example 3 with ByteArrayWriter

use of nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.ByteArrayWriter in project Gadgetbridge by Freeyourgadget.

the class EventWithValue method toByteArray.

public byte[] toByteArray() {
    ByteArrayWriter byteArrayWriter = this.getValueWriter();
    byteArrayWriter.appendUint32(this.value);
    return byteArrayWriter.getByteArray();
}
Also used : ByteArrayWriter(nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.ByteArrayWriter)

Example 4 with ByteArrayWriter

use of nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.ByteArrayWriter 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 5 with ByteArrayWriter

use of nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.ByteArrayWriter in project Gadgetbridge by Freeyourgadget.

the class ControlPoint method getValueWriter.

protected final ByteArrayWriter getValueWriter() {
    final ByteArrayWriter byteArrayWriter = new ByteArrayWriter();
    byteArrayWriter.appendUint8(this.code.value);
    return byteArrayWriter;
}
Also used : ByteArrayWriter(nodomain.freeyourgadget.gadgetbridge.service.devices.sonyswr12.util.ByteArrayWriter)

Aggregations

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