Integrating the ublox LISA C200 modem

Fork of SprintUSBModemHTTPClientTest by Donatien Garnier

Committer:
sam_grove
Date:
Thu Sep 26 00:44:20 2013 -0500
Revision:
5:3f93dd1d4cb3
Exported program and replaced contents of the repo with the source
to build and debug using keil mdk. Libs NOT upto date are lwip, lwip-sys
and socket. these have newer versions under mbed_official but were starting
from a know working point

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sam_grove 5:3f93dd1d4cb3 1 /* mbed Microcontroller Library
sam_grove 5:3f93dd1d4cb3 2 * Copyright (c) 2006-2013 ARM Limited
sam_grove 5:3f93dd1d4cb3 3 *
sam_grove 5:3f93dd1d4cb3 4 * Licensed under the Apache License, Version 2.0 (the "License");
sam_grove 5:3f93dd1d4cb3 5 * you may not use this file except in compliance with the License.
sam_grove 5:3f93dd1d4cb3 6 * You may obtain a copy of the License at
sam_grove 5:3f93dd1d4cb3 7 *
sam_grove 5:3f93dd1d4cb3 8 * http://www.apache.org/licenses/LICENSE-2.0
sam_grove 5:3f93dd1d4cb3 9 *
sam_grove 5:3f93dd1d4cb3 10 * Unless required by applicable law or agreed to in writing, software
sam_grove 5:3f93dd1d4cb3 11 * distributed under the License is distributed on an "AS IS" BASIS,
sam_grove 5:3f93dd1d4cb3 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
sam_grove 5:3f93dd1d4cb3 13 * See the License for the specific language governing permissions and
sam_grove 5:3f93dd1d4cb3 14 * limitations under the License.
sam_grove 5:3f93dd1d4cb3 15 */
sam_grove 5:3f93dd1d4cb3 16 #ifndef MBED_CALLCHAIN_H
sam_grove 5:3f93dd1d4cb3 17 #define MBED_CALLCHAIN_H
sam_grove 5:3f93dd1d4cb3 18
sam_grove 5:3f93dd1d4cb3 19 #include "FunctionPointer.h"
sam_grove 5:3f93dd1d4cb3 20 #include <string.h>
sam_grove 5:3f93dd1d4cb3 21
sam_grove 5:3f93dd1d4cb3 22 namespace mbed {
sam_grove 5:3f93dd1d4cb3 23
sam_grove 5:3f93dd1d4cb3 24 /** Group one or more functions in an instance of a CallChain, then call them in
sam_grove 5:3f93dd1d4cb3 25 * sequence using CallChain::call(). Used mostly by the interrupt chaining code,
sam_grove 5:3f93dd1d4cb3 26 * but can be used for other purposes.
sam_grove 5:3f93dd1d4cb3 27 *
sam_grove 5:3f93dd1d4cb3 28 * Example:
sam_grove 5:3f93dd1d4cb3 29 * @code
sam_grove 5:3f93dd1d4cb3 30 * #include "mbed.h"
sam_grove 5:3f93dd1d4cb3 31 *
sam_grove 5:3f93dd1d4cb3 32 * CallChain chain;
sam_grove 5:3f93dd1d4cb3 33 *
sam_grove 5:3f93dd1d4cb3 34 * void first(void) {
sam_grove 5:3f93dd1d4cb3 35 * printf("'first' function.\n");
sam_grove 5:3f93dd1d4cb3 36 * }
sam_grove 5:3f93dd1d4cb3 37 *
sam_grove 5:3f93dd1d4cb3 38 * void second(void) {
sam_grove 5:3f93dd1d4cb3 39 * printf("'second' function.\n");
sam_grove 5:3f93dd1d4cb3 40 * }
sam_grove 5:3f93dd1d4cb3 41 *
sam_grove 5:3f93dd1d4cb3 42 * class Test {
sam_grove 5:3f93dd1d4cb3 43 * public:
sam_grove 5:3f93dd1d4cb3 44 * void f(void) {
sam_grove 5:3f93dd1d4cb3 45 * printf("A::f (class member).\n");
sam_grove 5:3f93dd1d4cb3 46 * }
sam_grove 5:3f93dd1d4cb3 47 * };
sam_grove 5:3f93dd1d4cb3 48 *
sam_grove 5:3f93dd1d4cb3 49 * int main() {
sam_grove 5:3f93dd1d4cb3 50 * Test test;
sam_grove 5:3f93dd1d4cb3 51 *
sam_grove 5:3f93dd1d4cb3 52 * chain.add(second);
sam_grove 5:3f93dd1d4cb3 53 * chain.add_front(first);
sam_grove 5:3f93dd1d4cb3 54 * chain.add(&test, &Test::f);
sam_grove 5:3f93dd1d4cb3 55 * chain.call();
sam_grove 5:3f93dd1d4cb3 56 * }
sam_grove 5:3f93dd1d4cb3 57 * @endcode
sam_grove 5:3f93dd1d4cb3 58 */
sam_grove 5:3f93dd1d4cb3 59
sam_grove 5:3f93dd1d4cb3 60 typedef FunctionPointer* pFunctionPointer_t;
sam_grove 5:3f93dd1d4cb3 61
sam_grove 5:3f93dd1d4cb3 62 class CallChain {
sam_grove 5:3f93dd1d4cb3 63 public:
sam_grove 5:3f93dd1d4cb3 64 /** Create an empty chain
sam_grove 5:3f93dd1d4cb3 65 *
sam_grove 5:3f93dd1d4cb3 66 * @param size (optional) Initial size of the chain
sam_grove 5:3f93dd1d4cb3 67 */
sam_grove 5:3f93dd1d4cb3 68 CallChain(int size = 4);
sam_grove 5:3f93dd1d4cb3 69 virtual ~CallChain();
sam_grove 5:3f93dd1d4cb3 70
sam_grove 5:3f93dd1d4cb3 71 /** Add a function at the end of the chain
sam_grove 5:3f93dd1d4cb3 72 *
sam_grove 5:3f93dd1d4cb3 73 * @param function A pointer to a void function
sam_grove 5:3f93dd1d4cb3 74 *
sam_grove 5:3f93dd1d4cb3 75 * @returns
sam_grove 5:3f93dd1d4cb3 76 * The function object created for 'function'
sam_grove 5:3f93dd1d4cb3 77 */
sam_grove 5:3f93dd1d4cb3 78 pFunctionPointer_t add(void (*function)(void));
sam_grove 5:3f93dd1d4cb3 79
sam_grove 5:3f93dd1d4cb3 80 /** Add a function at the end of the chain
sam_grove 5:3f93dd1d4cb3 81 *
sam_grove 5:3f93dd1d4cb3 82 * @param tptr pointer to the object to call the member function on
sam_grove 5:3f93dd1d4cb3 83 * @param mptr pointer to the member function to be called
sam_grove 5:3f93dd1d4cb3 84 *
sam_grove 5:3f93dd1d4cb3 85 * @returns
sam_grove 5:3f93dd1d4cb3 86 * The function object created for 'tptr' and 'mptr'
sam_grove 5:3f93dd1d4cb3 87 */
sam_grove 5:3f93dd1d4cb3 88 template<typename T>
sam_grove 5:3f93dd1d4cb3 89 pFunctionPointer_t add(T *tptr, void (T::*mptr)(void)) {
sam_grove 5:3f93dd1d4cb3 90 return common_add(new FunctionPointer(tptr, mptr));
sam_grove 5:3f93dd1d4cb3 91 }
sam_grove 5:3f93dd1d4cb3 92
sam_grove 5:3f93dd1d4cb3 93 /** Add a function at the beginning of the chain
sam_grove 5:3f93dd1d4cb3 94 *
sam_grove 5:3f93dd1d4cb3 95 * @param function A pointer to a void function
sam_grove 5:3f93dd1d4cb3 96 *
sam_grove 5:3f93dd1d4cb3 97 * @returns
sam_grove 5:3f93dd1d4cb3 98 * The function object created for 'function'
sam_grove 5:3f93dd1d4cb3 99 */
sam_grove 5:3f93dd1d4cb3 100 pFunctionPointer_t add_front(void (*function)(void));
sam_grove 5:3f93dd1d4cb3 101
sam_grove 5:3f93dd1d4cb3 102 /** Add a function at the beginning of the chain
sam_grove 5:3f93dd1d4cb3 103 *
sam_grove 5:3f93dd1d4cb3 104 * @param tptr pointer to the object to call the member function on
sam_grove 5:3f93dd1d4cb3 105 * @param mptr pointer to the member function to be called
sam_grove 5:3f93dd1d4cb3 106 *
sam_grove 5:3f93dd1d4cb3 107 * @returns
sam_grove 5:3f93dd1d4cb3 108 * The function object created for 'tptr' and 'mptr'
sam_grove 5:3f93dd1d4cb3 109 */
sam_grove 5:3f93dd1d4cb3 110 template<typename T>
sam_grove 5:3f93dd1d4cb3 111 pFunctionPointer_t add_front(T *tptr, void (T::*mptr)(void)) {
sam_grove 5:3f93dd1d4cb3 112 return common_add_front(new FunctionPointer(tptr, mptr));
sam_grove 5:3f93dd1d4cb3 113 }
sam_grove 5:3f93dd1d4cb3 114
sam_grove 5:3f93dd1d4cb3 115 /** Get the number of functions in the chain
sam_grove 5:3f93dd1d4cb3 116 */
sam_grove 5:3f93dd1d4cb3 117 int size() const;
sam_grove 5:3f93dd1d4cb3 118
sam_grove 5:3f93dd1d4cb3 119 /** Get a function object from the chain
sam_grove 5:3f93dd1d4cb3 120 *
sam_grove 5:3f93dd1d4cb3 121 * @param i function object index
sam_grove 5:3f93dd1d4cb3 122 *
sam_grove 5:3f93dd1d4cb3 123 * @returns
sam_grove 5:3f93dd1d4cb3 124 * The function object at position 'i' in the chain
sam_grove 5:3f93dd1d4cb3 125 */
sam_grove 5:3f93dd1d4cb3 126 pFunctionPointer_t get(int i) const;
sam_grove 5:3f93dd1d4cb3 127
sam_grove 5:3f93dd1d4cb3 128 /** Look for a function object in the call chain
sam_grove 5:3f93dd1d4cb3 129 *
sam_grove 5:3f93dd1d4cb3 130 * @param f the function object to search
sam_grove 5:3f93dd1d4cb3 131 *
sam_grove 5:3f93dd1d4cb3 132 * @returns
sam_grove 5:3f93dd1d4cb3 133 * The index of the function object if found, -1 otherwise.
sam_grove 5:3f93dd1d4cb3 134 */
sam_grove 5:3f93dd1d4cb3 135 int find(pFunctionPointer_t f) const;
sam_grove 5:3f93dd1d4cb3 136
sam_grove 5:3f93dd1d4cb3 137 /** Clear the call chain (remove all functions in the chain).
sam_grove 5:3f93dd1d4cb3 138 */
sam_grove 5:3f93dd1d4cb3 139 void clear();
sam_grove 5:3f93dd1d4cb3 140
sam_grove 5:3f93dd1d4cb3 141 /** Remove a function object from the chain
sam_grove 5:3f93dd1d4cb3 142 *
sam_grove 5:3f93dd1d4cb3 143 * @arg f the function object to remove
sam_grove 5:3f93dd1d4cb3 144 *
sam_grove 5:3f93dd1d4cb3 145 * @returns
sam_grove 5:3f93dd1d4cb3 146 * true if the function object was found and removed, false otherwise.
sam_grove 5:3f93dd1d4cb3 147 */
sam_grove 5:3f93dd1d4cb3 148 bool remove(pFunctionPointer_t f);
sam_grove 5:3f93dd1d4cb3 149
sam_grove 5:3f93dd1d4cb3 150 /** Call all the functions in the chain in sequence
sam_grove 5:3f93dd1d4cb3 151 */
sam_grove 5:3f93dd1d4cb3 152 void call();
sam_grove 5:3f93dd1d4cb3 153
sam_grove 5:3f93dd1d4cb3 154 #ifdef MBED_OPERATORS
sam_grove 5:3f93dd1d4cb3 155 void operator ()(void) {
sam_grove 5:3f93dd1d4cb3 156 call();
sam_grove 5:3f93dd1d4cb3 157 }
sam_grove 5:3f93dd1d4cb3 158 pFunctionPointer_t operator [](int i) const {
sam_grove 5:3f93dd1d4cb3 159 return get(i);
sam_grove 5:3f93dd1d4cb3 160 }
sam_grove 5:3f93dd1d4cb3 161 #endif
sam_grove 5:3f93dd1d4cb3 162
sam_grove 5:3f93dd1d4cb3 163 private:
sam_grove 5:3f93dd1d4cb3 164 void _check_size();
sam_grove 5:3f93dd1d4cb3 165 pFunctionPointer_t common_add(pFunctionPointer_t pf);
sam_grove 5:3f93dd1d4cb3 166 pFunctionPointer_t common_add_front(pFunctionPointer_t pf);
sam_grove 5:3f93dd1d4cb3 167
sam_grove 5:3f93dd1d4cb3 168 pFunctionPointer_t* _chain;
sam_grove 5:3f93dd1d4cb3 169 int _size;
sam_grove 5:3f93dd1d4cb3 170 int _elements;
sam_grove 5:3f93dd1d4cb3 171 };
sam_grove 5:3f93dd1d4cb3 172
sam_grove 5:3f93dd1d4cb3 173 } // namespace mbed
sam_grove 5:3f93dd1d4cb3 174
sam_grove 5:3f93dd1d4cb3 175 #endif
sam_grove 5:3f93dd1d4cb3 176