Kenji Arai / TYBLE16_mbedlized_os5_several_examples_1st

Dependencies:   nRF51_Vdd TextLCD BME280

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  *  Class CellularDevice
00034  *
00035  *  An abstract interface that defines opening and closing of cellular interfaces.
00036  *  Deleting/Closing of opened interfaces can be done only via this class.
00037  */
00038 class CellularDevice {
00039 public:
00040     /** virtual Destructor
00041      */
00042     virtual ~CellularDevice() {}
00043 
00044 public:
00045     /** Create new CellularNetwork interface.
00046      *
00047      *  @param fh    file handle used in communication to modem. Can be for example UART handle.
00048      *  @return      New instance of interface CellularNetwork.
00049      */
00050     virtual CellularNetwork *open_network(FileHandle *fh) = 0;
00051 
00052     /** Create new CellularSMS interface.
00053      *
00054      *  @param fh    file handle used in communication to modem. Can be for example UART handle.
00055      *  @return      New instance of interface CellularSMS.
00056      */
00057     virtual CellularSMS *open_sms(FileHandle *fh) = 0;
00058 
00059     /** Create new CellularPower interface.
00060      *
00061      *  @param fh    file handle used in communication to modem. Can be for example UART handle.
00062      *  @return      New instance of interface CellularPower.
00063      */
00064     virtual CellularPower *open_power(FileHandle *fh) = 0;
00065 
00066     /** Create new CellularSIM interface.
00067      *
00068      *  @param fh    file handle used in communication to modem. Can be for example UART handle.
00069      *  @return      New instance of interface CellularSIM.
00070      */
00071     virtual CellularSIM *open_sim(FileHandle *fh) = 0;
00072 
00073     /** Create new CellularInformation interface.
00074      *
00075      *  @param fh    file handle used in communication to modem. Can be for example UART handle.
00076      *  @return      New instance of interface CellularInformation.
00077      */
00078     virtual CellularInformation *open_information(FileHandle *fh) = 0;
00079 
00080     /** Closes the opened CellularNetwork by deleting the CellularNetwork instance.
00081      */
00082     virtual void close_network() = 0;
00083 
00084     /** Closes the opened CellularSMS by deleting the CellularSMS instance.
00085      */
00086     virtual void close_sms() = 0;
00087 
00088     /** Closes the opened CellularPower by deleting the CellularPower instance.
00089      */
00090     virtual void close_power() = 0;
00091 
00092     /** Closes the opened CellularSIM by deleting the CellularSIM instance.
00093      */
00094     virtual void close_sim() = 0;
00095 
00096     /** Closes the opened CellularInformation by deleting the CellularInformation instance.
00097      */
00098     virtual void close_information() = 0;
00099 
00100     /** Set the default response timeout.
00101      *
00102      *  @param timeout    milliseconds to wait response from modem
00103      */
00104     virtual void set_timeout(int timeout) = 0;
00105 
00106     /** Turn modem debug traces on
00107      *
00108      *  @param on         set true to enable debug traces
00109      */
00110     virtual void modem_debug_on(bool on) = 0;
00111 
00112     /** Get network stack.
00113      *
00114      *  @return network stack
00115      */
00116     virtual NetworkStack *get_stack() = 0;
00117 
00118     /** Initialize cellular module must be called right after module is ready.
00119      *  For example, when multiple modules are supported in a single AT driver this function detects
00120      *  and adapts to an actual module at runtime.
00121      *
00122      *  @param fh    file handle used in communication to modem.
00123      *
00124      *  @return 0 on success
00125      */
00126     virtual nsapi_error_t init_module(FileHandle *fh) = 0;
00127 };
00128 
00129 } // namespace mbed
00130 
00131 #endif // CELLULAR_DEVICE_H_