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

Committer:
jengbrecht
Date:
Tue Dec 31 19:57:21 2013 +0000
Revision:
113:7238f9b8db17
Parent:
66:a170496ec5cf
Child:
141:571e0ef6c8dc
Made minor robustness improvements to Wifi close method and added NONE default to the transport class

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jengbrecht 66:a170496ec5cf 1 #ifndef TRANSPORT_H
jengbrecht 66:a170496ec5cf 2 #define TRANSPORT_H
jengbrecht 66:a170496ec5cf 3
jengbrecht 66:a170496ec5cf 4 #include "mbed.h"
jengbrecht 66:a170496ec5cf 5 #include "IPStack.h"
jengbrecht 66:a170496ec5cf 6
jengbrecht 66:a170496ec5cf 7 using namespace mts;
jengbrecht 66:a170496ec5cf 8
jengbrecht 66:a170496ec5cf 9 /** This class has been added to the standard mbed Socket library enabling people
jengbrecht 66:a170496ec5cf 10 * to use the Socket library interfaces for different transports that have
jengbrecht 66:a170496ec5cf 11 * their own internal IP-Stack. Use this class prior to instantiating any of the
jengbrecht 66:a170496ec5cf 12 * other classes in this folder to determine the underlying transport that will
jengbrecht 66:a170496ec5cf 13 * be used by them. It is important to know that the transport classes themsleves
jengbrecht 66:a170496ec5cf 14 * like Cellular or WiFi, must be properly initialized and connected before any
jengbrecht 66:a170496ec5cf 15 * of the Socket package classes can be used or even instantiated.
jengbrecht 66:a170496ec5cf 16 */
jengbrecht 66:a170496ec5cf 17 class Transport
jengbrecht 66:a170496ec5cf 18 {
jengbrecht 66:a170496ec5cf 19 public:
jengbrecht 66:a170496ec5cf 20 ///An enumeration that holds the supported Transport Types.
jengbrecht 66:a170496ec5cf 21 enum TransportType {
jengbrecht 113:7238f9b8db17 22 CELLULAR, WIFI, NONE
jengbrecht 66:a170496ec5cf 23 };
jengbrecht 66:a170496ec5cf 24
jengbrecht 66:a170496ec5cf 25 /** This method allows you to set the transport to be used when creating other
jengbrecht 66:a170496ec5cf 26 * objects from the Socket folder like TCPSocketConnection and UDPSocket.
jengbrecht 66:a170496ec5cf 27 *
jengbrecht 113:7238f9b8db17 28 * @param type the type of underlying transport to be used. The default is NONE.
jengbrecht 66:a170496ec5cf 29 */
jengbrecht 66:a170496ec5cf 30 static void setTransport(TransportType type);
jengbrecht 66:a170496ec5cf 31
jengbrecht 66:a170496ec5cf 32 /** This method is used within the Socket class to get the appropraite transport
jengbrecht 66:a170496ec5cf 33 * as an IPStack object. In general you do not need to call this directly, but
jengbrecht 66:a170496ec5cf 34 * simply use the other classes in this folder.
jengbrecht 66:a170496ec5cf 35 *
jengbrecht 66:a170496ec5cf 36 * @returns a pointer to an object that implements IPStack.
jengbrecht 66:a170496ec5cf 37 */
jengbrecht 66:a170496ec5cf 38 static IPStack* getInstance();
jengbrecht 66:a170496ec5cf 39
jengbrecht 66:a170496ec5cf 40 private:
jengbrecht 66:a170496ec5cf 41 static Transport::TransportType _type; // Member variable that holds the desired transport
jengbrecht 66:a170496ec5cf 42 };
jengbrecht 66:a170496ec5cf 43
jengbrecht 66:a170496ec5cf 44 #endif /* TRANSPORT_H */