Skip to content

Commit

Permalink
Support Robin UdpIpPort modify
Browse files Browse the repository at this point in the history
  • Loading branch information
JianWangInno committed Nov 15, 2023
1 parent f69283d commit ed73494
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ class InnovusionHwInterface : NebulaHwInterfaceBase
void UpdateUnicastIpPort(const std::string &strUnicastIp, const uint16_t &uUnicastPort,
const std::string &strLocalIp, const uint16_t &uLocalPort);

/// @brief update unicast ip port for robin by restApi
void RobinSetUdpPortIP(std::string strUdpIp, uint16_t uUdpPort);

public:
/// @brief Constructor
InnovusionHwInterface();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,28 @@ void InnovusionHwInterface::UpdateUnicastIpPort(const std::string &strUnicastIp,
return;
}

std::string strSendInfo = std::to_string(uLocalPort) + "," + std::to_string(uLocalPort)
+ "," + std::to_string(uLocalPort) + "," + strLocalIp;

if(sensor_configuration_->sensor_model == nebula::drivers::SensorModel::INNOVUSION_ROBIN){
RobinSetUdpPortIP(strLocalIp, uLocalPort);
} else if(sensor_configuration_->sensor_model == nebula::drivers::SensorModel::INNOVUSION_FALCON){
std::string strSendInfo = std::to_string(uLocalPort) + "," + std::to_string(uLocalPort)
+ "," + std::to_string(uLocalPort) + "," + strLocalIp;
std::cout << "UpdateFalconUnicastIpPort, strSendInfo:" << strSendInfo << std::endl;

SetSensorParameter("force_udp_ports_ip", strSendInfo);
} else {
std::cout << "UpdateUnicastIpPort, not support sensor model" << std::endl;
}
}

std::cout << "UpdateUnicastIpPort, strSendInfo:" << strSendInfo << std::endl;
void InnovusionHwInterface::RobinSetUdpPortIP(std::string strUdpIp, uint16_t uUdpPort)
{
std::string strSendInfo = "{\"ip\":\"" + strUdpIp + "\",\"port_data\":" + std::to_string(uUdpPort)
+ ",\"port_message\":" + std::to_string(uUdpPort) + ",\"port_status\":" + std::to_string(uUdpPort) + "}";
std::cout << "UpdateFalconUnicastIpPort, strSendInfo:" << strSendInfo << std::endl;

std::string ret = SetSensorParameter("force_udp_ports_ip", strSendInfo);
auto rt = http_client_driver_->post("/v1/lidar/force_udp_ports_ip", strSendInfo);
http_client_driver_->client()->close();
std::cout << "UpdateRobinUnicastIpPort, rt:" << rt << std::endl;
}

boost::property_tree::ptree InnovusionHwInterface::ParseJson(const std::string &str) {
Expand Down

0 comments on commit ed73494

Please sign in to comment.