Code Monkey home page Code Monkey logo

Comments (6)

dmarc1234 avatar dmarc1234 commented on August 15, 2024

That line did come out right above, should be:

snmp->addReadWriteStringHandler(".1.3.6.1.4.1.38218.1.3.1.0", (char**)(*conf).sensor_name, 40, true);

from arduino_snmp.

0neblock avatar 0neblock commented on August 15, 2024

Hi @dmarc1234.
What is the type of (*conf).sensor_name?
If it is a char*, then you'll need to pass the reference of it to addReadWriteStringHandler().
For example: snmp->addReadWriteStringHandler(".1.3.6.1.4.1.38218.1.3.1.0", &(*conf).sensor_name, 40, true);
You shouldn't need to cast it to a char** unless it's not a char* originally.

Let me know if that helps!. Thanks.

from arduino_snmp.

dmarc1234 avatar dmarc1234 commented on August 15, 2024

Thank you for your reply.

Yes, (*conf).sensor_name is a char within the CONFIG_REG structure.

I have tried:
snmp->addReadWriteStringHandler(".1.3.6.1.4.1.38218.1.3.1.0", &(*conf).sensor_name, 40, true);
but it will not compile, I need to cast to char** to make it compile, so:
snmp->addReadWriteStringHandler(".1.3.6.1.4.1.38218.1.3.1.0", (char**)&(*conf).client_name, 40, true);
which compiles but still results in a SNMP no such object error.

Also tried a different approach as follows:

CONFIG_REG *config = &configReg;
snmp->addReadWriteStringHandler(".1.3.6.1.4.1.38218.1.3.1.0", (char**)&config->sensor_name, 40, true);

which returns a blank string rather than the no object error.

Really not sure where to go next ?

from arduino_snmp.

0neblock avatar 0neblock commented on August 15, 2024

@dmarc1234 Can you show me the declaration of the CONFIG_REG type? What data type is sensor_name?

from arduino_snmp.

dmarc1234 avatar dmarc1234 commented on August 15, 2024

This is how CONFIG_REG is defined:

// Structure to contain configuration information
typedef struct
{
	char		sensor_name[40];		// Sensor name
	char		sensor_location[40];	// Sensor location
} CONFIG_REG;

and then declared as a global in main.c :
CONFIG_REG configReg;

I then create a pointer to it using:
CONFIG_REG *config = &configReg;

from arduino_snmp.

dmarc1234 avatar dmarc1234 commented on August 15, 2024

@0neblock did you see my message in relation to the structure, still struggling to get this to work.

from arduino_snmp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.