livoxGen1: Validate smo-ip provider-param
This commit is contained in:
@@ -192,7 +192,18 @@ extern "C" int livoxGen1_attachDeviceReq(
|
||||
imuPort = static_cast<uint16_t>(
|
||||
smo::device::DeviceAttachmentSpec
|
||||
::parseRequiredParamAsInt(*desc, "imu-port"));
|
||||
} else if (param.first == "smo-ip") {
|
||||
} else if (param.first == "smo-ip")
|
||||
{
|
||||
if (param.second.empty())
|
||||
{
|
||||
throw std::runtime_error(
|
||||
std::string(__func__) + ": smo-ip parameter is empty");
|
||||
}
|
||||
if (param.second.find('.') == std::string::npos)
|
||||
{
|
||||
throw std::runtime_error(
|
||||
std::string(__func__) + ": smo-ip parameter is not an IPv4 address");
|
||||
}
|
||||
smoIp = param.second;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user