How to Implement a LBS Set Clock Plug-in DLL

This topic describes how to implement a LBS set clock plug-in class.

Required background

LBS system clock adjustment overview describes the set clock plug-in interface.

Introduction

LBS contains a default implementation of a set clock module that sets the system clock time by calling User::SetUTCTime().

To set the system clock by some other method, a licensee must create a set clock plug-in DLL and configure LBS to use it.

Implementing the plug-in class

Licensee set clock plug-in classes must derive from the abstract base class CGPSSetClockBase shown in figure 1.

CGPSSetClockBase is packaged in GPSSetClock.dll. An implementation includes GPSSetClockBase.h and links with GPSSetClock.lib.

Figure 1. Figure 1. CGPSSetClockBase is the base class for LBS set clock plug-in classes.

To implement a set clock plug-in a developer must follow the steps in the next section.

Procedure

  1. Create a class derived from CGPSSetClockBase:

    #include <GPSSetClockBase.h>
    
    class CGPSSetClockImpl : public CGPSSetClockBase
    {
        
        public:
      static CGPSSetClockImpl* NewL();
         
      virtual TInt SetUTCTime(const TTime& aTime);
      virtual ~CGPSSetClockImpl();
      
     private:
      CGPSSetClockImpl();
      void ConstructL();
         
    };
    

    Note that the implementation class must only allocate memory on construction, not when CGPSSetClockBase::SetUTCTime() is called. This is because LBS must always be able to respond to emergency services location requests and so must never run out of memory at runtime. Memory for the set clock plug-in DLL must therefore be allocated on startup of the LBS subsystem when the ECom framework loads the plug-in DLL and calls the NewL() function on the implementation class.

    CGPSSetClockImpl* CGPSSetClockImpl::NewL()
    {
        // Allocate all required memory here or in ConstructL()
     ...
    }
    
  2. Implement the virtual method CGPSSetClockBase::SetUTCTime(). The implementation of this method is licensee specific and depends on the method that the licensee uses to set the system clock.

    
    TInt CGPSSetClockImpl::SetUTCTime(const TTime& aTime)
    {
        // Licensee method of setting the system clock
     // Do not allocate any additional memory!
        ...
    }
    
  3. Package the class as an ECom plug-in DLL.

    See How to create implementation collections for information on how to package an implementation class as an ECom plug-in DLL.

    Note: LBS must be configured to use the licensee set clock plug-in DLL to set the system clock. LBS administration describes how to configure LBS system clock synchronisation settings using either the LBS Administration API or a repository initialisation file.