Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Creating a response function within a class object

Rank

Total Posts: 2

Joined 2014-11-14

PM

I'm trying to assign to a response function and channel event function inside another object:

void object::init() {
....
ANT_AssignResponseFunction(f1, ant_message);
ANT_AssignChannelEventFunction(USER_ANTCHANNEL, f1, ant_message);
}

and I'm having issues declaring the function (f1) since it isn't of the type RESPONSE_FUNC. I know that I can get it to work if I declare the function as static:

BOOL f1(UCHAR ucChannel_, UCHAR ucEvent_) {}

but I need to use variables within the class object so I can't do that. If I declare the function within the object:

BOOL object::f1(UCHAR ucChannel_, UCHAR ucEvent_) {}

The error that I get is: "Error: argument of type "BOOL (object::*)(UCHAR ucChannel_, UCHAR ucEvent_)" is incompatible with parameter of type "RESPONSE_FUNC"".


Any suggestions?