diff options
Diffstat (limited to 'apps/soil-moisture.h')
-rw-r--r-- | apps/soil-moisture.h | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/apps/soil-moisture.h b/apps/soil-moisture.h deleted file mode 100644 index c960f79..0000000 --- a/apps/soil-moisture.h +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef SOIL_MOISTURE_H -#define SOIL_MOISTURE_H - -#define SENSOR_NAME_LEN 10 - -enum sm_cmd_code { - SM_CMD_GET_SENSOR_COUNT = 1, - SM_CMD_GET_VALUE = 2, - SM_CMD_SET_WARNING_VALUE = 3, - SM_CMD_GET_WARNING_VALUE = 4, - SM_CMD_SET_SENSOR_NAME = 5, - SM_CMD_GET_SENSOR_NAME = 6, - SM_CMD_SET_UPDATE_INTERVAL = 7, - SM_CMD_FAIL = 255, -}; - -struct sm_get_sensor_count_req { -} __attribute__((packed)); - -struct sm_get_sensor_count_res { - uint8_t count; -} __attribute__((packed)); - -struct sm_get_value_req { - uint8_t sensor; -} __attribute__((packed)); - -struct sm_get_value_res { - uint16_t value; -} __attribute__((packed)); - -struct sm_set_warning_value_req { - uint8_t sensor; - uint16_t warning_value; -} __attribute__((packed)); - -struct sm_set_warning_value_res { -} __attribute__((packed)); - -struct sm_get_warning_value_req { - uint8_t sensor; -} __attribute__((packed)); - -struct sm_get_warning_value_res { - uint16_t warning_value; -} __attribute__((packed)); - -struct sm_set_sensor_name_req { - uint8_t sensor; - uint8_t length; - uint8_t name[SENSOR_NAME_LEN]; -} __attribute__((packed)); - -struct sm_set_sensor_name_res { -} __attribute__((packed)); - -struct sm_get_sensor_name_req { - uint8_t sensor; -} __attribute__((packed)); - -struct sm_get_sensor_name_res { - uint8_t length; - uint8_t name[SENSOR_NAME_LEN]; -} __attribute__((packed)); - -struct sm_set_update_interval_req { - uint8_t sensor; - uint8_t interval_in_seconds; -} __attribute__((packed)); - -struct sm_set_update_interval_res { -} __attribute__((packed)); - -#define SM_REQ_HEADER_SIZE 1 - -struct sm_req { - // header - uint8_t code; - - // body - union { - struct sm_get_sensor_count_req get_sensor_count; - struct sm_get_value_req get_value; - struct sm_set_warning_value_req set_warning_value; - struct sm_get_warning_value_req get_warning_value; - struct sm_set_sensor_name_req set_sensor_name; - struct sm_get_sensor_name_req get_sensor_name; - struct sm_set_update_interval_req set_update_interval; - } __attribute__((packed)); -} __attribute__((packed)); - -#define SM_RES_HEADER_SIZE 1 - -struct sm_res { - // header - uint8_t code; - - // body - union { - struct sm_get_sensor_count_res get_sensor_count; - struct sm_get_value_res get_value; - struct sm_set_warning_value_res set_warning_value; - struct sm_get_warning_value_res get_warning_value; - struct sm_set_sensor_name_res set_sensor_name; - struct sm_get_sensor_name_res get_sensor_name; - struct sm_set_update_interval_res set_update_interval; - } __attribute__((packed)); -} __attribute__((packed)); - -#ifndef SM_DEBUG -#define SM_DEBUG 1 -#endif - -#if SM_DEBUG == 1 - -void write_req(struct sm_req const &req); - -void write_res(struct sm_res const &res); - -#endif - -#endif |