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()
voidAddChannelChangeListener()
RSensrvResourceChannelInfoList &ChannelInfoList()
voidCleanupPlugin()
voidDispatchMessage(CSensrvMessage &, TSensrvChannelId)
RSensrvResourceChannelInfoList &DynamicChannelInfoList()
TInt FindChannel(const TSensrvChannelInfo &, const RSensrvResourceChannelInfoList &)
TInt FindChannel(const RSensrvChannelInfoList &, const TSensrvChannelInfo &)
CSensrvChannel *GetChannelForId(TSensrvChannelId)
voidHandleSsyNotifyFailure()
voidHandleTransactionTimeout()
const TUidImplementationUid()
TInt InitializeChannelData(const CImplementationInformation &)
voidInitializePluginL()
TBool IsChannelSupported(TSensrvChannelId)
TBool IsInitialized()
TBool IsMarkedForDeletion()
RMutex &Mutex()
CSensrvPluginProxy *NewL(CSensrvProxyManager &, TUid)
TPluginState PluginState()
TBool PreviousSsyLoadFailed()
CSensrvProxyManager &ProxyManager()
voidRemoveChannelChangeListener()
RSensrvResourceChannelInfoList &RemovedChannelsInfoList()
CSensrvServerMediator *ServerMediator()
voidSessionTerminated(CSensrvSession *)
voidSetDeletionFlag()
CSensrvSsyMediator *SsyMediator()
voidSsyThreadTerminated()
voidStartUnloadTimerIfNeeded()
voidStopUnloadTimer()
voidTimerFired(TInt)
voidTransactionHandledAtSsy(CSensrvTransaction *)
CSensrvTransactionMonitor *TransactionMonitor()
Private Member Functions
CSensrvPluginProxy(CSensrvProxyManager &, TUid)
voidCleanupInitializePlugin(TAny *)
voidCompleteTransaction(CSensrvTransaction *)
voidConstructL()
TInt EnqueueDelayedInitializeTransaction()
TSensrvResourceChannelInfo *GetChannelInfoForId(TSensrvChannelId)
TInt GetTotalListenerCount()
voidHandleNextTransaction()
TInt QueueTransaction(CSensrvTransaction *, TBool)
voidSetPluginState(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
enumTPluginState {
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,
TUidaImplementationUid
)[private]

C++ constructor

Parameters

CSensrvProxyManager & aParentReference to proxy manager.
TUid aImplementationUidImplementation UID required to load plugin.

~CSensrvPluginProxy()

~CSensrvPluginProxy()[virtual]

Destructor.

Member Functions Documentation

AddChannelChangeListener()

voidAddChannelChangeListener()

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 *)

voidCleanupInitializePlugin(TAny *aAny)[private, static]

Cleanupitem callback for plugin initialization

Since
S60 5.0

Parameters

TAny * aAnyThe proxy pointer

CleanupPlugin()

voidCleanupPlugin()

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

Since
S60 5.0

CompleteTransaction(CSensrvTransaction *)

voidCompleteTransaction(CSensrvTransaction *aTransaction)[private]

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

Since
S60 5.0

Parameters

CSensrvTransaction * aTransactionThe transaction to complete

ConstructL()

voidConstructL()[private]

Second phase of construction.

DispatchMessage(CSensrvMessage &, TSensrvChannelId)

voidDispatchMessage(CSensrvMessage &aMessage,
TSensrvChannelIdaChannelId
)

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

Since
S60 5.0

Parameters

CSensrvMessage & aMessageThe message containing the client request.
TSensrvChannelId aChannelIdThe 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 & aChannelInfoChannel info to match from
const RSensrvResourceChannelInfoList & aChannelInfoListChannel 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 & aChannelInfoListChannel info list to match from
const TSensrvChannelInfo & aChannelInfoChannel info to match with

GetChannelForId(TSensrvChannelId)

CSensrvChannel *GetChannelForId(TSensrvChannelIdaChannelId)const

Gets the channel object that handles the specified channel.

Since
S60 5.0

Parameters

TSensrvChannelId aChannelIdThe channel id of desired channel.

GetChannelInfoForId(TSensrvChannelId)

TSensrvResourceChannelInfo *GetChannelInfoForId(TSensrvChannelIdaChannelId)[private]

Gets channel info matching specified channel id

Since
S60 5.0

Parameters

TSensrvChannelId aChannelIdChannel id

GetTotalListenerCount()

TInt GetTotalListenerCount()[private]

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

Since
S60 5.0

HandleNextTransaction()

voidHandleNextTransaction()[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()

voidHandleSsyNotifyFailure()

Handles notify failure at SSY

Since
S60 5.0

HandleTransactionTimeout()

voidHandleTransactionTimeout()

Transaction timeout handling.

Since
S60 5.0

ImplementationUid()

const TUidImplementationUid()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 & aImplInfoImplementation information of the channel

InitializePluginL()

voidInitializePluginL()

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(TSensrvChannelIdaChannelId)

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

Since
S60 5.0

Parameters

TSensrvChannelId aChannelIdChannel 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,
TUidaImplementationUid
)[static]

Two phase constructor

Since
S60 5.0
Exceptions
KErrNoMemory

Out of memory

Parameters

CSensrvProxyManager & aParentReference to proxy manager.
TUid aImplementationUidImplementation 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,
TBoolaLast
)[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 * aTransactionThe transaction to queue
TBool aLastIf ETrue, transaction is added to the end of the queue

RemoveChannelChangeListener()

voidRemoveChannelChangeListener()

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 *)

voidSessionTerminated(CSensrvSession *aSession)

Cleans up session related data.

Since
S60 5.0

Parameters

CSensrvSession * aSessionThe session that was deleted

SetDeletionFlag()

voidSetDeletionFlag()[inline]

Marks proxy for deletion Called from server thread

Since
S60 5.0

SetPluginState(TPluginState)

voidSetPluginState(TPluginStateaState)[private]

Sets plugin state. Called only from server thread.

Since
S60 5.0

Parameters

TPluginState aStateNew 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 * aParameterCSensrvPluginProxy pointer.

SsyThreadTerminated()

voidSsyThreadTerminated()

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

Since
S60 5.0

StartUnloadTimerIfNeeded()

voidStartUnloadTimerIfNeeded()

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

Since
S60 5.0

StopUnloadTimer()

voidStopUnloadTimer()[inline]

Stop unload timer if it is active

Since
S60 5.0

TimerFired(TInt)

voidTimerFired(TIntaTimerId)

Called when the unload timer fires. Cleanus up the SSY

Since
S60 5.0

Parameters

TInt aTimerIdTimer identifier to id which timer fired.

TransactionHandledAtSsy(CSensrvTransaction *)

voidTransactionHandledAtSsy(CSensrvTransaction *aTransaction)

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

Since
S60 5.0

Parameters

CSensrvTransaction * aTransactionThe 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.