mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #12123 from kivaisan/refactor_variable_visibilities
Cellular: Refactor cellular variable visibilitiespull/12055/head
commit
0dbf34bf06
|
@ -42,7 +42,7 @@ CellularDevice::CellularDevice(FileHandle *fh) : _network_ref_count(0),
|
|||
_sms_ref_count(0),
|
||||
#endif //MBED_CONF_CELLULAR_USE_SMS
|
||||
_info_ref_count(0), _fh(fh), _queue(10 * EVENTS_EVENT_SIZE), _state_machine(0),
|
||||
_nw(0), _status_cb(0), _property_array(0)
|
||||
_nw(0), _status_cb(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,6 @@ public: // from NetworkInterface
|
|||
*/
|
||||
static CellularContext *get_default_instance();
|
||||
|
||||
|
||||
/** Instantiates a default Non-IP cellular interface
|
||||
*
|
||||
* This function creates a new Non-IP PDP context.
|
||||
|
|
|
@ -485,9 +485,7 @@ protected: //Common functions
|
|||
|
||||
private: //Common functions
|
||||
nsapi_error_t start_state_machine(CellularStateMachine::CellularState target_state);
|
||||
|
||||
nsapi_error_t create_state_machine();
|
||||
|
||||
void stm_callback(nsapi_event_t ev, intptr_t ptr);
|
||||
|
||||
protected: //Member variables
|
||||
|
@ -499,15 +497,13 @@ protected: //Member variables
|
|||
FileHandle *_fh;
|
||||
events::EventQueue _queue;
|
||||
CellularStateMachine *_state_machine;
|
||||
Callback<void(nsapi_event_t, intptr_t)> _status_cb;
|
||||
|
||||
private: //Member variables
|
||||
CellularNetwork *_nw;
|
||||
char _sim_pin[MAX_PIN_SIZE + 1];
|
||||
char _plmn[MAX_PLMN_SIZE + 1];
|
||||
PlatformMutex _mutex;
|
||||
Callback<void(nsapi_event_t, intptr_t)> _status_cb;
|
||||
|
||||
const intptr_t *_property_array;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,8 +56,8 @@ protected:
|
|||
* virtual Destructor
|
||||
*/
|
||||
virtual ~CellularSMS() {};
|
||||
public:
|
||||
|
||||
public:
|
||||
/* Enumeration for possible SMS modes, PDU and Text */
|
||||
enum CellularSMSMmode {
|
||||
CellularSMSMmodePDU = 0,
|
||||
|
|
|
@ -73,6 +73,7 @@ public:
|
|||
AT_CellularDevice *get_device() const;
|
||||
|
||||
ATHandler &get_at_handler();
|
||||
|
||||
protected:
|
||||
virtual void cellular_callback(nsapi_event_t ev, intptr_t ptr);
|
||||
|
||||
|
@ -107,6 +108,7 @@ protected:
|
|||
virtual bool get_context();
|
||||
AT_CellularDevice::CellularProperty pdp_type_t_to_cellular_property(pdp_type_t pdp_type);
|
||||
bool set_new_context(int cid);
|
||||
|
||||
private:
|
||||
#if NSAPI_PPP_AVAILABLE
|
||||
nsapi_error_t open_data_channel();
|
||||
|
@ -124,6 +126,7 @@ private:
|
|||
virtual void do_connect_with_retry();
|
||||
void do_disconnect();
|
||||
void set_cid(int cid);
|
||||
|
||||
private:
|
||||
ContextOperation _current_op;
|
||||
FileHandle *_fh;
|
||||
|
@ -135,8 +138,6 @@ protected:
|
|||
// flag indicating if CP was requested to be setup
|
||||
bool _cp_req;
|
||||
bool _is_connected;
|
||||
|
||||
protected:
|
||||
ATHandler &_at;
|
||||
};
|
||||
|
||||
|
|
|
@ -124,6 +124,30 @@ public:
|
|||
*/
|
||||
virtual nsapi_error_t release_at_handler(ATHandler *at_handler);
|
||||
|
||||
virtual CellularContext *get_context_list() const;
|
||||
|
||||
virtual nsapi_error_t set_baud_rate(int baud_rate);
|
||||
|
||||
#if MBED_CONF_CELLULAR_USE_SMS
|
||||
virtual CellularSMS *open_sms(FileHandle *fh = NULL);
|
||||
|
||||
virtual void close_sms();
|
||||
#endif
|
||||
|
||||
/** Get value for the given key.
|
||||
*
|
||||
* @param key key for value to be fetched
|
||||
* @return property value for the given key. Value type is defined in enum CellularProperty
|
||||
*/
|
||||
intptr_t get_property(CellularProperty key);
|
||||
|
||||
/** Cellular module need to define an array of cellular properties which defines module supported property values.
|
||||
*
|
||||
* @param property_array array of module properties
|
||||
*/
|
||||
void set_cellular_properties(const intptr_t *property_array);
|
||||
|
||||
protected:
|
||||
/** Creates new instance of AT_CellularContext or if overridden, modem specific implementation.
|
||||
*
|
||||
* @param at ATHandler reference for communication with the modem.
|
||||
|
@ -149,50 +173,15 @@ public:
|
|||
*/
|
||||
virtual AT_CellularInformation *open_information_impl(ATHandler &at);
|
||||
|
||||
virtual CellularContext *get_context_list() const;
|
||||
|
||||
virtual nsapi_error_t set_baud_rate(int baud_rate);
|
||||
|
||||
#if MBED_CONF_CELLULAR_USE_SMS
|
||||
virtual CellularSMS *open_sms(FileHandle *fh = NULL);
|
||||
|
||||
virtual void close_sms();
|
||||
|
||||
/** 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);
|
||||
|
||||
AT_CellularSMS *_sms;
|
||||
|
||||
#endif // MBED_CONF_CELLULAR_USE_SMS
|
||||
|
||||
public:
|
||||
/** Get value for the given key.
|
||||
*
|
||||
* @param key key for value to be fetched
|
||||
* @return property value for the given key. Value type is defined in enum CellularProperty
|
||||
*/
|
||||
intptr_t get_property(CellularProperty key);
|
||||
|
||||
/** Cellular module need to define an array of cellular properties which defines module supported property values.
|
||||
*
|
||||
* @param property_array array of module properties
|
||||
*/
|
||||
void set_cellular_properties(const intptr_t *property_array);
|
||||
|
||||
public: //Member variables
|
||||
AT_CellularNetwork *_network;
|
||||
|
||||
AT_CellularInformation *_information;
|
||||
AT_CellularContext *_context_list;
|
||||
int _default_timeout;
|
||||
bool _modem_debug_on;
|
||||
ATHandler *_at;
|
||||
|
||||
protected:
|
||||
virtual void cellular_callback(nsapi_event_t ev, intptr_t ptr, CellularContext *ctx = NULL);
|
||||
void send_disconnect_to_context(int cid);
|
||||
// Sets commonly used URCs
|
||||
|
@ -208,7 +197,20 @@ private:
|
|||
void urc_nw_deact();
|
||||
void urc_pdn_deact();
|
||||
|
||||
protected:
|
||||
ATHandler *_at;
|
||||
|
||||
private:
|
||||
#if MBED_CONF_CELLULAR_USE_SMS
|
||||
AT_CellularSMS *_sms;
|
||||
#endif // MBED_CONF_CELLULAR_USE_SMS
|
||||
|
||||
AT_CellularNetwork *_network;
|
||||
AT_CellularInformation *_information;
|
||||
AT_CellularContext *_context_list;
|
||||
|
||||
int _default_timeout;
|
||||
bool _modem_debug_on;
|
||||
const intptr_t *_property_array;
|
||||
};
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ public:
|
|||
virtual nsapi_error_t get_iccid(char *buf, size_t buf_size);
|
||||
|
||||
ATHandler &get_at_handler();
|
||||
|
||||
protected:
|
||||
/** Request information text from cellular device
|
||||
*
|
||||
|
@ -61,7 +62,6 @@ protected:
|
|||
|
||||
protected:
|
||||
ATHandler &_at;
|
||||
|
||||
AT_CellularDevice &_device;
|
||||
};
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ namespace mbed {
|
|||
* Class for attaching to a network and getting information from it.
|
||||
*/
|
||||
class AT_CellularNetwork : public CellularNetwork {
|
||||
|
||||
public:
|
||||
|
||||
AT_CellularNetwork(ATHandler &atHandler, AT_CellularDevice &device);
|
||||
|
@ -101,7 +100,6 @@ public:
|
|||
ATHandler &get_at_handler();
|
||||
|
||||
protected:
|
||||
|
||||
/** Sets access technology to be scanned. Modem specific implementation.
|
||||
*
|
||||
* @param op_rat Access technology
|
||||
|
@ -140,7 +138,6 @@ private:
|
|||
void call_network_cb(nsapi_connection_status_t status);
|
||||
|
||||
protected:
|
||||
|
||||
Callback<void(nsapi_event_t, intptr_t)> _connection_status_cb;
|
||||
Callback<void(CIoT_Supported_Opt)> _ciotopt_network_support_cb;
|
||||
RadioAccessTechnology _op_act;
|
||||
|
@ -150,9 +147,7 @@ protected:
|
|||
registration_params_t _reg_params;
|
||||
mbed::Callback<void()> _urc_funcs[C_MAX];
|
||||
|
||||
protected:
|
||||
ATHandler &_at;
|
||||
|
||||
AT_CellularDevice &_device;
|
||||
};
|
||||
|
||||
|
|
|
@ -66,7 +66,6 @@ public:
|
|||
ATHandler &get_at_handler();
|
||||
|
||||
private:
|
||||
|
||||
struct sms_info_t {
|
||||
char date[SMS_MAX_TIME_STAMP_SIZE];
|
||||
uint16_t msg_index[50]; // can hold up to 50 concatenated msg parts, indexes are in correct order. So max sms size is 50*140 = 7kb
|
||||
|
@ -78,14 +77,6 @@ private:
|
|||
sms_info_t() : msg_size(0), parts(1), parts_added(1), msg_ref_number(0), next_info(0) {};
|
||||
};
|
||||
|
||||
// application callback function for received sms
|
||||
Callback<void()> _cb;
|
||||
CellularSMSMmode _mode;
|
||||
bool _use_8bit_encoding;
|
||||
uint32_t _sim_wait_time;
|
||||
uint16_t _sms_message_ref_number;
|
||||
sms_info_t *_sms_info;
|
||||
|
||||
// SMS urc's
|
||||
void cmt_urc();
|
||||
void cmti_urc();
|
||||
|
@ -171,8 +162,15 @@ private:
|
|||
int msg_len);
|
||||
|
||||
private:
|
||||
ATHandler &_at;
|
||||
// application callback function for received sms
|
||||
Callback<void()> _cb;
|
||||
CellularSMSMmode _mode;
|
||||
bool _use_8bit_encoding;
|
||||
uint32_t _sim_wait_time;
|
||||
uint16_t _sms_message_ref_number;
|
||||
sms_info_t *_sms_info;
|
||||
|
||||
ATHandler &_at;
|
||||
AT_CellularDevice &_device;
|
||||
};
|
||||
|
||||
|
|
|
@ -99,7 +99,6 @@ protected: // NetworkStack
|
|||
virtual void socket_attach(nsapi_socket_t handle, void (*callback)(void *), void *data);
|
||||
|
||||
protected:
|
||||
|
||||
class CellularSocket {
|
||||
public:
|
||||
CellularSocket() :
|
||||
|
@ -188,6 +187,7 @@ protected:
|
|||
virtual nsapi_size_or_error_t socket_recvfrom_impl(CellularSocket *socket, SocketAddress *address,
|
||||
void *buffer, nsapi_size_t size) = 0;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Find the socket handle based on the index of the socket construct
|
||||
* in the socket container. Please note that this index may or may not be
|
||||
|
@ -211,6 +211,10 @@ protected:
|
|||
*/
|
||||
bool is_addr_stack_compatible(const SocketAddress &addr);
|
||||
|
||||
private:
|
||||
int get_socket_index_by_port(uint16_t port);
|
||||
|
||||
protected:
|
||||
// socket container
|
||||
CellularSocket **_socket;
|
||||
|
||||
|
@ -229,16 +233,10 @@ protected:
|
|||
// IP version of send to address
|
||||
nsapi_version_t _ip_ver_sendto;
|
||||
|
||||
private:
|
||||
|
||||
int get_socket_index_by_port(uint16_t port);
|
||||
|
||||
protected:
|
||||
// mutex for write/read to a _socket array, needed when multiple threads may use sockets simultaneously
|
||||
PlatformMutex _socket_mutex;
|
||||
|
||||
ATHandler &_at;
|
||||
|
||||
AT_CellularDevice &_device;
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ public:
|
|||
virtual ~AT_ControlPlane_netif();
|
||||
|
||||
protected:
|
||||
|
||||
// ControlPlane_netif
|
||||
|
||||
/* Sends data using +CSODCP specified in
|
||||
|
@ -17,7 +16,6 @@ protected:
|
|||
*/
|
||||
virtual nsapi_size_or_error_t send(const void *cpdata, nsapi_size_t cpdata_length);
|
||||
|
||||
|
||||
/* Receives data using +CRTDCP specified in
|
||||
* 3GPP 27007 10.1.44: Reporting of terminating data via the control plane
|
||||
*/
|
||||
|
|
|
@ -38,7 +38,7 @@ CellularDevice::CellularDevice(FileHandle *fh) : _network_ref_count(0),
|
|||
_sms_ref_count(0),
|
||||
#endif //MBED_CONF_CELLULAR_USE_SMS
|
||||
_info_ref_count(0), _fh(fh), _queue(10 * EVENTS_EVENT_SIZE), _state_machine(0),
|
||||
_nw(0), _status_cb(0), _property_array(0)
|
||||
_status_cb(0), _nw(0)
|
||||
{
|
||||
MBED_ASSERT(fh);
|
||||
set_sim_pin(NULL);
|
||||
|
|
Loading…
Reference in New Issue