#ifndef APP_H #define APP_H #include enum sm_cmd_code { SM_CMD_GET_SENSOR_COUNT = 1, SM_CMD_SET_SENSOR_THRESHOLD = 2, SM_CMD_GET_SENSOR_LEVEL = 3, SM_CMD_FAIL = 255, }; struct sm_get_sensor_count_req { }; struct sm_get_sensor_count_res { uint8_t count; }; struct sm_set_sensor_threshold_req { uint8_t sensor; uint8_t threshold; }; struct sm_set_sensor_threshold_res { }; struct sm_get_sensor_level_req { uint8_t sensor; }; struct sm_get_sensor_level_res { uint8_t sensor; uint8_t level; }; struct sm_req { uint8_t code; union { struct sm_get_sensor_count_req get_sensor_count; struct sm_get_sensor_level_req get_sensor_level; struct sm_set_sensor_threshold_req set_sensor_threshold; }; }; struct sm_res { uint8_t len; uint8_t code; union { struct sm_get_sensor_count_res get_sensor_count; struct sm_get_sensor_level_res get_sensor_level; struct sm_set_sensor_threshold_res set_sensor_threshold; }; }; void on_loop(); bool tx_soil_moisture(struct sm_res *res); void notify_soil_moisture(struct sm_res *res); void notify_battery_level(uint8_t value); void on_soil_moisture(uint8_t *data, uint8_t len); #endif