Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stefan Zabka
Companion App Android
Commits
98d48420
Commit
98d48420
authored
Aug 16, 2019
by
Andreas Schildbach
Browse files
SetClockJob, MoodFragment: Adapt to new data format for the rockets characteristic.
parent
e945ca2a
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/de/ccc/events/badge/card10/background/SetClockJob.kt
View file @
98d48420
...
...
@@ -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
,
0x
ff
u
).
toByteArray
()
rocketsCharacteristic
?.
value
=
ubyteArrayOf
(
0xffu
,
0x00u
,
0x
00
u
).
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
))
...
...
app/src/main/java/de/ccc/events/badge/card10/mood/MoodFragment.kt
View file @
98d48420
...
...
@@ -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
())
})
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment