Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-du-car committed Nov 9, 2023
1 parent ee211d7 commit c0bac10
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/tmx/TmxUtils/src/SNMPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ namespace tmx::utils
: ip_(ip), port_(port), community_(community), snmp_version_(snmp_version), timeout_(timeout)
{

PLOG(logDEBUG1) << "Starting SNMP Client";
PLOG(logDEBUG1) << "Target device IP address: " << ip_;
PLOG(logINFO) << "Target device NTCIP port: " << port_;
PLOG(logDEBUG1) << "Starting SNMP Client. Target device IP address: " << ip_<< "Target device SNMP port: " << port_;

// Bring the IP address and port of the target SNMP device in the required form, which is "IPADDRESS:PORT":
std::string ip_port_string = ip_ + ":" + std::to_string(port_);
Expand All @@ -27,7 +25,7 @@ namespace tmx::utils
session.securityNameLen = snmp_user.length();

// Fallback behavior to setup a community for SNMP V1/V2
if (snmp_version_ != 3)
if (snmp_version_ != SNMP_VERSION_3)
{
char community_char[community_.length()];
std::copy(community_.begin(), community_.end(), community_char);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ namespace RSUHealthMonitor
}
}
}
catch (std::exception &ex)
catch (const std::exception &ex)
{
PLOG(logERROR) << ex.what();
}
Expand All @@ -120,7 +120,7 @@ namespace RSUHealthMonitor
// Create SNMP client and use SNMP V3 protocol
PLOG(logINFO) << "Update SNMP client: RSU IP: " << _rsuIp << ", RSU port: " << _snmpPort << ", User: " << _securityUser << ", auth pass phrase: " << _authPassPhrase << ", security level: "
<< _securityLevel;
auto _snmpClientPtr = std::make_unique<snmp_client>(_rsuIp, _snmpPort, "", _securityUser, _securityLevel, _authPassPhrase, 3, SEC_TO_MICRO);
auto _snmpClientPtr = std::make_unique<snmp_client>(_rsuIp, _snmpPort, "", _securityUser, _securityLevel, _authPassPhrase, SNMP_VERSION_3, SEC_TO_MICRO);
if (_snmpClientPtr == nullptr)
{
PLOG(logERROR) << "Error creating SNMP client!";
Expand Down Expand Up @@ -162,7 +162,7 @@ namespace RSUHealthMonitor
}
}
}
catch (std::exception &ex)
catch (const std::exception &ex)
{
PLOG(logERROR) << "SNMP call failure due to: " << ex.what();
}
Expand Down

0 comments on commit c0bac10

Please sign in to comment.