RPC library working for the K64F
Fork of mbed-rpc by
RPCFunction.cpp@1:6919289a5946, 2013-04-22 (annotated)
- Committer:
- emilmont
- Date:
- Mon Apr 22 17:50:11 2013 +0100
- Revision:
- 1:6919289a5946
- Parent:
- 0:efe8172b4113
Update license
Add "parse_pins" function removed from the mbed library
Who changed what in which revision?
User | Revision | Line number | New 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 | #include "RPCFunction.h" |
mbed_official | 0:efe8172b4113 | 17 | |
mbed_official | 0:efe8172b4113 | 18 | namespace mbed { |
mbed_official | 0:efe8172b4113 | 19 | |
mbed_official | 0:efe8172b4113 | 20 | //Custom rpc method caller for execute so that the string will not be delimited by anything |
mbed_official | 0:efe8172b4113 | 21 | void rpc_method_caller_run(RPC *this_ptr, Arguments *arguments, Reply *result) { |
mbed_official | 0:efe8172b4113 | 22 | ((static_cast<RPCFunction*>(this_ptr))->run)(arguments, result); |
mbed_official | 0:efe8172b4113 | 23 | } |
mbed_official | 0:efe8172b4113 | 24 | |
mbed_official | 0:efe8172b4113 | 25 | RPCFunction::RPCFunction(void (*f)(Arguments*, Reply*), const char* name) : RPC(name) { |
mbed_official | 0:efe8172b4113 | 26 | _ftr = f; |
mbed_official | 0:efe8172b4113 | 27 | } |
mbed_official | 0:efe8172b4113 | 28 | |
emilmont | 1:6919289a5946 | 29 | //Just run the attached function using the string thats in private memory - or just using null values, |
mbed_official | 0:efe8172b4113 | 30 | void RPCFunction::run(Arguments* args, Reply* r) { |
mbed_official | 0:efe8172b4113 | 31 | (*_ftr)(args, r); |
mbed_official | 0:efe8172b4113 | 32 | } |
mbed_official | 0:efe8172b4113 | 33 | |
mbed_official | 0:efe8172b4113 | 34 | const rpc_method *RPCFunction::get_rpc_methods() { |
mbed_official | 0:efe8172b4113 | 35 | static const rpc_method rpc_methods[] = { |
mbed_official | 0:efe8172b4113 | 36 | {"run", rpc_method_caller_run }, //Run using custom caller, all characters accepted in string |
mbed_official | 0:efe8172b4113 | 37 | RPC_METHOD_SUPER(RPC) |
mbed_official | 0:efe8172b4113 | 38 | }; |
mbed_official | 0:efe8172b4113 | 39 | return rpc_methods; |
mbed_official | 0:efe8172b4113 | 40 | } |
mbed_official | 0:efe8172b4113 | 41 | |
mbed_official | 0:efe8172b4113 | 42 | } |