Doxygen update: removed documentation from inherited classes as INHERTIC_DOCS is enabled in doxygen config. Reduces copy-paste and eases maintenance.

pull/6082/head
Teppo Järvelin 2018-02-22 12:42:53 +02:00 committed by Ari Parkkila
parent e99c18c233
commit 1a3b6e589c
20 changed files with 25 additions and 771 deletions

View File

@ -374,7 +374,7 @@ public:
*/ */
virtual int get_3gpp_error() = 0; virtual int get_3gpp_error() = 0;
/** Get the operator params /** Get the operator parameters.
* *
* @param format format of the operator field * @param format format of the operator field
* @param operator_params applicable operator param fields filled * @param operator_params applicable operator param fields filled

View File

@ -46,12 +46,6 @@ public:
protected: protected:
ATHandler *_atHandlers; ATHandler *_atHandlers;
/** Get the athandler. If the given fh is already used with existing athandler, instance to that athander is returned.
* Otherwise new athander is created.
*
* @param fh FileHandle to be used with the ATHandler
* @return pointer to ATHandler
*/
ATHandler *get_at_handler(FileHandle *fh); ATHandler *get_at_handler(FileHandle *fh);
/** Releases the given at_handler. If last reference to at_hander then it's deleted. /** Releases the given at_handler. If last reference to at_hander then it's deleted.
@ -61,82 +55,32 @@ protected:
void release_at_handler(ATHandler* at_handler); void release_at_handler(ATHandler* at_handler);
public: // CellularDevice public: // CellularDevice
/** Create new CellularNetwork interface.
*
* @param fh filehandle used in communication to modem. Can be for example UART handle.
* @return New instance of interface CellularNetwork.
*/
virtual CellularNetwork *open_network(FileHandle *fh); virtual CellularNetwork *open_network(FileHandle *fh);
/** Create new CellularSMS interface.
*
* @param fh filehandle used in communication to modem. Can be for example UART handle.
* @return New instance of interface CellularSMS.
*/
virtual CellularSMS *open_sms(FileHandle *fh); virtual CellularSMS *open_sms(FileHandle *fh);
/** Create new CellularPower interface.
*
* @param fh filehandle used in communication to modem. Can be for example UART handle.
* @return New instance of interface CellularPower.
*/
virtual CellularPower *open_power(FileHandle *fh); virtual CellularPower *open_power(FileHandle *fh);
/** Create new CellularSIM interface.
*
* @param fh filehandle used in communication to modem. Can be for example UART handle.
* @return New instance of interface CellularSIM.
*/
virtual CellularSIM *open_sim(FileHandle *fh); virtual CellularSIM *open_sim(FileHandle *fh);
/** Create new CellularMultiplexer interface.
*
* @param fh filehandle used in communication to modem. Can be for example UART handle.
* @return New instance of interface CellularMultiplexer.
*/
virtual CellularMultiplexer *open_multiplexer(FileHandle *fh); virtual CellularMultiplexer *open_multiplexer(FileHandle *fh);
/** Create new CellularInformation interface.
*
* @param fh filehandle used in communication to modem. Can be for example UART handle.
* @return New instance of interface CellularInformation.
*/
virtual CellularInformation *open_information(FileHandle *fh); virtual CellularInformation *open_information(FileHandle *fh);
/** Closes the opened CellularNetwork by deleting the CellularNetwork instance.
*/
virtual void close_network(); virtual void close_network();
/** Closes the opened CellularNetwork by deleting the CellularSMS instance.
*/
virtual void close_sms(); virtual void close_sms();
/** Closes the opened CellularNetwork by deleting the CellularPower instance.
*/
virtual void close_power(); virtual void close_power();
/** Closes the opened CellularNetwork by deleting the CellularSIM instance.
*/
virtual void close_sim(); virtual void close_sim();
/** Closes the opened CellularNetwork by deleting the CellularMultiplexer instance.
*/
virtual void close_multiplexer(); virtual void close_multiplexer();
/** Closes the opened CellularNetwork by deleting the CellularInformation instance.
*/
virtual void close_information(); virtual void close_information();
/** Set the default response timeout.
*
* @param timeout milliseconds to wait response from modem
*/
virtual void set_timeout(int timeout); virtual void set_timeout(int timeout);
/** Get network stack.
*
* @return network stack
*/
virtual NetworkStack *get_stack(); virtual NetworkStack *get_stack();
protected: protected:

View File

@ -35,28 +35,10 @@ public:
virtual ~AT_CellularInformation(); virtual ~AT_CellularInformation();
public: public:
/** Request manufacturer identification of cellular device
*
* @param buf manufacturer identification
* @param buf_size max length of manufacturer identification is 2048 characters
* @return on success read character count, on failure negative error code
*/
virtual nsapi_size_or_error_t get_manufacturer(char *buf, size_t buf_size); virtual nsapi_size_or_error_t get_manufacturer(char *buf, size_t buf_size);
/** Request model identification of cellular device
*
* @param buf model identification
* @param buf_size max length of model identification is 2048 characters
* @return on success read character count, on failure negative error code
*/
virtual nsapi_size_or_error_t get_model(char *buf, size_t buf_size); virtual nsapi_size_or_error_t get_model(char *buf, size_t buf_size);
/** Request revision identification of cellular device
*
* @param buf revision identification
* @param buf_size max length of revision identification is 2048 characters
* @return on success read character count, on failure negative error code
*/
virtual nsapi_size_or_error_t get_revision(char *buf, size_t buf_size); virtual nsapi_size_or_error_t get_revision(char *buf, size_t buf_size);
protected: protected:

View File

@ -35,10 +35,6 @@ public:
virtual ~AT_CellularMultiplexer(); virtual ~AT_CellularMultiplexer();
public: public:
/** Starts modem multiplexer mode specified by 3GPP TS 27.010.
*
* @return zero on success, negative error code on failure
*/
virtual nsapi_error_t multiplexer_mode_start(); virtual nsapi_error_t multiplexer_mode_start();
}; };

View File

@ -43,225 +43,68 @@ public:
public: // NetworkInterface public: // NetworkInterface
/** Set the cellular network APN and credentials
*
* @param apn Optional name of the network to connect to
* @param username Optional username for the APN
* @param password Optional password fot the APN
* @return 0 on success, negative error code on failure
*/
virtual nsapi_error_t set_credentials(const char *apn, virtual nsapi_error_t set_credentials(const char *apn,
const char *username = 0, const char *password = 0); const char *username = 0, const char *password = 0);
/** Set the cellular network APN and credentials
*
* @param apn Name of the network to connect to
* @param type Authentication type to use
* @param username Optional username for the APN
* @param password Optional password fot the APN
* @return 0 on success, negative error code on failure
*/
virtual nsapi_error_t set_credentials(const char *apn, AuthenticationType type, virtual nsapi_error_t set_credentials(const char *apn, AuthenticationType type,
const char *username = 0, const char *password = 0); const char *username = 0, const char *password = 0);
/** Start the interface. Attempts to connect to a cellular network.
*
* @param apn Optional name of the network to connect to
* @param username Optional username for your APN
* @param password Optional password for your APN
* @return 0 on success, negative error code on failure
*/
virtual nsapi_error_t connect(const char *apn, virtual nsapi_error_t connect(const char *apn,
const char *username = 0, const char *password = 0); const char *username = 0, const char *password = 0);
/** Start the interface. Attempts to connect to a cellular network.
*
* @return 0 on success, negative error code on failure
*/
virtual nsapi_error_t connect(); virtual nsapi_error_t connect();
/** Stop the interface
*
* @return 0 on success, negative error code on failure
*/
virtual nsapi_error_t disconnect(); virtual nsapi_error_t disconnect();
protected: protected:
/** Provide access to the NetworkStack object
*
* @return The underlying NetworkStack object
*/
virtual NetworkStack *get_stack(); virtual NetworkStack *get_stack();
public: // CellularNetwork public: // CellularNetwork
/** Request registering to network.
*
* @param plmn format is in numeric format or 0 for automatic network registration
* @return zero on success
*/
virtual nsapi_error_t set_registration(const char *plmn = 0); virtual nsapi_error_t set_registration(const char *plmn = 0);
/**
* Gets the network registration status.
* @param type see RegistrationType values
* @param status see RegistrationStatus values
* @return zero on success
*/
virtual nsapi_error_t get_registration_status(RegistrationType type, RegistrationStatus &status); virtual nsapi_error_t get_registration_status(RegistrationType type, RegistrationStatus &status);
/** Request attach to network.
*
* @param timeout milliseconds to wait for attach response
* @return zero on success
*/
virtual nsapi_error_t set_attach(int timeout = 10*1000); virtual nsapi_error_t set_attach(int timeout = 10*1000);
/** Request attach status from network.
*
* @param status see AttachStatus values
* @return zero on success
*/
virtual nsapi_error_t get_attach(AttachStatus &status); virtual nsapi_error_t get_attach(AttachStatus &status);
/** Get APN rate control.
*
* @remark optional params are not updated if not received from network, so use good defaults
*
* @param reports Additional exception reports at maximum rate reached are allowed to be sent [optional]
* @param time_unit Uplink time unit with values 0=unrestricted, 1=minute, 2=hour, 3=day, 4=week [optional]
* @param uplink_rate Maximum number of messages per timeUnit [optional]
* @return zero on success
*/
virtual nsapi_error_t get_rate_control(CellularNetwork::RateControlExceptionReports &reports, virtual nsapi_error_t get_rate_control(CellularNetwork::RateControlExceptionReports &reports,
CellularNetwork::RateControlUplinkTimeUnit &time_unit, int &uplink_rate); CellularNetwork::RateControlUplinkTimeUnit &time_unit, int &uplink_rate);
/** Get backoff timer value
*
* @param backoff_time Backoff timer value associated with PDP APN in seconds
* @return zero on success
*/
virtual nsapi_error_t get_backoff_time(int &backoff_time); virtual nsapi_error_t get_backoff_time(int &backoff_time);
/** Get notified if the connection gets lost
*
* @param status_cb user defined callback
*/
virtual void attach(Callback<void(nsapi_event_t, intptr_t)> status_cb); virtual void attach(Callback<void(nsapi_event_t, intptr_t)> status_cb);
/** Get the connection status
*
* @return The connection status according to ConnectionStatusType
*/
virtual nsapi_connection_status_t get_connection_status() const; virtual nsapi_connection_status_t get_connection_status() const;
/** Set blocking status of connect() which by default should be blocking
*
* @param blocking true if connect is blocking
* @return 0 on success, negative error code on failure
*/
virtual nsapi_error_t set_blocking(bool blocking); virtual nsapi_error_t set_blocking(bool blocking);
/** Get the local IP address
*
* @return Null-terminated representation of the local IP address
* or null if no IP address has been received
*/
virtual const char *get_ip_address(); virtual const char *get_ip_address();
/** Sets radio access technology.
*
* @param op_rat Radio access technology
* @return zero on success
*/
virtual nsapi_error_t set_access_technology(operator_t::RadioAccessTechnology op_rat); virtual nsapi_error_t set_access_technology(operator_t::RadioAccessTechnology op_rat);
/** Scans for operators module can reach.
*
* @param operators Container of reachable operators and their access technologies
* @param ops_count Number of found operators
* @return zero on success
*/
virtual nsapi_error_t scan_plmn(operList_t &operators, int &ops_count); virtual nsapi_error_t scan_plmn(operList_t &operators, int &ops_count);
/** Set CIoT optimizations.
*
* @param supported_opt Supported CIoT EPS optimizations.
* @param preferred_opt Preferred CIoT EPS optimizations.
* @return zero on success
*/
virtual nsapi_error_t set_ciot_optimization_config(Supported_UE_Opt supported_opt, virtual nsapi_error_t set_ciot_optimization_config(Supported_UE_Opt supported_opt,
Preferred_UE_Opt preferred_opt); Preferred_UE_Opt preferred_opt);
/** Get CIoT optimizations.
*
* @param supported_opt Supported CIoT EPS optimizations.
* @param preferred_opt Preferred CIoT EPS optimizations.
* @return zero on success
*/
virtual nsapi_error_t get_ciot_optimization_config(Supported_UE_Opt& supported_opt, virtual nsapi_error_t get_ciot_optimization_config(Supported_UE_Opt& supported_opt,
Preferred_UE_Opt& preferred_opt); Preferred_UE_Opt& preferred_opt);
virtual nsapi_error_t set_stack_type(nsapi_ip_stack_t stack_type);
/** Set the pdn type to be used virtual nsapi_ip_stack_t get_stack_type();
*
* @param stack_type the stack type to be used.
* @return NSAPI_ERROR_OK on success
*/
virtual nsapi_error_t set_stack_type(nsapi_ip_stack_t stack_type);
/** Get the pdn type in use virtual nsapi_error_t get_pdpcontext_params(pdpContextList_t& params_list);
*
* @return stack type
*/
virtual nsapi_ip_stack_t get_stack_type();
/** Get the relevant information for an active non secondary PDP context.
*
* @remark optional params are not updated if not received from network.
*
* @param params_list reference to linked list which is filled on successful call
* @return 0 on success, negative error code on failure
*/
virtual nsapi_error_t get_pdpcontext_params(pdpContextList_t& params_list);
/** Get extended signal quality parameters.
*
* @param rxlev signal strength level
* @param ber bit error rate
* @param rscp signal code power
* @param ecno ratio of the received energy per PN chip to the total received power spectral density
* @param rsrq signal received quality
* @param rsrp signal received power
* @return NSAPI_ERROR_OK on success, negative error code on failure
*/
virtual nsapi_error_t get_extended_signal_quality(int &rxlev, int &ber, int &rscp, int &ecno, int &rsrq, int &rsrp); virtual nsapi_error_t get_extended_signal_quality(int &rxlev, int &ber, int &rscp, int &ecno, int &rsrq, int &rsrp);
/** Get signal quality parameters.
*
* @param rssi signal strength level
* @param ber bit error rate
* @return NSAPI_ERROR_OK on success, negative error code on failure
*/
virtual nsapi_error_t get_signal_quality(int &rssi, int &ber); virtual nsapi_error_t get_signal_quality(int &rssi, int &ber);
/** Get cell id.
*
* @param cell_id cell id
* @return NSAPI_ERROR_OK on success, negative error code on failure
*/
virtual nsapi_error_t get_cell_id(int &cell_id); virtual nsapi_error_t get_cell_id(int &cell_id);
/** Get the last 3GPP error code
* @return see 3GPP TS 27.007 error codes
*/
virtual int get_3gpp_error(); virtual int get_3gpp_error();
/** Get the operator params
*
* @param format format of the operator field
* @param operator_params applicable operator param fields filled
* @return NSAPI_ERROR_OK on success, negative error code on failure
*/
virtual nsapi_error_t get_operator_params(int &format, operator_t &operator_params); virtual nsapi_error_t get_operator_params(int &format, operator_t &operator_params);
protected: protected:
@ -279,7 +122,7 @@ protected:
*/ */
virtual bool has_registration(RegistrationType reg_type); virtual bool has_registration(RegistrationType reg_type);
/** Sets access technology to be scanned. /** Sets access technology to be scanned. Modem specific implementation.
* *
* @param op_rat Access technology * @param op_rat Access technology
* *

View File

@ -35,80 +35,18 @@ public:
virtual ~AT_CellularPower(); virtual ~AT_CellularPower();
public: public:
/** Set cellular device power on. Default implementation is empty.
* Device power on/off is modem/board specific behavior and must be done on inherited class if needed.
* Power on is done by toggling power pin/button.
*
* @remark set_at_mode must be called to initialise modem
* @remark Should not be called if MUX is enabled and started. If called then start-up sequence must be done again.
*
* @return zero on success
*/
virtual nsapi_error_t on(); virtual nsapi_error_t on();
/** Set cellular device power off. Default implementation is empty.
* Device power on/off is modem/board specific behavior and must be done on inherited class if needed.
* Power off is done by toggling power pin/button.
*
* @remark Should not be called if MUX is enabled and started. If called then start-up sequence must be done again.
*
* @return zero on success
*/
virtual nsapi_error_t off(); virtual nsapi_error_t off();
/** Set AT command mode. Blocking until success or failure.
*
* @remark must be called after power on to prepare correct AT mode
*
* @return zero on success
*/
virtual nsapi_error_t set_at_mode(); virtual nsapi_error_t set_at_mode();
/** Set cellular device power level by enabling/disabling functionality.
*
* @param func_level:
* 0 minimum functionality
* 1 full functionality. Enable (turn on) the transmit and receive RF circuits for all supported radio access technologies.
* For MTs supporting +CSRA, this equals the RATs indicated by the response of +CSRA=?. Current +CSRA setting is ignored.
* It is not required that the MT transmit and receive RF circuits are in a disabled state for this setting to have effect.
* 2 disable (turn off) MT transmit RF circuits only
* 3 disable (turn off) MT receive RF circuits only
* 4 disable (turn off) both MT transmit and receive RF circuits
*
* @remark See 3GPP TS 27.007 CFUN for more details
* @remark Should not be called if MUX is enabled and started. If called then start-up sequence must be done again.
*
* @return zero on success
*/
virtual nsapi_error_t set_power_level(int func_level); virtual nsapi_error_t set_power_level(int func_level);
/** Reset and wake-up cellular device.
*
* @remark Should not be called if MUX is enabled and started. If called then start-up sequence must be done again.
*
* @return zero on success
*/
virtual nsapi_error_t reset(); virtual nsapi_error_t reset();
/** Opt for power save setting on cellular device. If both parameters are zero then disables PSM.
*
* @remark See 3GPP TS 27.007 PSM for details
*
* @param periodic_time Timeout in seconds IoT subsystem is not expecting messaging
* @param active_time Timeout in seconds IoT subsystem waits for response
* @return zero on success
*/
virtual nsapi_error_t opt_power_save_mode(int periodic_time, int active_time); virtual nsapi_error_t opt_power_save_mode(int periodic_time, int active_time);
/** Opt for discontinuous reception on cellular device.
*
* @remark See 3GPP TS 27.007 eDRX for details.
*
* @param mode disable or enable the use of eDRX
* @param act_type type of access technology
* @param edrx_value requested edxr value. Extended DRX parameters information element.
* @return zero on success
*/
virtual nsapi_error_t opt_receive_period(int mode, EDRXAccessTechnology act_type, uint8_t edrx_value); virtual nsapi_error_t opt_receive_period(int mode, EDRXAccessTechnology act_type, uint8_t edrx_value);
}; };

View File

@ -36,34 +36,12 @@ public:
virtual ~AT_CellularSIM(); virtual ~AT_CellularSIM();
public: public:
/** Open the SIM card by setting the pin code for SIM.
*
* @param sim_pin PIN for the SIM card
* @return zero on success
*/
virtual nsapi_error_t set_pin(const char *sim_pin); virtual nsapi_error_t set_pin(const char *sim_pin);
/**Change sim pin code.
*
* @param sim_pin Current PIN for sim
* @param new_pin New PIN for sim
* @return zero on success
*/
virtual nsapi_error_t change_pin(const char *sim_pin, const char *new_pin); virtual nsapi_error_t change_pin(const char *sim_pin, const char *new_pin);
/** Change is pin query needed after boot
*
* @param sim_pin Valid PIN for SIM card
* @param query_pin False is PIN query not needed, True if PIN query needed after boot.
* @return zero on success
*/
virtual nsapi_error_t set_pin_query(const char *sim_pin, bool query_pin); virtual nsapi_error_t set_pin_query(const char *sim_pin, bool query_pin);
/** Get sim card's state
*
* @param state current state of SIM
* @return zero on success
*/
virtual nsapi_error_t get_sim_state(SimState &state); virtual nsapi_error_t get_sim_state(SimState &state);
}; };

View File

@ -40,95 +40,23 @@ public:
public: public:
// from CellularSMS // from CellularSMS
/** Does all the necessary initializations needed for receiving and sending sms.
*
* @param mode enumeration for choosing the correct mode: text/pdu
* @return zero on success
*/
virtual nsapi_error_t initialize(CellularSMSMmode mode); virtual nsapi_error_t initialize(CellularSMSMmode mode);
/** Send the SMS with the given parameters
*
* @param phone_number Phone number where to send sms
* @param message SMS message content
* @param msg_len Length of the message
* @return possible error code or length of the sent sms
*/
virtual nsapi_size_or_error_t send_sms(const char* phone_number, const char* message, int msg_len); virtual nsapi_size_or_error_t send_sms(const char* phone_number, const char* message, int msg_len);
/** Gets the oldest received sms.
*
* @param buf preallocated buffer for sms message content
* @param buf_len length of allocated buf
* @param phone_num preallocated buffer for phone number where sms was sent
* @param phone_len length of allocated phone_num buffer
* @param time_stamp preallocated buffer for TP-Service Centre Time Stamp (format: yy/MM/dd,hh:mm:ss-+zz). +-zz is timezone.
* The unit of time zone is a quarter of an hour relative to GMT. For example +32 would be GMT+8.
* @param time_len length of allocated time_stamp buffer
* @param buf_size if method return error NSAPI_ERROR_NO_MEMORY because the given buf was not big enough this will
* hold the size which is enough. Otherwise zero.
* @return possible error code or size of buf. Will return SMS_ERROR_MULTIPART_ALL_PARTS_NOT_READ
* if sms was multipart but not all parts are present/failed to read.
*/
virtual nsapi_size_or_error_t get_sms(char* buf, uint16_t buf_len, char* phone_num, uint16_t phone_len, virtual nsapi_size_or_error_t get_sms(char* buf, uint16_t buf_len, char* phone_num, uint16_t phone_len,
char* time_stamp, uint16_t time_len, int *buf_size); char* time_stamp, uint16_t time_len, int *buf_size);
/** Callback which is called when new sms is received. SMS can be fetched via method get_sms().
*
* @remark In PDU mode there can be multipart sms and callback is called for every received part.
*
* @param func Callback function which is called when new sms is received.
*/
virtual void set_sms_callback(Callback<void()> func); virtual void set_sms_callback(Callback<void()> func);
/** CPMS preferred message storage
*
* @param memr memory from which messages are read and deleted
* "SM" - SIM SMS memory storage (default)
* "ME" - NVM SMS storage
* @param memw memory to which writing and sending operations are made
* "SM" - SIM SMS memory storage (default)
* "ME" - NVM SMS storage
* @param mems memory to which received SMs are preferred to be stored
* "SM" - SIM SMS memory storage (default)
* "ME" - NVM SMS storage
*
* @return zero for success
*/
virtual nsapi_error_t set_cpms(const char *memr, const char *memw, const char *mems); virtual nsapi_error_t set_cpms(const char *memr, const char *memw, const char *mems);
/** CSCA - set Service Center Address
*
* @param sca Service Center Address to be used for mobile originated SMS transmissions.
* @param type 129 - national numbering scheme, 145 - international numbering scheme (contains the character "+")
*
* @return zero for success
*/
virtual nsapi_error_t set_csca(const char *sca, int type); virtual nsapi_error_t set_csca(const char *sca, int type);
/** Set command sets the current character set used by the device. "GSM", "IRA",....
*
* @remark Current implementation support only ASCII so choose the correct character set.
*
* @param chr_set preferred character set list (comma separated). Modem might not support the wanted character set
* so chr_set list is looped from start until supported set is found. Used character set index is returned.
* See more from 3GPP TS 27.005.
* @return Used character set index from the given list in case of success. Otherwise negative errorcode.
*/
virtual nsapi_size_or_error_t set_cscs(const char *chr_set); virtual nsapi_size_or_error_t set_cscs(const char *chr_set);
/** Deletes all messages from the currently set memory/SIM
*
* @return zero for success
*/
virtual nsapi_error_t delete_all_messages(); virtual nsapi_error_t delete_all_messages();
/** Some modems need extra time between AT commands and responses or there will be error -314, SIM busy.
* If SIM busy errors are an issue this time should be increased. It can also be set to zero to make
* operations faster and more energy efficient if no errors will follow. By default wait time is zero.
*
* @param sim_wait_time
*/
virtual void set_extra_sim_wait_time(int sim_wait_time); virtual void set_extra_sim_wait_time(int sim_wait_time);
private: private:

View File

@ -43,175 +43,34 @@ public:
public: // NetworkStack public: // NetworkStack
/** Get the local IP address
*
* @return Null-terminated representation of the local IP address
* or null if not yet connected
*/
virtual const char *get_ip_address(); virtual const char *get_ip_address();
protected: // NetworkStack
/** Opens a socket
*
* Creates a network socket and stores it in the specified handle.
* The handle must be passed to following calls on the socket.
*
* A stack may have a finite number of sockets, in this case
* NSAPI_ERROR_NO_SOCKET is returned if no socket is available.
*
* @param handle Destination for the handle to a newly created socket
* @param proto Protocol of socket to open, NSAPI_TCP or NSAPI_UDP
* @return 0 on success, negative error code on failure
*/
virtual nsapi_error_t socket_open(nsapi_socket_t *handle, nsapi_protocol_t proto); virtual nsapi_error_t socket_open(nsapi_socket_t *handle, nsapi_protocol_t proto);
/** Close the socket
*
* Closes any open connection and deallocates any memory associated
* with the socket.
*
* @param handle Socket handle
* @return 0 on success, negative error code on failure
*/
virtual nsapi_error_t socket_close(nsapi_socket_t handle); virtual nsapi_error_t socket_close(nsapi_socket_t handle);
/** Bind a specific address to a socket
*
* Binding a socket specifies the address and port on which to recieve
* data. If the IP address is zeroed, only the port is bound.
*
* @param handle Socket handle
* @param address Local address to bind
* @return 0 on success, negative error code on failure.
*/
virtual nsapi_error_t socket_bind(nsapi_socket_t handle, const SocketAddress &address); virtual nsapi_error_t socket_bind(nsapi_socket_t handle, const SocketAddress &address);
/** Listen for connections on a TCP socket
*
* Marks the socket as a passive socket that can be used to accept
* incoming connections.
*
* @param handle Socket handle
* @param backlog Number of pending connections that can be queued
* simultaneously
* @return 0 on success, negative error code on failure
*/
virtual nsapi_error_t socket_listen(nsapi_socket_t handle, int backlog); virtual nsapi_error_t socket_listen(nsapi_socket_t handle, int backlog);
/** Connects TCP socket to a remote host
*
* Initiates a connection to a remote server specified by the
* indicated address.
*
* @param handle Socket handle
* @param address The SocketAddress of the remote host
* @return 0 on success, negative error code on failure
*/
virtual nsapi_error_t socket_connect(nsapi_socket_t handle, const SocketAddress &address); virtual nsapi_error_t socket_connect(nsapi_socket_t handle, const SocketAddress &address);
/** Accepts a connection on a TCP socket
*
* The server socket must be bound and set to listen for connections.
* On a new connection, creates a network socket and stores it in the
* specified handle. The handle must be passed to following calls on
* the socket.
*
* A stack may have a finite number of sockets, in this case
* NSAPI_ERROR_NO_SOCKET is returned if no socket is available.
*
* This call is non-blocking. If accept would block,
* NSAPI_ERROR_WOULD_BLOCK is returned immediately.
*
* @param server Socket handle to server to accept from
* @param handle Destination for a handle to the newly created socket
* @param address Destination for the remote address or NULL
* @return 0 on success, negative error code on failure
*/
virtual nsapi_error_t socket_accept(nsapi_socket_t server, virtual nsapi_error_t socket_accept(nsapi_socket_t server,
nsapi_socket_t *handle, SocketAddress *address=0); nsapi_socket_t *handle, SocketAddress *address=0);
/** Send data over a TCP socket
*
* The socket must be connected to a remote host. Returns the number of
* bytes sent from the buffer.
*
* This call is non-blocking. If send would block,
* NSAPI_ERROR_WOULD_BLOCK is returned immediately.
*
* @param handle Socket handle
* @param data Buffer of data to send to the host
* @param size Size of the buffer in bytes
* @return Number of sent bytes on success, negative error
* code on failure
*/
virtual nsapi_size_or_error_t socket_send(nsapi_socket_t handle, virtual nsapi_size_or_error_t socket_send(nsapi_socket_t handle,
const void *data, nsapi_size_t size); const void *data, nsapi_size_t size);
/** Receive data over a TCP socket
*
* The socket must be connected to a remote host. Returns the number of
* bytes received into the buffer.
*
* This call is non-blocking. If recv would block,
* NSAPI_ERROR_WOULD_BLOCK is returned immediately.
*
* @param handle Socket handle
* @param data Destination buffer for data received from the host
* @param size Size of the buffer in bytes
* @return Number of received bytes on success, negative error
* code on failure
*/
virtual nsapi_size_or_error_t socket_recv(nsapi_socket_t handle, virtual nsapi_size_or_error_t socket_recv(nsapi_socket_t handle,
void *data, nsapi_size_t size); void *data, nsapi_size_t size);
/** Send a packet over a UDP socket
*
* Sends data to the specified address. Returns the number of bytes
* sent from the buffer.
*
* This call is non-blocking. If sendto would block,
* NSAPI_ERROR_WOULD_BLOCK is returned immediately.
*
* @param handle Socket handle
* @param address The SocketAddress of the remote host
* @param data Buffer of data to send to the host
* @param size Size of the buffer in bytes
* @return Number of sent bytes on success, negative error
* code on failure
*/
virtual nsapi_size_or_error_t socket_sendto(nsapi_socket_t handle, const SocketAddress &address, virtual nsapi_size_or_error_t socket_sendto(nsapi_socket_t handle, const SocketAddress &address,
const void *data, nsapi_size_t size); const void *data, nsapi_size_t size);
/** Receive a packet over a UDP socket
*
* Receives data and stores the source address in address if address
* is not NULL. Returns the number of bytes received into the buffer.
*
* This call is non-blocking. If recvfrom would block,
* NSAPI_ERROR_WOULD_BLOCK is returned immediately.
*
* @param handle Socket handle
* @param address Destination for the source address or NULL
* @param buffer Destination buffer for data received from the host
* @param size Size of the buffer in bytes
* @return Number of received bytes on success, negative error
* code on failure
*/
virtual nsapi_size_or_error_t socket_recvfrom(nsapi_socket_t handle, SocketAddress *address, virtual nsapi_size_or_error_t socket_recvfrom(nsapi_socket_t handle, SocketAddress *address,
void *buffer, nsapi_size_t size); void *buffer, nsapi_size_t size);
/** Register a callback on state change of the socket
*
* The specified callback will be called on state changes such as when
* the socket can recv/send/accept successfully and on when an error
* occurs. The callback may also be called spuriously without reason.
*
* The callback may be called in an interrupt context and should not
* perform expensive operations such as recv/send calls.
*
* @param handle Socket handle
* @param callback Function to call on state change
* @param data Argument to pass to callback
*/
virtual void socket_attach(nsapi_socket_t handle, void (*callback)(void *), void *data); virtual void socket_attach(nsapi_socket_t handle, void (*callback)(void *), void *data);
protected: protected:

View File

@ -28,30 +28,13 @@ public:
QUECTEL_BC95_CellularNetwork(ATHandler &atHandler); QUECTEL_BC95_CellularNetwork(ATHandler &atHandler);
virtual ~QUECTEL_BC95_CellularNetwork(); virtual ~QUECTEL_BC95_CellularNetwork();
/** Provide access to the NetworkStack object protected:
*
* @return The underlying NetworkStack object
*/
virtual NetworkStack *get_stack(); virtual NetworkStack *get_stack();
/**
* Sets radio access technology.
*
* @param opRat Radio access technology
*
* @return zero on success
*/
virtual nsapi_error_t set_access_technology_impl(operator_t::RadioAccessTechnology opRat); virtual nsapi_error_t set_access_technology_impl(operator_t::RadioAccessTechnology opRat);
protected:
virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack); virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack);
/**
* Check if modem supports given registration type.
*
* @param reg_type enum RegistrationType
* @return true if given registration type is supported by modem
*/
virtual bool has_registration(RegistrationType reg_type); virtual bool has_registration(RegistrationType reg_type);
}; };
} // namespace mbed } // namespace mbed

View File

@ -29,18 +29,11 @@ public:
virtual ~QUECTEL_BC95_CellularPower(); virtual ~QUECTEL_BC95_CellularPower();
public: //from CellularPower public: //from CellularPower
/**
* Set AT command mode.
* @remark must be called after power on to prepare correct AT mode
* @return blocking until success or failure
*/
virtual nsapi_error_t set_at_mode(); virtual nsapi_error_t set_at_mode();
/** virtual nsapi_error_t reset();
* Reset and wake-up cellular device.
* @return zero on success
*/
virtual nsapi_error_t reset();
}; };
} // namespace mbed } // namespace mbed
#endif // TELIT_HE910_CELLULAR_POWER_H_ #endif // TELIT_HE910_CELLULAR_POWER_H_

View File

@ -31,97 +31,28 @@ public:
QUECTEL_BC95_CellularStack(ATHandler &atHandler, int cid, nsapi_ip_stack_t stack_type); QUECTEL_BC95_CellularStack(ATHandler &atHandler, int cid, nsapi_ip_stack_t stack_type);
virtual ~QUECTEL_BC95_CellularStack(); virtual ~QUECTEL_BC95_CellularStack();
public: // NetworkStack protected: // NetworkStack
/** Listen for connections on a TCP socket
*
* Marks the socket as a passive socket that can be used to accept
* incoming connections.
*
* @param handle Socket handle
* @param backlog Number of pending connections that can be queued
* simultaneously
* @return 0 on success, negative error code on failure
*/
virtual nsapi_error_t socket_listen(nsapi_socket_t handle, int backlog); virtual nsapi_error_t socket_listen(nsapi_socket_t handle, int backlog);
/** Accepts a connection on a TCP socket
*
* The server socket must be bound and set to listen for connections.
* On a new connection, creates a network socket and stores it in the
* specified handle. The handle must be passed to following calls on
* the socket.
*
* A stack may have a finite number of sockets, in this case
* NSAPI_ERROR_NO_SOCKET is returned if no socket is available.
*
* This call is non-blocking. If accept would block,
* NSAPI_ERROR_WOULD_BLOCK is returned immediately.
*
* @param server Socket handle to server to accept from
* @param handle Destination for a handle to the newly created socket
* @param address Destination for the remote address or NULL
* @return 0 on success, negative error code on failure
*/
virtual nsapi_error_t socket_accept(nsapi_socket_t server, virtual nsapi_error_t socket_accept(nsapi_socket_t server,
nsapi_socket_t *handle, SocketAddress *address=0); nsapi_socket_t *handle, SocketAddress *address=0);
protected: protected: // AT_CellularStack
/**
* Gets maximum number of sockets modem supports
*/
virtual int get_max_socket_count(); virtual int get_max_socket_count();
/**
* Gets maximum packet size
*/
virtual int get_max_packet_size(); virtual int get_max_packet_size();
/**
* Checks if modem supports given protocol
*
* @param protocol Protocol type
*/
virtual bool is_protocol_supported(nsapi_protocol_t protocol); virtual bool is_protocol_supported(nsapi_protocol_t protocol);
/**
* Implements modem specific AT command set for socket closing
*
* @param sock_id Socket id
*/
virtual nsapi_error_t socket_close_impl(int sock_id); virtual nsapi_error_t socket_close_impl(int sock_id);
/**
* Implements modem specific AT command set for creating socket
*
* @param socket Cellular socket handle
*/
virtual nsapi_error_t create_socket_impl(CellularSocket *socket); virtual nsapi_error_t create_socket_impl(CellularSocket *socket);
/**
* Implements modem specific AT command set for sending data
*
* @param socket Cellular socket handle
* @param address The SocketAddress of the remote host
* @param data Buffer of data to send to the host
* @param size Size of the buffer in bytes
* @return Number of sent bytes on success, negative error
* code on failure
*/
virtual nsapi_size_or_error_t socket_sendto_impl(CellularSocket *socket, const SocketAddress &address, virtual nsapi_size_or_error_t socket_sendto_impl(CellularSocket *socket, const SocketAddress &address,
const void *data, nsapi_size_t size); const void *data, nsapi_size_t size);
/**
* Implements modem specific AT command set for receiving data
*
* @param handle Socket handle
* @param address Destination for the source address or NULL
* @param buffer Destination buffer for data received from the host
* @param size Size of the buffer in bytes
* @return Number of received bytes on success, negative error
* code on failure
*/
virtual nsapi_size_or_error_t socket_recvfrom_impl(CellularSocket *socket, SocketAddress *address, virtual nsapi_size_or_error_t socket_recvfrom_impl(CellularSocket *socket, SocketAddress *address,
void *buffer, nsapi_size_t size); void *buffer, nsapi_size_t size);

View File

@ -28,23 +28,14 @@ public:
QUECTEL_BG96_CellularNetwork(ATHandler &atHandler); QUECTEL_BG96_CellularNetwork(ATHandler &atHandler);
virtual ~QUECTEL_BG96_CellularNetwork(); virtual ~QUECTEL_BG96_CellularNetwork();
/** Provide access to the NetworkStack object protected:
*
* @return The underlying NetworkStack object
*/
virtual NetworkStack *get_stack(); virtual NetworkStack *get_stack();
/**
* Sets radio access technology.
*
* @param opRat Access technology
*
* @return zero on success
*/
virtual nsapi_error_t set_access_technology_impl(operator_t::RadioAccessTechnology opRat); virtual nsapi_error_t set_access_technology_impl(operator_t::RadioAccessTechnology opRat);
protected:
virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack); virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack);
}; };
} // namespace mbed } // namespace mbed
#endif // QUECTEL_BG96_CELLULAR_NETWORK_H_ #endif // QUECTEL_BG96_CELLULAR_NETWORK_H_

View File

@ -32,97 +32,28 @@ public:
QUECTEL_BG96_CellularStack(ATHandler &atHandler, int cid, nsapi_ip_stack_t stack_type); QUECTEL_BG96_CellularStack(ATHandler &atHandler, int cid, nsapi_ip_stack_t stack_type);
virtual ~QUECTEL_BG96_CellularStack(); virtual ~QUECTEL_BG96_CellularStack();
public: // NetworkStack protected: // NetworkStack
/** Listen for connections on a TCP socket
*
* Marks the socket as a passive socket that can be used to accept
* incoming connections.
*
* @param handle Socket handle
* @param backlog Number of pending connections that can be queued
* simultaneously
* @return 0 on success, negative error code on failure
*/
virtual nsapi_error_t socket_listen(nsapi_socket_t handle, int backlog); virtual nsapi_error_t socket_listen(nsapi_socket_t handle, int backlog);
/** Accepts a connection on a TCP socket
*
* The server socket must be bound and set to listen for connections.
* On a new connection, creates a network socket and stores it in the
* specified handle. The handle must be passed to following calls on
* the socket.
*
* A stack may have a finite number of sockets, in this case
* NSAPI_ERROR_NO_SOCKET is returned if no socket is available.
*
* This call is non-blocking. If accept would block,
* NSAPI_ERROR_WOULD_BLOCK is returned immediately.
*
* @param server Socket handle to server to accept from
* @param handle Destination for a handle to the newly created socket
* @param address Destination for the remote address or NULL
* @return 0 on success, negative error code on failure
*/
virtual nsapi_error_t socket_accept(nsapi_socket_t server, virtual nsapi_error_t socket_accept(nsapi_socket_t server,
nsapi_socket_t *handle, SocketAddress *address=0); nsapi_socket_t *handle, SocketAddress *address=0);
protected: protected: // AT_CellularStack
/**
* Gets maximum number of sockets modem supports
*/
virtual int get_max_socket_count(); virtual int get_max_socket_count();
/**
* Gets maximum packet size
*/
virtual int get_max_packet_size(); virtual int get_max_packet_size();
/**
* Checks if modem supports given protocol
*
* @param protocol Protocol type
*/
virtual bool is_protocol_supported(nsapi_protocol_t protocol); virtual bool is_protocol_supported(nsapi_protocol_t protocol);
/**
* Implements modem specific AT command set for socket closing
*
* @param sock_id Socket id
*/
virtual nsapi_error_t socket_close_impl(int sock_id); virtual nsapi_error_t socket_close_impl(int sock_id);
/**
* Implements modem specific AT command set for creating socket
*
* @param socket Cellular socket handle
*/
virtual nsapi_error_t create_socket_impl(CellularSocket *socket); virtual nsapi_error_t create_socket_impl(CellularSocket *socket);
/**
* Implements modem specific AT command set for sending data
*
* @param socket Cellular socket handle
* @param address The SocketAddress of the remote host
* @param data Buffer of data to send to the host
* @param size Size of the buffer in bytes
* @return Number of sent bytes on success, negative error
* code on failure
*/
virtual nsapi_size_or_error_t socket_sendto_impl(CellularSocket *socket, const SocketAddress &address, virtual nsapi_size_or_error_t socket_sendto_impl(CellularSocket *socket, const SocketAddress &address,
const void *data, nsapi_size_t size); const void *data, nsapi_size_t size);
/**
* Implements modem specific AT command set for receiving data
*
* @param handle Socket handle
* @param address Destination for the source address or NULL
* @param buffer Destination buffer for data received from the host
* @param size Size of the buffer in bytes
* @return Number of received bytes on success, negative error
* code on failure
*/
virtual nsapi_size_or_error_t socket_recvfrom_impl(CellularSocket *socket, SocketAddress *address, virtual nsapi_size_or_error_t socket_recvfrom_impl(CellularSocket *socket, SocketAddress *address,
void *buffer, nsapi_size_t size); void *buffer, nsapi_size_t size);

View File

@ -27,7 +27,6 @@ public:
TELIT_HE910_CellularMultiplexer(ATHandler &atHandler); TELIT_HE910_CellularMultiplexer(ATHandler &atHandler);
virtual ~TELIT_HE910_CellularMultiplexer(); virtual ~TELIT_HE910_CellularMultiplexer();
// override from AT_CellularMultiplexer
virtual nsapi_error_t multiplexer_mode_start(); virtual nsapi_error_t multiplexer_mode_start();
}; };
} // namespace mbed } // namespace mbed

View File

@ -32,22 +32,11 @@ protected:
virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack); virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack);
/**
* Check if modem supports given registration type.
*
* @param rat enum RegistrationType
* @return true if given registration type is supported by modem
*/
virtual bool has_registration(RegistrationType rat); virtual bool has_registration(RegistrationType rat);
/**
* Sets access technology to be scanned.
*
* @param opRat Access technology
*
* @return zero on success
*/
virtual nsapi_error_t set_access_technology_impl(operator_t::RadioAccessTechnology opRat); virtual nsapi_error_t set_access_technology_impl(operator_t::RadioAccessTechnology opRat);
}; };
} // namespace mbed } // namespace mbed
#endif // TELIT_HE910_CELLULAR_NETWORK_H_ #endif // TELIT_HE910_CELLULAR_NETWORK_H_

View File

@ -29,24 +29,14 @@ public:
virtual ~TELIT_HE910_CellularPower(); virtual ~TELIT_HE910_CellularPower();
public: //from CellularPower public: //from CellularPower
/**
* Set cellular device power on.
* @return zero on success
*/
virtual nsapi_error_t on(); virtual nsapi_error_t on();
/**
* Set cellular device power off.
* @return zero on success
*/
virtual nsapi_error_t off(); virtual nsapi_error_t off();
/**
* Set AT command mode.
* @remark must be called after power on to prepare correct AT mode
* @return blocking until success or failure
*/
virtual nsapi_error_t set_at_mode(); virtual nsapi_error_t set_at_mode();
}; };
} // namespace mbed } // namespace mbed
#endif // TELIT_HE910_CELLULAR_POWER_H_ #endif // TELIT_HE910_CELLULAR_POWER_H_

View File

@ -26,15 +26,14 @@ class UBLOX_LISA_U : public AT_CellularDevice
{ {
public: public:
UBLOX_LISA_U(events::EventQueue &queue); UBLOX_LISA_U(events::EventQueue &queue);
virtual ~UBLOX_LISA_U(); virtual ~UBLOX_LISA_U();
public: // CellularDevice public: // CellularDevice
virtual CellularNetwork *open_network(FileHandle *fh); virtual CellularNetwork *open_network(FileHandle *fh);
virtual CellularPower *open_power(FileHandle *fh); virtual CellularPower *open_power(FileHandle *fh);
public: // NetworkInterface
}; };
} // namespace mbed } // namespace mbed
#endif // UBLOX_LISA_U_H_ #endif // UBLOX_LISA_U_H_

View File

@ -31,21 +31,8 @@ public:
protected: protected:
virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack); virtual bool get_modem_stack_type(nsapi_ip_stack_t requested_stack);
/**
* Check if modem supports given registration type.
*
* @param rat enum RegistrationType
* @return true if given registration type is supported by modem
*/
virtual bool has_registration(RegistrationType rat); virtual bool has_registration(RegistrationType rat);
/**
* Sets access technology to be scanned.
*
* @param opRat Access technology
*
* @return zero on success
*/
virtual nsapi_error_t set_access_technology_impl(operator_t::RadioAccessTechnology opRat); virtual nsapi_error_t set_access_technology_impl(operator_t::RadioAccessTechnology opRat);
}; };

View File

@ -29,16 +29,9 @@ public:
virtual ~UBLOX_LISA_U_CellularPower(); virtual ~UBLOX_LISA_U_CellularPower();
public: //from CellularPower public: //from CellularPower
/**
* Set cellular device power on.
* @return zero on success
*/
virtual nsapi_error_t on(); virtual nsapi_error_t on();
/**
* Set cellular device power off.
* @return zero on success
*/
virtual nsapi_error_t off(); virtual nsapi_error_t off();
}; };