Intergrating IOIO with android_core
Hi All
I've been trying to intergrate IOIO for android with ROS Android, to provide a readily available IO platform that can talk with ROScore. My main method is to communicate to an IOIO service by binding my node (as implments NodeMain) to the service and calling service functions from there.
In this case the class implementing NodeMain is the client.
I am however having trouble implementing the Intent as I'm not sure what context to use eg:
public class HMM_Interface_node implements NodeMain {
short despos1, despos2, despos3, despos4, despos5, despos6, despos7;
HMM_Interface_service mService;
boolean mBound = false;
public HMM_Interface_node(Context context) {
this.context= context;
}
then later on:
public void onStart(final ConnectedNode node)
{
Intent intent = new Intent(this.context, HMM_Interface_service.class);
mService.bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
I am thinking that HMM_Interface_node does not pass any context being only a class. Therefore I've been passing the ROSActivity context of the main activity to this. However when I run, my bindService throws a null pointer exception. I have checked all the fields of bindService and they are not null.
Unfortunately I can only find examples of binding services where the context for the intent comes directly from the main class which usually extends Activity. However in this case the NodeMainExecutorService is running multiple threads, this being one.
Any help would be appreciated.