cmd_handler: Add msg to InvalidCmd Response
This commit is contained in:
parent
9bec46490d
commit
7f9dc37c10
@ -163,6 +163,7 @@ const ERR_MSG_MISSING_POSTFILTER: &str = "Required field \"PostFilter\" does not
|
||||
const ERR_MSG_MISSING_SINC3FINEODR: &str = "Required field \"sinc3fineodr\" does not exist";
|
||||
const ERR_MSG_INVALID_PDMON_SETTINGS: &str = "Invalid PD Mon Parameter Setting(s)";
|
||||
const ERR_MSG_INVALID_LD_PWR_LIMIT_SETTING: &str = "Invalid LD Power Limit Setting";
|
||||
const ERR_MSG_CMD_NOT_FOUND: &str = "Command Not Found";
|
||||
|
||||
#[derive(Deserialize, Serialize, Copy, Clone, Debug, Default, Tree)]
|
||||
pub struct CmdJsonObj {
|
||||
@ -369,6 +370,10 @@ pub fn execute_cmd(
|
||||
info!("############ Thermostat Command Received {:?}", cmd.json.thermostat_cmd);
|
||||
info!("############ Device Command Received {:?}", cmd.json.device_cmd);
|
||||
|
||||
if cmd.json.laser_diode_cmd.is_none() && cmd.json.thermostat_cmd.is_none() && cmd.json.device_cmd.is_none() {
|
||||
send_response(buffer, ResponseEnum::InvalidCmd, Some(ERR_MSG_CMD_NOT_FOUND), socket);
|
||||
}
|
||||
|
||||
match cmd.json.device_cmd {
|
||||
Some(DeviceCmd::SetIPSettings) => match cmd.json.ip_settings {
|
||||
Some(val) => {
|
||||
@ -456,8 +461,7 @@ pub fn execute_cmd(
|
||||
}
|
||||
None => { /* Do Nothing */ }
|
||||
_ => {
|
||||
send_response(buffer, ResponseEnum::InvalidCmd, None, socket);
|
||||
debug!("Unimplemented Command")
|
||||
send_response(buffer, ResponseEnum::InvalidCmd, Some(ERR_MSG_CMD_NOT_FOUND), socket);
|
||||
}
|
||||
}
|
||||
|
||||
@ -580,8 +584,7 @@ pub fn execute_cmd(
|
||||
}
|
||||
None => { /* Do Nothing*/ }
|
||||
_ => {
|
||||
send_response(buffer, ResponseEnum::InvalidCmd, Some(ERR_MSG_MISSING_DATA_F32), socket);
|
||||
info!("Unimplemented Command")
|
||||
send_response(buffer, ResponseEnum::InvalidCmd, Some(ERR_MSG_CMD_NOT_FOUND), socket);
|
||||
}
|
||||
}
|
||||
|
||||
@ -907,13 +910,13 @@ pub fn execute_cmd(
|
||||
},
|
||||
None => { /* Do Nothing*/ }
|
||||
_ => {
|
||||
send_response(buffer, ResponseEnum::InvalidCmd, None, socket);
|
||||
send_response(buffer, ResponseEnum::InvalidCmd, Some(ERR_MSG_CMD_NOT_FOUND), socket);
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(_) => {
|
||||
info!("cmd_recv: {:?}", buffer);
|
||||
send_response(buffer, ResponseEnum::InvalidCmd, None, socket);
|
||||
send_response(buffer, ResponseEnum::InvalidCmd, Some(ERR_MSG_CMD_NOT_FOUND), socket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user