fay-geoposition-0.1.0.1: W3C compliant implementation of GeoPosition API.

Copyright(c) 2015 Altera Praxis Pty Ltd
LicenseBSD
Maintainereocallaghan@alterapraxis.com
Stabilityprovisional
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Fay.GeoPosition

Description

This module encapsulates Fay Javascript for the GeoPosition API specified as in the W3C spec.

Synopsis

Documentation

geoPositionErrorMessage :: GeoPositionError -> String

Helper function extracts UTC-16 encoded error message

geoPositionErrorCode :: GeoPositionError -> GeoPositionErrorCode

Helper function decodes enumerated error code into the GeoPositionErrorCode type

initGeoPosition :: GeoPositionCallbacks Fay -> Maybe GeoPositionOptions -> Fay ()

Call to initialise GeoPosition API with callback actions to be taken upon success or error.

data GeoPositionCallbacks m

See section [5.1 - W3C Geolocation API] Requires the monad type that the callbacks have action on

data GeoPositionOptions

See section [5.2 - W3C Geolocation API]

Constructors

GeoPositionOptions 

Fields

enableHighAccuracy :: Bool

Is a Bool that indicates the application would like to receive the best possible results.

timeout :: Int

Maximum length of time (in milliseconds) the device is allowed to take in order to return a position.

maximumAge :: Int

Maximum age in milliseconds of a possible cached position that is acceptable to return.

data GeoPosition

See section [5.3 - W3C Geolocation API]

Constructors

GeoPosition 

Fields

coords :: GeoCoordinates

Coordinates object defining the current location

timestamp :: UTCTime

DOMTimeStamp, time at which location was retrieved

data GeoCoordinates

See section [5.4 - W3C Geolocation API]

Constructors

GeoCoordinates 

Fields

latitude :: Double

decimal degrees

longitude :: Double

decimal degrees

altitude :: Maybe Double

meters above the reference ellipsoid

accuracy :: Double

meters

altitudeAccuracy :: Maybe Double

meters

heading :: Maybe Double

degrees clockwise from true north

speed :: Maybe Double

meters/second

data GeoPositionError

See section [5.5 - W3C Geolocation API]

Constructors

GeoPositionError 

Fields

code :: Int

Enumerated code, see GeoPositionErrorCode

message :: Text

Human readable 'UTF-16 DOMString' for debugging

data GeoPositionErrorCode

N.B. Fay does not support the Enum type class :( Thus, use the geoPositionErrorCode function to decode the value to the GeoPositionErrorCode type.

Constructors

PermissionDenied

The acquisition of the geolocation information failed because the page didn't have the permission to do it.

PositionUnavailable

The acquisition of the geolocation failed because at least one internal source of position returned an internal error.

Timeout

The time allowed to acquire the geolocation, defined by timeout information was reached before the information was obtained.

Unknown

Out of spec error code