12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- link: http://wiki.forum.nokia.com/index.php/How_to_turn_the_N97_into_a_Magnetic_Compass
- TInt i = 0;
- CSensrvChannelFinder* finder = CSensrvChannelFinder::NewLC();
- RSensrvChannelInfoList channelList;
- CleanupClosePushL( channelList );
- TSensrvChannelInfo Channelinfo;
- finder->FindChannelsL( channelList, Channelinfo );
-
- for (i = 0; i<channelList.Count(); i++)
- {
- Channelinfo = channelList[i];
- switch(Channelinfo.iChannelType)
- {
- case KSensrvChannelTypeIdMagneticNorthData:
- iBoolMagSupported = ETrue;
- break;
- default:
- iBoolMagSupported = EFalse;
- break;
- }
- if(iBoolMagSupported == (TInt)ETrue)
- {
- break;
- }
- }
-
- if(iBoolMagSupported == (TInt)EFalse)
- {
- User::Leave(KErrNotSupported);
- }
-
- if ( channelList.Count() > 0 )
- {
- Channelinfo = channelList[i];
- iMagneticNorthSensor = CSensrvChannel::NewL( channelList[ i ] );
- iMagneticNorthSensor->OpenChannelL();
- iMagneticNorthSensor->StartDataListeningL( this, 1, 1, 0 );
- }
- channelList.Close();
- CleanupStack::Pop( &channelList );
- CleanupStack::PopAndDestroy( finder );
|