Commit 98d48420 authored by Andreas Schildbach's avatar Andreas Schildbach
Browse files

SetClockJob, MoodFragment: Adapt to new data format for the rockets characteristic.

parent e945ca2a
......@@ -74,7 +74,7 @@ class SetClockJob(context: Context, workerParameters: WorkerParameters) : Worker
// TODO at this point update the clock, rather than blinking the LED
rocketsCharacteristic?.value = ubyteArrayOf(0x00u, 0xffu).toByteArray()
rocketsCharacteristic?.value = ubyteArrayOf(0xffu, 0x00u, 0x00u).toByteArray()
if (gatt.writeCharacteristic(rocketsCharacteristic)) {
writeLatch = CountDownLatch(1)
if (!writeLatch.await(1, TimeUnit.MINUTES))
......@@ -84,7 +84,7 @@ class SetClockJob(context: Context, workerParameters: WorkerParameters) : Worker
Thread.sleep(1000)
rocketsCharacteristic?.value = ubyteArrayOf(0x00u, 0x00u).toByteArray()
rocketsCharacteristic?.value = ubyteArrayOf(0x00u, 0x00u, 0x00u).toByteArray()
if (gatt.writeCharacteristic(rocketsCharacteristic)) {
writeLatch = CountDownLatch(1)
if (!writeLatch.await(1, TimeUnit.MINUTES))
......
......@@ -82,19 +82,13 @@ class MoodFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
mood_good.setOnClickListener({
writeGatt(rocketsCharacteristic!!, ubyteArrayOf(0x00u, 0xffu).toByteArray())
writeGatt(rocketsCharacteristic!!, ubyteArrayOf(0x01u, 0x00u).toByteArray())
writeGatt(rocketsCharacteristic!!, ubyteArrayOf(0x02u, 0x00u).toByteArray())
writeGatt(rocketsCharacteristic!!, ubyteArrayOf(0xffu, 0x00u, 0x00u).toByteArray())
})
mood_neutral.setOnClickListener({
writeGatt(rocketsCharacteristic!!, ubyteArrayOf(0x00u, 0x00u).toByteArray())
writeGatt(rocketsCharacteristic!!, ubyteArrayOf(0x01u, 0xffu).toByteArray())
writeGatt(rocketsCharacteristic!!, ubyteArrayOf(0x02u, 0x00u).toByteArray())
writeGatt(rocketsCharacteristic!!, ubyteArrayOf(0x00u, 0xffu, 0x00u).toByteArray())
})
mood_bad.setOnClickListener({
writeGatt(rocketsCharacteristic!!, ubyteArrayOf(0x00u, 0x00u).toByteArray())
writeGatt(rocketsCharacteristic!!, ubyteArrayOf(0x01u, 0x00u).toByteArray())
writeGatt(rocketsCharacteristic!!, ubyteArrayOf(0x02u, 0xffu).toByteArray())
writeGatt(rocketsCharacteristic!!, ubyteArrayOf(0x00u, 0x00u, 0xffu).toByteArray())
})
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment