Using Sensor Channels APIs

The Sensor Channel establishes a data exchange connection between the sensor framework and hardware using the sensor channel APIs.


  1. Include the library SensrvClient.lib in your .mmp file.

  2. Include the following header files, as they are required for accessing sensor channels regardless of the channel type:

    • sensrvchannel.h

    • sensrvchannelinfo.h

    • sensrvtypes.h

    • sensrvchannelfinder.h

    • sensrvdatalistener.h

  3. Retrieve details about the required sensor channel. For details. see Querying for Sensor Channels.

  4. Connect to the sensor by opening a connection with the sensor channel.

    1. Create an instance of CSensrvChannel and specify the instance of TSensrvChannelInfo returned by CSensrvChannelFinder::FindChannelsL(), as a parameter in the NewL() constructor.

       CSensrvChannel* sensorChannel;
       sensorChannel = CSensrvChannel::NewL(channelInfoList[0]);// channelInfoList is
      //   returned by the CSensrvChannelFinder::FindChannelsL()funtion
    2. Open the sensor channel using CSensrvChannel::OpenChannelL() function.

  5. Perform any of the following operations:

  6. Close the channel.


    Important: A channel must be closed when not required, as it reduces power consumption of the Symbian device. An open sensor channel keeps the device processor active each time data arrives. Therefore, the processor does not change to idle state even when the device user is not performing any operations on the device.