Gleb Klochkov / Mbed OS Climatcontroll_Main

Dependencies:   esp8266-driver

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 #include "AT_CellularNetwork.h"
00024 #include "AT_CellularSIM.h"
00025 #include "AT_CellularSMS.h"
00026 #include "AT_CellularPower.h"
00027 #include "AT_CellularInformation.h"
00028 
00029 #include "ATHandler.h"
00030 
00031 namespace mbed
00032 {
00033 
00034 /**
00035  *  Class AT_CellularDevice
00036  *
00037  *  A class defines opening and closing of cellular interfaces.
00038  *  Deleting/Closing of opened interfaces can be done only through this class.
00039  */
00040 class AT_CellularDevice : public CellularDevice
00041 {
00042 public:
00043     AT_CellularDevice(events::EventQueue &queue);
00044     virtual ~AT_CellularDevice();
00045 
00046 protected:
00047     ATHandler *_atHandlers;
00048 
00049     ATHandler *get_at_handler(FileHandle *fh);
00050 
00051     /** Releases the given at_handler. If last reference to at_hander then it's deleted.
00052      *
00053      *  @param at_handler
00054      */
00055     void release_at_handler(ATHandler* at_handler);
00056 
00057 public: // CellularDevice
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 void modem_debug_on(bool on);
00081 
00082     virtual NetworkStack *get_stack();
00083 
00084 protected:
00085     AT_CellularNetwork *_network;
00086     AT_CellularSMS *_sms;
00087     AT_CellularSIM *_sim;
00088     AT_CellularPower* _power;
00089     AT_CellularInformation* _information;
00090 
00091 protected:
00092     events::EventQueue &_queue;
00093     int _default_timeout;
00094     bool _modem_debug_on;
00095 };
00096 
00097 } // namespace mbed
00098 #endif // AT_CELLULAR_DEVICE_H_