locationSource.ts 568 B

12345678910111213141516171819202122232425
  1. export type LocationSourceMode = 'real' | 'mock'
  2. export interface LocationSample {
  3. latitude: number
  4. longitude: number
  5. accuracy?: number
  6. speed?: number | null
  7. headingDeg?: number | null
  8. timestamp: number
  9. sourceMode: LocationSourceMode
  10. }
  11. export interface LocationSourceCallbacks {
  12. onLocation: (sample: LocationSample) => void
  13. onStatus: (message: string) => void
  14. onError: (message: string) => void
  15. }
  16. export interface LocationSource {
  17. readonly mode: LocationSourceMode
  18. readonly active: boolean
  19. start(): void
  20. stop(): void
  21. destroy(): void
  22. }