@@ -6,6 +6,7 @@ import io.rebble.libpebblecommon.protocolhelpers.PebblePacket
6
6
import io.rebble.libpebblecommon.protocolhelpers.ProtocolEndpoint
7
7
import io.rebble.libpebblecommon.structmapper.*
8
8
import io.rebble.libpebblecommon.util.DataBuffer
9
+ import io.rebble.libpebblecommon.util.Endian
9
10
10
11
11
12
class AppMessageTuple () : StructMappable() {
@@ -22,9 +23,9 @@ class AppMessageTuple() : StructMappable() {
22
23
}
23
24
}
24
25
25
- val key = SUInt (m, endianness = ' < ' )
26
+ val key = SUInt (m, endianness = Endian . Little )
26
27
val type = SUByte (m)
27
- val dataLength = SUShort (m, endianness = ' < ' )
28
+ val dataLength = SUShort (m, endianness = Endian . Little )
28
29
val data = SBytes (m, 0 )
29
30
30
31
init {
@@ -46,8 +47,8 @@ class AppMessageTuple() : StructMappable() {
46
47
get() {
47
48
val obj = when (val size = dataLength.get().toInt()) {
48
49
1 -> SByte (StructMapper ())
49
- 2 -> SShort (StructMapper (), endianness = ' < ' )
50
- 4 -> SInt (StructMapper (), endianness = ' < ' )
50
+ 2 -> SShort (StructMapper (), endianness = Endian . Little )
51
+ 4 -> SInt (StructMapper (), endianness = Endian . Little )
51
52
else -> error(" Size not supported: $size " )
52
53
}
53
54
return obj.apply {
@@ -59,8 +60,8 @@ class AppMessageTuple() : StructMappable() {
59
60
get() {
60
61
val obj = when (val size = dataLength.get().toInt()) {
61
62
1 -> SUByte (StructMapper ())
62
- 2 -> SUShort (StructMapper (), endianness = ' < ' )
63
- 4 -> SUInt (StructMapper (), endianness = ' < ' )
63
+ 2 -> SUShort (StructMapper (), endianness = Endian . Little )
64
+ 4 -> SUInt (StructMapper (), endianness = Endian . Little )
64
65
else -> error(" Size not supported: $size " )
65
66
}
66
67
return obj.apply {
@@ -146,7 +147,7 @@ class AppMessageTuple() : StructMappable() {
146
147
this .key.set(key)
147
148
this .type.set(Type .Int .value)
148
149
149
- val bytes = SShort (StructMapper (), data, endianness = ' < ' ).toBytes()
150
+ val bytes = SShort (StructMapper (), data, endianness = Endian . Little ).toBytes()
150
151
this .dataLength.set(bytes.size.toUShort())
151
152
this .data.set(bytes)
152
153
}
@@ -158,7 +159,7 @@ class AppMessageTuple() : StructMappable() {
158
159
this .key.set(key)
159
160
this .type.set(Type .UInt .value)
160
161
161
- val bytes = SUShort (StructMapper (), data, endianness = ' < ' ).toBytes()
162
+ val bytes = SUShort (StructMapper (), data, endianness = Endian . Little ).toBytes()
162
163
this .dataLength.set(bytes.size.toUShort())
163
164
this .data.set(bytes)
164
165
}
@@ -170,7 +171,7 @@ class AppMessageTuple() : StructMappable() {
170
171
this .key.set(key)
171
172
this .type.set(Type .Int .value)
172
173
173
- val bytes = SInt (StructMapper (), data, endianness = ' < ' ).toBytes()
174
+ val bytes = SInt (StructMapper (), data, endianness = Endian . Little ).toBytes()
174
175
this .dataLength.set(bytes.size.toUShort())
175
176
this .data.set(bytes)
176
177
}
@@ -182,7 +183,7 @@ class AppMessageTuple() : StructMappable() {
182
183
this .key.set(key)
183
184
this .type.set(Type .UInt .value)
184
185
185
- val bytes = SUInt (StructMapper (), data, endianness = ' < ' ).toBytes()
186
+ val bytes = SUInt (StructMapper (), data, endianness = Endian . Little ).toBytes()
186
187
this .dataLength.set(bytes.size.toUShort())
187
188
this .data.set(bytes)
188
189
}
0 commit comments