Network Protocol Module API

This document describes the Network Protocol Module API that device creators use to develop their own Network Protocol Modules.

Purpose

A Network Protocol Module is an ECOM plug-in that provides network connectivity for the LBS subsystem. A Network Protocol Module typically supports one Location Based Services network protocol. Location Based Services network protocols are used by the LBS subsystem for the following purposes:

  • To receive location requests from the network.

  • To send requests for A-GPS assistance data to the network and to receive it.

  • To send GPS-calculated positions and GPS measurements to the network and to receive calculated positions from the network.

Network Protocol Modules can be classified into two groups, depending on the network operator's network architecture that they are intended to interface with:

  • Control plane architectures use the circuit-switched mobile network and signalling layer to support Location Based Services.

    To integrate the Symbian LBS subsystem with a control plane architecture, a Symbian licensee must implement their own control plane Network Protocol Module using the Network Protocol Module API described in this document.

  • User plane architectures use IP bearers independently of the circuit-switched signalling layer. SMS or WAP Push can also be used to initiate location requests. The OMA Secure User Plane Location (SUPL) architecture describes a model for supporting IP-based Location Based Services.

    Symbian provides a reference SUPL Protocol Module that supports the OMA SUPL v1.0 standard, using the 3GPP Radio Resource LCS Protocol (RRLP) as the protocol payload. The reference SUPL Protocol Module implements the Network Protocol Module API.

LBS architecture overview gives more details of how a Network Protocol Module fits into the LBS subsystem.

Introduction

A Network Protocol Module is an ECOM plug-in DLL. It communicates with the LBS Network Gateway process via the Network Protocol API and with the network via either the ETel or ESock APIs as shown in figure 1.

Figure 1. Figure 1. The Network Gateway Framework

A Network Protocol Module has several functions:

  • Translating method calls from the LBS subsystem into protocol specific messages which are sent over the network

  • Translating protocol specific messages received from the network into method calls on the LBS subsystem

  • Queueing and prioritising messages received from the network and messages to be sent to the network

  • Performing conflict resolution when a request is made which conflicts with ongoing location requests being processed by the LBS subsystem

Licensees can configure the LBS subsystem to load a different Network Protocol Module when the mobile device is in the home network and when roaming. For example, it is possible to configure LBS to load a licensee control plane Network Protocol Module in the home network and the Symbian reference SUPL Protocol Module when roaming. See Loading the Network Protocol Module for more details.

A Symbian licensee must create a Network Protocol Module to integrate the Symbian LBS subsystem with a control plane architecture. A control plane Network Protocol Module uses the ETel API and the telephony stack for network communications. Symbian does not provide a reference control plane Network Protocol Module.

Symbian provides a reference Network Protocol Module that implements the SUPL v1.0 user plane architecture with RRLP as the protocol data payload. See SUPL Protocol Module documentation for more information about this reference module. The SUPL Protocol Module may meet the requirements of Symbian licensees and network operators and so it may not be necessary for licensees to create a custom Network Protocol Module using the API described in this document.

Symbian also provide a Test Network Protocol Module as part of the LBS subsystem code distribution which can be found at <LBS_ROOT>\LbsProtocolModule. The test protocol module is not a production quality module for use in a mobile device, neither is it a reference implementation. Its main purpose is to facilitate Symbian's own testing of the LBS subsystem.

Network Protocol Module API description

This section describes the classes of the Network Protocol Module API.

API class diagram

A Network Protocol Module and the LBS Network Gateway process communicate using the Network Protocol Module API. The API consists of classes in an observer/observable design pattern.

Figure 2 shows the main classes of the Network Protocol Module API. Note that this diagram does not list all of the classes of the API and excludes numerous T classes that are used as method parameters.

Note that the virtual methods of CLbsNetworkProtocolBase and CLbsNetworkProtocolBase2 are synchronous and their implementations must return quickly (for example by queueing requests and returning immediately).

Figure 2. Figure 2. Main classes of the Network Protocol API

API classes and types

Table 1 lists the main classes of the Network Protocol Module API. Further details about the classes can be found by following the links to reference documentation.

The main classes are defined in lbsnetprotocolbase.h. Additional API classes and types that are used as API method parameters are defined in lbsnetcommon.h and lbsnetclasstypes.h.

The Network Protocol Module API has publishedPartner interface access.

Class/type name Description Header file

CLbsNetworkProtocolBase

The original base class for Network Protocol Module implementations. This class is extended by CLbsNetworkProtocolBase2 which should be used for new Network Protocol Module implementations.

lbsnetprotocolbase.h

CLbsNetworkProtocolBase2

Extended base class for Network Protocol Module implementations that should be used for new Network Protocol Module implementations.

lbsnetprotocolbase.h

MLbsNetworkProtocolObserver

The observer interface implemented by the LBS Network Gateway and used by a Network Protocol Module to forward network requests and information to the LBS subsystem. It is also the interface that a protocol module uses to provide responses to requests made by the LBS subsystem via CLbsNetworkProtocolBase.

lbsnetprotocolbase.h

MLbsNetworkProtocolObserver2

An extended observer interface. This is not yet implemented by the LBS subsystem.

lbsnetprotocolbase.h

Table 1 Classes of the Network Protocol Module API.

Network Protocol Modules derive from CLbsNetworkProtocolBase or CLbsNetworkProtocolBase2. The LBS subsystem implements the MLbsNetworkProtocolObserver interface to interact with a Network Protocol Module.

Libraries

The main classes of the Network Protocol Module API are packaged in lbsnetprotocol.dll. Network Protocol Module implementations link to lbsnetprotocol.lib.

LBS configuration

In addition to creating and installing a Network Protocol Module, the LBS administration settings KLbsSettingHomeProtocolModule and KLbsSettingRoamingProtocolModule must be set to the implementation UIDs of the appropriate Network Protocol Module ECOM plug-ins for LBS to load and use them. See Loading the Network Protocol Module for more information.

Using the Network Protocol Module API

A Network Protocol Module communicates with two other software components:

  • The LBS Network Gateway process

    The Network Gateway process communicates with the other components of the LBS subsystem. It is responsible for:

    1. Handling requests for location from the LBS subsystem and sending them to the network via the Network Protocol Module

    2. Receiving a reference position (based on Cell ID) from the network via the Network Protocol Module and sending it into LBS in response to 1.

    3. Handling requests for A-GPS assistance data from an A-GPS Integration Module and sending them to the network via the Network Protocol Module

    4. Receiving A-GPS assistance data from the network via the Network Protocol Module and sending it to the A-GPS Location Manager in response to 3.

    5. Handling requests from the LBS subsystem to send device location data to a third party over the network (MO-LR transmit to third party).

    6. Receiving privacy requests and location requests from the network (MT-LR and Emergency MT-LR) via the Network Protocol Module and forwarding them to the LBS subsystem.

    7. Sending responses to MT-LR privacy requests and location requests to the network via the Network Protocol Module in response to 6.

  • A network communications stack

    A Network Protocol Module that integrates with the control plane uses the Symbian ETel API.

    A Network Protocol Module that integrates with the user plane uses the Symbian ESock API. The Symbian reference SUPL Protocol Module is a user plane Network Protocol Module.

Figures 3, 4 and 5 show simple sequences of interaction between the LBS Network Gateway process, the Network Protocol Module and the network for MO-LR (self locate), MO-LR (transfer to third party) and MT-LR.

The behaviour of a Network Protocol Module can be complex when it is linked to a A-GPS Integration Module. Several detailed end-to-end sequence diagrams that document the behaviour of the LBS subsystem including the behaviour expected from a Network Protocol Module can be found in LBS Sequence Diagrams.

Figure 3. Figure 3. Simple MO-LR self locate sequence (for terminal based positioning)
Figure 4. Figure 4. Simple MO-LR transfer to third party sequence (for terminal based positioning)
Figure 5. Figure 5. Simple MT-LR sequence (for terminal based positioning)

CLbsNetworkProtocolBase

The following briefly describes the CLbsNetworkProtocolBase methods grouped according to their function. The LBS Network Gateway process calls these methods on the licensee Network Protocol Module. More detailed information about the purpose of these methods and their parameter lists can be found by following the links to the Symbian platform reference documentation.

Setting tracking mode (if necessary)

For MO-LR self locate, an application client can ask the LBS subsystem for periodic location updates. This is known as tracking and is described in the Location Acquisition API document How to get location information.

When a client requests tracking, the LBS subsystem notifies a Network Protocol Module of this requirement by calling CLbsNetworkProtocolBase::AdviceSystemStatus() with a parameter value CLbsNetworkProtocolBase::ESystemStatusClientTracking. This method is called before the first location request CLbsNetworkProtocolBase::RequestSelfLocation() described below.

When there are no longer any tracking LBS clients, the LBS subsystem notifies a Network Protocol Module by calling AdviceSystemStatus() with a parameter value CLbsNetworkProtocolBase::ESystemStatusNone.

Requesting and cancelling MO-LR (self locate)

Requesting and cancelling MO-LR (self locate) from the network

Requesting and cancelling of MO-LR (transmit to third party)

Responding to MT-LR privacy requests

Processing location requests

As shown in figures 3, 4 and 5, MO-LR self locate, MO-LR transfer to third party and MT-LR cause the Network Protocol Module to call MLbsNetworkProtocolObserver::ProcessLocationRequest() on the LBS Network Gateway process.

An instance of TLbsNetPosRequestMethod is passed when the Protocol Module calls MLbsNetworkProtocolObserver::ProcessLocationRequest(). It defines the type(s) of positioning method the LBS subsystem should use to calculate the device location.

A Network Protocol Module can specify up to two positioning methods, if required: TLbsNetPosRequestMethod contains an array of elements of type TLbsNetPosMethod. Each TLbsNetPosMethod element specifies a technology type and the positioning mode that should be used by the LBS subsystem to calculate location.

If the array contains two elements, the first element contains the preferred technology type and positioning mode. The second element contains an alternative positioning mode.

If the array contains only one element then this specifies the technology type and positioning mode that must be used by the LBS subsystem.

Examples of how a Network Protocol Module specifies the positioning mode follows:

  • Terminal based positioning mode only

    The Protocol Module creates a single TLbsNetPosMethod element and calls TLbsNetPosMethod::SetPosMethod() passing the parameters:

    aPosMeans = KLbsPositioningMeansGps

    aPosMode = TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted

    In this case, the LBS subsystem attempts to calculate a GPS location fix using assistance data from the network.

  • Terminal assisted positioning mode only

    The Protocol Module creates a single TLbsNetPosMethod element and calls TLbsNetPosMethod::SetPosMethod() passing the parameters:

    aPosMeans = KLbsPositioningMeansGps

    aPosMode = TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted

    In this case, the LBS subsystem attempts to calculate a GPS location fix using assistance data from the network.

  • Terminal based positioning mode (1st choice) & terminal assisted positioning mode (2nd choice)

    The Protocol Module creates two TLbsNetPosMethod elements and calls TLbsNetPosMethod::SetPosMethod() for each:

    • 1st Element:

      aPosMeans = KLbsPositioningMeansGps

      aPosMode = TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted

    • 2nd Element:

      aPosMeans = KLbsPositioningMeansGps

      aPosMode = TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted

    In this case, the LBS subsystem attempts to calculate a GPS location fix using assistance data from the network. While LBS is calculating a GPS fix it also returns GPS measurements to the Network Protocol Module.

  • Position from the network (cell based positioning)

    The Protocol Module creates a single TLbsNetPosMethod element and calls TLbsNetPosMethod::SetPosMethod() passing the parameters:

    aPosMeans = KLbsPositioningMeansCell

    aPosMode = TPositionModuleInfo::ETechnologyNetwork

    In this case, the LBS subsystem uses the reference location from the network as the location fix.

Calling MLbsNetworkProtocolObserver::ProcessLocationRequest() causes the LBS subsystem to begin to calculate a location (or begin to obtain GPS measurements necessary to calculate a location). When location data is available, the LBS Network Gateway process calls CLbsNetworkProtocolBase::RespondLocationRequest().

Requesting A-GPS assistance data

  • CLbsNetworkProtocolBase::RequestAssistanceData()

    This method is called to get additional A-GPS assistance data as part of an MO-LR (self locate), MO-LR (transfer to third party) or an MT-LR. Assistance data identifies the satellites that should be visible from the current mobile device location and this reduces the time required to obtain GPS measurements.

MLbsNetworkProtocolObserver

The following briefly describes the MLbsNetworkProtocolObserver methods grouped according to their function. A licensee Network Protocol Module calls these methods on the LBS Network Gateway process. More detailed information about the purpose of these methods and their parameter lists can be found by following the links to the Symbian platform reference documentation.

Getting the current capabilities of the LBS subsystem

  • MLbsNetworkProtocolObserver::GetCurrentCapabilities()

    This method is called by the Network Protocol Module to get the capabilities of the LBS subsystem, such as whether it can calculate a GPS location fix and the supported GPS modes. The method takes a single parameter of class TLbsNetPosCapabilities (defined in lbsnetcommon.h) that encapsulates methods to discover the protocols and positioning methods supported by the LBS subsystem.

    Note that the capabilities of the LBS subsystem can change at runtime (because of modification via the LBS Administration API) and therefore a licensee Network Protocol Module should call this method whenever it needs to check the current capabilities of the LBS subsystem.

Updating the LBS Network Gateway with the Network Protocol Module status

Notifying of MT-LR privacy requests

Requesting a location

For MO-LR (self locate) the LBS Network Gateway process calls CLbsNetworkProtocolBase::RequestSelfLocation() (for GPS positioning modes) or CLbsNetworkProtocolBase::RequestNetworkLocation() (for cell-based positioning modes).

For MO-LR (transfer to third party) the LBS Network Gateway calls CLbsNetworkProtocolBase::RequestTransmitLocation(). In response to these, or when an MT-LR location request is received, the Network Protocol Module calls MLbsNetworkProtocolObserver::ProcessLocationRequest() on the LBS Network Gateway.

A TLbsNetPosRequestMethod parameter specifies the method that should be used by the LBS subsystem to obtain the location fix.

Handling receipt of A-GPS assistance data

Resetting A-GPS assistance data for testing

If requested to do so by the network, a licensee's Network Protocol Module can instruct the LBS subsystem and the licensee's A-GPS Integration Module to reset any cached assistance data. It does this by calling MLbsNetworkProtocolObserver::ProcessAssistanceData(), with a KPositionAssistanceDataReset parameter to tell LBS to reset its cached assistance data and a TLbsAssistanceDataGroup bitmask parameter to specify the types of assistance data to be reset. Using ProcessAssistanceData() in this way has two effects:

Updating location data

  • MLbsNetworkProtocolObserver::ProcessLocationUpdate()

    This method is called to update the LBS subsystem either:

    • When a reference position is returned from the network

      ProcessLocationUpdate() returns a TPositionInfoBase parameter which contains the reference position. Calling TPositionInfoBase::PositionMode() returns TPositionModuleInfo::ETechnologyNetwork.

    • When the 'final position' is returned from the network (for MO-LR self locate and MO-LR transfer to third party)

      The final position is the last position returned from the network. For terminal based positioning, the final position is just the position that LBS sent to the network by calling CLbsNetworkProtocolBase::RespondLocationRequest(). For terminal assisted positioning, the final position is the one calculated by the network using GPS measurements from the device.

      For a final position calculated using terminal based positioning TPositionInfoBase::PositionMode() returns TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted.

      For a final position calculated using terminal assisted positioning TPositionInfoBase::PositionMode() returns TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted.

Completing a session

Network Protocol Module configuration

In addition to coding the Network Protocol Module, there are configuration steps that a device creator may need to complete:

Update the Network Location Manager .ini file

The file networklocationmanager.ini specifies the positioning capabilities of the network to LBS. It is exported to <rom_drive>:\private\10282253\lbs\locmods\ (10282253 is the UID3 of the LBS Root process) as part of the LBS build process. The contents of the file as delivered with the LBS subsystem are shown below:


# networklocationmanager.ini

[1]
Version= 0.1.1        #
ModuleId= 271064387    # dec
ModuleName= "NetLocManager"    # 
TechnologyType= 0010    # binary
DeviceLocation= 0010    # binary
Capabilities= 1111    # binary
ClassesSupported= 111111    # binary
TimeToFirstFix= 20000    # ms
TimeToNextFix= 20000    # ms
HorizontalAccuracy= 100 # real
VerticalAccuracy= 100 # real
CostIndicator= 3    # dec
PowerConsumption = 2 # dec
ExecutableName= "lbsnetlocmanager.exe"

Device creators only need to change the contents of the file if the parameters of their Network Protocol Module and the network capabilities are significantly different to the values shown above.

The table below describes each of the values in networklocationmanager.ini.

Parameter Type Description

Version

A string

The Network Protocol Module version.

ModuleId

A UID (decimal)

The UID3 of the Network Location Manager process.

TechnologyType

A binary value from TPositionModuleInfo::_TTechnologyType

The technology types the module supports: one or more of handset based, network based or network assisted. In this file the value specifies network only.

DeviceLocation

A bitmask value from TPositionModuleInfo::_TDeviceLocation

Specifies whether the module is internal or external to the handset. Currently only internal modules are supported. Defined in LbsCommon.h.

Capabilities

A bitmask value from TPositionModuleInfo::_TCapabilities

A bitmask value that defines the capabilities of this module (such as the ability to provide vertical position and speed data). Defined in LbsCommon.h.

ClassesSupported

A bitmask value from _TPositionInfoClassType

A bitmask value that defines the class types that are supported by this module. Defined in LbsClassTypes.h.

TimeToFirstFix

An integer value

The time to get the first location fix (in milliseconds).

TimeToNextFix

An integer value

The time to get subsequent location fixes after the first location fix (in milliseconds).

HorizontalAccuracy

A real value

The maximum accuracy of horizontal position that the module can supply (in metres). For example 100 if the location fix is accurate to within 100m.

VerticalAccuracy

A real value

The maximum accuracy of vertical position that the module can supply (in metres).

CostIndicator

A value from TPositionQuality::TCostIndicator

A qualitative measure of the financial cost to the handset owner of using this module to obtain a location fix. Defined in LbsCommon.h.

PowerConsumption

A value from TPositionQuality::TPowerConsumption

A qualitative measure of the power consumption of using this module to obtain a location fix. Defined in LbsCommon.h.

ExecutableName

A string

The name of the location manager process that uses this module.

Create a Network Protocol Module .rss file

A Network Protocol Module requires an ECOM resource file. The example below is the resource file for the Symbian reference SUPL Protocol Module.


#include "ecom/registryinfov2.rh"

RESOURCE REGISTRY_INFO theInfo
    {
    resource_format_version = RESOURCE_FORMAT_VERSION_2;
    dll_uid = 0x10285A9C;
    interfaces = 
        {
        INTERFACE_INFO
            {
            // UID of interface that is implemented
            interface_uid = 0x10281D4A;
            implementations = 
                {
                IMPLEMENTATION_INFO
                    {
                    // UID of this interface implementation
                    implementation_uid = 0x10285A9D;
                    version_no = 1;
                    display_name = "SUPL V1 Protocol Module";
                    default_data = "";
                    opaque_data = "";
                    rom_only = 0;
                    }
                };
            }
        };
    }
             

Update the LBS administration settings

The implementation UIDs of the Network Protocol Module implementations must be defined in the LBS administration repository initialisation file. The example below shows an initialisation file entry that configures LBS to load the Symbian reference SUPL Protocol Module when the handset is in the home network and also when roaming.

Note that if the UID of the Network Protocol Module is changed at runtime by using the LBS Administration API, it is necessary to reboot the handset in order to restart the LBS subsystem and load the different module.


#KSettingHomeProtocolModule. Use reference SUPL Protocol Module
0x0000000E  int  0x10285A9D
#KSettingRoamingProtocolModule.
0x0000000F  int  0x10285A9D

Loading the Network Protocol Module

A licensee Network Protocol Module is an ECOM plug-in DLL and is loaded by the LBS Network Gateway process.

  1. On startup, the LBS Network Gateway process reads KSettingHomeProtocolModule and KSettingRoamingProtocolModule from the central repository using the LBS Administration API.

    LBS uses the ETel API to obtain the mobile device's registration status with the network and LBS uses this status to decide which Network Protocol Module to load. A Symbian licensee must implement the ETel API methods RMobilePhone::GetNetworkRegistrationStatus() and RMobilePhone::NotifyNetworkRegistrationStatusChange() to report the current registration status of the device.

    Only one Network Protocol Module is loaded by LBS when the mobile device starts. If the network registration status is reported as RMobilePhone::ERegisteredOnHomeNetwork, LBS loads the Protocol Module plug-in specified by KSettingHomeProtocolModule. If the network registration status is reported as RMobilePhone::ERegisteredRoaming, LBS loads the Protocol Module plug-in specified by KSettingRoamingProtocolModule.

    Note that if the network registration status is not reported as ERegisteredOnHomeNetwork or ERegisteredRoaming, LBS does not load a Network Protocol Module and the LBS subsystem will not function.

    LBS does not unload a Network Protocol Module once it is loaded. The module remains loaded by the LBS subsystem until the device is restarted. This means that if a different Network Protocol Module is specified for the home network and for roaming, it is necessary to restart the mobile device when changing networks in order to load the correct module.

  2. The LBS Network Gateway process creates a TLbsNetProtocolModuleParams object, passing a reference to itself in the TLbsNetProtocolModuleParams constructor (the Network Gateway process is an MLbsNetworkProtocolObserver).

  3. The LBS Network Gateway process calls CLbsNetworkProtocolBase::NewL(), passing the licensee Network Protocol Module implementation class UID and the TLbsNetProtocolModuleParams object as parameters. The ECOM framework loads the licensee Network Protocol Module and supplies it with a reference to the LBS Network Gateway process.

  4. The following describes the behaviour of a Network Protocol Module that uses the control plane (ETel) and does not describe the behaviour of the Symbian reference SUPL Protocol Module on startup.

    When a licensee control plane Network Protocol Module is loaded, there are several methods that it typically needs to call immediately in order to register to receive MT-LR and A-GPS assistance data from the network:

    • The Network Protocol Module instructs the ETel server to pre-allocate memory to handle an Emergency MT-LR by calling RPhone::SetEmergencyClient(), passing a parameter value RPhone::EEmergencyLCSRequest.

    • RMobileLocationServices::NotifyMeasurementControl() registers the module to receive A-GPS assistance data updates from the network. Note that each time this method notifies the caller that assistance data is received, this method must be called again to request further notifications.

    • RMobileLocationServices::NotifyMtlr() registers the protocol module to receive MT-LRs from the network. Note that each time this method notifies the caller that an MT-LR is received, this method must be called again to request further notifications.