Add mock GPS simulator and configurable location sources
This commit is contained in:
25
miniprogram/engine/sensor/locationSource.ts
Normal file
25
miniprogram/engine/sensor/locationSource.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
export type LocationSourceMode = 'real' | 'mock'
|
||||
|
||||
export interface LocationSample {
|
||||
latitude: number
|
||||
longitude: number
|
||||
accuracy?: number
|
||||
speed?: number | null
|
||||
headingDeg?: number | null
|
||||
timestamp: number
|
||||
sourceMode: LocationSourceMode
|
||||
}
|
||||
|
||||
export interface LocationSourceCallbacks {
|
||||
onLocation: (sample: LocationSample) => void
|
||||
onStatus: (message: string) => void
|
||||
onError: (message: string) => void
|
||||
}
|
||||
|
||||
export interface LocationSource {
|
||||
readonly mode: LocationSourceMode
|
||||
readonly active: boolean
|
||||
start(): void
|
||||
stop(): void
|
||||
destroy(): void
|
||||
}
|
||||
Reference in New Issue
Block a user