Network Component  Version 7.15.0
MDK Middleware for IPv4 and IPv6 Networking
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
net_modem.h
Go to the documentation of this file.
1 /*------------------------------------------------------------------------------
2  * MDK Middleware - Component ::Network
3  * Copyright (c) 2004-2020 Arm Limited (or its affiliates). All rights reserved.
4  *------------------------------------------------------------------------------
5  * Name: net_modem.h
6  * Purpose: Network Modem Driver API
7  * Rev.: V6.3.0
8  *----------------------------------------------------------------------------*/
9 
10 /* History:
11  * Version 6.3.0
12  * Added access to modem response string
13  * Version 6.2
14  * Compatible release
15  * Version 6.00
16  * Compatible release
17  * Version 5.10
18  * Initial release
19  */
20 
21 #ifndef __NET_MODEM_H
22 #define __NET_MODEM_H
23 
24 #include <stddef.h>
25 #include <stdint.h>
26 #include <stdbool.h>
27 
28 /**
29 \brief Modem Driver Status of executed operation.
30 */
31 typedef enum _MODEM_STATUS {
32  MODEM_OK = 0, ///< Operation succeeded
33  MODEM_ERROR = 1 ///< Unspecified error
34 } MODEM_STATUS;
35 
36 /**
37 \brief Modem Driver Callback Events.
38 */
39 typedef enum _MODEM_EVENT {
40  MODEM_EVENT_OK, ///< Operation succeeded
41  MODEM_EVENT_TIMEOUT, ///< Operation timeout
42  MODEM_EVENT_RESPONSE, ///< Modem response returned
43  MODEM_EVENT_ERROR ///< Unspecified error
44 } MODEM_EVENT;
45 
46 // Function documentation
47 /**
48  \fn MODEM_STATUS Modem_Initialize (Modem_Request_t cb_request, const char *init_string)
49  \brief Initialize Modem Device.
50  \param[in] cb_request Pointer to \ref Modem_Request.
51  \param[in] init_string Pointer to modem initialization string.
52  \return execution status \ref MODEM_STATUS.
53 */
54 /**
55  \fn MODEM_STATUS Modem_Uninitialize (void)
56  \brief De-initialize Modem Device.
57  \return execution status \ref MODEM_STATUS.
58 */
59 /**
60  \fn MODEM_STATUS Modem_Listen (void)
61  \brief Start Modem Device listening mode.
62  \return execution status \ref MODEM_STATUS.
63 */
64 /**
65  \fn MODEM_STATUS Modem_Dial (const char *dial_num)
66  \brief Start dialing target number.
67  \param[in] dial_num Target number, a null-terminated string.
68  \return execution status \ref MODEM_STATUS.
69 */
70 /**
71  \fn MODEM_STATUS Modem_Hangup (void)
72  \brief Hangup the line.
73  \return execution status \ref MODEM_STATUS.
74 */
75 /**
76  \fn bool Modem_IsOnline (void)
77  \brief Check if modem is online.
78  \return
79  - \b true Modem is Online.
80  - \b false Modem is Offline.
81 */
82 /**
83  \fn void Modem_Notify (MODEM_EVENT event, const char *response)
84  \brief Notify the Modem Driver of completion event.
85  \param[in] event Notification event \ref MODEM_EVENT.
86  \param[in] response Actual modem response, a null-terminated string.
87  \return None.
88 */
89 
90 /**
91  \fn void Modem_Request (const char *command, const char *response, uint32_t timeout, uint32_t retries)
92  \brief Request Callback function for the driver.
93  \param[in] command Command to send to modem.
94  \param[in] response Expected response from modem, or "#" for any response.
95  \param[in] timeout Response timeout in milliseconds.
96  \param[in] retries Number of retries.
97  \return None.
98  \note Any response "#" disables internal processing and delivers modem responses in \ref Modem_Notify.
99 */
100 
101 typedef void (*Modem_Request_t) (const char *command, const char *response, uint32_t timeout, uint32_t retries);
102 
103 /**
104 \brief Access structure of the Modem Driver.
105 */
106 typedef struct _DRIVER_MODEM {
107  MODEM_STATUS (*Initialize) (Modem_Request_t cb_request,
108  const char *init_string); ///< Pointer to \ref Modem_Initialize : Initialize Modem Device.
109  MODEM_STATUS (*Uninitialize) (void); ///< Pointer to \ref Modem_Uninitialize : De-initialize Modem Device.
110  MODEM_STATUS (*Listen) (void); ///< Pointer to \ref Modem_Listen : Start Modem Device listening mode.
111  MODEM_STATUS (*Dial) (const char *dial_num); ///< Pointer to \ref Modem_Dial : Start dialing target number.
112  MODEM_STATUS (*Hangup) (void); ///< Pointer to \ref Modem_Hangup : Hangup the line.
113  bool (*IsOnline) (void); ///< Pointer to \ref Modem_IsOnline : Check if modem is online.
114  void (*Notify) (MODEM_EVENT event,
115  const char *response); ///< Pointer to \ref Modem_Notify : Notify the driver of completion event.
116 } const DRIVER_MODEM;
117 
118 #endif /* __NET_MODEM_H */
Unspecified error.
Definition: net_modem.h:43
Operation succeeded.
Definition: net_modem.h:40
Access structure of the Modem Driver.
Definition: net_modem.h:106
MODEM_STATUS
Modem Driver Status of executed operation.
Definition: net_modem.h:31
MODEM_EVENT
Modem Driver Callback Events.
Definition: net_modem.h:39
MODEM_EVENT
Definition: net_modem.txt:22
void(* Modem_Request_t)(const char *command, const char *response, uint32_t timeout, uint32_t retries)
Definition: net_modem.h:101
Modem response returned.
Definition: net_modem.h:42
Operation succeeded.
Definition: net_modem.h:32
Unspecified error.
Definition: net_modem.h:33
Operation timeout.
Definition: net_modem.h:41