takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers AT_CellularDevice.h Source File

AT_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 AT_CELLULAR_DEVICE_H_
00019 #define AT_CELLULAR_DEVICE_H_
00020 
00021 #include "CellularDevice.h"
00022 
00023 namespace mbed {
00024 
00025 class ATHandler;
00026 class AT_CellularInformation;
00027 class AT_CellularNetwork;
00028 class AT_CellularPower;
00029 class AT_CellularSIM;
00030 class AT_CellularSMS;
00031 
00032 /**
00033  *  Class AT_CellularDevice
00034  *
00035  *  A class defines opening and closing of cellular interfaces.
00036  *  Deleting/Closing of opened interfaces can be done only through this class.
00037  */
00038 class AT_CellularDevice : public CellularDevice {
00039 public:
00040     AT_CellularDevice(events::EventQueue &queue);
00041     virtual ~AT_CellularDevice();
00042 
00043 protected:
00044     ATHandler *_atHandlers;
00045 
00046     ATHandler *get_at_handler(FileHandle *fh);
00047 
00048     /** Releases the given at_handler. If last reference to at_hander then it's deleted.
00049      *
00050      *  @param at_handler
00051      */
00052     void release_at_handler(ATHandler *at_handler);
00053 
00054 public: // CellularDevice
00055 
00056     virtual events::EventQueue *get_queue() const;
00057 
00058     virtual CellularNetwork *open_network(FileHandle *fh);
00059 
00060     virtual CellularSMS *open_sms(FileHandle *fh);
00061 
00062     virtual CellularPower *open_power(FileHandle *fh);
00063 
00064     virtual CellularSIM *open_sim(FileHandle *fh);
00065 
00066     virtual CellularInformation *open_information(FileHandle *fh);
00067 
00068     virtual void close_network();
00069 
00070     virtual void close_sms();
00071 
00072     virtual void close_power();
00073 
00074     virtual void close_sim();
00075 
00076     virtual void close_information();
00077 
00078     virtual void set_timeout(int timeout);
00079 
00080     virtual uint16_t get_send_delay();
00081 
00082     virtual void modem_debug_on(bool on);
00083 
00084     virtual NetworkStack *get_stack();
00085 
00086     virtual nsapi_error_t init_module(FileHandle *fh);
00087 
00088 protected:
00089     /** Create new instance of AT_CellularNetwork or if overridden, modem specific implementation.
00090      *
00091      *  @param at   ATHandler reference for communication with the modem.
00092      *  @return new instance of class AT_CellularNetwork
00093      */
00094     virtual AT_CellularNetwork *open_network_impl(ATHandler &at);
00095 
00096     /** Create new instance of AT_CellularSMS or if overridden, modem specific implementation.
00097      *
00098      *  @param at   ATHandler reference for communication with the modem.
00099      *  @return new instance of class AT_CellularSMS
00100      */
00101     virtual AT_CellularSMS *open_sms_impl(ATHandler &at);
00102 
00103     /** Create new instance of AT_CellularPower or if overridden, modem specific implementation.
00104      *
00105      *  @param at   ATHandler reference for communication with the modem.
00106      *  @return new instance of class AT_CellularPower
00107      */
00108     virtual AT_CellularPower *open_power_impl(ATHandler &at);
00109 
00110     /** Create new instance of AT_CellularSIM or if overridden, modem specific implementation.
00111      *
00112      *  @param at   ATHandler reference for communication with the modem.
00113      *  @return new instance of class AT_CellularSIM
00114      */
00115     virtual AT_CellularSIM *open_sim_impl(ATHandler &at);
00116 
00117     /** Create new instance of AT_CellularInformation or if overridden, modem specific implementation.
00118      *
00119      *  @param at   ATHandler reference for communication with the modem.
00120      *  @return new instance of class AT_CellularInformation
00121      */
00122     virtual AT_CellularInformation *open_information_impl(ATHandler &at);
00123 
00124     AT_CellularNetwork *_network;
00125     AT_CellularSMS *_sms;
00126     AT_CellularSIM *_sim;
00127     AT_CellularPower *_power;
00128     AT_CellularInformation *_information;
00129 
00130 protected:
00131     events::EventQueue &_queue;
00132     int _default_timeout;
00133     bool _modem_debug_on;
00134 };
00135 
00136 } // namespace mbed
00137 #endif // AT_CELLULAR_DEVICE_H_