Skip to content

Commit

Permalink
update source
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-du-car committed Nov 9, 2023
1 parent c0bac10 commit 1edaf32
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace RSUHealthMonitor
RSUHealthMonitorPlugin::RSUHealthMonitorPlugin(std::string name) : PluginClient(name)
{
UpdateConfigSettings();
// Send SNMP call to RSU status at configurable interval.
// Send SNMP call to RSU periodically at configurable interval.
std::thread rsuStatus_t(&RSUHealthMonitorPlugin::PeriodicRSUStatusReq, this);
rsuStatus_t.join();
}
Expand Down Expand Up @@ -62,7 +62,7 @@ namespace RSUHealthMonitor
}
catch (const std::exception &e)
{
PLOG(logERROR) << "Error updating RSU OID config" << e.what();
PLOG(logERROR) << "Error updating RSU OID config " << e.what();
}
}

Expand All @@ -75,12 +75,12 @@ namespace RSUHealthMonitor
void RSUHealthMonitorPlugin::PeriodicRSUStatusReq()
{
while (true)
{
// Broadcast the RSU status info when there are any RSU responses.
{
try
{
//SNMP call to get RSU status
auto rsuStatusJson = getRSUstatus();

// Broadcast the RSU status info when there are RSU responses.
if (!rsuStatusJson.empty())
{
vector<string> rsuStatusFields;
Expand All @@ -95,7 +95,8 @@ namespace RSUHealthMonitor
string json_str = fasterWirter.write(rsuStatusJson);
tmx::messages::RSUStatusMessage sendRsuStatusMsg;
sendRsuStatusMsg.set_contents(json_str);
BroadcastMessage(sendRsuStatusMsg);
string source = RSUHealthMonitorPlugin::GetName();
BroadcastMessage(sendRsuStatusMsg, source);
PLOG(logINFO) << "Broadcast RSU status: " << json_str;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace RSUHealthMonitor
*/
void PeriodicRSUStatusReq();
/**
* @brief Sending SNMP requests to get info for each field in the _rsuOIDConfigMap, and return the RSU status in JSON string
* @brief Sending SNMP requests to get info for each field in the _rsuOIDConfigMap, and return the RSU status in JSON
*/
Json::Value getRSUstatus();
/**
Expand All @@ -61,6 +61,7 @@ namespace RSUHealthMonitor
std::map<double, double> ParseGPS(const std::string &gps_nmea_data);
/**
* @brief determine if all required fields in the RSU config map _rsuOIDConfigMap present in the input fields
* @return True if all required fields found. Otherwise, false.
*/
bool isAllRequiredFieldsPresent(vector<string> fields);

Expand Down

0 comments on commit 1edaf32

Please sign in to comment.