SatNav
caution
This service is experimental and may change in the future.
A satellite-based navigation system like GPS, Gallileo, ...
import { SatNav } from "@devicescript/core"
const satNav = new SatNav()
Registers
reading
Reported coordinates, geometric altitude and time of position. Altitude accuracy is 0 if not available.
type:
Register<any[]>
(packing formatu64 i9.23 i9.23 u16.16 i26.6 u16.16
)track incoming values
import { SatNav } from "@devicescript/core"
const satNav = new SatNav()
// ...
satNav.reading.subscribe(async (value) => {
...
})
note
write
and read
will block until a server is bound to the client.
enabled
Enables or disables the GPS module
type:
Register<boolean>
(packing formatu8
)read and write
import { SatNav } from "@devicescript/core"
const satNav = new SatNav()
// ...
const value = await satNav.enabled.read()
await satNav.enabled.write(value)
- track incoming values
import { SatNav } from "@devicescript/core"
const satNav = new SatNav()
// ...
satNav.enabled.subscribe(async (value) => {
...
})
note
write
and read
will block until a server is bound to the client.
Events
inactive
The module is disabled or lost connection with satellites.
satNav.inactive.subscribe(() => {
})