add: pulse endpoint

This commit is contained in:
Tobias Reisinger 2020-06-27 18:31:36 +02:00
parent c41dd7e9fa
commit fb66480873
9 changed files with 135 additions and 3 deletions

View file

@ -13,4 +13,7 @@ command_set_controller_name(controller_t *controller);
int
command_send(controller_t *controller, int command_code, char *payload, uint32_t payload_size);
int
command_pulse(relay_t *relay, uint8_t duration);
#endif /* CORE_COMMAND_H */

View file

@ -27,4 +27,7 @@ api_v1_controllers_STR_relays_INT_GET(struct mg_connection *nc, struct http_mess
void
api_v1_controllers_STR_relays_INT_PUT(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
void
api_v1_controllers_STR_relays_INT_pulse_POST(struct mg_connection *nc, struct http_message *hm, endpoint_args_t *args, endpoint_response_t *response);
#endif /* CORE_ENDPOINTS_API_V1_CONTROLLERS_H */

View file

@ -16,6 +16,7 @@ typedef enum
COMMAND_MAPPING_SCHEDULE_ID = 4,
COMMAND_MAPPING_PERIODS_COUNT = 5,
COMMAND_MAPPING_PERIODS_BLOB = 6,
COMMAND_MAPPING_PULSE_DURATION = 7,
} control_mapping_t;
typedef enum
@ -28,6 +29,7 @@ typedef enum
COMMAND_CODE_GET_SCHEDULE = 103,
COMMAND_CODE_SET_RELAY_NAME = 104,
COMMAND_CODE_GET_RELAY_NAME = 105,
COMMAND_CODE_PULSE = 200,
} command_code_t;
typedef enum