Porting Guide/Location

From Tizen Wiki
Jump to: navigation, search

Location.png

Description

Location provides location based services (LBS) including the position information, satellite information and GPS status.

Features Overview
  • GPS (Global positioning system).
  • Getting the current position, last known position, accuracy, distance and velocity.
  • Getting the satellite information of GPS and GLONASS.
  • Notifying a user when they enter or exit a predefined set of boundaries, known as geo-fence, like school attendance zones or neighborhood boundaries.
Location framework Description
  • Native Locations:
Tizen gives applications access to the location services supported by the device through the native locations, which provides API’s to determine location and bearing of the underlying services (if available).
  • Location Library:
    • This contains the location providers that can be used by the native locations to get the services.
    • GPS
      • GPS provides position information, velocity and satellite information. It is used to get current position of a device.
  • Lbs dbus:
    • This is the IPC used to communicate between location module and the GPS Manager daemon.
  • GPS Manager:
    • GPS Manager provides position, velocity, NMEA and satellite information by communicating with a GPS chip.
    • Functionalities of GPS Manager
      • GPS initialization/de-initialization and open/close control.
      • Provides the position result for location library.
      • Location session management-determination for session termination based on session status.
      • Serial interface with the GPS receiver.
      • Enables GPS chipset to support standalone GPS positioning methods.
      • Supported Operation modes.
        • Standalone:
          • A GPS receiver device in which the receiver provides all of its own data needs and performs all position calculations, without connection to an external network or server.

Porting OAL Interface

The GPS plugin is implemented based on Tizen GPS manager for vendor specific GPS device.

The GPS plugin is implemented as a shared library and the gps-manager loads a specific GPS plugin at runtime. A GPS plugin should be written with predefined interfaces. The gps-manager-plugin-dev source package is installed on OBS by adding the following command in the package spec file.

BuildRequires: pkgconfig(gps-manager-plugin)

With gps-manager-plugin-dev package source files can be found in:

/usr/include/gps-manager-plugin/*.h 
/usr/lib/pkgconfig/gps-manager-plugin.pc

gps_manager_plugin_intf.h includes the API interfaces for the communication between the gps-manager and its GPS plugin.

typedef struct { 
/** Initialize plugin module and register callback function for event delivery */ 
int (*init) (gps_event_cb gps_event_cb, gps_server_param_t * gps_params); 
/** Deinitialize plugin module */ 
int (*deinit) (gps_failure_reason_t *reason_code); 
/** Request specific action to plugin module */ 
int (*request) (gps_action_t gps_action, void *data, gps_failure_reason_t *reason_code); 
} gps_plugin_interface; 
const gps_plugin_interface *get_gps_plugin_interface();

get_gps_plugin_interface() should be exported in GPS plugin. It gives gps_plugin_interface structure to the gps-manager, and the gps-manager will be communicated by these interfaces. When the gps-manager is started, the GPS plugin will be loaded and init() function is called. At this moment, A GPS device should be initialized. (Power control, firmware download etc.,)

int (*init) (gps_event_cb gps_event_cb, gps_server_param_t * gps_params);

When init() function is called, gps_event_cb is set. GPS events and data from a GPS device is delivered by registered call back function « gps_event_cb ».

typedef int (*gps_event_cb) (gps_event_info_t *gps_event_info);

GPS events are described in below.

typedef enum { 
GPS_EVENT_START_SESSION = 0x0000,/**< The session is started */ 
GPS_EVENT_STOP_SESSION, /**< The session is stopped */ 
GPS_EVENT_REPORT_POSITION = 0x0100,/**< Bring up GPS position data */ 
GPS_EVENT_REPORT_SATELLITE, /**< Bring up GPS SV data */ 
GPS_EVENT_REPORT_NMEA, /**< Bring up GPS NMEA data */ 
GPS_EVENT_SET_OPTION = 0x0200,/**< The option is set */ 
GPS_EVENT_GET_REF_LOCATION = 0x0300,/**< Get the reference location for AGPS */ 
GPS_EVENT_GET_IMSI, /**< Get IMSI for identification */ 
GPS_EVENT_OPEN_DATA_CONNECTION = 0x0400,/**< Request opening data network connection */ GPS_EVENT_CLOSE_DATA_CONNECTION, /**< Request closing data network connection */ 
GPS_EVENT_DNS_LOOKUP_IND, /**< Request resolving host name */ 
GPS_EVENT_AGPS_VERIFICATION_INDI, /**< Verification indicator for AGPS is required 
GPS_EVENT_FACTORY_TEST = 0x0500,/**< Factory test is done */ 
GPS_EVENT_ERR_CAUSE = 0xFFFF /**< Some error is occurred */ 
} gps_event_id_t; 

The GPS events will contain specific GPS event data which is part of gps_event_data_t and the GPS configuration is delivered by gps_server_param_t structure, refer to gps_manager_plugin_intf.h and gps_manager_extra_data_types.h. When the gps-manager want to make a request to GPS device, the request() function is called.

int (*request) (gps_action_t gps_action, void *data, gps_failure_reason_t *reason_code); 

Each request is classified by gps_action_t.

typedef enum { 
GPS_ACTION_SEND_PARAMS = 0x00, 
GPS_ACTION_START_SESSION, 
GPS_ACTION_STOP_SESSION, 
GPS_INDI_SUPL_VERIFICATION, 
GPS_INDI_SUPL_DNSQUERY, 
GPS_ACTION_START_FACTTEST, 
GPS_ACTION_STOP_FACTTEST, 
GPS_ACTION_REQUEST_SUPL_NI 
} gps_action_t;

With the standalone GPS (Unassisted GPS), GPS_ACTION_START_SESSION and GPS_ACTION_STOP_SESSION are mandatory actions. If the GPS_ACTION_START_SESSION is delivered, the GPS plugin shall start acquisition of satellites and report the GPS_EVENT_START_SESSION event to the gps-manager by the gps_event_cb callback function. Once the acquisitions completed and position is fixed, its position should be delivered by the gps_event_cb with the GPS_EVENT_REPORT_POSITION event id and the position data.

To shut down the gps-manager, deinitialize the GPS device with the gps-manager call deinit() function.

int (*deinit) (gps_failure_reason_t *reason_code);
  • New GPS Plugin Addition:
During the boot up gps-manager loads the gps plugin module. To load the plugin module it has to be defined in server.c file so that during the boot up, gps-manager loads the available plugin at /sys/devices/platform.

Ex:

#define PLATFORM_PATH 	"/sys/devices/platform“
#define PLUGIN_PATH	PLATFORM_PATH"/xxxxx_gps“

The function “check_plugin_module(char* module_name)” checks the access to available plugin at /sys/devices/platform and the “load_plugin_module” loads the plugin during the boot up time.

Configuration

None

References

None