anjay
Loading...
Searching...
No Matches
sms.h File Reference
#include <anjay/core.h>

Go to the source code of this file.

Data Structures

struct  anjay_smsdrv_multipart_info_t
 
struct  anjay_smsdrv_struct
 

Macros

#define ANJAY_MSISDN_SIZE   16
 

Typedefs

typedef int anjay_smsdrv_recv_all_cb_t(void *cb_arg, const char *source, const void *data, uint8_t data_size, const anjay_smsdrv_multipart_info_t *multipart_info, bool *out_should_remove)
 
typedef int anjay_smsdrv_send_t(anjay_smsdrv_t *driver, const char *destination, const void *data, size_t data_size, const anjay_smsdrv_multipart_info_t *multipart_info, avs_time_duration_t timeout)
 
typedef int anjay_smsdrv_should_try_recv_t(anjay_smsdrv_t *driver, avs_time_duration_t timeout)
 
typedef int anjay_smsdrv_recv_all_t(anjay_smsdrv_t *driver, anjay_smsdrv_recv_all_cb_t *cb, void *cb_arg)
 
typedef int anjay_smsdrv_system_socket_t(anjay_smsdrv_t *driver, const void **out)
 
typedef avs_errno_t anjay_smsdrv_error_t(anjay_smsdrv_t *driver)
 
typedef void anjay_smsdrv_free_t(anjay_smsdrv_t *driver)
 

Functions

void anjay_smsdrv_cleanup (anjay_smsdrv_t **driver)
 

Macro Definition Documentation

◆ ANJAY_MSISDN_SIZE

#define ANJAY_MSISDN_SIZE   16

Typedef Documentation

◆ anjay_smsdrv_error_t

typedef avs_errno_t anjay_smsdrv_error_t(anjay_smsdrv_t *driver)

If the last other method invoked on the driver returned an error, returns an errno-compatible code with its actual cause.

NOTE: AVS_ENODEV is reserved for signalling a loss-of-carrier condition that shall NOT be treated as fatal. For this one special error code, errors while handling incoming requests will NOT trigger connection closure (and subsequent retry and/or rebootstrap attempts) as all other errors will.

Parameters
driverSMS driver object to operate on.
Returns
errno-compatible error code.

◆ anjay_smsdrv_free_t

typedef void anjay_smsdrv_free_t(anjay_smsdrv_t *driver)

Cleanups the device driver, freeing all used resources.

Parameters
driverDevice driver context to operate on.

◆ anjay_smsdrv_recv_all_cb_t

typedef int anjay_smsdrv_recv_all_cb_t(void *cb_arg, const char *source, const void *data, uint8_t data_size, const anjay_smsdrv_multipart_info_t *multipart_info, bool *out_should_remove)

◆ anjay_smsdrv_recv_all_t

typedef int anjay_smsdrv_recv_all_t(anjay_smsdrv_t *driver, anjay_smsdrv_recv_all_cb_t *cb, void *cb_arg)

Examines the SMS inbox.

Note that all entries which are not in 8-bit format or cannot be handled for any other reason, are ignored.

Parameters
driverSMS driver object to operate on.
cbFunction to invoke for all 8-bit SMS messages present in the inbox. If the callback sets its out_should_remove variable to true, the message is removed from the inbox.
cb_argUser data value to be passed on to the cb function.

◆ anjay_smsdrv_send_t

typedef int anjay_smsdrv_send_t(anjay_smsdrv_t *driver, const char *destination, const void *data, size_t data_size, const anjay_smsdrv_multipart_info_t *multipart_info, avs_time_duration_t timeout)

Sends an SMS message in 8-bit mode.

Parameters
driverSMS driver object to operate on.
destinationPhone number of the destination in plain ASCII format (either international using "+", or national).
dataPointer to SMS payload data to send.
data_sizeLength of SMS payload data to send.
multipart_infoReference information for a Concatenated SMS part, or NULL if the SMS being sent is not part of a Concatenated SMS message.
timeoutDuration of time after which to give up waiting for a response from the modem.
Returns
Zero for success, or a negative value in case of error.

◆ anjay_smsdrv_should_try_recv_t

typedef int anjay_smsdrv_should_try_recv_t(anjay_smsdrv_t *driver, avs_time_duration_t timeout)

Waits for new messages in the inbox. Checks whether any new messages came since last call to anjay_smsdrv_recv_all_cb_t, and if not - waits for notification about new message to come before the specified timeout.

Parameters
driverSMS driver object to operate on.
timeoutDuration of time after which to give up waiting for notification.
Returns
1 if there are new messages in the inbox, 0 if none came before timeout, or a negative value in case of error.

◆ anjay_smsdrv_system_socket_t

typedef int anjay_smsdrv_system_socket_t(anjay_smsdrv_t *driver, const void **out)

Returns a pointer to bare system handle to the modem port (e.g. to invoke select or poll). The returned handle shall be interpreted in the same way as the value returned from avs_net_socket_get_system().

Parameters
driverSMS driver object to operate on.
outPointer to a variable in which to save the pointer to the system handle.
Returns
Zero for success, or a negative value in case of error.

Function Documentation

◆ anjay_smsdrv_cleanup()

void anjay_smsdrv_cleanup ( anjay_smsdrv_t **  driver)

Cleans up all resources and releases an SMS driver object, using user provided implementation of anjay_smsdrv_free_t .

Sets *driver to NULL afterwards.

NOTE: If an Anjay object has been using the SMS driver, the SMS driver shall be cleaned up after freeing the Anjay object using anjay_delete.

Parameters
driverPointer to an SMS driver object to delete.