Arduino_SNMP icon indicating copy to clipboard operation
Arduino_SNMP copied to clipboard

How to reuse trap and update setTrapOID() for each send

Open dmarc1234 opened this issue 2 months ago • 0 comments

Hi,

I am using your great library to send temperature SET traps to my PC every minute when over a particular threshold and its working well.

The problem I have is that when the temperature drops below a threshold I want to send a CLEAR trap to inform my software that the threshold is no long breached. This means I need to change the originally configured:

snmp_trap->setTrapOID(new OIDType(".1.3.6.1.4.1.311.2.6.1.1"));

to

snmp_trap->setTrapOID(new OIDType(".1.3.6.1.4.1.311.2.6.2.1"));

However, if I do this using 'new' the heap reduces on each trap and eventually reaches a point where the ESP32 reboots due to an exception error.

How can I redfine the setTrapOID() without using 'new' ?

dmarc1234 avatar Apr 22 '24 14:04 dmarc1234