RPC and Serial Connections. Disconnecting/Swapping.

25 Aug 2011

Hi all,

I have a program running RPC over a bluetooth link. Which is fantastic. But the problem with RPC is that you can't use the serial connection that you have it open on as a normal serial connection. You can only RPC over it , and get returns back from the RPC method. even if you pass back a char*. That is going to get messy if sending back something big.

and I want to send a file across my serial connection. (I have Java listener I've written on the PC, that will see it, and dump it down to disk)

I have it all working. (I have the concepts for both ends working)

But, there's one bit I can't solve.

I want to do this...

void sendFile() {

// DOES NOT WORK.

//grab the serial port off the RPC for a mo.
Serial device(p13, p14);  // tx, rx
device.baud(115200);
device.printf("hello world! (PC) ");
//give it back
SerialRPCInterface Interface(p13, p14,115200); //bluetooth interface
}

If I just use the serial device at the beginning of the program, and comment out the RPC, it works. If I just use the RPC as RPC. It works.

but I cannot swap my serial port from an RPC interface to a normal interface dynamically like this it seems. I want to use the 1 port, as it is running over bluetooth back to my PC.

One thing to mention is that this method is run from an RPC call. I want to be able to request a file via RPC and it "squirt it" at the PC via the serial port.

anyway..

Any ideas ?

If we can sort this, I'll publish my solution to both ends of the problem. (Including a Java request Gui)

cheers,

Dave.