Added Navigation service #5

Merged
Elara6331 merged 9 commits from yannickulrich/infinitime:navigation-service into master 2022-11-03 19:09:07 +00:00
Showing only changes of commit 2fbd8cb666 - Show all commits

View File

@ -38,6 +38,10 @@ const (
FSTransferChar = "adaf0200-4669-6c65-5472-616e73666572" FSTransferChar = "adaf0200-4669-6c65-5472-616e73666572"
FSVersionChar = "adaf0100-4669-6c65-5472-616e73666572" FSVersionChar = "adaf0100-4669-6c65-5472-616e73666572"
WeatherDataChar = "00040001-78fc-48fe-8e23-433b3a1942d0" WeatherDataChar = "00040001-78fc-48fe-8e23-433b3a1942d0"
NavFlagsChar = "00010001-78fc-48fe-8e23-433b3a1942d0"
NavNarrativeChar= "00010002-78fc-48fe-8e23-433b3a1942d0"
NavManDistChar = "00010003-78fc-48fe-8e23-433b3a1942d0"
NavProgressChar = "00010004-78fc-48fe-8e23-433b3a1942d0"
) )
var charNames = map[string]string{ var charNames = map[string]string{
@ -52,10 +56,18 @@ var charNames = map[string]string{
FSTransferChar: "Filesystem Transfer", FSTransferChar: "Filesystem Transfer",
FSVersionChar: "Filesystem Version", FSVersionChar: "Filesystem Version",
WeatherDataChar: "Weather Data", WeatherDataChar: "Weather Data",
NavFlagsChar: "Navigation Icon",
NavNarrativeChar:"Navigation Instruction",
NavManDistChar: "Navigation Distance to next event",
NavProgressChar: "Navigation Progress",
} }
type Device struct { type Device struct {
device *device.Device1 device *device.Device1
navflagsChar *gatt.GattCharacteristic1
navnarrativeChar*gatt.GattCharacteristic1
navmandistChar *gatt.GattCharacteristic1
navprogressChar *gatt.GattCharacteristic1
newAlertChar *gatt.GattCharacteristic1 newAlertChar *gatt.GattCharacteristic1
notifEventChar *gatt.GattCharacteristic1 notifEventChar *gatt.GattCharacteristic1
stepCountChar *gatt.GattCharacteristic1 stepCountChar *gatt.GattCharacteristic1
@ -394,6 +406,14 @@ func (i *Device) resolveChars() error {
charResolved := true charResolved := true
// Set correct characteristics // Set correct characteristics
switch char.Properties.UUID { switch char.Properties.UUID {
case NavFlagsChar:
i.navflagsChar = char
case NavNarrativeChar:
i.navnarrativeChar = char
case NavManDistChar:
i.navmandistChar = char
case NavProgressChar:
i.navprogressChar = char
case NewAlertChar: case NewAlertChar:
i.newAlertChar = char i.newAlertChar = char
case NotifEventChar: case NotifEventChar: