test public

Dependencies:   HttpServer_snapshot_mbed-os

Committer:
anhtran
Date:
Fri Oct 18 03:09:43 2019 +0000
Revision:
0:e9fd5575b10e
abc

Who changed what in which revision?

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