MultilevelSensor#
Modules#
Enumerations#
Defined possible sensor types.
Defined possible sensor read size.
Defined possible sensor read precision.
Defined sensor interface return values.
Defined Multilevel Sensor return values.
Typedefs#
Defined possible sensor types.
Structure that holds the attributes of a sensor type.
Structure that holds a read result from the read interface.
Structure that administrate all of the registered sensors.
Functions#
This function will report the registered sensor's measured datas to the Lifeline group.
Calls the init function for all of the registered sensor interfaces.
Checks if the wanted scale is a legal one for an interface.
Checks if the wanted sensor type has a registered interface or not.
Registers an interface to a specific sensor type.
Fills an input buffer with flags where each flag represents a supported sensor.
Fills an input buffer with flags where each flag represents a supported scale.
Getter function for a sensor type's interface.
Gets the default sensor type value.
Initialize an iterator struct for the registered sensor interfaces.
Moves the iterator reference forward to the next registered interface, if the current is the last one then NULL If there is any registered interface the iterator will be NULL.
Returns the number of registered sensor interfaces.
Removes all of the registered sensor interfaces from the administration.
Returns a sensor_type_t struct from the sensor_types config table.
Initialize a sensor interface instance.
Adds a new scale to an existing interface.
Macros#
Structure that holds a read result from the read interface.
Enumeration Documentation#
sensor_name#
sensor_name
Defined possible sensor types.
Enumerator | |
---|---|
SENSOR_NAME_AIR_TEMPERATURE | |
SENSOR_NAME_GENERAL_PURPOSE | |
SENSOR_NAME_ILLUMINANCE | |
SENSOR_NAME_POWER | |
SENSOR_NAME_HUMIDITY | |
SENSOR_NAME_ACCELERATION_X | |
SENSOR_NAME_ACCELERATION_Y | |
SENSOR_NAME_ACCELERATION_Z | |
SENSOR_NAME_MAX_COUNT |
sensor_read_result_size_t#
sensor_read_result_size_t
Defined possible sensor read size.
Enumerator | |
---|---|
SENSOR_READ_RESULT_SIZE_1 | |
SENSOR_READ_RESULT_SIZE_2 | |
SENSOR_READ_RESULT_SIZE_4 | |
SENSOR_READ_RESULT_SIZE_END |
sensor_read_result_precision#
sensor_read_result_precision
Defined possible sensor read precision.
Enumerator | |
---|---|
SENSOR_READ_RESULT_PRECISION_1 | |
SENSOR_READ_RESULT_PRECISION_2 | |
SENSOR_READ_RESULT_PRECISION_3 | |
SENSOR_READ_RESULT_PRECISION_END |
sensor_interface_return_value_t#
sensor_interface_return_value_t
Defined sensor interface return values.
Enumerator | |
---|---|
SENSOR_INTERFACE_RETURN_VALUE_OK | |
SENSOR_INTERFACE_RETURN_VALUE_ALREADY_SET | |
SENSOR_INTERFACE_RETURN_VALUE_INVALID_SCALE_VALUE | |
SENSOR_INTERFACE_RETURN_VALUE_ERROR | |
SENSOR_INTERFACE_RETURN_VALUE_END |
cc_multilevel_sensor_return_value#
cc_multilevel_sensor_return_value
Defined Multilevel Sensor return values.
Enumerator | |
---|---|
CC_MULTILEVEL_SENSOR_RETURN_VALUE_OK | |
CC_MULTILEVEL_SENSOR_RETURN_VALUE_ERROR | |
CC_MULTILEVEL_SENSOR_RETURN_VALUE_NOT_FOUND | |
CC_MULTILEVEL_SENSOR_RETURN_VALUE_ALREADY_REGISTRATED | |
CC_MULTILEVEL_SENSOR_RETURN_VALUE_REGISTRATION_LIMIT_REACHED | |
CC_MULTILEVEL_SENSOR_RETURN_VALUE_END |
Typedef Documentation#
sensor_type_t#
typedef struct _sensor_type sensor_type_t
Structure that holds the attributes of a sensor type.
sensor_interface_t#
typedef struct _sensor_interface sensor_interface_t
Structure that holds a read result from the read interface.
sensor_administration_t#
typedef struct _sensor_administration sensor_administration_t
Structure that administrate all of the registered sensors.
Function Documentation#
cc_multilevel_sensor_send_sensor_data#
void cc_multilevel_sensor_send_sensor_data (void )
This function will report the registered sensor's measured datas to the Lifeline group.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
cc_multilevel_sensor_config_register_instances#
void cc_multilevel_sensor_config_register_instances (void )
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
cc_multilevel_sensor_init_all_sensor#
void cc_multilevel_sensor_init_all_sensor (void )
Calls the init function for all of the registered sensor interfaces.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
cc_multilevel_sensor_check_scale#
uint8_t cc_multilevel_sensor_check_scale (const sensor_interface_t * i_interface, uint8_t i_scale)
Checks if the wanted scale is a legal one for an interface.
Type | Direction | Argument Name | Description |
---|---|---|---|
const sensor_interface_t * | [in] | i_interface | Pointer to an existing sensor interface |
uint8_t | [in] | i_scale | Scale value to check |
If the scale is not set the function will return with the first available scale. The function will iterate from bit 0 to 7 to look for the first scale which is supported. That will be the default scale. Returns
a usable scale value, if the input i_scale is valid that will be return, else the default one.
cc_multilevel_sensor_check_sensor_type_registered#
cc_multilevel_sensor_return_value cc_multilevel_sensor_check_sensor_type_registered (uint8_t endpoint, uint8_t sensor_type_value)
Checks if the wanted sensor type has a registered interface or not.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | endpoint | Sensor type value to check, this is the value in sensor_type_t struct's value |
uint8_t | N/A | sensor_type_value |
Returns
CC_MULTILEVEL_SENSOR_RETURN_VALUE_OK if interface is registered for a sensor, else CC_MULTILEVEL_SENSOR_RETURN_VALUE_NOT_FOUND.
cc_multilevel_sensor_registration#
cc_multilevel_sensor_return_value cc_multilevel_sensor_registration (sensor_interface_t * i_new_sensor)
Registers an interface to a specific sensor type.
Type | Direction | Argument Name | Description |
---|---|---|---|
sensor_interface_t * | [in] | i_new_sensor | Pointer to a filled sensor interface struct |
The number of registered sensor types is maximized with REGISTERED_SENSOR_NUMBER_LIMIT Returns
CC_MULTILEVEL_SENSOR_RETURN_VALUE_OK if interface is registered for a sensor.
cc_multilevel_sensor_get_supported_sensors#
cc_multilevel_sensor_return_value cc_multilevel_sensor_get_supported_sensors (uint8_t * o_supported_sensor_buffer)
Fills an input buffer with flags where each flag represents a supported sensor.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t * | [out] | o_supported_sensor_buffer | Pointer to a buffer where the supported sensors' are represented as flags in a byte array. The position of each flag is calculated based on SDS13812. The buffer must be 11 byte long at least. |
Returns
CC_MULTILEVEL_SENSOR_RETURN_VALUE_OK if success, else CC_MULTILEVEL_SENSOR_RETURN_VALUE_ERROR.
cc_multilevel_sensor_get_supported_scale#
cc_multilevel_sensor_return_value cc_multilevel_sensor_get_supported_scale (uint8_t sensor_type_value, uint8_t * o_supported_scale)
Fills an input buffer with flags where each flag represents a supported scale.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | sensor_type_value | Sensor type value to check, this is the value in sensor_type_t struct's value |
uint8_t * | [out] | o_supported_scale | Pointer to a buffer where the supported scales will be represented for a sensor type |
Returns
CC_MULTILEVEL_SENSOR_RETURN_VALUE_OK if interface is registered for a sensor.
cc_multilevel_sensor_get_interface#
cc_multilevel_sensor_return_value cc_multilevel_sensor_get_interface (uint8_t endpoint, uint8_t sensor_type_value, sensor_interface_t ** o_interface)
Getter function for a sensor type's interface.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | endpoint | Sensor type value to check, this is the value in sensor_type_t struct's value |
uint8_t | [out] | sensor_type_value | This is a double pointer which will hold an interface reference |
sensor_interface_t ** | N/A | o_interface |
Returns
CC_MULTILEVEL_SENSOR_RETURN_VALUE_OK if interface is registered for a sensor, else CC_MULTILEVEL_SENSOR_RETURN_VALUE_NOT_FOUND.
cc_multilevel_sensor_get_default_sensor_type#
cc_multilevel_sensor_return_value cc_multilevel_sensor_get_default_sensor_type (uint8_t * o_default_sensor_type)
Gets the default sensor type value.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t * | [in] | o_default_sensor_type | Pointer to a byte buffer which will hold the default sensor type value |
Basically the first registered sensor interface' type is the default one. Returns
CC_MULTILEVEL_SENSOR_RETURN_VALUE_OK if there is any registered interface, else CC_MULTILEVEL_SENSOR_RETURN_VALUE_ERROR.
cc_multilevel_sensor_init_iterator#
cc_multilevel_sensor_return_value cc_multilevel_sensor_init_iterator (sensor_interface_iterator_t ** i_iterator)
Initialize an iterator struct for the registered sensor interfaces.
Type | Direction | Argument Name | Description |
---|---|---|---|
sensor_interface_iterator_t ** | [out] | i_iterator | This is a double pointer which will hold an interface reference to the first registered interface |
If there is any registered interface the iterator will be NULL. Returns
CC_MULTILEVEL_SENSOR_RETURN_VALUE_OK if success, else CC_MULTILEVEL_SENSOR_RETURN_VALUE_ERROR..
cc_multilevel_sensor_next_iterator#
void cc_multilevel_sensor_next_iterator (sensor_interface_iterator_t ** i_iterator)
Moves the iterator reference forward to the next registered interface, if the current is the last one then NULL If there is any registered interface the iterator will be NULL.
Type | Direction | Argument Name | Description |
---|---|---|---|
sensor_interface_iterator_t ** | [out] | i_iterator | This is a double pointer which will hold an interface reference |
cc_multilevel_sensor_get_number_of_registered_sensors#
uint8_t cc_multilevel_sensor_get_number_of_registered_sensors (void )
Returns the number of registered sensor interfaces.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
Number of registered sensor interfaces.
cc_multilevel_sensor_reset_administration#
void cc_multilevel_sensor_reset_administration (void )
Removes all of the registered sensor interfaces from the administration.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
cc_multilevel_sensor_get_sensor_type#
const sensor_type_t * cc_multilevel_sensor_get_sensor_type (sensor_name_t i_sensor_name)
Returns a sensor_type_t struct from the sensor_types config table.
Type | Direction | Argument Name | Description |
---|---|---|---|
sensor_name_t | [in] | i_sensor_name | The name of the sensor type, the sensor type attributes' reference will be look for based on this value |
Returns
sensor_type_t struct which includes the type attributes.
cc_multilevel_sensor_init_interface#
sensor_interface_return_value_t cc_multilevel_sensor_init_interface (sensor_interface_t * i_instance, sensor_name_t i_name)
Initialize a sensor interface instance.
Type | Direction | Argument Name | Description |
---|---|---|---|
sensor_interface_t * | [in] | i_instance | Pointer to an existing sensor interface to init |
sensor_name_t | [in] | i_name | The name of the sensor type, the sensor type attributes' reference will be look for based on this value |
Sets the whole struct to zero and sets the reference to the appropiate sensor_type_t struct. Returns
Status of the initialization.
cc_multilevel_sensor_add_supported_scale_interface#
sensor_interface_return_value_t cc_multilevel_sensor_add_supported_scale_interface (sensor_interface_t * i_instance, uint8_t i_scale)
Adds a new scale to an existing interface.
Type | Direction | Argument Name | Description |
---|---|---|---|
sensor_interface_t * | [in] | i_instance | Pointer to an existing sensor interface which the new scale will be registered to |
uint8_t | [in] | i_scale | The new scale which will be registered |
Supported scales must be set by this function during initialization. Returns
Status of the new scale value registration.