
An example HTTP Server using new Ethernet Interface and localfilesystem.
Dependencies: EthernetInterface HttpServer mbed-rpc mbed-rtos mbed
Fork of giken9_HTMLServer_Sample by
mbed-rpc/Arguments.h@0:7766f6712673, 2014-03-12 (annotated)
- Committer:
- yueee_yt
- Date:
- Wed Mar 12 04:19:54 2014 +0000
- Revision:
- 0:7766f6712673
???????????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yueee_yt | 0:7766f6712673 | 1 | /* mbed Microcontroller Library |
yueee_yt | 0:7766f6712673 | 2 | * Copyright (c) 2006-2013 ARM Limited |
yueee_yt | 0:7766f6712673 | 3 | * |
yueee_yt | 0:7766f6712673 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
yueee_yt | 0:7766f6712673 | 5 | * you may not use this file except in compliance with the License. |
yueee_yt | 0:7766f6712673 | 6 | * You may obtain a copy of the License at |
yueee_yt | 0:7766f6712673 | 7 | * |
yueee_yt | 0:7766f6712673 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
yueee_yt | 0:7766f6712673 | 9 | * |
yueee_yt | 0:7766f6712673 | 10 | * Unless required by applicable law or agreed to in writing, software |
yueee_yt | 0:7766f6712673 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
yueee_yt | 0:7766f6712673 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
yueee_yt | 0:7766f6712673 | 13 | * See the License for the specific language governing permissions and |
yueee_yt | 0:7766f6712673 | 14 | * limitations under the License. |
yueee_yt | 0:7766f6712673 | 15 | */ |
yueee_yt | 0:7766f6712673 | 16 | #ifndef ARGUMENTS_H |
yueee_yt | 0:7766f6712673 | 17 | #define ARGUMENTS_H |
yueee_yt | 0:7766f6712673 | 18 | |
yueee_yt | 0:7766f6712673 | 19 | #include "platform.h" |
yueee_yt | 0:7766f6712673 | 20 | #include "parse_pins.h" |
yueee_yt | 0:7766f6712673 | 21 | |
yueee_yt | 0:7766f6712673 | 22 | namespace mbed { |
yueee_yt | 0:7766f6712673 | 23 | |
yueee_yt | 0:7766f6712673 | 24 | #define RPC_MAX_STRING 128 |
yueee_yt | 0:7766f6712673 | 25 | #define RPC_MAX_ARGS 16 |
yueee_yt | 0:7766f6712673 | 26 | |
yueee_yt | 0:7766f6712673 | 27 | class Arguments { |
yueee_yt | 0:7766f6712673 | 28 | public: |
yueee_yt | 0:7766f6712673 | 29 | Arguments(const char* rqs); |
yueee_yt | 0:7766f6712673 | 30 | |
yueee_yt | 0:7766f6712673 | 31 | template<typename Arg> |
yueee_yt | 0:7766f6712673 | 32 | Arg getArg(void); |
yueee_yt | 0:7766f6712673 | 33 | |
yueee_yt | 0:7766f6712673 | 34 | char *obj_name; |
yueee_yt | 0:7766f6712673 | 35 | char *method_name; |
yueee_yt | 0:7766f6712673 | 36 | |
yueee_yt | 0:7766f6712673 | 37 | int argc; |
yueee_yt | 0:7766f6712673 | 38 | char* argv[RPC_MAX_ARGS]; |
yueee_yt | 0:7766f6712673 | 39 | |
yueee_yt | 0:7766f6712673 | 40 | private: |
yueee_yt | 0:7766f6712673 | 41 | // This copy can be removed if we can assume the request string is |
yueee_yt | 0:7766f6712673 | 42 | // persistent and writable for the duration of the call |
yueee_yt | 0:7766f6712673 | 43 | char request[RPC_MAX_STRING]; |
yueee_yt | 0:7766f6712673 | 44 | int index; |
yueee_yt | 0:7766f6712673 | 45 | char* search_arg(char **arg, char *p, char next_sep); |
yueee_yt | 0:7766f6712673 | 46 | }; |
yueee_yt | 0:7766f6712673 | 47 | |
yueee_yt | 0:7766f6712673 | 48 | class Reply { |
yueee_yt | 0:7766f6712673 | 49 | public: |
yueee_yt | 0:7766f6712673 | 50 | Reply(char* r); |
yueee_yt | 0:7766f6712673 | 51 | |
yueee_yt | 0:7766f6712673 | 52 | template<typename Data> |
yueee_yt | 0:7766f6712673 | 53 | void putData(Data d); |
yueee_yt | 0:7766f6712673 | 54 | |
yueee_yt | 0:7766f6712673 | 55 | private: |
yueee_yt | 0:7766f6712673 | 56 | void separator(void); |
yueee_yt | 0:7766f6712673 | 57 | bool first; |
yueee_yt | 0:7766f6712673 | 58 | char* reply; |
yueee_yt | 0:7766f6712673 | 59 | }; |
yueee_yt | 0:7766f6712673 | 60 | |
yueee_yt | 0:7766f6712673 | 61 | |
yueee_yt | 0:7766f6712673 | 62 | } // Namespace mbed |
yueee_yt | 0:7766f6712673 | 63 | |
yueee_yt | 0:7766f6712673 | 64 | #endif |