Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CellularDevice.h Source File

CellularDevice.h

00001 /*
00002  * Copyright (c) 2017, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef CELLULAR_DEVICE_H_
00019 #define CELLULAR_DEVICE_H_
00020 
00021 #include "FileHandle.h"
00022 
00023 #include "CellularSIM.h"
00024 #include "CellularNetwork.h"
00025 #include "CellularSMS.h"
00026 #include "CellularPower.h"
00027 #include "CellularInformation.h"
00028 #include "NetworkStack.h"
00029 
00030 namespace mbed
00031 {
00032 
00033 /**
00034  *  Class CellularDevice
00035  *
00036  *  An abstract interface that defines opening and closing of cellular interfaces.
00037  *  Deleting/Closing of opened interfaces can be done only via this class.
00038  */
00039 class CellularDevice
00040 {
00041 public:
00042     /** virtual Destructor
00043      */
00044     virtual ~CellularDevice() {}
00045 
00046 public:
00047     /** Create new CellularNetwork interface.
00048      *
00049      *  @param fh    file handle used in communication to modem. Can be for example UART handle.
00050      *  @return      New instance of interface CellularNetwork.
00051      */
00052     virtual CellularNetwork *open_network(FileHandle *fh) = 0;
00053 
00054     /** Create new CellularSMS interface.
00055      *
00056      *  @param fh    file handle used in communication to modem. Can be for example UART handle.
00057      *  @return      New instance of interface CellularSMS.
00058      */
00059     virtual CellularSMS *open_sms(FileHandle *fh) = 0;
00060 
00061     /** Create new CellularPower interface.
00062      *
00063      *  @param fh    file handle used in communication to modem. Can be for example UART handle.
00064      *  @return      New instance of interface CellularPower.
00065      */
00066     virtual CellularPower *open_power(FileHandle *fh) = 0;
00067 
00068     /** Create new CellularSIM interface.
00069      *
00070      *  @param fh    file handle used in communication to modem. Can be for example UART handle.
00071      *  @return      New instance of interface CellularSIM.
00072      */
00073     virtual CellularSIM *open_sim(FileHandle *fh) = 0;
00074 
00075     /** Create new CellularInformation interface.
00076      *
00077      *  @param fh    file handle used in communication to modem. Can be for example UART handle.
00078      *  @return      New instance of interface CellularInformation.
00079      */
00080     virtual CellularInformation *open_information(FileHandle *fh) = 0;
00081 
00082     /** Closes the opened CellularNetwork by deleting the CellularNetwork instance.
00083      */
00084     virtual void close_network() = 0;
00085 
00086     /** Closes the opened CellularNetwork by deleting the CellularSMS instance.
00087      */
00088     virtual void close_sms() = 0;
00089 
00090     /** Closes the opened CellularNetwork by deleting the CellularPower instance.
00091      */
00092     virtual void close_power() = 0;
00093 
00094     /** Closes the opened CellularNetwork by deleting the CellularSIM instance.
00095      */
00096     virtual void close_sim() = 0;
00097 
00098     /** Closes the opened CellularNetwork by deleting the CellularInformation instance.
00099      */
00100     virtual void close_information() = 0;
00101 
00102     /** Set the default response timeout.
00103      *
00104      *  @param timeout    milliseconds to wait response from modem
00105      */
00106     virtual void set_timeout(int timeout) = 0;
00107 
00108     /** Turn modem debug traces on
00109      *
00110      *  @param on         set true to enable debug traces
00111      */
00112     virtual void modem_debug_on(bool on) = 0;
00113 
00114     /** Get network stack.
00115      *
00116      *  @return network stack
00117      */
00118     virtual NetworkStack *get_stack() = 0;
00119 };
00120 
00121 } // namespace mbed
00122 
00123 #endif // CELLULAR_DEVICE_H_