FYI: Breaking change in Arduino_SNMP_Manager
Closed this issue · 2 comments
Just to let you know if you update to the latest Arduino_SNMP_Manager library, there is a breaking change when callbacks are created or searched for. In that, you need to provide the IP address in addition to the OID. This was to allow the library to support querying the same OID from multiple devices.
This library is used in router_stats_lcd and router_graph_lcd
In addition, I've updated the example to get the callback when creating the callback, rather than using findCallback. Either works, but it may simplify the code a little.
Original (router_graph_lcd/traffic.cpp) and (router_stats_lcd/router_stats_lcd.ino):
// Create a handler for each of the OID
snmp.addCounter32Handler(oidInOctetsCount32, &inOctetsResponse);
snmp.addCounter32Handler(oidOutOctetsCount32, &outOctetsResponse);
snmp.addTimestampHandler(oidUptime, &uptime);
// Create the call back ID's for each OID
callbackInOctets = snmp.findCallback(oidInOctetsCount32);
callbackOutOctets = snmp.findCallback(oidOutOctetsCount32);
callbackUptime = snmp.findCallback(oidUptime);
Revised for update Arduino_SNMP_Manager library:
callbackInOctets = snmp.addCounter32Handler(router, oidInOctetsCount32, &inOctetsResponse);
callbackOutOctets = snmp.addCounter32Handler(router, oidOutOctetsCount32, &outOctetsResponse);
callbackUptime = snmp.addTimestampHandler(router, oidUptime, &uptime);
Thanks Martin (shortbloke)
Thanks for the heads up - much appreciated.
ps: I added some screenshots to those projects so you can see how they look.