STM32F103

Fork of mbed-rpc by Mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Arguments.h Source File

Arguments.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2006-2013 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #ifndef ARGUMENTS_H
00017 #define ARGUMENTS_H
00018 
00019 #include "platform.h"
00020 #include "parse_pins.h"
00021 
00022 namespace mbed {
00023 
00024 #define RPC_MAX_STRING  128
00025 #define RPC_MAX_ARGS     16
00026 
00027 class Arguments {
00028 public:
00029     Arguments(const char* rqs);
00030 
00031     template<typename Arg>
00032     Arg   getArg(void);
00033 
00034     char *obj_name;
00035     char *method_name;
00036 
00037     int   argc;
00038     char* argv[RPC_MAX_ARGS];
00039 
00040 private:
00041     // This copy can be removed if we can assume the request string is
00042     // persistent and writable for the duration of the call
00043     char  request[RPC_MAX_STRING];
00044     int index;
00045     char* search_arg(char **arg, char *p, char next_sep);
00046 };
00047 
00048 class Reply {
00049 public:
00050     Reply(char* r);
00051 
00052     template<typename Data>
00053     void putData(Data d);
00054 
00055 private:
00056     void separator(void);
00057     bool first;
00058     char* reply;
00059 };
00060 
00061 
00062 } // Namespace mbed
00063 
00064 #endif