Data Structures | |
struct | _sensor_type |
struct | _sensor_read_result |
struct | _sensor_interface |
struct | _sensor_administration |
Macros | |
#define | MULTILEVEL_SENSOR_DEFAULT_AUTOREPORT_PEDIOD_SEC (MULTILEVEL_SENSOR_DEFAULT_AUTOREPORT_PEDIOD_MIN*60) |
#define | MULTILEVEL_SENSOR_DEFAULT_AUTOREPORT_PEDIOD_MS (MULTILEVEL_SENSOR_DEFAULT_AUTOREPORT_PEDIOD_SEC*1000) |
#define | SENSOR_SCALE_DEFAULT 0x00 |
#define | SENSOR_SCALE_CELSIUS 0x00 |
#define | SENSOR_SCALE_FAHRENHEIT 0x01 |
#define | SENSOR_SCALE_PERCENTAGE 0x00 |
#define | SENSOR_SCALE_DIMENSIONLESS 0x01 |
#define | SENSOR_SCALE_LUX 0x01 |
#define | SENSOR_SCALE_WATT 0x00 |
#define | SENSOR_SCALE_BTU_H 0x01 /*Btu/h*/ |
#define | SENSOR_SCALE_ABSOLUTE_HUMIDITY 0x01 /*g/m3*/ |
#define | SENSOR_SCALE_METER_SQUARE_SECOND 0x00 /*m/s^2*/ |
#define | SLI_MAX_RAW_RESULT_BYTES 4 |
Typedefs | |
typedef enum sensor_name | sensor_name_t |
typedef struct _sensor_type | sensor_type_t |
typedef struct _sensor_read_result | sensor_read_result_t |
typedef struct _sensor_interface | sensor_interface_t |
typedef struct _sensor_interface | sensor_interface_iterator_t |
typedef struct _sensor_administration | sensor_administration_t |
#define MULTILEVEL_SENSOR_DEFAULT_AUTOREPORT_PEDIOD_MS (MULTILEVEL_SENSOR_DEFAULT_AUTOREPORT_PEDIOD_SEC*1000) |
#define MULTILEVEL_SENSOR_DEFAULT_AUTOREPORT_PEDIOD_SEC (MULTILEVEL_SENSOR_DEFAULT_AUTOREPORT_PEDIOD_MIN*60) |
#define SENSOR_SCALE_ABSOLUTE_HUMIDITY 0x01 /*g/m3*/ |
#define SENSOR_SCALE_BTU_H 0x01 /*Btu/h*/ |
#define SENSOR_SCALE_CELSIUS 0x00 |
#define SENSOR_SCALE_DEFAULT 0x00 |
#define SENSOR_SCALE_DIMENSIONLESS 0x01 |
#define SENSOR_SCALE_FAHRENHEIT 0x01 |
#define SENSOR_SCALE_LUX 0x01 |
#define SENSOR_SCALE_METER_SQUARE_SECOND 0x00 /*m/s^2*/ |
#define SENSOR_SCALE_PERCENTAGE 0x00 |
#define SENSOR_SCALE_WATT 0x00 |
#define SLI_MAX_RAW_RESULT_BYTES 4 |
Structure that holds a read result from the read interface.
typedef struct _sensor_administration sensor_administration_t |
Structure that administrate all of the registered sensors.
typedef struct _sensor_interface sensor_interface_iterator_t |
typedef struct _sensor_interface sensor_interface_t |
Structure that holds a read result from the read interface.
typedef enum sensor_name sensor_name_t |
Defined possible sensor types
typedef struct _sensor_read_result sensor_read_result_t |
typedef struct _sensor_type sensor_type_t |
Structure that holds the attributes of a sensor type.
Defined Multilevel Sensor return values
enum sensor_name |
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. Supported scales must be set by this function during initialization.
[in] | i_instance | Pointer to an existing sensor interface which the new scale will be registered to |
[in] | i_scale | The new scale which will be registered |
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. 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.
[in] | i_interface | Pointer to an existing sensor interface |
[in] | i_scale | Scale value to check |
cc_multilevel_sensor_return_value cc_multilevel_sensor_check_sensor_type_registered | ( | uint8_t | sensor_type_value | ) |
Checks if the wanted sensor type has a registered interface or not.
[in] | sensor_type_value | Sensor type value to check, this is the value in sensor_type_t struct's value |
void cc_multilevel_sensor_config_register_instances | ( | void | ) |
cc_multilevel_sensor_return_value cc_multilevel_sensor_get_default_sensor_type | ( | uint8_t * | o_default_sensor_type | ) |
Gets the default sensor type value. Basically the first registered sensor interface' type is the default one.
[in] | o_default_sensor_type | Pointer to a byte buffer which will hold the default sensor type value |
cc_multilevel_sensor_return_value cc_multilevel_sensor_get_interface | ( | uint8_t | sensor_type_value, |
sensor_interface_t ** | o_interface ) |
Getter function for a sensor type's interface
[in] | sensor_type_value | Sensor type value to check, this is the value in sensor_type_t struct's value |
[out] | o_interface | This is a double pointer which will hold an interface reference |
uint8_t cc_multilevel_sensor_get_number_of_registered_sensors | ( | void | ) |
Returns the number of registered sensor interfaces
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
[in] | i_sensor_name | The name of the sensor type, the sensor type attributes' reference will be look for based on this value |
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
[in] | sensor_type_value | Sensor type value to check, this is the value in sensor_type_t struct's value |
[out] | o_supported_scale | Pointer to a buffer where the supported scales will be represented for a sensor type |
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.
[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. |
void cc_multilevel_sensor_init_all_sensor | ( | void | ) |
Calls the init function for all of the registered sensor interfaces.
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. Sets the whole struct to zero and sets the reference to the appropiate sensor_type_t struct.
[in] | i_instance | Pointer to an existing sensor interface to init |
[in] | i_name | The name of the sensor type, the sensor type attributes' reference will be look for based on this value |
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. If there is any registered interface the iterator will be NULL.
[out] | i_iterator | This is a double pointer which will hold an interface reference to the first registered interface |
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.
[out] | i_iterator | This is a double pointer which will hold an interface reference |
cc_multilevel_sensor_return_value cc_multilevel_sensor_registration | ( | sensor_interface_t * | i_new_sensor | ) |
Registers an interface to a specific sensor type. The number of registered sensor types is maximized with REGISTERED_SENSOR_NUMBER_LIMIT
[in] | i_new_sensor | Pointer to a filled sensor interface struct |
void cc_multilevel_sensor_reset_administration | ( | void | ) |
Removes all of the registered sensor interfaces from the administration
void cc_multilevel_sensor_send_sensor_data | ( | void | ) |
This function will report the registered sensor's measured datas to the Lifeline group.