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 revert by Axeda Corp

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Transport.cpp Source File

Transport.cpp

00001 /* Universal Socket Modem Interface Library
00002 * Copyright (c) 2013 Multi-Tech Systems
00003 *
00004 * Licensed under the Apache License, Version 2.0 (the "License");
00005 * you may not use this file except in compliance with the License.
00006 * You may obtain a copy of the License at
00007 *
00008 *     http://www.apache.org/licenses/LICENSE-2.0
00009 *
00010 * Unless required by applicable law or agreed to in writing, software
00011 * distributed under the License is distributed on an "AS IS" BASIS,
00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013 * See the License for the specific language governing permissions and
00014 * limitations under the License.
00015 */
00016 
00017 #include "Transport.h"
00018 #include "Cellular.h"
00019 #include "Wifi.h"
00020 
00021 Transport::TransportType Transport::_type = Transport::NONE;
00022 
00023 void Transport::setTransport(TransportType type)
00024 {
00025     _type = type;
00026 }
00027 
00028 IPStack* Transport::getInstance()
00029 {
00030     switch (_type) {
00031         case CELLULAR:
00032             return (IPStack*) Cellular::getInstance();
00033         case WIFI:
00034             return (IPStack*) Wifi::getInstance();
00035         default:
00036             printf("[ERROR] Transport not set, use setTransport method.\n\r");
00037             return NULL;
00038     }
00039 }
00040