le_port_interface.h

Go to the documentation of this file.
1 
2 
3 /*
4  * ====================== WARNING ======================
5  *
6  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
7  * DO NOT MODIFY IN ANY WAY.
8  *
9  * ====================== WARNING ======================
10  */
11 
12 /**
13  * @page c_port Port Service
14  *
15  * @ref le_port_interface.h "API Reference"
16  *
17  * This service manages a list of serial links (physical or emulated). It also manages the
18  * link modes (AT command and data mode).
19  *
20  * @section le_port_binding IPC interfaces binding
21  *
22  * All the functions of this API are provided by the @b portService.
23  *
24  * Here's a code sample binding to the port service:
25  * @verbatim
26  bindings:
27  {
28  portTest.portTestComp.le_port -> portService.le_port
29  }
30  @endverbatim
31  *
32  * @section port_request Request Device
33  *
34  * le_port_Request() must be called to open a configured device. If the device was not opened, it
35  * opens the device.
36  *
37  * @section port_SwitchMode Switch Mode
38  *
39  * le_port_SetDataMode() must be called to switch the device into data mode.
40  * le_port_SetCommandMode() must be called to switch the device into command mode.
41  *
42  * @section port_Release Release Device
43  *
44  * le_port_Release() must be called to release the device.
45  *
46  * @section port_config Configuration
47  *
48  * @todo Configuration documentation to be written.
49  *
50  * @section port_GetPortReference Get Port Reference
51  *
52  * le_port_GetPortReference() must be called to get the port object reference regarding to a given
53  * reference coming from the AT server.
54  *
55  * @todo The port service is not implemented yet.
56  *
57  * <HR>
58  *
59  * Copyright (C) Sierra Wireless Inc.
60  */
61 /**
62  * @file le_port_interface.h
63  *
64  * Legato @ref c_port include file.
65  *
66  * Copyright (C) Sierra Wireless Inc.
67  */
68 /**
69  * Include le_atServer.api for atServer type definitions.
70  */
71 
72 #ifndef LE_PORT_INTERFACE_H_INCLUDE_GUARD
73 #define LE_PORT_INTERFACE_H_INCLUDE_GUARD
74 
75 
76 #include "legato.h"
77 
78 // Interface specific includes
79 #include "le_atServer_interface.h"
80 
81 // Internal includes for this interface
82 #include "le_port_common.h"
83 /** @addtogroup le_port le_port API Reference
84  * @{
85  * @file le_port_common.h
86  * @file le_port_interface.h **/
87 //--------------------------------------------------------------------------------------------------
88 /**
89  * Type for handler called when a server disconnects.
90  */
91 //--------------------------------------------------------------------------------------------------
92 typedef void (*le_port_DisconnectHandler_t)(void *);
93 
94 //--------------------------------------------------------------------------------------------------
95 /**
96  *
97  * Connect the current client thread to the service providing this API. Block until the service is
98  * available.
99  *
100  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
101  * called before any other functions in this API. Normally, ConnectService is automatically called
102  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
103  *
104  * This function is created automatically.
105  */
106 //--------------------------------------------------------------------------------------------------
108 (
109  void
110 );
111 
112 //--------------------------------------------------------------------------------------------------
113 /**
114  *
115  * Try to connect the current client thread to the service providing this API. Return with an error
116  * if the service is not available.
117  *
118  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
119  * called before any other functions in this API. Normally, ConnectService is automatically called
120  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
121  *
122  * This function is created automatically.
123  *
124  * @return
125  * - LE_OK if the client connected successfully to the service.
126  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
127  * bound.
128  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
129  * - LE_COMM_ERROR if the Service Directory cannot be reached.
130  */
131 //--------------------------------------------------------------------------------------------------
133 (
134  void
135 );
136 
137 //--------------------------------------------------------------------------------------------------
138 /**
139  * Set handler called when server disconnection is detected.
140  *
141  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
142  * to continue without exiting, it should call longjmp() from inside the handler.
143  */
144 //--------------------------------------------------------------------------------------------------
146 (
147  le_port_DisconnectHandler_t disconnectHandler,
148  void *contextPtr
149 );
150 
151 //--------------------------------------------------------------------------------------------------
152 /**
153  *
154  * Disconnect the current client thread from the service providing this API.
155  *
156  * Normally, this function doesn't need to be called. After this function is called, there's no
157  * longer a connection to the service, and the functions in this API can't be used. For details, see
158  * @ref apiFilesC_client.
159  *
160  * This function is created automatically.
161  */
162 //--------------------------------------------------------------------------------------------------
164 (
165  void
166 );
167 
168 
169 //--------------------------------------------------------------------------------------------------
170 /**
171  * Reference type for referring to the device.
172  */
173 //--------------------------------------------------------------------------------------------------
174 
175 
176 //--------------------------------------------------------------------------------------------------
177 /**
178  * This function requests to open a configured device. If the device was not opened, it opens
179  * the device.
180  *
181  * @return
182  * - Reference to the device.
183  * - NULL if the device is not available.
184  */
185 //--------------------------------------------------------------------------------------------------
187 (
188  const char* LE_NONNULL deviceName
189  ///< [IN] Device name to be requested.
190 );
191 
192 //--------------------------------------------------------------------------------------------------
193 /**
194  * This function switches the device into data mode.
195  *
196  * @return
197  * - LE_OK Function succeeded.
198  * - LE_FAULT Function failed.
199  * - LE_BAD_PARAMETER Invalid parameter.
200  * - LE_UNAVAILABLE JSON parsing is not completed.
201  * - LE_DUPLICATE Device already opened in data mode.
202  */
203 //--------------------------------------------------------------------------------------------------
205 (
206  le_port_DeviceRef_t devRef,
207  ///< [IN] Device reference.
208  int* fdPtr
209  ///< [OUT] File descriptor of the device.
210 );
211 
212 //--------------------------------------------------------------------------------------------------
213 /**
214  * This function switches the device into AT command mode and returns AT server device reference.
215  *
216  * @return
217  * - LE_OK Function succeeded.
218  * - LE_FAULT Function failed.
219  * - LE_BAD_PARAMETER Invalid parameter.
220  */
221 //--------------------------------------------------------------------------------------------------
223 (
224  le_port_DeviceRef_t devRef,
225  ///< [IN] Device reference.
226  le_atServer_DeviceRef_t* atServerDevRefPtr
227  ///< [OUT] AT server device reference.
228 );
229 
230 //--------------------------------------------------------------------------------------------------
231 /**
232  * This function closes the device and releases the resources.
233  *
234  * @return
235  * - LE_OK Function succeeded.
236  * - LE_FAULT Function failed.
237  * - LE_BAD_PARAMETER Invalid parameter.
238  * - LE_UNAVAILABLE JSON parsing is not completed.
239  */
240 //--------------------------------------------------------------------------------------------------
242 (
243  le_port_DeviceRef_t devRef
244  ///< [IN] Device reference.
245 );
246 
247 //--------------------------------------------------------------------------------------------------
248 /**
249  * This function gets the device reference regarding to a given reference coming from the AT server.
250  *
251  * @return
252  * - LE_OK Function succeeded.
253  * - LE_FAULT Function failed.
254  * - LE_BAD_PARAMETER Invalid parameter.
255  */
256 //--------------------------------------------------------------------------------------------------
258 (
259  le_atServer_DeviceRef_t atServerDevRef,
260  ///< [IN] Device reference from AT server.
261  le_port_DeviceRef_t* devRefPtr
262  ///< [OUT] Device reference from port service.
263 );
264 
265 /** @} **/
266 
267 #endif // LE_PORT_INTERFACE_H_INCLUDE_GUARD
void le_port_ConnectService(void)
LE_FULL_API void le_port_SetServerDisconnectHandler(le_port_DisconnectHandler_t disconnectHandler, void *contextPtr)
struct le_port_Device * le_port_DeviceRef_t
Definition: le_port_common.h:43
le_result_t
Definition: le_basics.h:46
void(* le_port_DisconnectHandler_t)(void *)
Definition: le_port_interface.h:92
le_result_t le_port_GetPortReference(le_atServer_DeviceRef_t atServerDevRef, le_port_DeviceRef_t *devRefPtr)
le_result_t le_port_SetDataMode(le_port_DeviceRef_t devRef, int *fdPtr)
le_result_t le_port_Release(le_port_DeviceRef_t devRef)
struct le_atServer_Device * le_atServer_DeviceRef_t
Definition: le_atServer_common.h:65
le_result_t le_port_TryConnectService(void)
#define LE_FULL_API
Definition: le_apiFeatures.h:40
le_result_t le_port_SetCommandMode(le_port_DeviceRef_t devRef, le_atServer_DeviceRef_t *atServerDevRefPtr)
le_port_DeviceRef_t le_port_Request(const char *LE_NONNULL deviceName)
void le_port_DisconnectService(void)