A library for talking to Multi-Tech's Cellular SocketModem Devices.
Dependents: M2X_dev axeda_wrapper_dev MTS_M2x_Example1 MTS_Cellular_Connect_Example ... more
Socket/Transport.h@141:571e0ef6c8dc, 2014-01-04 (annotated)
- Committer:
- kranjan
- Date:
- Sat Jan 04 05:28:45 2014 +0000
- Revision:
- 141:571e0ef6c8dc
- Parent:
- 113:7238f9b8db17
- Child:
- 146:efc4db23a564
Added licensing header to all files in the library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kranjan | 141:571e0ef6c8dc | 1 | /* Universal Socket Modem Interface Library |
kranjan | 141:571e0ef6c8dc | 2 | * Copyright (c) 2013 Multi-Tech Systems |
kranjan | 141:571e0ef6c8dc | 3 | * |
kranjan | 141:571e0ef6c8dc | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
kranjan | 141:571e0ef6c8dc | 5 | * you may not use this file except in compliance with the License. |
kranjan | 141:571e0ef6c8dc | 6 | * You may obtain a copy of the License at |
kranjan | 141:571e0ef6c8dc | 7 | * |
kranjan | 141:571e0ef6c8dc | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
kranjan | 141:571e0ef6c8dc | 9 | * |
kranjan | 141:571e0ef6c8dc | 10 | * Unless required by applicable law or agreed to in writing, software |
kranjan | 141:571e0ef6c8dc | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
kranjan | 141:571e0ef6c8dc | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
kranjan | 141:571e0ef6c8dc | 13 | * See the License for the specific language governing permissions and |
kranjan | 141:571e0ef6c8dc | 14 | * limitations under the License. |
kranjan | 141:571e0ef6c8dc | 15 | */ |
kranjan | 141:571e0ef6c8dc | 16 | |
jengbrecht | 66:a170496ec5cf | 17 | #ifndef TRANSPORT_H |
jengbrecht | 66:a170496ec5cf | 18 | #define TRANSPORT_H |
jengbrecht | 66:a170496ec5cf | 19 | |
jengbrecht | 66:a170496ec5cf | 20 | #include "mbed.h" |
jengbrecht | 66:a170496ec5cf | 21 | #include "IPStack.h" |
jengbrecht | 66:a170496ec5cf | 22 | |
jengbrecht | 66:a170496ec5cf | 23 | using namespace mts; |
jengbrecht | 66:a170496ec5cf | 24 | |
jengbrecht | 66:a170496ec5cf | 25 | /** This class has been added to the standard mbed Socket library enabling people |
jengbrecht | 66:a170496ec5cf | 26 | * to use the Socket library interfaces for different transports that have |
jengbrecht | 66:a170496ec5cf | 27 | * their own internal IP-Stack. Use this class prior to instantiating any of the |
jengbrecht | 66:a170496ec5cf | 28 | * other classes in this folder to determine the underlying transport that will |
jengbrecht | 66:a170496ec5cf | 29 | * be used by them. It is important to know that the transport classes themsleves |
jengbrecht | 66:a170496ec5cf | 30 | * like Cellular or WiFi, must be properly initialized and connected before any |
jengbrecht | 66:a170496ec5cf | 31 | * of the Socket package classes can be used or even instantiated. |
jengbrecht | 66:a170496ec5cf | 32 | */ |
jengbrecht | 66:a170496ec5cf | 33 | class Transport |
jengbrecht | 66:a170496ec5cf | 34 | { |
jengbrecht | 66:a170496ec5cf | 35 | public: |
jengbrecht | 66:a170496ec5cf | 36 | ///An enumeration that holds the supported Transport Types. |
jengbrecht | 66:a170496ec5cf | 37 | enum TransportType { |
jengbrecht | 113:7238f9b8db17 | 38 | CELLULAR, WIFI, NONE |
jengbrecht | 66:a170496ec5cf | 39 | }; |
jengbrecht | 66:a170496ec5cf | 40 | |
jengbrecht | 66:a170496ec5cf | 41 | /** This method allows you to set the transport to be used when creating other |
jengbrecht | 66:a170496ec5cf | 42 | * objects from the Socket folder like TCPSocketConnection and UDPSocket. |
jengbrecht | 66:a170496ec5cf | 43 | * |
jengbrecht | 113:7238f9b8db17 | 44 | * @param type the type of underlying transport to be used. The default is NONE. |
jengbrecht | 66:a170496ec5cf | 45 | */ |
jengbrecht | 66:a170496ec5cf | 46 | static void setTransport(TransportType type); |
jengbrecht | 66:a170496ec5cf | 47 | |
jengbrecht | 66:a170496ec5cf | 48 | /** This method is used within the Socket class to get the appropraite transport |
jengbrecht | 66:a170496ec5cf | 49 | * as an IPStack object. In general you do not need to call this directly, but |
jengbrecht | 66:a170496ec5cf | 50 | * simply use the other classes in this folder. |
jengbrecht | 66:a170496ec5cf | 51 | * |
jengbrecht | 66:a170496ec5cf | 52 | * @returns a pointer to an object that implements IPStack. |
jengbrecht | 66:a170496ec5cf | 53 | */ |
jengbrecht | 66:a170496ec5cf | 54 | static IPStack* getInstance(); |
jengbrecht | 66:a170496ec5cf | 55 | |
jengbrecht | 66:a170496ec5cf | 56 | private: |
jengbrecht | 66:a170496ec5cf | 57 | static Transport::TransportType _type; // Member variable that holds the desired transport |
jengbrecht | 66:a170496ec5cf | 58 | }; |
jengbrecht | 66:a170496ec5cf | 59 | |
jengbrecht | 66:a170496ec5cf | 60 | #endif /* TRANSPORT_H */ |