Minimalistischer Remote Procedure Call (RPC) HTTP Server V2

Dependencies:   EthernetInterface HttpServer OLEDDisplay mbed-rtos mbed

Fork of RPCHTTPServerSimple by smd.iotkit2.ch

Committer:
stefan1691
Date:
Wed Apr 08 12:31:41 2015 +0000
Revision:
11:43e28c85fd75
Korrektur AnalogIn laut . https://developer.mbed.org/questions/3897/AnalogIn-not-working-in-rpc/

Who changed what in which revision?

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