Added Navigation service #5
@ -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 {
|
||||||
yannickulrich marked this conversation as resolved
Outdated
|
|||||||
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:
|
||||||
|
Reference in New Issue
Block a user
I think it would be better if these were individual constants rather than a slice. That way, they could have their own type and the compiler can guarantee that they're valid instead of needing a separate function. Since that will add quite a bit of code, I think the navigation service can be moved into a separate file.
Maybe something like
Then, the
NavigationEvent
can take aNavFlag
instead ofstring
.Taken care of in
d46f545