MT2523 API Reference  LinkIt SDK v4
Sensor application subscription interface

The sensor application subscription interface targets the events of a specific sensor, such as pedometer, to provide rich information on user's daily activities. More...

Overview

The sensor application subscription interface targets the events of a specific sensor, such as pedometer, to provide rich information on user's daily activities.

An example implementation of the subscription to accelerometer data can be found in [sdk_root]/project/mt2523_sdk/apps/sensor_subsys_accelerometer. The steps are described below.

Macros

#define SENSOR_MAX_SUBSCRIBER_NAME_LEN   ( 8 )
 The maximum sensor subscriber name length. More...
 

Functions

int32_t sensor_manager_init (void)
 This function initializes the data structures in sensor manager. More...
 
int32_t sensor_get_latest_sensor_data (uint32_t type, sensor_data_t *const output)
 This function gets the latest data of the specified sensor type. More...
 
int32_t sensor_subscribe_sensor (sensor_subscriber_t *subscriber)
 This function subscribes the sensor event for a specified sensor type. More...
 
int32_t sensor_unsubscribe_sensor (int32_t handle)
 This function unsubscribes the sensor event for a specified sensor type. More...
 

Modules

 Struct
 
 Typedef
 

Macro Definition Documentation

#define SENSOR_MAX_SUBSCRIBER_NAME_LEN   ( 8 )

The maximum sensor subscriber name length.

Function Documentation

int32_t sensor_get_latest_sensor_data ( uint32_t  type,
sensor_data_t *const  output 
)

This function gets the latest data of the specified sensor type.

Parameters
[in]typeis the sensor type for the sensor event data acquisition.
[out]outputis the sensor event data.
Returns
>=0, if the operation completed successfully.
int32_t sensor_manager_init ( void  )

This function initializes the data structures in sensor manager.

Returns
>=0, if the operation completed successfully.
int32_t sensor_subscribe_sensor ( sensor_subscriber_t subscriber)

This function subscribes the sensor event for a specified sensor type.

Parameters
[in,out]subscriberis the data structure for the subscription.
Returns
>=0, if the operation completed successfully.
int32_t sensor_unsubscribe_sensor ( int32_t  handle)

This function unsubscribes the sensor event for a specified sensor type.

Parameters
[in]handleis the subscriber's handle to be unsubscribed.
Returns
>=0, if the operation completed successfully.