For bug fixes
Fork of MTS-Socket by
Transport.h@2:ebc6129de4e8, 2014-05-20 (annotated)
- Committer:
- Mike Fiore
- Date:
- Tue May 20 16:12:17 2014 -0500
- Revision:
- 2:ebc6129de4e8
- Parent:
- 1:096f484f3ae6
include mbed.h in cpp files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mfiore | 0:eef30dbe1130 | 1 | #ifndef TRANSPORT_H |
mfiore | 0:eef30dbe1130 | 2 | #define TRANSPORT_H |
mfiore | 0:eef30dbe1130 | 3 | |
Mike Fiore |
1:096f484f3ae6 | 4 | #include "IPStack.h" |
Mike Fiore |
1:096f484f3ae6 | 5 | |
Mike Fiore |
1:096f484f3ae6 | 6 | /** This class has been added to the standard mbed Socket library enabling people |
Mike Fiore |
1:096f484f3ae6 | 7 | * to use the Socket library interfaces for different transports. Use this class prior |
Mike Fiore |
1:096f484f3ae6 | 8 | * to instantiating any of the other classes in this folder to determine the underlying |
Mike Fiore |
1:096f484f3ae6 | 9 | * transport that will be used by them. It is important to know that the transport classes |
Mike Fiore |
1:096f484f3ae6 | 10 | * themsleves which derive from IPStack.h, must be properly initialized and connected before any |
Mike Fiore |
1:096f484f3ae6 | 11 | * of the Socket package classes can be used. |
Mike Fiore |
1:096f484f3ae6 | 12 | */ |
Mike Fiore |
1:096f484f3ae6 | 13 | class Transport |
Mike Fiore |
1:096f484f3ae6 | 14 | { |
Mike Fiore |
1:096f484f3ae6 | 15 | public: |
Mike Fiore |
1:096f484f3ae6 | 16 | /** This method allows you to set the transport to be used when creatin other |
Mike Fiore |
1:096f484f3ae6 | 17 | * objects from the Socket folder like TCPSocketConnection and UDPSocket. |
Mike Fiore |
1:096f484f3ae6 | 18 | * |
Mike Fiore |
1:096f484f3ae6 | 19 | * @param type the type of underlying transport to be used as an IPStack object. |
Mike Fiore |
1:096f484f3ae6 | 20 | */ |
Mike Fiore |
1:096f484f3ae6 | 21 | static void setTransport(IPStack* type); |
Mike Fiore |
1:096f484f3ae6 | 22 | |
Mike Fiore |
1:096f484f3ae6 | 23 | /** This method is used within the Socket class to get the appropraite transport |
Mike Fiore |
1:096f484f3ae6 | 24 | * as an IPStack object. In general you do not need to call this directly, but |
Mike Fiore |
1:096f484f3ae6 | 25 | * simply use the other classes in this folder. |
Mike Fiore |
1:096f484f3ae6 | 26 | * |
Mike Fiore |
1:096f484f3ae6 | 27 | * @returns a pointer to an object that implements IPStack. |
Mike Fiore |
1:096f484f3ae6 | 28 | */ |
Mike Fiore |
1:096f484f3ae6 | 29 | static IPStack* getInstance(); |
Mike Fiore |
1:096f484f3ae6 | 30 | |
Mike Fiore |
1:096f484f3ae6 | 31 | private: |
Mike Fiore |
1:096f484f3ae6 | 32 | static IPStack* transport; //Member variable that holds an custom transport type. |
Mike Fiore |
1:096f484f3ae6 | 33 | }; |
Mike Fiore |
1:096f484f3ae6 | 34 | |
Mike Fiore |
1:096f484f3ae6 | 35 | #endif /* TRANSPORT_H */ |