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
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 IPStack* Transport::customType = NULL; 00024 00025 void Transport::setTransport(TransportType type) 00026 { 00027 if (type == CUSTOM) { 00028 printf("[ERROR] Transport not set, use other setTransport method for setting custom type.\n\r"); 00029 return; 00030 } 00031 _type = type; 00032 } 00033 00034 void Transport::setTransport(IPStack* type) 00035 { 00036 customType = type; 00037 _type = CUSTOM; 00038 } 00039 00040 IPStack* Transport::getInstance() 00041 { 00042 switch (_type) { 00043 case CELLULAR: 00044 return (IPStack*) Cellular::getInstance(); 00045 case WIFI: 00046 return (IPStack*) Wifi::getInstance(); 00047 case CUSTOM: 00048 return customType; 00049 default: 00050 printf("[ERROR] Transport not set, use setTransport method.\n\r"); 00051 return NULL; 00052 } 00053 } 00054
Generated on Tue Jul 12 2022 21:46:23 by 1.7.2