Skip to content
Snippets Groups Projects
Commit 3ccc752f authored by Cyril Danilevski's avatar Cyril Danilevski
Browse files

Pin SNMP library to 2.0.0

parent c7f1d1d6
No related branches found
No related tags found
Loading
Pipeline #152077 passed
...@@ -69,7 +69,7 @@ Update the Arduino index with: ...@@ -69,7 +69,7 @@ Update the Arduino index with:
The required libraries are (minimum versions): The required libraries are (minimum versions):
arduino-cli lib install ethernet arduino-cli lib install ethernet
arduino-cli lib install --git-url https://github.com/patricklaf/SNMP.git --config-file arduino-cli.yaml # Awaiting 1.4.1+ tag arduino-cli lib install SNMP@2.0.0
arduino-cli lib install MCP23S08@0.5.2 arduino-cli lib install MCP23S08@0.5.2
......
...@@ -17,7 +17,7 @@ MPOD::MPOD() { ...@@ -17,7 +17,7 @@ MPOD::MPOD() {
// Create an SNMP SETREQUEST message to setup MPOD // Create an SNMP SETREQUEST message to setup MPOD
SNMP::Message* MPOD::setup() { SNMP::Message* MPOD::setup() {
// Use read/write community, not read-only // Use read/write community, not read-only
SNMP::Message* message = new SNMP::Message(SNMP::VERSION2C, "guru", SNMP::TYPE_SETREQUEST); SNMP::Message* message = new SNMP::Message(SNMP::Version::V2C, "guru", SNMP::Type::SetRequest);
// In SETREQUEST, use node type and set the value. // In SETREQUEST, use node type and set the value.
// OUTPUT SWITCH, integer type, 0 is OFF and 1 is ON. // OUTPUT SWITCH, integer type, 0 is OFF and 1 is ON.
message->add(OID::NAMES[OID::OUTPUTSWITCH], new IntegerBER(0)); message->add(OID::NAMES[OID::OUTPUTSWITCH], new IntegerBER(0));
...@@ -32,7 +32,7 @@ SNMP::Message* MPOD::setup() { ...@@ -32,7 +32,7 @@ SNMP::Message* MPOD::setup() {
// Create an SNMP GETREQUEST message // Create an SNMP GETREQUEST message
SNMP::Message* MPOD::read() { SNMP::Message* MPOD::read() {
SNMP::Message* message = new SNMP::Message(SNMP::VERSION2C, "public", SNMP::TYPE_GETREQUEST); SNMP::Message* message = new SNMP::Message(SNMP::Version::V2C, "public", SNMP::Type::GetRequest);
// In GETREQUEST, values are always of type NULL. // In GETREQUEST, values are always of type NULL.
message->add(OID::NAMES[OID::OUTPUTSTATUS]); message->add(OID::NAMES[OID::OUTPUTSTATUS]);
message->add(OID::NAMES[OID::OUTPUTMEASUREMENTSENSEVOLTAGE]); message->add(OID::NAMES[OID::OUTPUTMEASUREMENTSENSEVOLTAGE]);
...@@ -42,7 +42,7 @@ SNMP::Message* MPOD::read() { ...@@ -42,7 +42,7 @@ SNMP::Message* MPOD::read() {
// Create an SNMP SETREQUEST message to switch on or off the MPOD // Create an SNMP SETREQUEST message to switch on or off the MPOD
SNMP::Message* MPOD::output(const bool on) { SNMP::Message* MPOD::output(const bool on) {
SNMP::Message* message = new SNMP::Message(SNMP::VERSION2C, "guru", SNMP::TYPE_SETREQUEST); SNMP::Message* message = new SNMP::Message(SNMP::Version::V2C, "guru", SNMP::Type::SetRequest);
// In SETREQUEST, use node type and set the value. // In SETREQUEST, use node type and set the value.
// OUTPUT SWITCH, integer type, 0 is OFF and 1 is ON. // OUTPUT SWITCH, integer type, 0 is OFF and 1 is ON.
message->add(OID::NAMES[OID::OUTPUTSWITCH], new IntegerBER(on ? 1 : 0)); message->add(OID::NAMES[OID::OUTPUTSWITCH], new IntegerBER(on ? 1 : 0));
...@@ -196,7 +196,7 @@ void onMessage(const SNMP::Message *message, const IPAddress remote, const uint1 ...@@ -196,7 +196,7 @@ void onMessage(const SNMP::Message *message, const IPAddress remote, const uint1
} }
void initializeSNMP() { void initializeSNMP() {
snmp.begin(&udp); snmp.begin(udp);
snmp.onMessage(onMessage); snmp.onMessage(onMessage);
Serial.println("SNMP Server Started"); Serial.println("SNMP Server Started");
} }
...@@ -143,7 +143,7 @@ void sendSNMP() { ...@@ -143,7 +143,7 @@ void sendSNMP() {
auto ipAddr = IPAddress(192,168,140,79); auto ipAddr = IPAddress(192,168,140,79);
if (output != NONE) { if (output != NONE) {
SNMP::Message *snmp_msg = mpod.output(output); SNMP::Message *snmp_msg = mpod.output(output);
snmp.send(snmp_msg, ipAddr, SNMP::PORT::SNMP); snmp.send(snmp_msg, ipAddr, SNMP::Port::SNMP);
delete snmp_msg; delete snmp_msg;
success = true; success = true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment