Library to provide a mechanism to make it easier to add RPC to custom code by using RPCFunction and RPCVariable objects. Also includes a class to receive and process RPC over serial.
Dependents: GSL_10-Pololu_A4983_STEPMOTORDRIVER Protodrive RPC_HTTP RPC_TestHack ... more
Diff: RPCFunction.h
- Revision:
- 1:67aefdc74b32
- Parent:
- 0:9232f9e1178d
- Child:
- 2:1d5b7485f683
diff -r 9232f9e1178d -r 67aefdc74b32 RPCFunction.h --- a/RPCFunction.h Thu Sep 16 13:27:57 2010 +0000 +++ b/RPCFunction.h Mon Sep 20 14:26:52 2010 +0000 @@ -1,5 +1,5 @@ /** -*@section LICENSE +* @section LICENSE *Copyright (c) 2010 ARM Ltd. * *Permission is hereby granted, free of charge, to any person obtaining a copy @@ -20,7 +20,7 @@ *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN *THE SOFTWARE. * -*@section Description +* @section Description *This class provides an object which can be called over RPC to run the function which is attached to it. * */ @@ -51,21 +51,14 @@ */ RPCFunction(void(*f)(char*, char*), const char* = NULL); - /** - *execute + /** + *run * - * Calls the function which is attached to this object. This method can be called over RPC. This method will wait until the attached function has completed before returning. - * - *@param The string to be passed to the function. This string can consist of any ASCII characters apart from escape codes. The usual limtations on argument content for RPC strings has been removed + *Calls the attached function passing the string in but doesn't return the result. + *@param str The string to be passed into the attached function. This string can consist of any ASCII characters apart from escape codes. The usual limtations on argument content for RPC strings has been removed *@return A string output from the function */ - char* execute(char *input); - - /** - *Calls the attached function passing the string in but doesn't return the result. - *@param str The string to be passed into the attached function. This string can consist of any ASCII characters apart from escape codes. The usual limtations on argument content for RPC strings has been removed - */ - void run(char* str); + char * run(char* str); /** *Reads the value of the output string. @@ -73,20 +66,12 @@ *@returns the string outputted from the last time the function was called */ char * read(); - /** - *Sets the value of the input string to the function. - * - *@param String to be written to the input string - */ - void write(char * str); + #ifdef MBED_RPC virtual const struct rpc_method *get_rpc_methods(); - static struct rpc_class *get_rpc_class(); #endif - - private: void (*_ftr)(char*, char*);