-
Carlo Alessandro Nicolau authoredCarlo Alessandro Nicolau authored
command_ALARM_ENABLE.tpl.c 2.39 KiB
// Auto-generated template file: command_ALARM_ENABLE.tpl.c
// Generation timestamp: 2021-06-21 19:42:34.864200
#include "../typedefs.h"
#include "../communication.h"
#include "../hardware.h"
err_t command_ALARM_ENABLE(void) {
// Command: ALARM_ENABLE
// Description: Enable or disable one of the alarms. Can be used to get the current enable status without changing it (see request payload field)
//
// Request code: CMDCODE_ALARM_ENABLE_REQ
// Response code: CMDCODE_ALARM_ENABLE_REQ
// Request payload (length in bytes is 2):
// field #0 (1 byte) [type: enum_alarm_number_t] : ALARM_NUMBER (Alarm number)
// field #1 (1 byte) [type: enum_enablestate_nc_t] : ENABLESTATE_NC (Enable state)
// Response payload (length in bytes is 2):
// field #0 (1 byte) [type: enum_alarm_number_t] : ALARM_NUMBER (Alarm number)
// field #1 (1 byte) [type: enum_enablestate_t] : ENABLESTATE (Enable state)
// Auto-generated section: request payload fields reading
enum_alarm_number_t req_alarm_number = (enum_alarm_number_t)communication_request_payload_retrieve_uint8_t();
enum_enablestate_nc_t req_enablestate_nc = (enum_enablestate_nc_t)communication_request_payload_retrieve_uint8_t();
// checking range for enum field req_alarm_number
if((uint8_t)req_alarm_number < (uint8_t)enum_alarm_number_t_min) return ERR_RANGE;
if((uint8_t)req_alarm_number > (uint8_t)enum_alarm_number_t_max) return ERR_RANGE;
// checking range for enum field req_enablestate_nc
if((uint8_t)req_enablestate_nc < (uint8_t)enum_enablestate_nc_t_min) return ERR_RANGE;
if((uint8_t)req_enablestate_nc > (uint8_t)enum_enablestate_nc_t_max) return ERR_RANGE;
// End of auto-generated section
// USER CODE HERE
// TODO implement command callback function command_ALARM_ENABLE
// TODO: assign response field ALARM_NUMBER in command ALARM_ENABLE callback
enum_alarm_number_t resp_alarm_number = -1;
// TODO: assign response field ENABLESTATE in command ALARM_ENABLE callback
enum_enablestate_t resp_enablestate = -1;
// Auto-generated section: response payload fields writing
communication_response_payload_appender_reset();
communication_response_payload_append_uint8_t((uint8_t)resp_alarm_number);
communication_response_payload_append_uint8_t((uint8_t)resp_enablestate);
return NOERR;
// End of auto-generated section
}