Arduino SNMP set response from agent

Dear all,

I followed the instructions on the URL (SNMP(Simple Network Management Protocol) Implementation on Arduino Ethernet Shield: Monitoring Room Temperature) and my Arduino UNO successfully provides a response to GET request from an SNMP manager - the UNO returns the current value from a temperature sensor to MIB Browser's GET request.

My project also requires the UNO internal value to be changed by the SNMP manager so to turn on +5V from some digital pins.
Unfortunately, the code provided is only to respond to the GET request. The respond to SET request is not complete ("not done for simplicity" as remarked in the code).

I would be much appreciated if someone can guide me along for the SET response.

Warmest regards
Christopher Koek

P.S.
I added the following Seria.println for testing and found only GET command causes printing on serial monitor but not the SET command -
else if ( strcmp_P(oid, sysContact ) == 0 ) {
Serial.println("--------------------");
// handle sysContact (set/get) requests
if ( pdu.type == SNMP_PDU_SET ) {
Serial.println("#####################");
// response packet from set-request - object is read/write
//status = pdu.VALUE.decode(locContact, strlen(locContact));
//pdu.type = SNMP_PDU_RESPONSE;
//pdu.error = status;
} else {
Serial.println("***********************");
// response packet from get-request - locContact
status = pdu.VALUE.encode(SNMP_SYNTAX_OCTETS, locContact);
pdu.type = SNMP_PDU_RESPONSE;
pdu.error = status;

1 Like