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