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
Diff: Socket/Transport.h
- Revision:
- 66:a170496ec5cf
- Child:
- 113:7238f9b8db17
diff -r ed113472b2c1 -r a170496ec5cf Socket/Transport.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Socket/Transport.h Mon Dec 23 19:07:32 2013 +0000 @@ -0,0 +1,44 @@ +#ifndef TRANSPORT_H +#define TRANSPORT_H + +#include "mbed.h" +#include "IPStack.h" + +using namespace mts; + +/** This class has been added to the standard mbed Socket library enabling people +* to use the Socket library interfaces for different transports that have +* their own internal IP-Stack. Use this class prior to instantiating any of the +* other classes in this folder to determine the underlying transport that will +* be used by them. It is important to know that the transport classes themsleves +* like Cellular or WiFi, must be properly initialized and connected before any +* of the Socket package classes can be used or even instantiated. +*/ +class Transport +{ +public: + ///An enumeration that holds the supported Transport Types. + enum TransportType { + CELLULAR, WIFI + }; + + /** This method allows you to set the transport to be used when creating other + * objects from the Socket folder like TCPSocketConnection and UDPSocket. + * + * @param type the type of underlying transport to be used. + */ + static void setTransport(TransportType type); + + /** This method is used within the Socket class to get the appropraite transport + * as an IPStack object. In general you do not need to call this directly, but + * simply use the other classes in this folder. + * + * @returns a pointer to an object that implements IPStack. + */ + static IPStack* getInstance(); + +private: + static Transport::TransportType _type; // Member variable that holds the desired transport +}; + +#endif /* TRANSPORT_H */ \ No newline at end of file