elemy-sensortree 1.0.0
el_sensorsnode_blob.h
Go to the documentation of this file.
1
9#ifndef LIBELSENSORTREE_ELSENSORTREE_EL_SENSORSNODE_BLOB_H_
10#define LIBELSENSORTREE_ELSENSORTREE_EL_SENSORSNODE_BLOB_H_
11
12#include <libubox/blobmsg.h>
13
14#include "elutils/el_utils.h"
16
17#include "elutils/c_decls.h"
18__BEGIN_DECLS /* till __END_DECLS */
19
20
21int ps_blobmsg_parse(const struct blobmsg_policy *policy, int policy_len, struct blob_attr **tb, void *data, unsigned int len);
22
23void dump_blob_attr(struct blob_attr *attr, char *msg);
24int ps_parse_blob(const struct blobmsg_policy *policy, int cnt_policy, struct blob_attr **attrs, struct blob_attr *attr, char **err_msg);
25int get_table_field(struct blob_attr *attr, char *field_name, int type, struct blob_attr **res, char **err_msg);
26
27#define ERR_BLOB_NODE_FW_VERSION_BAD_OPEN_TABLE (1)
28#define ERR_BLOB_NODE_FW_VERSION_BAD_OPEN_TABLE_MSG "Can't open table FW_VERSION_KEY"
29#define ERR_BLOB_NODE_FW_VERSION_BAD_ADD_DATA (2)
30#define ERR_BLOB_NODE_FW_VERSION_BAD_ADD_DATA_MSG "Error on adding data to table FW_VERSION_KEY"
31int blob_node_fw_version(struct blob_buf *bb, node_fw_version_t *p, bool named, char **err_msg);
32
33#define ERR_UNBLOB_NODE_FW_VERSION_BAD_PARSE (1)
34#define ERR_UNBLOB_NODE_FW_VERSION_BAD_PARSE_MSG "Can't parse NODE_FW_VERSION"
35#define ERR_UNBLOB_NODE_FW_VERSION_BAD_GET_SW_PATCH (2)
36#define ERR_UNBLOB_NODE_FW_VERSION_BAD_GET_SW_PATCH_MSG "Can't get NODE_FW_VERSION_SW_PATCH"
37#define ERR_UNBLOB_NODE_FW_VERSION_BAD_GET_SW_MINOR (3)
38#define ERR_UNBLOB_NODE_FW_VERSION_BAD_GET_SW_MINOR_MSG "Can't get NODE_FW_VERSION_SW_MINOR"
39#define ERR_UNBLOB_NODE_FW_VERSION_BAD_GET_SW_MAJOR (4)
40#define ERR_UNBLOB_NODE_FW_VERSION_BAD_GET_SW_MAJOR_MSG "Can't get NODE_FW_VERSION_SW_MAJOR"
41#define ERR_UNBLOB_NODE_FW_VERSION_BAD_GET_BOOT (5)
42#define ERR_UNBLOB_NODE_FW_VERSION_BAD_GET_BOOT_MSG "Can't get NODE_FW_VERSION_BOOT"
43#define ERR_UNBLOB_NODE_FW_VERSION_BAD_GET_HW_REVISION (6)
44#define ERR_UNBLOB_NODE_FW_VERSION_BAD_GET_HW_REVISION_MSG "Can't get NODE_FW_VERSION_HW_REVISION"
45#define ERR_UNBLOB_NODE_FW_VERSION_BAD_GET_PROTOCOL (7)
46#define ERR_UNBLOB_NODE_FW_VERSION_BAD_GET_PROTOCOL_MSG "Can't get NODE_FW_VERSION_PROTOCOL"
47int unblob_node_fw_version(node_fw_version_t *p, struct blob_attr *attr, char **err_msg);
48
49int unblob_node_addr(node_addr_t *p, struct blob_attr *attr, char **err_msg);
50int blob_node_addr(struct blob_buf *bb, node_addr_t *p);
51
52int unblob_node_serial_num(node_serial_num_t *p, struct blob_attr *attr, char **err_msg);
53int blob_node_serial_num(struct blob_buf *bb, node_serial_num_t *p);
54
55int unblob_node_info(node_info_t *p, struct blob_attr *attr, char **err_msg);
56int blob_node_info(struct blob_buf *bb, node_info_t *p);
57
58int get_node_info(struct blob_attr *attr, struct blob_attr **res, char **err_msg);
59
60#define SENSOR_VALUE_ANALOG_VALUE_2KEY "analog_value"
61#define SENSOR_VALUE_DISCRETE_VALUE_2KEY "discrete_value"
62#define SENSOR_VALUE_DISCRETE_COUNT_2KEY "discrete_count"
63
64int unblob_sensor_value(sensor_value_t *p, struct blob_attr *attr, char **err_msg);
65int blob_sensor_value(struct blob_buf *bb, sensor_value_t *p, char *name);
66
67#define SENSORS_NODE_VALUES_COUNT "values_cnt"
68
69int unblob_sensors_node(sensors_node_t *p, struct blob_attr *attr, char **err_msg);
70int blob_sensors_node(struct blob_buf *bb, sensors_node_t *p, int named);
71
73#endif /* LIBELSENSORTREE_ELSENSORTREE_EL_SENSORSNODE_BLOB_H_ */
#define __END_DECLS
#define __BEGIN_DECLS
header with defines and structs for sensor
u_io_type_t type
Definition: el_sensorsnode.h:2
struct @16 data
int get_node_info(struct blob_attr *attr, struct blob_attr **res, char **err_msg)
extract ptr to node_info attr from table object by name NODE_INFO_KEY
Definition: el_sensorsnode_blob.c:702
__BEGIN_DECLS int ps_blobmsg_parse(const struct blobmsg_policy *policy, int policy_len, struct blob_attr **tb, void *data, unsigned int len)
Definition: el_sensorsnode_blob.c:26
int blob_sensor_value(struct blob_buf *bb, sensor_value_t *p, char *name)
Definition: el_sensorsnode_blob.c:833
int unblob_sensor_value(sensor_value_t *p, struct blob_attr *attr, char **err_msg)
Definition: el_sensorsnode_blob.c:752
int blob_sensors_node(struct blob_buf *bb, sensors_node_t *p, int named)
Definition: el_sensorsnode_blob.c:1015
int blob_node_fw_version(struct blob_buf *bb, node_fw_version_t *p, bool named, char **err_msg)
put into blob_buf node_fw_version_t as table
Definition: el_sensorsnode_blob.c:186
int get_table_field(struct blob_attr *attr, char *field_name, int type, struct blob_attr **res, char **err_msg)
Definition: el_sensorsnode_blob.c:121
void dump_blob_attr(struct blob_attr *attr, char *msg)
Definition: el_sensorsnode_blob.c:89
int blob_node_info(struct blob_buf *bb, node_info_t *p)
Definition: el_sensorsnode_blob.c:632
int unblob_node_serial_num(node_serial_num_t *p, struct blob_attr *attr, char **err_msg)
Definition: el_sensorsnode_blob.c:467
int unblob_node_fw_version(node_fw_version_t *p, struct blob_attr *attr, char **err_msg)
put into blob_buf node_fw_version_t as table
Definition: el_sensorsnode_blob.c:234
int blob_node_serial_num(struct blob_buf *bb, node_serial_num_t *p)
Definition: el_sensorsnode_blob.c:495
int ps_parse_blob(const struct blobmsg_policy *policy, int cnt_policy, struct blob_attr **attrs, struct blob_attr *attr, char **err_msg)
Definition: el_sensorsnode_blob.c:96
int unblob_node_info(node_info_t *p, struct blob_attr *attr, char **err_msg)
Definition: el_sensorsnode_blob.c:531
int unblob_node_addr(node_addr_t *p, struct blob_attr *attr, char **err_msg)
Definition: el_sensorsnode_blob.c:356
int unblob_sensors_node(sensors_node_t *p, struct blob_attr *attr, char **err_msg)
Definition: el_sensorsnode_blob.c:909
int blob_node_addr(struct blob_buf *bb, node_addr_t *p)
Definition: el_sensorsnode_blob.c:405
Definition: el_sensorsnode.h:83
адрес узла a0 - top level
Definition: el_sensorsnode.h:50