mbed rpc

Dependents:   GSwifi_ap_ws_rpc gba_rpc

Fork of mbed-rpc by mbed official

Committer:
okini3939
Date:
Mon May 12 14:30:23 2014 +0000
Revision:
7:ddd4f57351e2
Parent:
1:6919289a5946
fix supported AnalogOut

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:efe8172b4113 1 /* mbed Microcontroller Library
emilmont 1:6919289a5946 2 * Copyright (c) 2006-2013 ARM Limited
mbed_official 0:efe8172b4113 3 *
emilmont 1:6919289a5946 4 * Licensed under the Apache License, Version 2.0 (the "License");
emilmont 1:6919289a5946 5 * you may not use this file except in compliance with the License.
emilmont 1:6919289a5946 6 * You may obtain a copy of the License at
mbed_official 0:efe8172b4113 7 *
emilmont 1:6919289a5946 8 * http://www.apache.org/licenses/LICENSE-2.0
mbed_official 0:efe8172b4113 9 *
emilmont 1:6919289a5946 10 * Unless required by applicable law or agreed to in writing, software
emilmont 1:6919289a5946 11 * distributed under the License is distributed on an "AS IS" BASIS,
emilmont 1:6919289a5946 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
emilmont 1:6919289a5946 13 * See the License for the specific language governing permissions and
emilmont 1:6919289a5946 14 * limitations under the License.
mbed_official 0:efe8172b4113 15 */
mbed_official 0:efe8172b4113 16 #ifndef RPCFUNCTION_RPC
mbed_official 0:efe8172b4113 17 #define RPCFUNCTION_RPC
mbed_official 0:efe8172b4113 18
mbed_official 0:efe8172b4113 19 #include "rpc.h"
mbed_official 0:efe8172b4113 20 #define STR_LEN 64
mbed_official 0:efe8172b4113 21
mbed_official 0:efe8172b4113 22 namespace mbed {
mbed_official 0:efe8172b4113 23
mbed_official 0:efe8172b4113 24 /**
mbed_official 0:efe8172b4113 25 *
mbed_official 0:efe8172b4113 26 *Class to call custom functions over RPC
mbed_official 0:efe8172b4113 27 *
mbed_official 0:efe8172b4113 28 */
mbed_official 0:efe8172b4113 29 class RPCFunction: public RPC {
mbed_official 0:efe8172b4113 30 public:
mbed_official 0:efe8172b4113 31 /**
mbed_official 0:efe8172b4113 32 * Constructor
emilmont 1:6919289a5946 33 *
mbed_official 0:efe8172b4113 34 *@param f Pointer to the function to call. the function must be of the form void foo(char * input, char * output)
mbed_official 0:efe8172b4113 35 *@param name The name of this object
mbed_official 0:efe8172b4113 36 */
mbed_official 0:efe8172b4113 37 RPCFunction(void (*f)(Arguments*, Reply*), const char* = NULL);
mbed_official 0:efe8172b4113 38
emilmont 1:6919289a5946 39 /**
emilmont 1:6919289a5946 40 *run
mbed_official 0:efe8172b4113 41 *
mbed_official 0:efe8172b4113 42 *Calls the attached function passing the string in but doesn't return the result.
mbed_official 0:efe8172b4113 43 *@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
mbed_official 0:efe8172b4113 44 *@return A string output from the function
mbed_official 0:efe8172b4113 45 */
mbed_official 0:efe8172b4113 46 void run(Arguments* args, Reply* r);
mbed_official 0:efe8172b4113 47
mbed_official 0:efe8172b4113 48 virtual const struct rpc_method *get_rpc_methods();
mbed_official 0:efe8172b4113 49
mbed_official 0:efe8172b4113 50 private:
mbed_official 0:efe8172b4113 51 void (*_ftr)(Arguments*, Reply*);
mbed_official 0:efe8172b4113 52
mbed_official 0:efe8172b4113 53 char _input[STR_LEN];
mbed_official 0:efe8172b4113 54 char _output[STR_LEN];
mbed_official 0:efe8172b4113 55 };
mbed_official 0:efe8172b4113 56
mbed_official 0:efe8172b4113 57 }
mbed_official 0:efe8172b4113 58
mbed_official 0:efe8172b4113 59 #endif