1 /* mbed Microcontroller Library
2 * Copyright (c) 2006-2013 ARM Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 #ifndef RPCFUNCTION_RPC
17 #define RPCFUNCTION_RPC
26 *Class to call custom functions over RPC
29 class RPCFunction: public RPC {
34 *@param f Pointer to the function to call. the function must be of the form void foo(char * input, char * output)
35 *@param name The name of this object
37 RPCFunction(void (*f)(Arguments*, Reply*), const char* = NULL);
42 *Calls the attached function passing the string in but doesn't return the result.
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
44 *@return A string output from the function
46 void run(Arguments* args, Reply* r);
48 virtual const struct rpc_method *get_rpc_methods();
51 void (*_ftr)(Arguments*, Reply*);
54 char _output[STR_LEN];