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 #include "RPCFunction.h"
anhtran 0:e9fd5575b10e 17
anhtran 0:e9fd5575b10e 18 namespace mbed {
anhtran 0:e9fd5575b10e 19
anhtran 0:e9fd5575b10e 20 //Custom rpc method caller for execute so that the string will not be delimited by anything
anhtran 0:e9fd5575b10e 21 void rpc_method_caller_run(RPC *this_ptr, Arguments *arguments, Reply *result) {
anhtran 0:e9fd5575b10e 22 ((static_cast<RPCFunction*>(this_ptr))->run)(arguments, result);
anhtran 0:e9fd5575b10e 23 }
anhtran 0:e9fd5575b10e 24
anhtran 0:e9fd5575b10e 25 RPCFunction::RPCFunction(void (*f)(Arguments*, Reply*), const char* name) : RPC(name) {
anhtran 0:e9fd5575b10e 26 _ftr = f;
anhtran 0:e9fd5575b10e 27 }
anhtran 0:e9fd5575b10e 28
anhtran 0:e9fd5575b10e 29 //Just run the attached function using the string thats in private memory - or just using null values,
anhtran 0:e9fd5575b10e 30 void RPCFunction::run(Arguments* args, Reply* r) {
anhtran 0:e9fd5575b10e 31 (*_ftr)(args, r);
anhtran 0:e9fd5575b10e 32 }
anhtran 0:e9fd5575b10e 33
anhtran 0:e9fd5575b10e 34 const rpc_method *RPCFunction::get_rpc_methods() {
anhtran 0:e9fd5575b10e 35 static const rpc_method rpc_methods[] = {
anhtran 0:e9fd5575b10e 36 {"run", rpc_method_caller_run }, //Run using custom caller, all characters accepted in string
anhtran 0:e9fd5575b10e 37 RPC_METHOD_SUPER(RPC)
anhtran 0:e9fd5575b10e 38 };
anhtran 0:e9fd5575b10e 39 return rpc_methods;
anhtran 0:e9fd5575b10e 40 }
anhtran 0:e9fd5575b10e 41
anhtran 0:e9fd5575b10e 42 }
anhtran 0:e9fd5575b10e 43