Added navigation characteristics

This commit is contained in:
Yannick Ulrich 2022-10-21 22:47:05 +01:00
parent 54fdd19bec
commit 2fbd8cb666
1 changed files with 20 additions and 0 deletions

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: