BA / SerialCom

Fork of OmniWheels by Gustav Atmel

Committer:
gustavatmel
Date:
Tue May 01 15:47:08 2018 +0000
Revision:
1:9c5af431a1f1
sdf

Who changed what in which revision?

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