feat/1030-more-unit-tests #29
@@ -49,6 +49,7 @@ typedef enum relay_chn_direction_enum relay_chn_direction_t;
|
||||
* @brief Enums that represent the state of a relay channel.
|
||||
*/
|
||||
enum relay_chn_state_enum {
|
||||
RELAY_CHN_STATE_UNDEFINED, ///< The relay channel state is undefined.
|
||||
RELAY_CHN_STATE_FREE, ///< The relay channel is free to run or execute commands.
|
||||
RELAY_CHN_STATE_STOPPED, ///< The relay channel is stopped and not running.
|
||||
RELAY_CHN_STATE_FORWARD, ///< The relay channel is running in the forward direction.
|
||||
|
||||
@@ -648,16 +648,16 @@ static void relay_chn_issue_cmd(relay_chn_t* relay_chn, relay_chn_cmd_t cmd)
|
||||
/* relay_chn APIs */
|
||||
relay_chn_state_t relay_chn_get_state(uint8_t chn_id)
|
||||
{
|
||||
if (!relay_chn_is_channel_id_valid(chn_id)) {
|
||||
return RELAY_CHN_STATE_STOPPED;
|
||||
if (!relay_chn_is_channel_id_valid(chn_id) || chn_id == RELAY_CHN_ID_ALL) {
|
||||
return RELAY_CHN_STATE_UNDEFINED;
|
||||
}
|
||||
return relay_channels[chn_id].state;
|
||||
}
|
||||
|
||||
char *relay_chn_get_state_str(uint8_t chn_id)
|
||||
{
|
||||
if (!relay_chn_is_channel_id_valid(chn_id)) {
|
||||
return "INVALID";
|
||||
if (!relay_chn_is_channel_id_valid(chn_id) || chn_id == RELAY_CHN_ID_ALL) {
|
||||
return relay_chn_state_str(RELAY_CHN_STATE_UNDEFINED);
|
||||
}
|
||||
return relay_chn_state_str(relay_channels[chn_id].state);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user