Library, which makes my digital out program work.
Fork of mbed-rpc by
Arguments.h@6:f462916424ea, 2014-04-09 (annotated)
- Committer:
- Bear05
- Date:
- Wed Apr 09 16:35:22 2014 +0000
- Revision:
- 6:f462916424ea
- Parent:
- 1:6919289a5946
Code does not work with latest version of 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 | #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 |