Capstone project for Bachelor's in Mechanical Engineering 2011

Dependencies:   FatFileSystem MAX3100 MODGPS MODSERIAL SDFileSystem mbed

Committer:
lhiggs
Date:
Wed May 29 00:45:41 2013 +0000
Revision:
0:0529d2d7762f
Broken, after updating all the libraries. RPC has issues with new mbed libraries.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lhiggs 0:0529d2d7762f 1 /**
lhiggs 0:0529d2d7762f 2 * @section LICENSE
lhiggs 0:0529d2d7762f 3 *Copyright (c) 2010 ARM Ltd.
lhiggs 0:0529d2d7762f 4 *
lhiggs 0:0529d2d7762f 5 *Permission is hereby granted, free of charge, to any person obtaining a copy
lhiggs 0:0529d2d7762f 6 *of this software and associated documentation files (the "Software"), to deal
lhiggs 0:0529d2d7762f 7 *in the Software without restriction, including without limitation the rights
lhiggs 0:0529d2d7762f 8 *to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
lhiggs 0:0529d2d7762f 9 *copies of the Software, and to permit persons to whom the Software is
lhiggs 0:0529d2d7762f 10 *furnished to do so, subject to the following conditions:
lhiggs 0:0529d2d7762f 11 *
lhiggs 0:0529d2d7762f 12 *The above copyright notice and this permission notice shall be included in
lhiggs 0:0529d2d7762f 13 *all copies or substantial portions of the Software.
lhiggs 0:0529d2d7762f 14 *
lhiggs 0:0529d2d7762f 15 *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
lhiggs 0:0529d2d7762f 16 *IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
lhiggs 0:0529d2d7762f 17 *FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
lhiggs 0:0529d2d7762f 18 *AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
lhiggs 0:0529d2d7762f 19 *LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
lhiggs 0:0529d2d7762f 20 *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
lhiggs 0:0529d2d7762f 21 *THE SOFTWARE.
lhiggs 0:0529d2d7762f 22 *
lhiggs 0:0529d2d7762f 23 * @section Description
lhiggs 0:0529d2d7762f 24 *This class provides an object which can be called over RPC to run the function which is attached to it.
lhiggs 0:0529d2d7762f 25 *
lhiggs 0:0529d2d7762f 26 */
lhiggs 0:0529d2d7762f 27 #ifndef RPCFUNCTION_RPC
lhiggs 0:0529d2d7762f 28 #define RPCFUNCTION_RPC
lhiggs 0:0529d2d7762f 29 /**
lhiggs 0:0529d2d7762f 30 *Includes
lhiggs 0:0529d2d7762f 31 */
lhiggs 0:0529d2d7762f 32 #include "mbed.h"
lhiggs 0:0529d2d7762f 33 #include "platform.h"
lhiggs 0:0529d2d7762f 34 #include "rpc.h"
lhiggs 0:0529d2d7762f 35 #define STR_LEN 64
lhiggs 0:0529d2d7762f 36 #include "platform.h"
lhiggs 0:0529d2d7762f 37
lhiggs 0:0529d2d7762f 38 #ifdef MBED_RPC
lhiggs 0:0529d2d7762f 39 #include "rpc.h"
lhiggs 0:0529d2d7762f 40 #endif
lhiggs 0:0529d2d7762f 41 /**
lhiggs 0:0529d2d7762f 42 *
lhiggs 0:0529d2d7762f 43 *Class to call custom functions over RPC
lhiggs 0:0529d2d7762f 44 *
lhiggs 0:0529d2d7762f 45 */
lhiggs 0:0529d2d7762f 46 class RPCFunction : public Base{
lhiggs 0:0529d2d7762f 47 public:
lhiggs 0:0529d2d7762f 48 /**
lhiggs 0:0529d2d7762f 49 * Constructor
lhiggs 0:0529d2d7762f 50 *
lhiggs 0:0529d2d7762f 51 *@param f Pointer to the function to call. the function must be of the form void foo(char * input, char * output)
lhiggs 0:0529d2d7762f 52 *@param name The name of this object
lhiggs 0:0529d2d7762f 53 */
lhiggs 0:0529d2d7762f 54 RPCFunction(void(*f)(char*, char*), const char* = NULL);
lhiggs 0:0529d2d7762f 55
lhiggs 0:0529d2d7762f 56 /**
lhiggs 0:0529d2d7762f 57 *run
lhiggs 0:0529d2d7762f 58 *
lhiggs 0:0529d2d7762f 59 *Calls the attached function passing the string in but doesn't return the result.
lhiggs 0:0529d2d7762f 60 *@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
lhiggs 0:0529d2d7762f 61 *@return A string output from the function
lhiggs 0:0529d2d7762f 62 */
lhiggs 0:0529d2d7762f 63 char * run(char* str);
lhiggs 0:0529d2d7762f 64
lhiggs 0:0529d2d7762f 65 /**
lhiggs 0:0529d2d7762f 66 *Reads the value of the output string.
lhiggs 0:0529d2d7762f 67 *
lhiggs 0:0529d2d7762f 68 *@returns the string outputted from the last time the function was called
lhiggs 0:0529d2d7762f 69 */
lhiggs 0:0529d2d7762f 70 char * read();
lhiggs 0:0529d2d7762f 71
lhiggs 0:0529d2d7762f 72
lhiggs 0:0529d2d7762f 73 #ifdef MBED_RPC
lhiggs 0:0529d2d7762f 74 virtual const struct rpc_method *get_rpc_methods();
lhiggs 0:0529d2d7762f 75 #endif
lhiggs 0:0529d2d7762f 76
lhiggs 0:0529d2d7762f 77 private:
lhiggs 0:0529d2d7762f 78 void (*_ftr)(char*, char*);
lhiggs 0:0529d2d7762f 79
lhiggs 0:0529d2d7762f 80 char _input[STR_LEN];
lhiggs 0:0529d2d7762f 81 char _output[STR_LEN];
lhiggs 0:0529d2d7762f 82
lhiggs 0:0529d2d7762f 83 };
lhiggs 0:0529d2d7762f 84 #endif