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 62987fa31b - Show all commits

View File

@ -62,6 +62,13 @@ var charNames = map[string]string{
NavProgressChar: "Navigation Progress", NavProgressChar: "Navigation Progress",
} }
type NavigationEvent struct {
yannickulrich marked this conversation as resolved Outdated

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.

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

type NavFlag string

const (
    NavFlagArrive     NavFlag = "arrive"
    NavFlagArriveLeft NavFlag = "arrive-left"
    // ...
)

Then, the NavigationEvent can take a NavFlag instead of string.

Maybe something like ```go type NavFlag string const ( NavFlagArrive NavFlag = "arrive" NavFlagArriveLeft NavFlag = "arrive-left" // ... ) ``` Then, the `NavigationEvent` can take a `NavFlag` instead of `string`.

Taken care of in d46f545

Taken care of in d46f545
flag string
narrative string
dist string
progress uint8
}
type Device struct { type Device struct {
device *device.Device1 device *device.Device1
navflagsChar *gatt.GattCharacteristic1 navflagsChar *gatt.GattCharacteristic1
@ -83,6 +90,7 @@ type Device struct {
notifEventDone bool notifEventDone bool
Music MusicCtrl Music MusicCtrl
DFU DFU DFU DFU
navigationEv NavigationEvent
} }
var ( var (