0neblock / Arduino_SNMP

SNMP Agent built with Arduino
MIT License
77 stars 30 forks source link

addDynamicIntegerHandler usage #47

Open GiovanniMasuri14 opened 5 months ago

GiovanniMasuri14 commented 5 months ago

I need to provide a read-only changing integer so i think i need to use the addDynamicIntegerHandler. The challenge for me is that the SNMPAgent instance is a class member and i dont know what i've to pass as GETINT_FUNC.

class MyClass
{
    private:
        int myChangingInt;
        SNMPAgent * snmp;
        int callback_test() {return myChangingInt};
        void Init()
        {
            snmp = new SNMPAgent("public", "private");
            .
            .
            .
            // the following line returns an invalid use of non-static member function 'int MyClass::callback_test()'
                snmp->addDynamicIntegerHandler(".1.3.6.1.4.1.14.1", callback_test, true);
            .
            .
            .
        };
};

Anyone that knows how to solve it?