Commit Graph

27 Commits

Author SHA1 Message Date
4479cad6f9 Improve navigation API 2022-11-06 20:08:13 -08:00
9e73961af9 Remove check for unchanged values and refactor code 2022-11-05 20:33:30 -07:00
0aa25353fd Added Navigation service (#5)
InfiniTime implements a [Navigation Service](https://github.com/InfiniTimeOrg/InfiniTime/blob/develop/doc/NavigationService.md). This pull request will add it to the go library by defining a function
```go
func (i *Device) Navigation(flag string, narrative string, dist string, progress uint8) error {
  ...
}
```
From the InfiniTime manual
 * `flag`: the graphic instruction as provided by [Pure Maps](https://github.com/rinigus/pure-maps/tree/master/qml/icons/navigation). A list of valid instruction icons can be found [here](https://github.com/rinigus/pure-maps/tree/master/qml/icons/navigation)
 * `narrative`: the instruction in words, eg. "At the roundabout take the first exit".
 * `dist`: a short string describing the distance to the upcoming instruction such as "50 m".
 * `progress`: the percent complete in a `uint8`

Adding this to the `itd` daemon is straightforward
```patch
diff --git a/api/types.go b/api/types.go
index 281a85b..14c84de 100644
--- a/api/types.go
+++ b/api/types.go
@@ -22,6 +22,13 @@ type FwUpgradeData struct {
        Files []string
 }

+type NavigationData struct {
+       Flag         string
+       Narrative    string
+       Dist         string
+       Progress     uint8
+}
+
 type NotifyData struct {
        Title string
        Body  string
diff --git a/socket.go b/socket.go
index 6fcba5c..91b37c0 100644
--- a/socket.go
+++ b/socket.go
@@ -204,6 +204,10 @@ func (i *ITD) Address(_ *server.Context) string {
        return i.dev.Address()
 }

+func (i *ITD) Navigation(_ *server.Context, data api.NavigationData) error {
+       return i.dev.Navigation(data.Flag, data.Narrative, data.Dist, data.Progress)
+}
+
 func (i *ITD) Notify(_ *server.Context, data api.NotifyData) error {
        return i.dev.Notify(data.Title, data.Body)
 }
```

Co-authored-by: Yannick Ulrich <yannick.ulrich@durham.ac.uk>
Reviewed-on: https://gitea.arsenm.dev/Arsen6331/infinitime/pulls/5
Co-authored-by: yannickulrich <yannick.ulrich@protonmail.com>
Co-committed-by: yannickulrich <yannick.ulrich@protonmail.com>
2022-11-03 19:09:06 +00:00
91a47acb50 Add contexts and improve error handling 2022-05-11 13:22:57 -07:00
a832c16d69 Add debug logging 2022-04-23 19:58:00 -07:00
c5d938ce99 Use log level provided in options 2022-04-23 19:07:41 -07:00
8ff29b0ca9 Ensure that done signals for Watch functions are handled properly and restart notifications if they stop unexpectedly 2022-04-23 18:40:25 -07:00
165db63deb Log when too many disconnects occur rather than removing the device (Arsen6331/itd#10) 2022-04-16 04:24:21 -07:00
b6ba971d50 Rewrite connect/reconnect code 2022-02-21 02:46:20 -08:00
2342b0d82a Create custom BlueZ agent 2021-12-16 21:30:29 -08:00
db8f03dee7 Add weather service 2021-12-12 12:43:43 -08:00
90936d8900 Set connected property to true in all connecting functions 2021-11-25 20:33:06 -08:00
a5c90c3b7d Fix checkStatus call in (*Device).FS() 2021-11-25 13:35:58 -08:00
0a3ed67ede Allow multiple call notification responses and improve error handling 2021-11-25 12:39:43 -08:00
60a4ad91f4 Implement BLE filesystem (experimental and will change in the future) 2021-11-22 21:19:30 -08:00
a19fedf763 Add whitelist to pair() and make case insensitive 2021-10-26 21:42:41 -07:00
651270051e Add cancel functions to battery level and heart rate 2021-10-22 21:26:33 -07:00
4fa0ce1801 Implement Motion Service 2021-10-22 12:59:51 -07:00
6b602169a0 Add call notification support 2021-10-15 00:23:54 -07:00
df067d2c56 Return intial values in watch functions 2021-08-24 22:17:34 -07:00
367032ec7e Add watch function for battery level 2021-08-24 21:55:03 -07:00
cd3daa5848 Remove pair timeout entirely 2021-08-22 13:12:16 -07:00
613a7cb044 Fix bug where Connect blocked forever after 10 seconds 2021-08-22 13:09:56 -07:00
8f4bb3e226 Fix segfault due to using wrong opts struct 2021-08-21 20:27:31 -07:00
d5c893b9d1 Add error handling to connect call 2021-08-21 20:25:09 -07:00
d5f83f4643 Allow configuration of pair timeout 2021-08-21 20:24:56 -07:00
1b10eba464 Initial Commit 2021-08-19 17:41:09 -07:00