mbed RPC for none LPC_xxx platform
Dependents: mbed_controller_demo
Fork of mbed-rpc by
Arguments.h@11:f80f9c2bfb8c, 2015-06-17 (annotated)
- Committer:
- hillkim7
- Date:
- Wed Jun 17 01:54:37 2015 +0000
- Revision:
- 11:f80f9c2bfb8c
- Parent:
- 1:6919289a5946
Fix console stack overflow error. Stack size of console is enlarged.
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 | #ifndef ARGUMENTS_H |
mbed_official | 0:efe8172b4113 | 17 | #define ARGUMENTS_H |
mbed_official | 0:efe8172b4113 | 18 | |
mbed_official | 0:efe8172b4113 | 19 | #include "platform.h" |
emilmont | 1:6919289a5946 | 20 | #include "parse_pins.h" |
mbed_official | 0:efe8172b4113 | 21 | |
mbed_official | 0:efe8172b4113 | 22 | namespace mbed { |
mbed_official | 0:efe8172b4113 | 23 | |
mbed_official | 0:efe8172b4113 | 24 | #define RPC_MAX_STRING 128 |
mbed_official | 0:efe8172b4113 | 25 | #define RPC_MAX_ARGS 16 |
mbed_official | 0:efe8172b4113 | 26 | |
mbed_official | 0:efe8172b4113 | 27 | class Arguments { |
mbed_official | 0:efe8172b4113 | 28 | public: |
mbed_official | 0:efe8172b4113 | 29 | Arguments(const char* rqs); |
emilmont | 1:6919289a5946 | 30 | |
mbed_official | 0:efe8172b4113 | 31 | template<typename Arg> |
mbed_official | 0:efe8172b4113 | 32 | Arg getArg(void); |
emilmont | 1:6919289a5946 | 33 | |
mbed_official | 0:efe8172b4113 | 34 | char *obj_name; |
mbed_official | 0:efe8172b4113 | 35 | char *method_name; |
emilmont | 1:6919289a5946 | 36 | |
mbed_official | 0:efe8172b4113 | 37 | int argc; |
mbed_official | 0:efe8172b4113 | 38 | char* argv[RPC_MAX_ARGS]; |
mbed_official | 0:efe8172b4113 | 39 | |
mbed_official | 0:efe8172b4113 | 40 | private: |
mbed_official | 0:efe8172b4113 | 41 | // This copy can be removed if we can assume the request string is |
mbed_official | 0:efe8172b4113 | 42 | // persistent and writable for the duration of the call |
mbed_official | 0:efe8172b4113 | 43 | char request[RPC_MAX_STRING]; |
mbed_official | 0:efe8172b4113 | 44 | int index; |
mbed_official | 0:efe8172b4113 | 45 | char* search_arg(char **arg, char *p, char next_sep); |
mbed_official | 0:efe8172b4113 | 46 | }; |
mbed_official | 0:efe8172b4113 | 47 | |
mbed_official | 0:efe8172b4113 | 48 | class Reply { |
mbed_official | 0:efe8172b4113 | 49 | public: |
mbed_official | 0:efe8172b4113 | 50 | Reply(char* r); |
emilmont | 1:6919289a5946 | 51 | |
mbed_official | 0:efe8172b4113 | 52 | template<typename Data> |
mbed_official | 0:efe8172b4113 | 53 | void putData(Data d); |
mbed_official | 0:efe8172b4113 | 54 | |
mbed_official | 0:efe8172b4113 | 55 | private: |
mbed_official | 0:efe8172b4113 | 56 | void separator(void); |
mbed_official | 0:efe8172b4113 | 57 | bool first; |
mbed_official | 0:efe8172b4113 | 58 | char* reply; |
mbed_official | 0:efe8172b4113 | 59 | }; |
mbed_official | 0:efe8172b4113 | 60 | |
mbed_official | 0:efe8172b4113 | 61 | |
mbed_official | 0:efe8172b4113 | 62 | } // Namespace mbed |
mbed_official | 0:efe8172b4113 | 63 | |
mbed_official | 0:efe8172b4113 | 64 | #endif |