diff -r 51a74ef9ed63 -r ae94777fff8f Symbian3/SDK/Source/GUID-60EE22AA-402D-4FC2-9AD1-B3AEF822E8DC.dita --- a/Symbian3/SDK/Source/GUID-60EE22AA-402D-4FC2-9AD1-B3AEF822E8DC.dita Wed Mar 31 11:11:55 2010 +0100 +++ b/Symbian3/SDK/Source/GUID-60EE22AA-402D-4FC2-9AD1-B3AEF822E8DC.dita Fri Jun 11 12:39:03 2010 +0100 @@ -1,98 +1,98 @@ - - - - - -Receiving -Channel Data based on ConditionsConditional listening enables you to receive sensor data feeds -based on a specific condition. For example, you can choose to receive sensor -feeds that are only movement specific. -

Before listening -for channel data, you must open -the sensor channel.

- -Create channel condition -items using CSensrvChannelCondition constructor. These -conditions can be used to filter the sensor data feeds. -//Comparison values needed for condition -... -TInt firstNumber=45; -HBufC8 *firstBufNumber=NULL; -InetProtTextUtils::ConvertIntToDescriptorL(firstNumber,firstBufNumber); -CleanupStack::PushL(firstBufNumber); - -TInt secondNumber=150; -HBufC8 *secondBufNumber=NULL; -InetProtTextUtils::ConvertIntToDescriptorL(secondNumber,secondBufNumber); -CleanupStack::PushL(secondBufNumber); - -//Creates a SingleLimit Condition with a GreaterThan operator -CSensrvChannelCondition *firstCondition = CSensrvChannelCondition::NewL(ESensrvSingleLimitCondition,ESensrvOperatorGreaterThan,1,*firstBufNumber); - -//Creates a SingleLimit Condition with a LessThan operator -CSensrvChannelCondition *secondCondition = CSensrvChannelCondition::NewL(ESensrvSingleLimitCondition,ESensrvOperatorLessThan,2,*secondBufNumber); - -Create a channel -condition set using CSensrvChannelConditionSet constructor. -Add the condition items to the condition set using the CSensrvChannelConditionSet::AddConditionL() function. -//Creates a ConditionSet with ConditionType OR - CSensrvChannelConditionSet *ConditionSet=CSensrvChannelConditionSet::NewLC(ESensrvAndConditionSet); - - //Add channel1 and channel2 to conditonset - ConditionSet->AddChannelConditionL(firstCondition); - ConditionSet->AddChannelConditionL(secondCondition); - -Add the condition -set to the required channel using the CSensrvChannel::AddConditionL() function. -CSensrvChannel* channel; -channel->AddConditionL(*ConditionSet); - - -Create a condition -listener implementation for the MSensrvChannelConditionListener interface, -which listens for sensor data feeds based on CSensrvChannelConditionSet. -class ConditionListener:public MSensrvChannelConditionListener - { - public: - void ConditionMet(CSensrvChannel &aChannel, CSensrvChannelConditionSet &aChannelConditionSet, TDesC8 &avalue) - { - ... - //Implementation - } - void ConditionError(CSensrvChannel &aChannel, TSensrvErrorSeverity aError) - { - ... - //Implementation - } - void GetChannelConditionListenerInterfaceL(TUid aInterfaceUid, TAny *&aInterface) - { - ... - //Implementation - } - }; - -Start conditional -listening by passing an instance of the condition listener implementation, -using the CSensrvChannel::StartConditionListeningL() function. -//Instance of the condition listener implementation -ConditionListener conditionListener; -... -channel->StartConditionListeningL(conditionListener,1,1); -... - -Once you get the -required sensor data feeds from the sensor channel based on the conditions -set, you can stop conditional listening using the CSensrvChannel::StopConditionListening() function. -channel->StopConditionListening(); - - - -

End the session -with the sensor channel using the CSensrvChannel::CloseChannel() function.

+ + + + + +Receiving +Channel Data based on ConditionsConditional listening enables you to receive sensor data feeds +based on a specific condition. For example, you can choose to receive sensor +feeds that are only movement specific. +

Before listening +for channel data, you must open +the sensor channel.

+ +Create channel condition +items using CSensrvChannelCondition constructor. These +conditions can be used to filter the sensor data feeds. +//Comparison values needed for condition +... +TInt firstNumber=45; +HBufC8 *firstBufNumber=NULL; +InetProtTextUtils::ConvertIntToDescriptorL(firstNumber,firstBufNumber); +CleanupStack::PushL(firstBufNumber); + +TInt secondNumber=150; +HBufC8 *secondBufNumber=NULL; +InetProtTextUtils::ConvertIntToDescriptorL(secondNumber,secondBufNumber); +CleanupStack::PushL(secondBufNumber); + +//Creates a SingleLimit Condition with a GreaterThan operator +CSensrvChannelCondition *firstCondition = CSensrvChannelCondition::NewL(ESensrvSingleLimitCondition,ESensrvOperatorGreaterThan,1,*firstBufNumber); + +//Creates a SingleLimit Condition with a LessThan operator +CSensrvChannelCondition *secondCondition = CSensrvChannelCondition::NewL(ESensrvSingleLimitCondition,ESensrvOperatorLessThan,2,*secondBufNumber); + +Create a channel +condition set using CSensrvChannelConditionSet constructor. +Add the condition items to the condition set using the CSensrvChannelConditionSet::AddConditionL() function. +//Creates a ConditionSet with ConditionType OR + CSensrvChannelConditionSet *ConditionSet=CSensrvChannelConditionSet::NewLC(ESensrvAndConditionSet); + + //Add channel1 and channel2 to conditonset + ConditionSet->AddChannelConditionL(firstCondition); + ConditionSet->AddChannelConditionL(secondCondition); + +Add the condition +set to the required channel using the CSensrvChannel::AddConditionL() function. +CSensrvChannel* channel; +channel->AddConditionL(*ConditionSet); + + +Create a condition +listener implementation for the MSensrvChannelConditionListener interface, +which listens for sensor data feeds based on CSensrvChannelConditionSet. +class ConditionListener:public MSensrvChannelConditionListener + { + public: + void ConditionMet(CSensrvChannel &aChannel, CSensrvChannelConditionSet &aChannelConditionSet, TDesC8 &avalue) + { + ... + //Implementation + } + void ConditionError(CSensrvChannel &aChannel, TSensrvErrorSeverity aError) + { + ... + //Implementation + } + void GetChannelConditionListenerInterfaceL(TUid aInterfaceUid, TAny *&aInterface) + { + ... + //Implementation + } + }; + +Start conditional +listening by passing an instance of the condition listener implementation, +using the CSensrvChannel::StartConditionListeningL() function. +//Instance of the condition listener implementation +ConditionListener conditionListener; +... +channel->StartConditionListeningL(conditionListener,1,1); +... + +Once you get the +required sensor data feeds from the sensor channel based on the conditions +set, you can stop conditional listening using the CSensrvChannel::StopConditionListening() function. +channel->StopConditionListening(); + + + +

End the session +with the sensor channel using the CSensrvChannel::CloseChannel() function.

\ No newline at end of file