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