Editing PyMaemo/Using Location API

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 27: Line 27:
* <code>location.METHOD_AGNSS</code> (Assisted Global Navigation Satellite System) - A method for using GPS receiver with assistance data from external location server. A SIM card and a network connection is needed for AGNSS method. If no network connection or SIM card is available, this equals to GNSS.
* <code>location.METHOD_AGNSS</code> (Assisted Global Navigation Satellite System) - A method for using GPS receiver with assistance data from external location server. A SIM card and a network connection is needed for AGNSS method. If no network connection or SIM card is available, this equals to GNSS.
-
Location resources are shared between applications, and applications can request different location methods. Fixes for all requested methods are sent for all applications listening to <code>GPSDevice</code>'s "<code>changed</code>" signal, therefore application should judge whether fix it is receiving, is one that it needs. See [[#GPSDevice and GPSDeviceFix|GPSDeviceFix]] section for discussion.
+
Location resources are shared between applications, and applications can request different location methods. Fixes for all requested methods are sent for all applications listening to <code>GPSDevice</code>'s "changed" signal, therefore application should judge whether fix it is receiving, is one that it needs. See [[#GPSDevice and GPSDeviceFix|GPSDeviceFix]] section for discussion.
If device is set for bluetooth GPS from control panel, it can used for locationing via USER_SELECTED, AGNSS and GNSS methods. In this case AGNSS and GNSS do not differ, because assistance server cannot be utilized.
If device is set for bluetooth GPS from control panel, it can used for locationing via USER_SELECTED, AGNSS and GNSS methods. In this case AGNSS and GNSS do not differ, because assistance server cannot be utilized.
Line 45: Line 45:
Here is table that summarizes differences between the methods. Accuracy refers to horizontal accuracy of the fix.
Here is table that summarizes differences between the methods. Accuracy refers to horizontal accuracy of the fix.
-
{| class="wikitable"
+
{| class="wikitable" style="margin: 1em auto 1em auto"
-
|+ Available location methods
+
-
|-
+
! Method !! Typical accuracy !! Requires SIM !! Requires network !! Drains battery
! Method !! Typical accuracy !! Requires SIM !! Requires network !! Drains battery
|-
|-
-
| CWP || 1 - 1000 km || Yes || No || No
+
| CWP || 1km-1000km || Yes || No || No
|-
|-
-
| ACWP || 1 - 10 km || Yes || Yes || No
+
| ACWP || 1km-10km || Yes || Yes || No
|-
|-
-
| GNSS || 5 - 100 m || No || No || Yes
+
| GNSS || 5m-100m || No || No || Yes
|-
|-
-
| AGNSS || 5 - 100 m || Yes || Yes || Yes
+
| AGNSS || 5m-100m || Yes || Yes || Yes
|}
|}
Line 69: Line 67:
== GPSDevice and GPSDeviceFix ==
== GPSDevice and GPSDeviceFix ==
-
<code>GPSDevice</code> object has the following attributes ('''FIXME:''' currently "<code>satellites</code>" and "<code>cell_info</code>" attributes are not supported in Python):
+
<code>GPSDevice</code> object has the following attributes ('''FIXME:''' currently "satellites" and "cell_info" attributes are not supported in Python):
-
*<code>online</code>: Whether there is a connection to the hardware
+
*online: Whether there is a connection to the hardware
-
*<code>status</code>: Status of the device
+
*status: Status of the device
-
*<code>fix</code>: Tuple containing actual fix data (latitude, longitude, etc)
+
*fix: Tuple containing actual fix data (latitude, longitude, etc)
-
*<code>satellites_in_view</code>: Number of satellites in view
+
*satellites_in_view: Number of satellites in view
-
*<code>satellites_in_use</code>: Number of satellites in use
+
*satellites_in_use: Number of satellites in use
-
*<code>satellites</code>: Tuple containing information about satellites
+
*satellites: Tuple containing information about satellites
-
*<code>cell_info</code>: Tuple containing information about cell the device is connected to
+
*cell_info: Tuple containing information about cell the device is connected to
-
The most useful attribute is naturally the "<code>fix</code>" tuple which contains position and movement of the device and accuracies for them. The available information is listed below (in the order they appear on the tuple). In parenthesis there is a identifier which can be bitwisely anded with the "fields" value, to see whether corresponding tuple value is set.
+
The most useful attribute is naturally the "fix" tuple which contains position and movement of the device and accuracies for them. The available information is listed below (in the order they appear on the tuple). In parenthesis there is a identifier which can be bitwisely anded with the "fields" value, to see whether corresponding tuple value is set.
-
*<code>mode</code>: The mode of the fix
+
*mode: The mode of the fix
-
*<code>fields</code>: A bitfield representing which items of this tuple contain valid data
+
*fields: A bitfield representing which items of this tuple contain valid data
-
*<code>time</code>: The timestamp of the update (<code>location.GPS_DEVICE_TIME_SET</code>)
+
*time: The timestamp of the update (<code>location.GPS_DEVICE_TIME_SET</code>)
-
*<code>ept</code>: Time accuracy
+
*ept: Time accuracy
-
*<code>latitude</code>: Fix latitude (<code>location.GPS_DEVICE_LATLONG_SET</code>)
+
*latitude: Fix latitude (<code>location.GPS_DEVICE_LATLONG_SET</code>)
-
*<code>longitude</code>: Fix longitude (<code>location.GPS_DEVICE_LATLONG_SET</code>)
+
*longitude: Fix longitude (<code>location.GPS_DEVICE_LATLONG_SET</code>)
-
*<code>eph</code>: Horizontal position accuracy
+
*eph: Horizontal position accuracy
-
*<code>altitude</code>: Fix altitude in meters (<code>location.GPS_DEVICE_ALTITUDE_SET</code>)
+
*altitude: Fix altitude in meters (<code>location.GPS_DEVICE_ALTITUDE_SET</code>)
-
*double <code>epv</code>: Vertical position accuracy
+
*double epv: Vertical position accuracy
-
*<code>track</code>: Direction of motion in degrees (<code>location.GPS_DEVICE_TRACK_SET</code>)
+
*track: Direction of motion in degrees (<code>location.GPS_DEVICE_TRACK_SET</code>)
-
*<code>epd</code>: Track accuracy
+
*epd: Track accuracy
-
*<code>speed</code>: Current speed in km/h (<code>location.GPS_DEVICE_SPEED_SET</code>)
+
*speed: Current speed in km/h (<code>location.GPS_DEVICE_SPEED_SET</code>)
-
*<code>eps</code>: Speed accuracy
+
*eps: Speed accuracy
-
*<code>climb</code>: Current rate of climb in m/s (<code>location.GPS_DEVICE_CLIMB_SET</code>)
+
*climb: Current rate of climb in m/s (<code>location.GPS_DEVICE_CLIMB_SET</code>)
-
*<code>epc</code>: Climb accuracy
+
*epc: Climb accuracy
-
An application receiving a fix cannot know if the fix is a result from location method it requested. Therefore application should study whether fix is accurate enough to satisfy application's needs. This can be done by inspecting "<code>eph</code>" field, which is fix's horizontal accuracy in centimeters. Typical values for horizontal accuracies can be seen in the location methods table. If accuracy is not known, it has a value of NaN.
+
An application receiving a fix cannot know if the fix is a result from location method it requested. Therefore application should study whether fix is accurate enough to satisfy application's needs. This can be done by inspecting "eph" field, which is fix's horizontal accuracy in centimeters. Typical values for horizontal accuracies can be seen in the location methods table. If accuracy is not known, it has a value of NaN.
== Liblocation signals and callbacks ==
== Liblocation signals and callbacks ==
Line 139: Line 137:
     print "Satellites in view: %d, in use: %d" % (device.satellites_in_view, device.satellites_in_use)
     print "Satellites in view: %d, in use: %d" % (device.satellites_in_view, device.satellites_in_use)
</source>
</source>
-
Liblocation sends a "<code>changed</code>" signal also after locationing is started or stopped, in which case a last known fix is sent if such exists. Application can differentiate these fixes from real ones by inspecting <code>device.status</code> attribute which equals <code>location.GPS_DEVICE_STATUS_NO_FIX</code> if the fix is not real.
+
Liblocation sends a "changed" signal also after locationing is started or stopped, in which case a last known fix is sent if such exists. Application can differentiate these fixes from real ones by inspecting <code>device.status</code> attribute which equals <code>location.GPS_DEVICE_STATUS_NO_FIX</code> if the fix is not real.
== Starting and stopping locationing ==
== Starting and stopping locationing ==

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)