CSensrvPluginProxy Class Reference

class CSensrvPluginProxy : public CBase

Manages single plugin and transactions related to it

Since
S60 5.0

Inherits from

Public Member Functions
~CSensrvPluginProxy ()
void AddChannelChangeListener ()
RSensrvResourceChannelInfoList & ChannelInfoList ()
void CleanupPlugin ()
void DispatchMessage ( CSensrvMessage &, TSensrvChannelId )
RSensrvResourceChannelInfoList & DynamicChannelInfoList ()
TInt FindChannel (const TSensrvChannelInfo &, const RSensrvResourceChannelInfoList &)
TInt FindChannel (const RSensrvChannelInfoList &, const TSensrvChannelInfo &)
CSensrvChannel * GetChannelForId ( TSensrvChannelId )
void HandleSsyNotifyFailure ()
void HandleTransactionTimeout ()
const TUid ImplementationUid ()
TInt InitializeChannelData (const CImplementationInformation &)
void InitializePluginL ()
TBool IsChannelSupported ( TSensrvChannelId )
TBool IsInitialized ()
TBool IsMarkedForDeletion ()
RMutex & Mutex ()
CSensrvPluginProxy * NewL ( CSensrvProxyManager &, TUid )
TPluginState PluginState ()
TBool PreviousSsyLoadFailed ()
CSensrvProxyManager & ProxyManager ()
void RemoveChannelChangeListener ()
RSensrvResourceChannelInfoList & RemovedChannelsInfoList ()
CSensrvServerMediator * ServerMediator ()
void SessionTerminated ( CSensrvSession *)
void SetDeletionFlag ()
CSensrvSsyMediator * SsyMediator ()
void SsyThreadTerminated ()
void StartUnloadTimerIfNeeded ()
void StopUnloadTimer ()
void TimerFired ( TInt )
void TransactionHandledAtSsy ( CSensrvTransaction *)
CSensrvTransactionMonitor * TransactionMonitor ()
Private Member Functions
CSensrvPluginProxy ( CSensrvProxyManager &, TUid )
void CleanupInitializePlugin ( TAny *)
void CompleteTransaction ( CSensrvTransaction *)
void ConstructL ()
TInt EnqueueDelayedInitializeTransaction ()
TSensrvResourceChannelInfo * GetChannelInfoForId ( TSensrvChannelId )
TInt GetTotalListenerCount ()
void HandleNextTransaction ()
TInt QueueTransaction ( CSensrvTransaction *, TBool )
void SetPluginState ( TPluginState )
TInt SsyThreadFunction ( TAny *)
TInt UpdateChannelInfoLists ()
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enum TPluginState {
EPluginStateUninitialized , EPluginStateThreadInitializing , EPluginStateThreadInitialized , EPluginStateLoaded , EPluginStateUnloading , EPluginStateUnloaded
}
Private Attributes
TInt iChannelChangeListenerCount
RSensrvResourceChannelInfoList iChannelInfoList
RPointerArray < CSensrvChannel > iChannelList
TBool iDeletionFlag
RSensrvResourceChannelInfoList iDynamicChannelInfoList
TUid iImplementationUid
TBool iIsInitialized
CSensrvTransactionQueue * iLoadWaitQueue
RMutex iMutex
TPluginState iPluginState
TBool iPreviousSsyLoadFailed
CSensrvProxyManager & iProxyManager
RSensrvResourceChannelInfoList iRemovedChannelsInfoList
CSensrvServerMediator * iServerMediator
CSensrvSsyMediator * iSsyMediator
RThread iSsyThread
CSensrvThreadMonitor * iThreadMonitor
CSensrvTransactionMonitor * iTransactionMonitor
CSensrvTimer * iUnloadTimer

Constructor & Destructor Documentation

CSensrvPluginProxy(CSensrvProxyManager &, TUid)

CSensrvPluginProxy ( CSensrvProxyManager & aParent,
TUid aImplementationUid
) [private]

C++ constructor

Parameters

CSensrvProxyManager & aParent Reference to proxy manager.
TUid aImplementationUid Implementation UID required to load plugin.

~CSensrvPluginProxy()

~CSensrvPluginProxy ( ) [virtual]

Destructor.

Member Functions Documentation

AddChannelChangeListener()

void AddChannelChangeListener ( )

Increments dynamic channel change listener count

Since
S60 5.0

ChannelInfoList()

RSensrvResourceChannelInfoList & ChannelInfoList ( ) [inline]

Gets a reference for plugin channel info array. Called from both threads.

Since
S60 5.0

CleanupInitializePlugin(TAny *)

void CleanupInitializePlugin ( TAny * aAny ) [private, static]

Cleanupitem callback for plugin initialization

Since
S60 5.0

Parameters

TAny * aAny The proxy pointer

CleanupPlugin()

void CleanupPlugin ( )

Cleans up the plugin, its thread and SSY mediator. Only called from server thread.

Since
S60 5.0

CompleteTransaction(CSensrvTransaction *)

void CompleteTransaction ( CSensrvTransaction * aTransaction ) [private]

Completes transaction after it has been handled by SSY. Only called from server thread.

Since
S60 5.0

Parameters

CSensrvTransaction * aTransaction The transaction to complete

ConstructL()

void ConstructL ( ) [private]

Second phase of construction.

DispatchMessage(CSensrvMessage &, TSensrvChannelId)

void DispatchMessage ( CSensrvMessage & aMessage,
TSensrvChannelId aChannelId
)

Handles client message. Message completion responsibility transfers. Called only within server thread.

Since
S60 5.0

Parameters

CSensrvMessage & aMessage The message containing the client request.
TSensrvChannelId aChannelId The channel id of related channel.

DynamicChannelInfoList()

RSensrvResourceChannelInfoList & DynamicChannelInfoList ( ) [inline]

Gets a reference for plugin dynamic channel info array. Called from both threads.

Since
S60 5.0

EnqueueDelayedInitializeTransaction()

TInt EnqueueDelayedInitializeTransaction ( ) [private]

Enqueues delayd initialization if load queue is empty Only called from server thread.

Since
S60 5.0

FindChannel(const TSensrvChannelInfo &, const RSensrvResourceChannelInfoList &)

TInt FindChannel ( const TSensrvChannelInfo & aChannelInfo,
const RSensrvResourceChannelInfoList & aChannelInfoList
) [static]

Finds channel from info list that matches to given channel info

Since
S60 5.0

Parameters

const TSensrvChannelInfo & aChannelInfo Channel info to match from
const RSensrvResourceChannelInfoList & aChannelInfoList Channel info list to match with

FindChannel(const RSensrvChannelInfoList &, const TSensrvChannelInfo &)

TInt FindChannel ( const RSensrvChannelInfoList & aChannelInfoList,
const TSensrvChannelInfo & aChannelInfo
) [static]

Finds channel from info list that matches to given channel info

Since
S60 5.0

Parameters

const RSensrvChannelInfoList & aChannelInfoList Channel info list to match from
const TSensrvChannelInfo & aChannelInfo Channel info to match with

GetChannelForId(TSensrvChannelId)

CSensrvChannel * GetChannelForId ( TSensrvChannelId aChannelId ) const

Gets the channel object that handles the specified channel.

Since
S60 5.0

Parameters

TSensrvChannelId aChannelId The channel id of desired channel.

GetChannelInfoForId(TSensrvChannelId)

TSensrvResourceChannelInfo * GetChannelInfoForId ( TSensrvChannelId aChannelId ) [private]

Gets channel info matching specified channel id

Since
S60 5.0

Parameters

TSensrvChannelId aChannelId Channel id

GetTotalListenerCount()

TInt GetTotalListenerCount ( ) [private]

Gets listener count of all channels Called only from server thread.

Since
S60 5.0

HandleNextTransaction()

void HandleNextTransaction ( ) [private]

Handle next queued transaction in specified queue. If there was an error, transaction is completed with error. Only called from server thread.

Since
S60 5.0

HandleSsyNotifyFailure()

void HandleSsyNotifyFailure ( )

Handles notify failure at SSY

Since
S60 5.0

HandleTransactionTimeout()

void HandleTransactionTimeout ( )

Transaction timeout handling.

Since
S60 5.0

ImplementationUid()

const TUid ImplementationUid ( ) const [inline]

Gets plugin implementation UID Called from SSY thread.

Since
S60 5.0

InitializeChannelData(const CImplementationInformation &)

TInt InitializeChannelData ( const CImplementationInformation & aImplInfo )

Initializes plugin channel data.

Since
S60 5.0

Parameters

const CImplementationInformation & aImplInfo Implementation information of the channel

InitializePluginL()

void InitializePluginL ( )

Initializes plugin thread and mediators. Also queues load transaction. Called only within server thread.

Since
S60 5.0
Exceptions
Normal

Symbian error code

IsChannelSupported(TSensrvChannelId)

TBool IsChannelSupported ( TSensrvChannelId aChannelId )

Check if this proxy supports specified channel Called only within server thread.

Since
S60 5.0

Parameters

TSensrvChannelId aChannelId Channel id to check

IsInitialized()

TBool IsInitialized ( ) const [inline]

Gets proxy initialization status Called from server thread

Since
S60 5.0

IsMarkedForDeletion()

TBool IsMarkedForDeletion ( ) const [inline]

Checks if proxy is marked for deletion Called from server thread

Since
S60 5.0

Mutex()

RMutex & Mutex ( ) [inline]

Gets reference to the mutex controlling access to shared resources between server and plugin threads.

Since
S60 5.0

NewL(CSensrvProxyManager &, TUid)

CSensrvPluginProxy * NewL ( CSensrvProxyManager & aParent,
TUid aImplementationUid
) [static]

Two phase constructor

Since
S60 5.0
Exceptions
KErrNoMemory

Out of memory

Parameters

CSensrvProxyManager & aParent Reference to proxy manager.
TUid aImplementationUid Implementation UID required to load plugin.

PluginState()

TPluginState PluginState ( ) const [inline]

Gets plugin state. Called from both threads.

Since
S60 5.0

PreviousSsyLoadFailed()

TBool PreviousSsyLoadFailed ( ) const [inline]

Checks SSY load fail indicator

Since
S60 5.0

ProxyManager()

CSensrvProxyManager & ProxyManager ( ) [inline]

Gets reference to the proxy manager Called from both threads.

Since
S60 5.0

QueueTransaction(CSensrvTransaction *, TBool)

TInt QueueTransaction ( CSensrvTransaction * aTransaction,
TBool aLast
) [private]

Queues new transaction to proxy's queue. Ownership of the transaction transfers to queue. If queue is empty, also calls HandleNextTransaction. Only called from server thread.

Since
S60 5.0

Parameters

CSensrvTransaction * aTransaction The transaction to queue
TBool aLast If ETrue, transaction is added to the end of the queue

RemoveChannelChangeListener()

void RemoveChannelChangeListener ( )

Decrements dynamic channel change listener count

Since
S60 5.0

RemovedChannelsInfoList()

RSensrvResourceChannelInfoList & RemovedChannelsInfoList ( ) [inline]

Gets a reference for plugin removed channels info array. Called from both threads.

Since
S60 5.0

ServerMediator()

CSensrvServerMediator * ServerMediator ( ) [inline]

Gets pointer to server mediator. Called from both threads.

Since
S60 5.0

SessionTerminated(CSensrvSession *)

void SessionTerminated ( CSensrvSession * aSession )

Cleans up session related data.

Since
S60 5.0

Parameters

CSensrvSession * aSession The session that was deleted

SetDeletionFlag()

void SetDeletionFlag ( ) [inline]

Marks proxy for deletion Called from server thread

Since
S60 5.0

SetPluginState(TPluginState)

void SetPluginState ( TPluginState aState ) [private]

Sets plugin state. Called only from server thread.

Since
S60 5.0

Parameters

TPluginState aState New state.

SsyMediator()

CSensrvSsyMediator * SsyMediator ( ) [inline]

Gets pointer to SSY mediator. Called from both threads.

Since
S60 5.0

SsyThreadFunction(TAny *)

TInt SsyThreadFunction ( TAny * aParameter ) [private, static]

SSY thread main method. Only called from SSY thread.

Since
S60 5.0

Parameters

TAny * aParameter CSensrvPluginProxy pointer.

SsyThreadTerminated()

void SsyThreadTerminated ( )

Called by thread monitor when it detects that SSY thread is no longer running or has explicitly killed it.

Since
S60 5.0

StartUnloadTimerIfNeeded()

void StartUnloadTimerIfNeeded ( )

Check if plugin has no clients, and start unload timer if so.

Since
S60 5.0

StopUnloadTimer()

void StopUnloadTimer ( ) [inline]

Stop unload timer if it is active

Since
S60 5.0

TimerFired(TInt)

void TimerFired ( TInt aTimerId )

Called when the unload timer fires. Cleanus up the SSY

Since
S60 5.0

Parameters

TInt aTimerId Timer identifier to id which timer fired.

TransactionHandledAtSsy(CSensrvTransaction *)

void TransactionHandledAtSsy ( CSensrvTransaction * aTransaction )

Notifies proxy that a transaction has been handled by plugin. Called only from server thread.

Since
S60 5.0

Parameters

CSensrvTransaction * aTransaction The transaction that has been handled.

TransactionMonitor()

CSensrvTransactionMonitor * TransactionMonitor ( ) [inline]

Gets a reference to transaction monitor. Called from both threads.

Since
S60 5.0

UpdateChannelInfoLists()

TInt UpdateChannelInfoLists ( ) [private]

Grabs raw channel info data from SSY mediator and Updates channel info and removed channel info lists.

Since
S60 5.0

Member Enumerations Documentation

Enum TPluginState

Enumeration from plugin states.

Enumerators

EPluginStateUninitialized
EPluginStateThreadInitializing
EPluginStateThreadInitialized
EPluginStateLoaded
EPluginStateUnloading
EPluginStateUnloaded

Member Data Documentation

TInt iChannelChangeListenerCount

TInt iChannelChangeListenerCount [private]

Channel change listener counter

RSensrvResourceChannelInfoList iChannelInfoList

RSensrvResourceChannelInfoList iChannelInfoList [private]

Active channels provided by the plugin

RPointerArray< CSensrvChannel > iChannelList

RPointerArray < CSensrvChannel > iChannelList [private]

List of channels opened at least for one client. Own. (the channels in list)

TBool iDeletionFlag

TBool iDeletionFlag [private]

If true, proxy is marked for deletion and will be deleted soon.

RSensrvResourceChannelInfoList iDynamicChannelInfoList

RSensrvResourceChannelInfoList iDynamicChannelInfoList [private]

Dynamic channels provided by the plugin

TUid iImplementationUid

TUid iImplementationUid [private]

Implementation UID needed to load plugin.

TBool iIsInitialized

TBool iIsInitialized [private]

Indicates that this proxy has finished its initialization. Note that this doesn't mean channels are actually available or that plugins are loaded successfully.

CSensrvTransactionQueue * iLoadWaitQueue

CSensrvTransactionQueue * iLoadWaitQueue [private]

Holds load transaction and channel related transactions until plugin has finished loading. Queued transactions are owned by the queue. Own.

RMutex iMutex

RMutex iMutex [private]

Used to control access to data shared by server and plugin threads.

TPluginState iPluginState

TPluginState iPluginState [private]

Stores the state of plugin controlled by this proxy.

TBool iPreviousSsyLoadFailed

TBool iPreviousSsyLoadFailed [private]

Indicator of previous SSY load fail. If ETrue, the load attempt was failed.

CSensrvProxyManager & iProxyManager

CSensrvProxyManager & iProxyManager [private]

Reference to proxy manager Own.

RSensrvResourceChannelInfoList iRemovedChannelsInfoList

RSensrvResourceChannelInfoList iRemovedChannelsInfoList [private]

Channels that have been provided by the plugin at one time, but have subsequently been removed. Removed channels are stored so that original channel ids can be recovered should they be re-registered.

CSensrvServerMediator * iServerMediator

CSensrvServerMediator * iServerMediator [private]

Mediator used to pass transactions from plugin thread to main thread Own.

CSensrvSsyMediator * iSsyMediator

CSensrvSsyMediator * iSsyMediator [private]

Mediator used to pass transactions from main thread to plugin thread Own technically, but actual deletion is done in static SsyThreadFunction, after SSY active scheduler loop terminates.

RThread iSsyThread

RThread iSsyThread [private]

SSY thread handle

CSensrvThreadMonitor * iThreadMonitor

CSensrvThreadMonitor * iThreadMonitor [private]

Monitors plugin threads existence. Own.

CSensrvTransactionMonitor * iTransactionMonitor

CSensrvTransactionMonitor * iTransactionMonitor [private]

Monitors transactions Own.

CSensrvTimer * iUnloadTimer

CSensrvTimer * iUnloadTimer [private]

Timer used to unload plugin if it has no clients for a certain period of time. Own.