mbed-os/features/cellular/framework/AT/AT_CellularDevice.h

137 lines
4.0 KiB
C
Raw Normal View History

2018-02-09 11:24:27 +00:00
/*
* Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef AT_CELLULAR_DEVICE_H_
#define AT_CELLULAR_DEVICE_H_
#include "CellularDevice.h"
2018-08-01 11:50:14 +00:00
namespace mbed {
2018-02-09 11:24:27 +00:00
class ATHandler;
class AT_CellularInformation;
class AT_CellularNetwork;
class AT_CellularPower;
class AT_CellularSIM;
class AT_CellularSMS;
/**
* Class AT_CellularDevice
*
* A class defines opening and closing of cellular interfaces.
* Deleting/Closing of opened interfaces can be done only through this class.
*/
2018-08-01 11:50:14 +00:00
class AT_CellularDevice : public CellularDevice {
2018-02-09 11:24:27 +00:00
public:
AT_CellularDevice(events::EventQueue &queue);
virtual ~AT_CellularDevice();
ATHandler *_atHandlers;
ATHandler *get_at_handler(FileHandle *fh);
/** Releases the given at_handler. If last reference to at_hander then it's deleted.
*
* @param at_handler
*/
2018-08-01 11:50:14 +00:00
void release_at_handler(ATHandler *at_handler);
2018-02-09 11:24:27 +00:00
public: // CellularDevice
virtual events::EventQueue *get_queue() const;
2018-02-09 11:24:27 +00:00
virtual CellularNetwork *open_network(FileHandle *fh);
virtual CellularSMS *open_sms(FileHandle *fh);
virtual CellularPower *open_power(FileHandle *fh);
virtual CellularSIM *open_sim(FileHandle *fh);
virtual CellularInformation *open_information(FileHandle *fh);
virtual void close_network();
virtual void close_sms();
virtual void close_power();
virtual void close_sim();
virtual void close_information();
virtual void set_timeout(int timeout);
virtual uint16_t get_send_delay() const;
2018-04-09 10:46:40 +00:00
virtual void modem_debug_on(bool on);
virtual NetworkStack *get_stack();
virtual nsapi_error_t init_module(FileHandle *fh);
2018-02-09 11:24:27 +00:00
protected:
/** Create new instance of AT_CellularNetwork or if overridden, modem specific implementation.
*
* @param at ATHandler reference for communication with the modem.
* @return new instance of class AT_CellularNetwork
*/
virtual AT_CellularNetwork *open_network_impl(ATHandler &at);
/** Create new instance of AT_CellularSMS or if overridden, modem specific implementation.
*
* @param at ATHandler reference for communication with the modem.
* @return new instance of class AT_CellularSMS
*/
virtual AT_CellularSMS *open_sms_impl(ATHandler &at);
/** Create new instance of AT_CellularPower or if overridden, modem specific implementation.
*
* @param at ATHandler reference for communication with the modem.
* @return new instance of class AT_CellularPower
*/
virtual AT_CellularPower *open_power_impl(ATHandler &at);
/** Create new instance of AT_CellularSIM or if overridden, modem specific implementation.
*
* @param at ATHandler reference for communication with the modem.
* @return new instance of class AT_CellularSIM
*/
virtual AT_CellularSIM *open_sim_impl(ATHandler &at);
/** Create new instance of AT_CellularInformation or if overridden, modem specific implementation.
*
* @param at ATHandler reference for communication with the modem.
* @return new instance of class AT_CellularInformation
*/
virtual AT_CellularInformation *open_information_impl(ATHandler &at);
2018-02-09 11:24:27 +00:00
AT_CellularNetwork *_network;
AT_CellularSMS *_sms;
AT_CellularSIM *_sim;
2018-08-01 11:50:14 +00:00
AT_CellularPower *_power;
AT_CellularInformation *_information;
2018-02-09 11:24:27 +00:00
protected:
events::EventQueue &_at_queue;
2018-02-09 11:24:27 +00:00
int _default_timeout;
bool _modem_debug_on;
2018-02-09 11:24:27 +00:00
};
} // namespace mbed
#endif // AT_CELLULAR_DEVICE_H_