Commit a5a016e2 authored by Stefan Zabka's avatar Stefan Zabka
Browse files

ble: personal status fixing all of the bugs

parent abfee43a
...@@ -41,19 +41,19 @@ class MoodFragment : Fragment() { ...@@ -41,19 +41,19 @@ class MoodFragment : Fragment() {
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
mood_congress.setOnClickListener{ mood_chaos.setOnClickListener{
card10Service?.setPersonalState(PersonalState.CHAOS) card10Service?.setPersonalState(PersonalState.CHAOS)
} }
mood_chaos.setOnClickListener{ mood_communication.setOnClickListener{
card10Service?.setPersonalState(PersonalState.COMMUNICATION) card10Service?.setPersonalState(PersonalState.COMMUNICATION)
} }
mood_congress.setOnClickListener{ mood_camp.setOnClickListener{
card10Service?.setPersonalState(PersonalState.CAMP) card10Service?.setPersonalState(PersonalState.CAMP)
} }
no_contact.setOnClickListener{ no_contact.setOnClickListener{
card10Service?.setPersonalState(PersonalState.NO_CONTACT) card10Service?.setPersonalState(PersonalState.NO_CONTACT)
} }
no_contact.setOnClickListener{ no_state.setOnClickListener{
card10Service?.setPersonalState(PersonalState.NONE) card10Service?.setPersonalState(PersonalState.NONE)
} }
} }
......
...@@ -63,8 +63,8 @@ class Card10Service( ...@@ -63,8 +63,8 @@ class Card10Service(
fun setPersonalState(value: PersonalState) { fun setPersonalState(value: PersonalState) {
personalStateCharacteristic.value = ByteArray(2) personalStateCharacteristic.value = ByteArray(2)
personalStateCharacteristic.value[0] = value.v.toByte() personalStateCharacteristic.value[1] = value.v.toByte()
personalStateCharacteristic.value[1] = (value.v shr 8).toByte() personalStateCharacteristic.value[0] = (value.v shr 8).toByte()
println("=== Writing personal State array : ${personalStateCharacteristic.value[0]},${personalStateCharacteristic.value[1]} ") println("=== Writing personal State array : ${personalStateCharacteristic.value[0]},${personalStateCharacteristic.value[1]} ")
ConnectionService.writeCharacteristic(personalStateCharacteristic) ConnectionService.writeCharacteristic(personalStateCharacteristic)
} }
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
android:text="@string/chaos"/> android:text="@string/chaos"/>
<Button android:id="@+id/mood_communication" android:layout_width="wrap_content" android:layout_height="wrap_content" <Button android:id="@+id/mood_communication" android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="@string/communication"/> android:text="@string/communication"/>
<Button android:id="@+id/mood_congress" android:layout_width="wrap_content" android:layout_height="wrap_content" <Button android:id="@+id/mood_camp" android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="@string/congress"/> android:text="@string/camp"/>
<Button android:id="@+id/no_contact" android:layout_width="wrap_content" android:layout_height="wrap_content" <Button android:id="@+id/no_contact" android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="@string/no_contact"/> android:text="@string/no_contact"/>
<Button android:id="@+id/no_state" android:layout_width="wrap_content" android:layout_height="wrap_content" <Button android:id="@+id/no_state" android:layout_width="wrap_content" android:layout_height="wrap_content"
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<string name="personal_state">Personal State</string> <string name="personal_state">Personal State</string>
<string name="chaos">Chaos</string> <string name="chaos">Chaos</string>
<string name="communication">Communication</string> <string name="communication">Communication</string>
<string name="congress">Congress</string> <string name="camp">Camp</string>
<string name="no_contact">No Contact</string> <string name="no_contact">No Contact</string>
<string name="off">Off</string> <string name="off">Off</string>
</resources> </resources>
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