CSensrvChannel Class Reference

class CSensrvChannel : public CBase

Implements channel related handling.

Since
S60 5.0

Inherits from

Public Member Functions
~CSensrvChannel ()
CSensrvChannelBuffer * Buffer ()
void ChannelClosed ()
TSensrvResourceChannelInfo::TSensrvChannelGroup ChannelGroup ()
void ChannelOpened ( TInt , MSsyChannelDataProvider *, MSsyPropertyProvider *)
void CompleteTransaction ( CSensrvTransaction *)
CSensrvConditionEvaluator * ConditionEvaluatorL ()
CSensrvTransaction * DataAvailableTransaction ()
TInt DataItemSize ()
MSsyChannelDataProvider * DataProvider ()
void DispatchMessage ( CSensrvMessage &)
void ForceBufferFilled ()
CSensrvTransaction * ForceBufferFilledTransaction ()
CSensrvTransaction * ForceChannelCloseTransaction ()
void GetAffectedClients ( RArray < TInt > &, TSecureId )
TInt GetHighestListenerPriority ( TInt &)
CSensrvChannelListener * GetListener ( CSensrvSession *)
void HandleSsyNotifyFailure ()
TSensrvChannelId Id ()
TInt ListenerCount ()
TInt MaxBufferingCount ()
CSensrvChannel * NewL (const TSensrvResourceChannelInfo &, CSensrvPluginProxy &)
CSensrvTransaction * PropertyChangedTransaction ()
MSsyPropertyProvider * PropertyProvider ()
CSensrvPluginProxy & Proxy ()
TInt RecalculateBufferingCount ()
void SessionTerminated ( CSensrvSession *)
TSensrvChannelState State ()
TBool StoreChangedProperty (const TSensrvProperty &, const CSensrvSession *)
void TakePropertySetControl ( CSensrvChannelListener *)
CSensrvChannelListener * TakenPropertySetControl ()
Private Member Functions
CSensrvChannel (const TSensrvChannelInfo &, CSensrvPluginProxy &)
void CloseIfNeeded ()
void ConstructL ()
void DeleteListener ( CSensrvSession *)
CSensrvChannelListener * FindListener ( CSensrvSession *)
RSensrvChannelList * GetAffectedChannels ()
RSensrvChannelList * GetAvailabilityAffectedChannels ( TSensrvAvailability )
TInt GetHighestChannelPriority (const RSensrvChannelList *, TSensrvChannelId &)
TInt GetHighestListenerPriorityOfAffectedChannels ( TInt &)
TInt GetLowestChannelPriority (const RSensrvChannelList *, TSensrvChannelId &)
void HandleAvailabilityChange (const TSensrvProperty &)
void HandleAvailabilityChange (const TSensrvAvailability &)
void HandleDependencyOnClose (const TInt &)
void HandleDependencyOnOpen ()
void HandleNextTransaction ()
void HandleSetPropertySuccessIndOnCreateOrDelete ()
void HandleSetPropertySuccessIndOnPropertyChange ()
TInt HandleStartListeningTransaction ( CSensrvTransaction &)
TInt HandleStopListeningTransaction ( CSensrvTransaction &, TBool &)
TSensrvResourceChannelInfo::TSensrvChannelGroup ReadChannelGroup ()
TInt SetAvailability ( TSensrvChannelId , TSensrvProperty &, TSensrvAvailability , const TSecurityInfo &)
TInt SetChannelAvailability ( TSensrvChannelId , TSensrvChannelId , TSensrvProperty &)
TInt SetChannelAvailability ( TSensrvChannelId , TSensrvProperty &, TSensrvAvailability )
void SetChannelAvailable ()
void SetChannelUnavailable ()
void UpdateSetPropertySuccessIndToChannelListeners ( CSensrvChannel &, TInt , TInt )
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 TSensrvChannelState { EChannelStateClosed , EChannelStateOpen , EChannelStateListening }
Private Attributes
CSensrvChannelBuffer * iChannelBuffer
TSensrvResourceChannelInfo iChannelInfo
CSensrvTransactionQueue * iChannelQueue
CSensrvConditionEvaluator * iConditionEvaluator
CSensrvChannelListener * iCurrentSetPropertyControl
CSensrvTransaction * iDataAvailableTransaction
MSsyChannelDataProvider * iDataProvider
CSensrvTransaction * iForceBufferFilledTransaction
CSensrvTransaction * iForceChannelCloseTransaction
TBool iForcingBufferFilled
TInt iHighestListenerPriority
TInt iHighestListenerPriorityMultiples
TSensrvChannelId iId
RPointerArray < CSensrvChannelListener > iListenerList
TInt iMaxBufferingCount
CSensrvTransaction * iPropertyChangedTransaction
MSsyPropertyProvider * iPropertyProvider
CSensrvPluginProxy & iProxy
TSensrvChannelState iState

Constructor & Destructor Documentation

CSensrvChannel(const TSensrvChannelInfo &, CSensrvPluginProxy &)

CSensrvChannel ( const TSensrvChannelInfo & aInfo,
CSensrvPluginProxy & aProxy
) [private]

C++ constructor

Since
S60 5.0

Parameters

const TSensrvChannelInfo & aInfo Channel info.
CSensrvPluginProxy & aProxy Callback proxy.

~CSensrvChannel()

~CSensrvChannel ( ) [virtual]

Destructor.

Member Functions Documentation

Buffer()

CSensrvChannelBuffer * Buffer ( ) [inline]

Gets data buffer pointer. Called from SSY thread.

Since
S60 5.0

ChannelClosed()

void ChannelClosed ( )

Indicates channel has been closed by SSY Called from SSY thread only.

Since
S60 5.0

ChannelGroup()

TSensrvResourceChannelInfo::TSensrvChannelGroup ChannelGroup ( )

Gets channel group Called from server thread.

Since
S60 5.0

ChannelOpened(TInt, MSsyChannelDataProvider *, MSsyPropertyProvider *)

void ChannelOpened ( TInt aErrorCode,
MSsyChannelDataProvider * aDataProvider,
MSsyPropertyProvider * aSensorPropertyProvider
)

Indicates channel has been opened by SSY Called from SSY thread only.

Since
S60 5.0

Parameters

TInt aErrorCode Indicates any error that occurred during channel opening.
MSsyChannelDataProvider * aDataProvider Pointer to channel data provider instance
MSsyPropertyProvider * aSensorPropertyProvider Pointer to sensor property provider instance

CloseIfNeeded()

void CloseIfNeeded ( ) [private]

Closes the channel to SSY if there are no listeners.

Since
S60 5.0

CompleteTransaction(CSensrvTransaction *)

void CompleteTransaction ( CSensrvTransaction * aTransaction )

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

ConditionEvaluatorL()

CSensrvConditionEvaluator * ConditionEvaluatorL ( )

Creates a new condition evaluator or returns an existing one.

Since
S60 5.0

ConstructL()

void ConstructL ( ) [private]

2nd phase of construction

Since
S60 5.0

DataAvailableTransaction()

CSensrvTransaction * DataAvailableTransaction ( ) const [inline]

Gets the persistent ETransTypeMediatorNewDataAvailable transaction. Called from SSY thread.

Since
S60 5.0

DataItemSize()

TInt DataItemSize ( ) const [inline]

Gets the data item size Called from server thread.

Since
S60 5.0

DataProvider()

MSsyChannelDataProvider * DataProvider ( ) [inline]

Gets data provider pointer. Called from SSY thread.

Since
S60 5.0

DeleteListener(CSensrvSession *)

void DeleteListener ( CSensrvSession * aSession ) [private]

Deletes a listener.

Since
S60 5.0

Parameters

CSensrvSession * aSession Session for which the listener is deleted.

DispatchMessage(CSensrvMessage &)

void DispatchMessage ( CSensrvMessage & aMessage )

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.

FindListener(CSensrvSession *)

CSensrvChannelListener * FindListener ( CSensrvSession * aSession ) [private]

Finds a listener by session.

Since
S60 5.0

Parameters

CSensrvSession * aSession Session for which the listener is found.

ForceBufferFilled()

void ForceBufferFilled ( )

Forces buffer filled at SSY

Since
S60 5.0

ForceBufferFilledTransaction()

CSensrvTransaction * ForceBufferFilledTransaction ( ) const [inline]

Gets the persistent ETransTypeMediatorForceBufferFilled transaction. Called from server thread.

Since
S60 5.0

ForceChannelCloseTransaction()

CSensrvTransaction * ForceChannelCloseTransaction ( ) const [inline]

Gets the persistent ETransTypeMediatorForceChannelClose transaction. Called from SSY thread.

Since
S60 5.0

GetAffectedChannels()

RSensrvChannelList * GetAffectedChannels ( ) const [private]

Gets the affected channel list from SSY

Since
S60 5.0

GetAffectedClients(RArray< TInt > &, TSecureId)

void GetAffectedClients ( RArray < TInt > & aAffectedClients,
TSecureId aCallerSecureId
)

Get clients of this channel. The client identified by aCallerSecureId is not added to the affected clients list.

Since
S60 5.0

Parameters

RArray < TInt > & aAffectedClients On return contains client processes priorities for this channel.
TSecureId aCallerSecureId Identifies the listener which is filtered away.

GetAvailabilityAffectedChannels(TSensrvAvailability)

RSensrvChannelList * GetAvailabilityAffectedChannels ( TSensrvAvailability aValue ) const [private]

Gets the affected channel list from SSY

Since
S60 5.0

Parameters

TSensrvAvailability aValue

GetHighestChannelPriority(const RSensrvChannelList *, TSensrvChannelId &)

TInt GetHighestChannelPriority ( const RSensrvChannelList * aAffectedChannelsList,
TSensrvChannelId & aChannelId
) [private]

Get channel from affected channels list with the highest priority

Since
S60 5.0

Parameters

const RSensrvChannelList * aAffectedChannelsList
TSensrvChannelId & aChannelId

GetHighestListenerPriority(TInt &)

TInt GetHighestListenerPriority ( TInt & aHighestPriority )

Gets the highest priority listener and its multiples from this channel.

Since
S60 5.0

Parameters

TInt & aHighestPriority Stores the highest priority.

GetHighestListenerPriorityOfAffectedChannels(TInt &)

TInt GetHighestListenerPriorityOfAffectedChannels ( TInt & aHighestPriority ) [private]

Gets the highest priority listener and its multiples from all affected channels.

Since
S60 5.0

Parameters

TInt & aHighestPriority Stores the highest priority.

GetListener(CSensrvSession *)

CSensrvChannelListener * GetListener ( CSensrvSession * aSession )

Gets listener for session.

Since
S60 5.0

Parameters

CSensrvSession * aSession Session for which the listener is needed.

GetLowestChannelPriority(const RSensrvChannelList *, TSensrvChannelId &)

TInt GetLowestChannelPriority ( const RSensrvChannelList * aAffectedChannelsList,
TSensrvChannelId & aChannelId
) [private]

Get channel from affected channels list with the lowest priority

Since
S60 5.0

Parameters

const RSensrvChannelList * aAffectedChannelsList
TSensrvChannelId & aChannelId

HandleAvailabilityChange(const TSensrvProperty &)

void HandleAvailabilityChange ( const TSensrvProperty & aProperty ) [private]

Handles channel availability property change

Since
S60 5.0

Parameters

const TSensrvProperty & aProperty

HandleAvailabilityChange(const TSensrvAvailability &)

void HandleAvailabilityChange ( const TSensrvAvailability & value ) [private]

Handles channel availability property change

Since
S60 5.0

Parameters

const TSensrvAvailability & value

HandleDependencyOnClose(const TInt &)

void HandleDependencyOnClose ( const TInt & aPriority ) [private]

Handles dependent channels on channel close

Since
S60 5.0

Parameters

const TInt & aPriority

HandleDependencyOnOpen()

void HandleDependencyOnOpen ( ) [private]

Handles dependent channels on channel open

Since
S60 5.0

HandleNextTransaction()

void HandleNextTransaction ( ) [private]

Handles next transaction in queue. If first transaction is still executing or the queue is empty, does nothing.

Since
S60 5.0

HandleSetPropertySuccessIndOnCreateOrDelete()

void HandleSetPropertySuccessIndOnCreateOrDelete ( ) [private]

Handles set property success indications on listener creation or deletion

Since
S60 5.0

HandleSetPropertySuccessIndOnPropertyChange()

void HandleSetPropertySuccessIndOnPropertyChange ( ) [private]

Handles set property success indications on property change

Since
S60 5.0

HandleSsyNotifyFailure()

void HandleSsyNotifyFailure ( )

Handles notify failure at SSY

Since
S60 5.0

HandleStartListeningTransaction(CSensrvTransaction &)

TInt HandleStartListeningTransaction ( CSensrvTransaction & aTransaction ) [private]

Handles start data and condition listening transactions

Since
S60 5.0

Parameters

CSensrvTransaction & aTransaction Reference to the transaction.

HandleStopListeningTransaction(CSensrvTransaction &, TBool &)

TInt HandleStopListeningTransaction ( CSensrvTransaction & aTransaction,
TBool & aSsyTransactionNeeded
) [private]

Handles stop data and condition listening transactions

Since
S60 5.0

Parameters

CSensrvTransaction & aTransaction Reference to the transaction.
TBool & aSsyTransactionNeeded Returns ETrue if SSY transaction is needed.

Id()

TSensrvChannelId Id ( ) [inline]

Returns the channel id

Since
S60 5.0

ListenerCount()

TInt ListenerCount ( ) const [inline]

Gets the listener count. Called from server thread.

Since
S60 5.0

MaxBufferingCount()

TInt MaxBufferingCount ( ) [inline]

Gets maximum allowed buffering count. Called from server thread.

Since
S60 5.0

NewL(const TSensrvResourceChannelInfo &, CSensrvPluginProxy &)

CSensrvChannel * NewL ( const TSensrvResourceChannelInfo & aInfo,
CSensrvPluginProxy & aProxy
) [static]

Two phase constructor

Since
S60 5.0
Exceptions
KErrNoMemory

Out of memory

Parameters

const TSensrvResourceChannelInfo & aInfo Channel info.
CSensrvPluginProxy & aProxy Callback proxy.

PropertyChangedTransaction()

CSensrvTransaction * PropertyChangedTransaction ( ) const [inline]

Gets the persistent ETransTypeMediatorPropertyChanged transaction. Called from SSY thread.

Since
S60 5.0

PropertyProvider()

MSsyPropertyProvider * PropertyProvider ( ) [inline]

Gets property provider pointer. Called from SSY thread.

Since
S60 5.0

Proxy()

CSensrvPluginProxy & Proxy ( ) [inline]

Gets parent proxy reference. Called from both threads.

Since
S60 5.0

ReadChannelGroup()

TSensrvResourceChannelInfo::TSensrvChannelGroup ReadChannelGroup ( ) [private]

Reads channel group

Since
S60 5.0

RecalculateBufferingCount()

TInt RecalculateBufferingCount ( )

Recalculates buffering count, if there is more than one client.

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

SetAvailability(TSensrvChannelId, TSensrvProperty &, TSensrvAvailability, const TSecurityInfo &)

TInt SetAvailability ( TSensrvChannelId aChannelId,
TSensrvProperty & aProperty,
TSensrvAvailability aValue,
const TSecurityInfo & aSecurityInfo
) [private]

Sets dependent channel availability

Since
S60 5.0

Parameters

TSensrvChannelId aChannelId
TSensrvProperty & aProperty
TSensrvAvailability aValue
const TSecurityInfo & aSecurityInfo

SetChannelAvailability(TSensrvChannelId, TSensrvChannelId, TSensrvProperty &)

TInt SetChannelAvailability ( TSensrvChannelId aChannelIdToEnable,
TSensrvChannelId aChannelIdToDisable,
TSensrvProperty & aProperty
) [private]

Sets dependent channel availability

Since
S60 5.0

Parameters

TSensrvChannelId aChannelIdToEnable
TSensrvChannelId aChannelIdToDisable
TSensrvProperty & aProperty

SetChannelAvailability(TSensrvChannelId, TSensrvProperty &, TSensrvAvailability)

TInt SetChannelAvailability ( TSensrvChannelId aChannelId,
TSensrvProperty & aProperty,
TSensrvAvailability aValue
) [private]

Sets dependent channel availability

Since
S60 5.0

Parameters

TSensrvChannelId aChannelId
TSensrvProperty & aProperty
TSensrvAvailability aValue

SetChannelAvailable()

void SetChannelAvailable ( ) [private]

Handles channel availability property change to availabe

Since
S60 5.0

SetChannelUnavailable()

void SetChannelUnavailable ( ) [private]

Handles channel availability property change to unavailabe

Since
S60 5.0

State()

TSensrvChannelState State ( ) const [inline]

Gets channel state. Called from both threads.

Since
S60 5.0

StoreChangedProperty(const TSensrvProperty &, const CSensrvSession *)

TBool StoreChangedProperty ( const TSensrvProperty & aProperty,
const CSensrvSession * aIgnoreSession
)

Store a changed property provided by SSY. Called from SSY thread only.

Since
S60 5.0

Parameters

const TSensrvProperty & aProperty Property that has changed
const CSensrvSession * aIgnoreSession Do not store change for this session. Can be NULL.

TakePropertySetControl(CSensrvChannelListener *)

void TakePropertySetControl ( CSensrvChannelListener * aListener )

Takes the property set control. Required priority checks must be done by client before using this method.

Since
S60 5.0

Parameters

CSensrvChannelListener * aListener The listener that takes control or NULL if control is freed.

TakenPropertySetControl()

CSensrvChannelListener * TakenPropertySetControl ( ) const [inline]

Gets the listener that has taken the property set control.

Since
S60 5.0

UpdateSetPropertySuccessIndToChannelListeners(CSensrvChannel &, TInt, TInt)

void UpdateSetPropertySuccessIndToChannelListeners ( CSensrvChannel & aChannel,
TInt aHighestOfAffectedChannels,
TInt aMultiplesOnAffectedChannels
) [private, static]

Updated set property success indication to channel listeners

Since
S60 5.0

Parameters

CSensrvChannel & aChannel Channel to update
TInt aHighestOfAffectedChannels Highest priority of affected channels
TInt aMultiplesOnAffectedChannels Multiples of highest priority listeners

Member Enumerations Documentation

Enum TSensrvChannelState

Channel state.

Enumerators

EChannelStateClosed
EChannelStateOpen
EChannelStateListening

Member Data Documentation

CSensrvChannelBuffer * iChannelBuffer

CSensrvChannelBuffer * iChannelBuffer [private]

Channel buffer. Own.

TSensrvResourceChannelInfo iChannelInfo

TSensrvResourceChannelInfo iChannelInfo [private]

Channel info of this channel.

CSensrvTransactionQueue * iChannelQueue

CSensrvTransactionQueue * iChannelQueue [private]

Transaction queue for transactions targeting this channel. Own. iChannelQueue owns the queued transactions.

CSensrvConditionEvaluator * iConditionEvaluator

CSensrvConditionEvaluator * iConditionEvaluator [private]

Condition evaluator plugin. Own.

CSensrvChannelListener * iCurrentSetPropertyControl

CSensrvChannelListener * iCurrentSetPropertyControl [private]

The channel listener that has taken the property set control. Not own.

CSensrvTransaction * iDataAvailableTransaction

CSensrvTransaction * iDataAvailableTransaction [private]

Transaction for notifying new data from SSY to Server. It is stored and reused to both avoid repeatedly constructing and deleting it and to ensure it always exists, as the transaction is initiated by SSY. Own.

MSsyChannelDataProvider * iDataProvider

MSsyChannelDataProvider * iDataProvider [private]

Data provider residing in SSY thread heap. Can safely be accessed only from SSY thread. Not Own, owned by SSY.

CSensrvTransaction * iForceBufferFilledTransaction

CSensrvTransaction * iForceBufferFilledTransaction [private]

Transaction for notifying buffer filled must be forced. It is stored and reused to avoid repeatedly constructing and deleting it. Own.

CSensrvTransaction * iForceChannelCloseTransaction

CSensrvTransaction * iForceChannelCloseTransaction [private]

Transaction for notifying channel close must be forced. It is stored and reused to ensure it always exists, as the transaction is initiated by SSY. Own.

TBool iForcingBufferFilled

TBool iForcingBufferFilled [private]

Indicates outstanding explicit buffer fill request.

TInt iHighestListenerPriority

TInt iHighestListenerPriority [private]

Highest listener priority of the channel.

TInt iHighestListenerPriorityMultiples

TInt iHighestListenerPriorityMultiples [private]

Multiples of highest listener priority. If there are no listeners on this channel, value is zero. If there is single listener with the highest priority, value is one, etc.

TSensrvChannelId iId

TSensrvChannelId iId [private]

Channel identifier of this channel.

RPointerArray< CSensrvChannelListener > iListenerList

RPointerArray < CSensrvChannelListener > iListenerList [private]

Channel listener array for open clients Listed listeners are owned.

TInt iMaxBufferingCount

TInt iMaxBufferingCount [private]

Indicates maximum buffering count.

CSensrvTransaction * iPropertyChangedTransaction

CSensrvTransaction * iPropertyChangedTransaction [private]

Transaction for notifying property change from SSY to Server Own.

MSsyPropertyProvider * iPropertyProvider

MSsyPropertyProvider * iPropertyProvider [private]

Sensor property provider residing in SSY thread heap. Can safely be accessed only from SSY thread. Not Own, owned by SSY.

CSensrvPluginProxy & iProxy

CSensrvPluginProxy & iProxy [private]

Callback proxy

TSensrvChannelState iState

TSensrvChannelState iState [private]

Current channel state