@@ -6,6 +6,7 @@ import io.rebble.libpebblecommon.protocolhelpers.PebblePacket
66import io.rebble.libpebblecommon.protocolhelpers.ProtocolEndpoint
77import io.rebble.libpebblecommon.structmapper.*
88import io.rebble.libpebblecommon.util.DataBuffer
9+ import io.rebble.libpebblecommon.util.Endian
910
1011
1112class AppMessageTuple () : StructMappable() {
@@ -22,9 +23,9 @@ class AppMessageTuple() : StructMappable() {
2223 }
2324 }
2425
25- val key = SUInt (m, endianness = ' < ' )
26+ val key = SUInt (m, endianness = Endian . Little )
2627 val type = SUByte (m)
27- val dataLength = SUShort (m, endianness = ' < ' )
28+ val dataLength = SUShort (m, endianness = Endian . Little )
2829 val data = SBytes (m, 0 )
2930
3031 init {
@@ -46,8 +47,8 @@ class AppMessageTuple() : StructMappable() {
4647 get() {
4748 val obj = when (val size = dataLength.get().toInt()) {
4849 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 )
5152 else -> error(" Size not supported: $size " )
5253 }
5354 return obj.apply {
@@ -59,8 +60,8 @@ class AppMessageTuple() : StructMappable() {
5960 get() {
6061 val obj = when (val size = dataLength.get().toInt()) {
6162 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 )
6465 else -> error(" Size not supported: $size " )
6566 }
6667 return obj.apply {
@@ -146,7 +147,7 @@ class AppMessageTuple() : StructMappable() {
146147 this .key.set(key)
147148 this .type.set(Type .Int .value)
148149
149- val bytes = SShort (StructMapper (), data, endianness = ' < ' ).toBytes()
150+ val bytes = SShort (StructMapper (), data, endianness = Endian . Little ).toBytes()
150151 this .dataLength.set(bytes.size.toUShort())
151152 this .data.set(bytes)
152153 }
@@ -158,7 +159,7 @@ class AppMessageTuple() : StructMappable() {
158159 this .key.set(key)
159160 this .type.set(Type .UInt .value)
160161
161- val bytes = SUShort (StructMapper (), data, endianness = ' < ' ).toBytes()
162+ val bytes = SUShort (StructMapper (), data, endianness = Endian . Little ).toBytes()
162163 this .dataLength.set(bytes.size.toUShort())
163164 this .data.set(bytes)
164165 }
@@ -170,7 +171,7 @@ class AppMessageTuple() : StructMappable() {
170171 this .key.set(key)
171172 this .type.set(Type .Int .value)
172173
173- val bytes = SInt (StructMapper (), data, endianness = ' < ' ).toBytes()
174+ val bytes = SInt (StructMapper (), data, endianness = Endian . Little ).toBytes()
174175 this .dataLength.set(bytes.size.toUShort())
175176 this .data.set(bytes)
176177 }
@@ -182,7 +183,7 @@ class AppMessageTuple() : StructMappable() {
182183 this .key.set(key)
183184 this .type.set(Type .UInt .value)
184185
185- val bytes = SUInt (StructMapper (), data, endianness = ' < ' ).toBytes()
186+ val bytes = SUInt (StructMapper (), data, endianness = Endian . Little ).toBytes()
186187 this .dataLength.set(bytes.size.toUShort())
187188 this .data.set(bytes)
188189 }
0 commit comments