Skip to content
Snippets Groups Projects
Commit e275ab7f authored by Stefan Zabka's avatar Stefan Zabka
Browse files

ble:card10 personal state sending the correct byte array now

parent 745aa095
No related branches found
No related tags found
No related merge requests found
...@@ -50,12 +50,12 @@ val LEDS_POWERSAFE_CHARACTERISTIC_UUID = UUID.fromString("42230217-2342-2342-234 ...@@ -50,12 +50,12 @@ val LEDS_POWERSAFE_CHARACTERISTIC_UUID = UUID.fromString("42230217-2342-2342-234
val FLASHLIGHT_CHARACTERISTIC_UUID = UUID.fromString("42230218-2342-2342-2342-234223422342") val FLASHLIGHT_CHARACTERISTIC_UUID = UUID.fromString("42230218-2342-2342-2342-234223422342")
val PERSONAL_STATE_CHARACTERISTIC_UUID = UUID.fromString("42230219-2342-2342-2342-234223422342") val PERSONAL_STATE_CHARACTERISTIC_UUID = UUID.fromString("42230219-2342-2342-2342-234223422342")
enum class PersonalState(val v: Byte) { enum class PersonalState(val v: Int) {
NONE(0x0000), NONE(0x0000),
NO_CONTACT(0x0100.toByte()), NO_CONTACT(0x0100),
CHAOS(0x0200.toByte()), CHAOS(0x0200),
COMMUNICATION(0x0300.toByte()), COMMUNICATION(0x0300),
CAMP(0x0400.toByte()) CAMP(0x0400)
} }
val LEDS_ABOVE_CHARACTERISTIC_UUID = UUID.fromString("42230220-2342-2342-2342-234223422342") val LEDS_ABOVE_CHARACTERISTIC_UUID = UUID.fromString("42230220-2342-2342-2342-234223422342")
......
...@@ -41,7 +41,7 @@ class Card10Service( ...@@ -41,7 +41,7 @@ class Card10Service(
timeCharacteristic.writeType = BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE timeCharacteristic.writeType = BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE
rocketsCharacteristic.writeType = BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE rocketsCharacteristic.writeType = BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE
ledsAboveCharacteristic.writeType = BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE ledsAboveCharacteristic.writeType = BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE
personalStateCharacteristic.writeType = BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT personalStateCharacteristic.writeType = BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE
} }
fun setTime() { fun setTime() {
...@@ -62,8 +62,10 @@ class Card10Service( ...@@ -62,8 +62,10 @@ class Card10Service(
} }
fun setPersonalState(value: PersonalState) { fun setPersonalState(value: PersonalState) {
personalStateCharacteristic.value = ByteArray(1) personalStateCharacteristic.value = ByteArray(2)
personalStateCharacteristic.value[0] = value.v personalStateCharacteristic.value[0] = value.v.toByte()
personalStateCharacteristic.value[1] = (value.v shr 8).toByte()
println("=== Writing personal State array : ${personalStateCharacteristic.value[0]},${personalStateCharacteristic.value[1]} ")
ConnectionService.writeCharacteristic(personalStateCharacteristic) ConnectionService.writeCharacteristic(personalStateCharacteristic)
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment