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 //--------------------------------------------------------------------------------------------------
84 /**
85  * Type for handler called when a server disconnects.
86  */
87 //--------------------------------------------------------------------------------------------------
88 typedef void (*le_port_DisconnectHandler_t)(void *);
89 
90 //--------------------------------------------------------------------------------------------------
91 /**
92  *
93  * Connect the current client thread to the service providing this API. Block until the service is
94  * available.
95  *
96  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
97  * called before any other functions in this API. Normally, ConnectService is automatically called
98  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
99  *
100  * This function is created automatically.
101  */
102 //--------------------------------------------------------------------------------------------------
104 (
105  void
106 );
107 
108 //--------------------------------------------------------------------------------------------------
109 /**
110  *
111  * Try to connect the current client thread to the service providing this API. Return with an error
112  * if the service is not available.
113  *
114  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
115  * called before any other functions in this API. Normally, ConnectService is automatically called
116  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
117  *
118  * This function is created automatically.
119  *
120  * @return
121  * - LE_OK if the client connected successfully to the service.
122  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
123  * bound.
124  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
125  * - LE_COMM_ERROR if the Service Directory cannot be reached.
126  */
127 //--------------------------------------------------------------------------------------------------
129 (
130  void
131 );
132 
133 //--------------------------------------------------------------------------------------------------
134 /**
135  * Set handler called when server disconnection is detected.
136  *
137  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
138  * to continue without exiting, it should call longjmp() from inside the handler.
139  */
140 //--------------------------------------------------------------------------------------------------
142 (
143  le_port_DisconnectHandler_t disconnectHandler,
144  void *contextPtr
145 );
146 
147 //--------------------------------------------------------------------------------------------------
148 /**
149  *
150  * Disconnect the current client thread from the service providing this API.
151  *
152  * Normally, this function doesn't need to be called. After this function is called, there's no
153  * longer a connection to the service, and the functions in this API can't be used. For details, see
154  * @ref apiFilesC_client.
155  *
156  * This function is created automatically.
157  */
158 //--------------------------------------------------------------------------------------------------
160 (
161  void
162 );
163 
164 
165 //--------------------------------------------------------------------------------------------------
166 /**
167  * Reference type for referring to the device.
168  */
169 //--------------------------------------------------------------------------------------------------
170 
171 
172 //--------------------------------------------------------------------------------------------------
173 /**
174  * This function requests to open a configured device. If the device was not opened, it opens
175  * the device.
176  *
177  * @return
178  * - Reference to the device.
179  * - NULL if the device is not available.
180  */
181 //--------------------------------------------------------------------------------------------------
182 le_port_DeviceRef_t le_port_Request
183 (
184  const char* LE_NONNULL deviceName
185  ///< [IN] Device name to be requested.
186 );
187 
188 //--------------------------------------------------------------------------------------------------
189 /**
190  * This function switches the device into data mode.
191  *
192  * @return
193  * - LE_OK Function succeeded.
194  * - LE_FAULT Function failed.
195  * - LE_BAD_PARAMETER Invalid parameter.
196  * - LE_UNAVAILABLE JSON parsing is not completed.
197  * - LE_DUPLICATE Device already opened in data mode.
198  */
199 //--------------------------------------------------------------------------------------------------
201 (
202  le_port_DeviceRef_t devRef,
203  ///< [IN] Device reference.
204  int* fdPtr
205  ///< [OUT] File descriptor of the device.
206 );
207 
208 //--------------------------------------------------------------------------------------------------
209 /**
210  * This function switches the device into AT command mode and returns AT server device reference.
211  *
212  * @return
213  * - LE_OK Function succeeded.
214  * - LE_FAULT Function failed.
215  * - LE_BAD_PARAMETER Invalid parameter.
216  */
217 //--------------------------------------------------------------------------------------------------
219 (
220  le_port_DeviceRef_t devRef,
221  ///< [IN] Device reference.
222  le_atServer_DeviceRef_t* atServerDevRefPtr
223  ///< [OUT] AT server device reference.
224 );
225 
226 //--------------------------------------------------------------------------------------------------
227 /**
228  * This function closes the device and releases the resources.
229  *
230  * @return
231  * - LE_OK Function succeeded.
232  * - LE_FAULT Function failed.
233  * - LE_BAD_PARAMETER Invalid parameter.
234  * - LE_UNAVAILABLE JSON parsing is not completed.
235  */
236 //--------------------------------------------------------------------------------------------------
238 (
239  le_port_DeviceRef_t devRef
240  ///< [IN] Device reference.
241 );
242 
243 //--------------------------------------------------------------------------------------------------
244 /**
245  * This function gets the device reference regarding to a given reference coming from the AT server.
246  *
247  * @return
248  * - LE_OK Function succeeded.
249  * - LE_FAULT Function failed.
250  * - LE_BAD_PARAMETER Invalid parameter.
251  */
252 //--------------------------------------------------------------------------------------------------
254 (
255  le_atServer_DeviceRef_t atServerDevRef,
256  ///< [IN] Device reference from AT server.
257  le_port_DeviceRef_t* devRefPtr
258  ///< [OUT] Device reference from port service.
259 );
260 
261 #endif // LE_PORT_INTERFACE_H_INCLUDE_GUARD
le_result_t
Definition: le_basics.h:35
LE_FULL_API void le_port_SetServerDisconnectHandler(le_port_DisconnectHandler_t disconnectHandler, void *contextPtr)
void le_port_DisconnectService(void)
le_result_t le_port_TryConnectService(void)
le_result_t le_port_Release(le_port_DeviceRef_t devRef)
le_port_DeviceRef_t le_port_Request(const char *LE_NONNULL deviceName)
void le_port_ConnectService(void)
le_result_t le_port_SetDataMode(le_port_DeviceRef_t devRef, int *fdPtr)
#define LE_FULL_API
Definition: le_apiFeatures.h:40
void(* le_port_DisconnectHandler_t)(void *)
Definition: le_port_interface.h:88
le_result_t le_port_SetCommandMode(le_port_DeviceRef_t devRef, le_atServer_DeviceRef_t *atServerDevRefPtr)
le_result_t le_port_GetPortReference(le_atServer_DeviceRef_t atServerDevRef, le_port_DeviceRef_t *devRefPtr)