le_mdc_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_mdc Modem Data Control
14  *
15  * @ref le_mdc_interface.h "API Reference"
16  *
17  * <HR>
18  *
19  * A data session is useful for applications that need to send or receive data over a network
20  * where SMS messages are insufficient. To start a data session, a data profile must
21  * be configured as specified by the target network.
22  *
23  * The Modem Data Control (mdc) API is used to manage data profiles and data sessions.
24  *
25  * @section le_mdc_binding IPC interfaces binding
26  *
27  * All the functions of this API are provided by the @b modemService service.
28  *
29  * Here's a code sample binding to modem services:
30  * @verbatim
31  bindings:
32  {
33  clientExe.clientComponent.le_mdc -> modemService.le_mdc
34  }
35  @endverbatim
36  *
37  * @section le_mdc_profile Data Profiles
38  *
39  * If a pre-defined data profile has been configured then this profile can
40  * be loaded using le_mdc_GetProfile().
41  * le_mdc_GetProfile() must be called with @c LE_MDC_DEFAULT_PROFILE to retrieve the default index
42  * used by the modem for data connection.
43  * le_mdc_GetProfile() must be called with @c LE_MDC_SIMTOOLKIT_BIP_DEFAULT_PROFILE to retrieve the
44  * default index used by the modem for Bearer Independent Protocol (BIP).
45  * The maximum number of data profiles supported is modem dependent and can be retrieved with
46  * le_mdc_NumProfiles().
47  * The list of supported PDP context identifiers (CID) are modem dependent and can be retrieved by
48  * calling le_mdc_GetCidList().
49  *
50  * @note le_mdc_GetProfile() creates a new profile if the profile's index can't be found.
51  *
52  * @warning 0 is not a valid index.
53  *
54  * A pre-defined data profile can be retrieved using le_mdc_GetProfileFromApn() thanks to its
55  * APN.
56  *
57  * A default APN can be set for a defined profile with le_mdc_SetDefaultAPN(), based on the SIM
58  * identification number (ICCID). If no match is found in the database using the ICCID, the search
59  * falls back on the home network (MCC/MNC) to determine the default APN.
60  *
61  * @warning Ensure to check the list of supported data profiles for your specific platform.
62  *
63  * The following data profile parameters can be retrieved:
64  * - Packet Data Protocol using le_mdc_GetPDP().
65  * - Access Point Name using le_mdc_GetAPN().
66  * - Authentication settings using le_mdc_GetAuthentication().
67  *
68  * The following data profile parameters can be set:
69  * - Packet Data Protocol using le_mdc_SetPDP().
70  * - Access Point Name using le_mdc_SetAPN().
71  * - Authentication settings using le_mdc_SetAuthentication().
72  *
73  * @warning The maximum APN length might be limited by the platform.
74  * Please refer to the platform documentation.
75  *
76  * A sample code can be seen in the following page:
77  * - @subpage c_mdcDataProfiles
78  *
79  * @section le_mdc_session Data Sessions
80  *
81  * @subsection le_mdc_session_MO Mobile Originated (MO-PDP context activation)
82  *
83  * le_mdc_MapProfileOnNetworkInterface() may be used to map a data session with a network interface.
84  * To take effect, this API has to be called before starting the data session. Otherwise, the
85  * mapping will be taken into account at the next start of the data profile.
86  *
87  * A data session can be started using le_mdc_StartSession(). It is a blocking function with a
88  * maximum timeout set to 155 seconds. To start a data session, a data profile must be created
89  * and written to the modem, or an existing data profile can be used.
90  * A data session can be stopped using le_mdc_StopSession(). The number of
91  * simultaneous data sessions supported is dependent on the modem, but cannot be more than the
92  * maximum number of supported profiles.
93  *
94  * A data session can be started using le_mdc_StartSessionAsync() and stopped using
95  * le_mdc_StopSessionAsync(). These functions are not blocking. The response will be returned
96  * with the @c le_mdc_SessionHandlerFunc_t handler function.
97  *
98  * The current state of a data session can be queried using le_mdc_GetSessionState(). An application
99  * can also a register handler to be notified when the session state changes. The handler
100  * can be managed using le_mdc_AddSessionStateHandler() and le_mdc_RemoveSessionStateHandler().
101  *
102  * @subsection le_mdc_session_MT Mobile Terminated (MT-PDP context activation)
103  * To be notified by the MT-PDP context request, the application has to subscribe to the state
104  * handler using le_mdc_AddMtPdpSessionStateHandler().
105  * When the incoming MT-PDP context request is notified,
106  * the application takes responsibility to trigger the data session for that MT PDP request using
107  * le_mdc_StartSession(). That data session can be stopped using le_mdc_StopSession().
108  *
109  * The network interface settings of that MT-PDP context can be retrieved using the provided
110  * Data Profile.
111  * Please refer to @ref le_mdc_session_networkItf.
112  *
113  * A data session can be rejected using le_mdc_RejectMtPdpSession().
114  * The number of simultaneous data sessions supported is dependent on the modem,
115  * but cannot be more than the maximum number of supported profiles.
116  *
117  * The handler can be released using le_mdc_RemoveMtPdpSessionStateHandler().
118  *
119  * @warning The MT-PDP context activation feature is not supported on all platforms. Please refer to
120  * @ref MT-PDP_context section for full details.
121  *
122  * @subsection le_mdc_session_networkItf Network interface settings
123  * Once a data session starts, a Linux network interface is created. It's the application's
124  * responsibility to configure the network interface, usually through a DHCP client. Query the
125  * interface name using le_mdc_GetInterfaceName(). The IP Preference can be checked with
126  * le_mdc_IsIPv4() or le_mdc_IsIPv6() when the profile is connected. The IP address for the
127  * current data session
128  * can be retrieved by le_mdc_GetIPv4Address() or le_mdc_GetIPv6Address(). The Gateway and
129  * DNS
130  * addresses can be retrieved using le_mdc_GetIPv4GatewayAddress(),
131  * le_mdc_GetIPv4DNSAddresses() or le_mdc_GetIPv6GatewayAddress(), le_mdc_GetIPv6DNSAddresses().
132  * The Access Point Name can be retrieved by le_mdc_GetAPN(). The Data bearer
133  * Technology can be retrieved by le_mdc_GetDataBearerTechnology().
134  *
135  * le_mdc_GetDisconnectionReasonExt() or le_mdc_GetPlatformSpecificDisconnectionCodeExt() let you get
136  * the reason for disconnection of data session by retrieving the call end failure code
137  * from @c le_mdc_ProfileRef_t.
138  *
139  * le_mdc_GetPlatformSpecificFailureConnectionReasonExt() let you get the data session connection
140  * failure reason by retrieving the call connection failure code and type from
141  * @c le_mdc_ProfileRef_t.
142  *
143  * Please refer to @ref platformConstraintsSpecificErrorCodes for platform specific
144  * disconnection code description.
145  *
146  * A sample code can be seen in the following page:
147  * - @subpage c_mdcDataSessions
148  *
149  * @section le_mdc_dataStatistics Data Statistics
150  *
151  * The amount of received and transmitted data can be retrieved through le_mdc_GetBytesCounters().
152  * The returned values correspond to the number of received and transmitted
153  * bytes since the last call to le_mdc_ResetBytesCounter().
154  *
155  * The data statistics collection can be enabled with le_mdc_StartBytesCounter() and disabled
156  * without resetting the counters with le_mdc_StopBytesCounter().
157  *
158  * @note The data statistics collection activation and the data counters are persistent even after
159  * a reboot of the platform.
160  *
161  * A sample code can be seen in the following page:
162  * - @subpage c_mdcDataStatistics
163  *
164  * <HR>
165  *
166  * Copyright (C) Sierra Wireless Inc.
167  */
168 /**
169  * @page c_mdcDataProfiles Sample code for Data Profiles
170  *
171  * @snippet "apps/test/modemServices/mdc/mdcIntegrationTest/mdcTestComp/mdcTest.c" Profiles
172  */
173 /**
174  * @page c_mdcDataSessions Sample code for network interface settings
175  *
176  * @snippet "apps/test/modemServices/mdc/mdcIntegrationTest/mdcTestComp/mdcTest.c" Sessions
177  */
178 /**
179  * @page c_mdcDataStatistics Sample code for Data Statistics
180  *
181  * @snippet "apps/test/modemServices/mdc/mdcIntegrationTest/mdcTestComp/mdcTest.c" Statistics
182  */
183 /**
184  * @file le_mdc_interface.h
185  *
186  * Legato @ref c_mdc include file.
187  *
188  * Copyright (C) Sierra Wireless Inc.
189  */
190 
191 #ifndef LE_MDC_INTERFACE_H_INCLUDE_GUARD
192 #define LE_MDC_INTERFACE_H_INCLUDE_GUARD
193 
194 
195 #include "legato.h"
196 
197 // Internal includes for this interface
198 #include "le_mdc_common.h"
199 //--------------------------------------------------------------------------------------------------
200 /**
201  * Type for handler called when a server disconnects.
202  */
203 //--------------------------------------------------------------------------------------------------
204 typedef void (*le_mdc_DisconnectHandler_t)(void *);
205 
206 //--------------------------------------------------------------------------------------------------
207 /**
208  *
209  * Connect the current client thread to the service providing this API. Block until the service is
210  * available.
211  *
212  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
213  * called before any other functions in this API. Normally, ConnectService is automatically called
214  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
215  *
216  * This function is created automatically.
217  */
218 //--------------------------------------------------------------------------------------------------
220 (
221  void
222 );
223 
224 //--------------------------------------------------------------------------------------------------
225 /**
226  *
227  * Try to connect the current client thread to the service providing this API. Return with an error
228  * if the service is not available.
229  *
230  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
231  * called before any other functions in this API. Normally, ConnectService is automatically called
232  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
233  *
234  * This function is created automatically.
235  *
236  * @return
237  * - LE_OK if the client connected successfully to the service.
238  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
239  * bound.
240  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
241  * - LE_COMM_ERROR if the Service Directory cannot be reached.
242  */
243 //--------------------------------------------------------------------------------------------------
245 (
246  void
247 );
248 
249 //--------------------------------------------------------------------------------------------------
250 /**
251  * Set handler called when server disconnection is detected.
252  *
253  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
254  * to continue without exiting, it should call longjmp() from inside the handler.
255  */
256 //--------------------------------------------------------------------------------------------------
258 (
259  le_mdc_DisconnectHandler_t disconnectHandler,
260  void *contextPtr
261 );
262 
263 //--------------------------------------------------------------------------------------------------
264 /**
265  *
266  * Disconnect the current client thread from the service providing this API.
267  *
268  * Normally, this function doesn't need to be called. After this function is called, there's no
269  * longer a connection to the service, and the functions in this API can't be used. For details, see
270  * @ref apiFilesC_client.
271  *
272  * This function is created automatically.
273  */
274 //--------------------------------------------------------------------------------------------------
276 (
277  void
278 );
279 
280 
281 //--------------------------------------------------------------------------------------------------
282 /**
283  * Reference to a modem data connection profile.
284  */
285 //--------------------------------------------------------------------------------------------------
286 
287 
288 //--------------------------------------------------------------------------------------------------
289 /**
290  * Enumeration of data bearer technologies.
291  */
292 //--------------------------------------------------------------------------------------------------
293 
294 
295 //--------------------------------------------------------------------------------------------------
296 /**
297  * Enumeration of Packet Data Protocol.
298  */
299 //--------------------------------------------------------------------------------------------------
300 
301 
302 //--------------------------------------------------------------------------------------------------
303 /**
304  * Authentication bit mask.
305  */
306 //--------------------------------------------------------------------------------------------------
307 
308 
309 //--------------------------------------------------------------------------------------------------
310 /**
311  * Enumeration of connection state.
312  */
313 //--------------------------------------------------------------------------------------------------
314 
315 
316 //--------------------------------------------------------------------------------------------------
317 /**
318  * Enumeration of the possible reasons for the disconnection.
319  */
320 //--------------------------------------------------------------------------------------------------
321 
322 
323 //--------------------------------------------------------------------------------------------------
324 /**
325  * Handler for Data session connection state changes.
326  */
327 //--------------------------------------------------------------------------------------------------
328 
329 
330 //--------------------------------------------------------------------------------------------------
331 /**
332  * Handler for MT-PDP Data session connection state changes.
333  */
334 //--------------------------------------------------------------------------------------------------
335 
336 
337 //--------------------------------------------------------------------------------------------------
338 /**
339  * Handler for asynchronous session start and stop result response
340  *
341  */
342 //--------------------------------------------------------------------------------------------------
343 
344 
345 //--------------------------------------------------------------------------------------------------
346 /**
347  * Reference type used by Add/Remove functions for EVENT 'le_mdc_SessionState'
348  */
349 //--------------------------------------------------------------------------------------------------
350 
351 
352 //--------------------------------------------------------------------------------------------------
353 /**
354  * Reference type used by Add/Remove functions for EVENT 'le_mdc_MtPdpSessionState'
355  */
356 //--------------------------------------------------------------------------------------------------
357 
358 
359 //--------------------------------------------------------------------------------------------------
360 /**
361  * This is the structure with info about a given cellular data profile
362  */
363 //--------------------------------------------------------------------------------------------------
364 
365 
366 //--------------------------------------------------------------------------------------------------
367 /**
368  * Add handler function for EVENT 'le_mdc_SessionState'
369  *
370  * This event provides information on data session connection state changes for the given profileRef.
371  *
372  */
373 //--------------------------------------------------------------------------------------------------
374 le_mdc_SessionStateHandlerRef_t le_mdc_AddSessionStateHandler
375 (
376  le_mdc_ProfileRef_t profileRef,
377  ///< [IN] The profile object of interest
378  le_mdc_SessionStateHandlerFunc_t handlerPtr,
379  ///< [IN]
380  void* contextPtr
381  ///< [IN]
382 );
383 
384 //--------------------------------------------------------------------------------------------------
385 /**
386  * Remove handler function for EVENT 'le_mdc_SessionState'
387  */
388 //--------------------------------------------------------------------------------------------------
390 (
391  le_mdc_SessionStateHandlerRef_t handlerRef
392  ///< [IN]
393 );
394 
395 //--------------------------------------------------------------------------------------------------
396 /**
397  * Add handler function for EVENT 'le_mdc_MtPdpSessionState'
398  *
399  * This event provides information on data session connection state changes for the given profileRef.
400  *
401  */
402 //--------------------------------------------------------------------------------------------------
403 le_mdc_MtPdpSessionStateHandlerRef_t le_mdc_AddMtPdpSessionStateHandler
404 (
405  le_mdc_SessionStateHandlerFunc_t handlerPtr,
406  ///< [IN]
407  void* contextPtr
408  ///< [IN]
409 );
410 
411 //--------------------------------------------------------------------------------------------------
412 /**
413  * Remove handler function for EVENT 'le_mdc_MtPdpSessionState'
414  */
415 //--------------------------------------------------------------------------------------------------
417 (
418  le_mdc_MtPdpSessionStateHandlerRef_t handlerRef
419  ///< [IN]
420 );
421 
422 //--------------------------------------------------------------------------------------------------
423 /**
424  * Get Profile Reference for index
425  *
426  * @note Create a new profile if the profile's index can't be found.
427  *
428  * @warning 0 is not a valid index.
429  *
430  * @warning Ensure to check the list of supported data profiles for your specific platform.
431  *
432  * @return
433  * - Reference to the data profile
434  * - NULL if the profile index does not exist
435  */
436 //--------------------------------------------------------------------------------------------------
437 le_mdc_ProfileRef_t le_mdc_GetProfile
438 (
439  uint32_t index
440  ///< [IN] index of the profile.
441 );
442 
443 //--------------------------------------------------------------------------------------------------
444 /**
445  * Get the index for the given Profile.
446  *
447  * @return
448  * - index of the profile in the modem
449  *
450  * @note
451  * The process exits, if an invalid profile object is given
452  */
453 //--------------------------------------------------------------------------------------------------
454 uint32_t le_mdc_GetProfileIndex
455 (
456  le_mdc_ProfileRef_t profileRef
457  ///< [IN] Query this profile object
458 );
459 
460 //--------------------------------------------------------------------------------------------------
461 /**
462  * Get the list of supported PDP context identifiers
463  *
464  * @return
465  * - LE_OK on success
466  * - LE_BAD_PARAMETER if the input parameter is not valid
467  * - LE_FAULT for other failures
468  */
469 //--------------------------------------------------------------------------------------------------
471 (
472  uint8_t* cidPtr,
473  ///< [OUT] List of supported PDP context identifiers
474  size_t* cidSizePtr
475  ///< [INOUT]
476 );
477 
478 //--------------------------------------------------------------------------------------------------
479 /**
480  * Start profile data session.
481  *
482  * @return
483  * - LE_OK on success
484  * - LE_BAD_PARAMETER if input parameter is incorrect
485  * - LE_DUPLICATE if the data session is already connected for the given profile
486  * - LE_TIMEOUT for session start timeout
487  * - LE_FAULT for other failures
488  *
489  * @note
490  * The process exits, if an invalid profile object is given
491  */
492 //--------------------------------------------------------------------------------------------------
494 (
495  le_mdc_ProfileRef_t profileRef
496  ///< [IN] Start data session for this profile object
497 );
498 
499 //--------------------------------------------------------------------------------------------------
500 /**
501  * Start profile data session.
502  *
503  * @note
504  * The process exits, if an invalid profile object is given
505  */
506 //--------------------------------------------------------------------------------------------------
508 (
509  le_mdc_ProfileRef_t profileRef,
510  ///< [IN] Start data session for this profile object
511  le_mdc_SessionHandlerFunc_t handlerPtr,
512  ///< [IN] Handler for start data session result
513  void* contextPtr
514  ///< [IN]
515 );
516 
517 //--------------------------------------------------------------------------------------------------
518 /**
519  * Stop profile data session.
520  *
521  * @return
522  * - LE_OK on success
523  * - LE_BAD_PARAMETER if the input parameter is not valid
524  * - LE_FAULT for other failures
525  *
526  * @note
527  * The process exits, if an invalid profile object is given
528  *
529  * @warning The MT-PDP context activation feature is not supported on all platforms. Please refer to
530  * @ref MT-PDP_context section for full details.
531  */
532 //--------------------------------------------------------------------------------------------------
534 (
535  le_mdc_ProfileRef_t profileRef
536  ///< [IN] Stop data session for this profile object
537 );
538 
539 //--------------------------------------------------------------------------------------------------
540 /**
541  * Stop profile data session.
542  *
543  * @note
544  * The process exits, if an invalid profile object is given
545  */
546 //--------------------------------------------------------------------------------------------------
548 (
549  le_mdc_ProfileRef_t profileRef,
550  ///< [IN] Stop data session for this profile object
551  le_mdc_SessionHandlerFunc_t handlerPtr,
552  ///< [IN] Handler for stop data session result
553  void* contextPtr
554  ///< [IN]
555 );
556 
557 //--------------------------------------------------------------------------------------------------
558 /**
559  * Reject MT-PDP profile data session.
560  *
561  * @return
562  * - LE_OK on success
563  * - LE_BAD_PARAMETER if the input parameter is not valid
564  * - LE_UNSUPPORTED if not supported by the target
565  * - LE_FAULT for other failures
566  *
567  * @note
568  * The process exits, if an invalid profile object is given
569  *
570  * @warning The MT-PDP context activation feature is not supported on all platforms. Please refer to
571  * @ref MT-PDP_context section for full details.
572  */
573 //--------------------------------------------------------------------------------------------------
575 (
576  le_mdc_ProfileRef_t profileRef
577  ///< [IN] Reject MT-PDP data session for this profile object
578 );
579 
580 //--------------------------------------------------------------------------------------------------
581 /**
582  * Get the current data session state.
583  *
584  * @return
585  * - LE_OK on success
586  * - LE_BAD_PARAMETER if an input parameter is not valid
587  * - LE_FAULT on failure
588  *
589  * @note
590  * The process exits, if an invalid profile object is given
591  */
592 //--------------------------------------------------------------------------------------------------
594 (
595  le_mdc_ProfileRef_t profileRef,
596  ///< [IN] Query this profile object
597  le_mdc_ConState_t* connectionStatePtr
598  ///< [OUT] The data session state
599 );
600 
601 //--------------------------------------------------------------------------------------------------
602 /**
603  * Get the network interface name, if the data session is connected.
604  *
605  * @return
606  * - LE_OK on success
607  * - LE_OVERFLOW if the interface name would not fit in interfaceNameStr
608  * - LE_FAULT for all other errors
609  *
610  * @note
611  * The process exits, if an invalid profile object is given
612  */
613 //--------------------------------------------------------------------------------------------------
615 (
616  le_mdc_ProfileRef_t profileRef,
617  ///< [IN] Query this profile object
618  char* interfaceName,
619  ///< [OUT] The name of the network interface
620  size_t interfaceNameSize
621  ///< [IN]
622 );
623 
624 //--------------------------------------------------------------------------------------------------
625 /**
626  * Get the IPv4 address for the given profile, if the data session is connected and has an IPv4
627  * address.
628  *
629  * @return
630  * - LE_OK on success
631  * - LE_OVERFLOW if the IP address would not fit in ipAddrStr
632  * - LE_FAULT for all other errors
633  *
634  * @note
635  * The process exits, if an invalid profile object is given
636  */
637 //--------------------------------------------------------------------------------------------------
639 (
640  le_mdc_ProfileRef_t profileRef,
641  ///< [IN] Query this profile object
642  char* ipAddr,
643  ///< [OUT] The IP address in dotted format
644  size_t ipAddrSize
645  ///< [IN]
646 );
647 
648 //--------------------------------------------------------------------------------------------------
649 /**
650  * Get the gateway IPv4 address for the given profile, if the data session is connected and has an
651  * IPv4 address.
652  *
653  * @return
654  * - LE_OK on success
655  * - LE_OVERFLOW if the IP address would not fit in gatewayAddrStr
656  * - LE_FAULT for all other errors
657  *
658  * @note
659  * The process exits, if an invalid profile object is given
660  */
661 //--------------------------------------------------------------------------------------------------
663 (
664  le_mdc_ProfileRef_t profileRef,
665  ///< [IN] Query this profile object
666  char* gatewayAddr,
667  ///< [OUT] The gateway IP address in dotted format
668  size_t gatewayAddrSize
669  ///< [IN]
670 );
671 
672 //--------------------------------------------------------------------------------------------------
673 /**
674  * Get the primary/secondary DNS v4 addresses for the given profile, if the data session is
675  * connected and has an IPv4 address.
676  *
677  * @return
678  * - LE_OK on success
679  * - LE_OVERFLOW if the IP address would not fit in buffer
680  * - LE_FAULT for all other errors
681  *
682  * @note
683  * - If only one DNS address is available, then it will be returned, and an empty string will
684  * be returned for the unavailable address
685  * - The process exits, if an invalid profile object is given
686  */
687 //--------------------------------------------------------------------------------------------------
689 (
690  le_mdc_ProfileRef_t profileRef,
691  ///< [IN] Query this profile object
692  char* dns1AddrStr,
693  ///< [OUT] The primary DNS IP address in dotted format
694  size_t dns1AddrStrSize,
695  ///< [IN]
696  char* dns2AddrStr,
697  ///< [OUT] The secondary DNS IP address in dotted format
698  size_t dns2AddrStrSize
699  ///< [IN]
700 );
701 
702 //--------------------------------------------------------------------------------------------------
703 /**
704  * Get the IPv6 address for the given profile, if the data session is connected and has an IPv6
705  * address.
706  *
707  * @return
708  * - LE_OK on success
709  * - LE_OVERFLOW if the IP address would not fit in ipAddrStr
710  * - LE_FAULT for all other errors
711  *
712  * @note
713  * The process exits, if an invalid profile object is given
714  */
715 //--------------------------------------------------------------------------------------------------
717 (
718  le_mdc_ProfileRef_t profileRef,
719  ///< [IN] Query this profile object
720  char* ipAddr,
721  ///< [OUT] The IP address in dotted format
722  size_t ipAddrSize
723  ///< [IN]
724 );
725 
726 //--------------------------------------------------------------------------------------------------
727 /**
728  * Get the gateway IPv6 address for the given profile, if the data session is connected and has an
729  * IPv6 address.
730  *
731  * @return
732  * - LE_OK on success
733  * - LE_OVERFLOW if the IP address would not fit in gatewayAddrStr
734  * - LE_FAULT for all other errors
735  *
736  * @note
737  * The process exits, if an invalid profile object is given
738  */
739 //--------------------------------------------------------------------------------------------------
741 (
742  le_mdc_ProfileRef_t profileRef,
743  ///< [IN] Query this profile object
744  char* gatewayAddr,
745  ///< [OUT] The gateway IP address in dotted format
746  size_t gatewayAddrSize
747  ///< [IN]
748 );
749 
750 //--------------------------------------------------------------------------------------------------
751 /**
752  * Get the primary/secondary DNS v6 addresses, if the data session is connected and has an IPv6
753  * address.
754  *
755  * @return
756  * - LE_OK on success
757  * - LE_OVERFLOW if the IP address can't fit in buffer
758  * - LE_FAULT for all other errors
759  *
760  * @note
761  * - If only one DNS address is available, it will be returned, and an empty string will
762  * be returned for the unavailable address.
763  * - The process exits, if an invalid profile object is given
764  */
765 //--------------------------------------------------------------------------------------------------
767 (
768  le_mdc_ProfileRef_t profileRef,
769  ///< [IN] Query this profile object
770  char* dns1AddrStr,
771  ///< [OUT] The primary DNS IP address in dotted format
772  size_t dns1AddrStrSize,
773  ///< [IN]
774  char* dns2AddrStr,
775  ///< [OUT] The secondary DNS IP address in dotted format
776  size_t dns2AddrStrSize
777  ///< [IN]
778 );
779 
780 //--------------------------------------------------------------------------------------------------
781 /**
782  * Allow the caller to know if the given profile is actually supporting IPv4, if the data session
783  * is connected.
784  *
785  * @return TRUE if PDP type is IPv4, FALSE otherwise.
786  *
787  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
788  * function will not return.
789  */
790 //--------------------------------------------------------------------------------------------------
791 bool le_mdc_IsIPv4
792 (
793  le_mdc_ProfileRef_t profileRef
794  ///< [IN] Query this profile object
795 );
796 
797 //--------------------------------------------------------------------------------------------------
798 /**
799  * Allow the caller to know if the given profile is actually supporting IPv6, if the data session
800  * is connected.
801  *
802  * @return TRUE if PDP type is IPv6, FALSE otherwise.
803  *
804  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
805  * function will not return.
806  */
807 //--------------------------------------------------------------------------------------------------
808 bool le_mdc_IsIPv6
809 (
810  le_mdc_ProfileRef_t profileRef
811  ///< [IN] Query this profile object
812 );
813 
814 //--------------------------------------------------------------------------------------------------
815 /**
816  * Get the Data Bearer Technology for the given profile, if the data session is connected.
817  *
818  * @return
819  * - LE_OK on success
820  * - LE_FAULT for all other errors
821  *
822  * @note
823  * The process exits, if an invalid profile object is given
824  */
825 //--------------------------------------------------------------------------------------------------
827 (
828  le_mdc_ProfileRef_t profileRef,
829  ///< [IN] Query this profile object
830  le_mdc_DataBearerTechnology_t* downlinkDataBearerTechPtrPtr,
831  ///< [OUT] downlink data bearer technology
832  le_mdc_DataBearerTechnology_t* uplinkDataBearerTechPtrPtr
833  ///< [OUT] uplink data bearer technology
834 );
835 
836 //--------------------------------------------------------------------------------------------------
837 /**
838  * Get number of bytes received/transmitted without error since the last reset.
839  *
840  * @return
841  * - LE_OK on success
842  * - LE_FAULT for all other errors
843  *
844  * @note
845  * - The process exits, if an invalid pointer is given
846  */
847 //--------------------------------------------------------------------------------------------------
849 (
850  uint64_t* rxBytesPtr,
851  ///< [OUT] bytes amount received since the last counter reset
852  uint64_t* txBytesPtr
853  ///< [OUT] bytes amount transmitted since the last counter reset
854 );
855 
856 //--------------------------------------------------------------------------------------------------
857 /**
858  * Reset received/transmitted data flow statistics
859  *
860  * @return
861  * - LE_OK on success
862  * - LE_FAULT for all other errors
863  */
864 //--------------------------------------------------------------------------------------------------
866 (
867  void
868 );
869 
870 //--------------------------------------------------------------------------------------------------
871 /**
872  * Stop collecting received/transmitted data flow statistics
873  *
874  * @return
875  * - LE_OK on success
876  * - LE_FAULT for all other errors
877  */
878 //--------------------------------------------------------------------------------------------------
880 (
881  void
882 );
883 
884 //--------------------------------------------------------------------------------------------------
885 /**
886  * Start collecting received/transmitted data flow statistics
887  *
888  * @return
889  * - LE_OK on success
890  * - LE_FAULT for all other errors
891  */
892 //--------------------------------------------------------------------------------------------------
894 (
895  void
896 );
897 
898 //--------------------------------------------------------------------------------------------------
899 /**
900  * Set the Packet Data Protocol (PDP) for the given profile.
901  *
902  * @return
903  * - LE_OK on success
904  * - LE_BAD_PARAMETER if the PDP is not supported
905  * - LE_FAULT if the data session is currently connected for the given profile
906  *
907  * @note
908  * The process exits, if an invalid profile object is given
909  */
910 //--------------------------------------------------------------------------------------------------
912 (
913  le_mdc_ProfileRef_t profileRef,
914  ///< [IN] Query this profile object
915  le_mdc_Pdp_t pdp
916  ///< [IN] The Packet Data Protocol
917 );
918 
919 //--------------------------------------------------------------------------------------------------
920 /**
921  * Get the Packet Data Protocol (PDP) for the given profile.
922  *
923  * @return
924  * - packet data protocol value
925  *
926  * @note
927  * The process exits, if an invalid profile object is given
928  */
929 //--------------------------------------------------------------------------------------------------
930 le_mdc_Pdp_t le_mdc_GetPDP
931 (
932  le_mdc_ProfileRef_t profileRef
933  ///< [IN] Query this profile object
934 );
935 
936 //--------------------------------------------------------------------------------------------------
937 /**
938  * Set the Access Point Name (APN) for the given profile.
939  *
940  * The APN must be an ASCII string.
941  *
942  * @return
943  * - LE_OK on success
944  * - LE_BAD_PARAMETER if an input parameter is not valid
945  * - LE_FAULT if the data session is currently connected for the given profile
946  *
947  * @note If APN is too long (max APN_NAME_MAX_LEN digits), it is a fatal error, the
948  * function will not return.
949  *
950  * @warning The maximum APN length might be limited by the platform.
951  * Please refer to the platform documentation @ref platformConstraintsMdc.
952  *
953  * @note
954  * The process exits, if an invalid profile object is given
955  */
956 //--------------------------------------------------------------------------------------------------
958 (
959  le_mdc_ProfileRef_t profileRef,
960  ///< [IN] Query this profile object
961  const char* LE_NONNULL apnStr
962  ///< [IN] The Access Point Name
963 );
964 
965 //--------------------------------------------------------------------------------------------------
966 /**
967  * Set the Access Point Name (APN) for the given profile according to the SIM identification
968  * number (ICCID). If no APN is found using the ICCID, fall back on the home network (MCC/MNC)
969  * to determine the default APN.
970  *
971  * @return
972  * - LE_OK on success
973  * - LE_BAD_PARAMETER if an input parameter is not valid
974  * - LE_FAULT for all other errors
975  *
976  * @note
977  * The process exits if an invalid profile object is given
978  */
979 //--------------------------------------------------------------------------------------------------
981 (
982  le_mdc_ProfileRef_t profileRef
983  ///< [IN] Query this profile object
984 );
985 
986 //--------------------------------------------------------------------------------------------------
987 /**
988  * Get the Access Point Name (APN) for the given profile.
989  *
990  * @return
991  * - LE_OK on success
992  * - LE_BAD_PARAMETER if an input parameter is not valid
993  * - LE_OVERFLOW if the APN is is too long
994  * - LE_FAULT on failed
995  *
996  * @note
997  * The process exits, if an invalid profile object is given
998  */
999 //--------------------------------------------------------------------------------------------------
1001 (
1002  le_mdc_ProfileRef_t profileRef,
1003  ///< [IN] Query this profile object
1004  char* apnStr,
1005  ///< [OUT] The Access Point Name
1006  size_t apnStrSize
1007  ///< [IN]
1008 );
1009 
1010 //--------------------------------------------------------------------------------------------------
1011 /**
1012  * Set authentication property
1013  *
1014  * @return
1015  * - LE_OK on success
1016  *
1017  * @note
1018  * - The process exits, if userName or password are NULL when type is not PA_MDC_AUTH_NONE
1019  * - The process exits, if an invalid profile object is given
1020  * @note If userName is too long (max USER_NAME_MAX_LEN digits), it is a fatal error, the
1021  * function will not return.
1022  * @note If password is too long (max PASSWORD_NAME_MAX_LEN digits), it is a fatal error, the
1023  * function will not return.
1024  * @note Both PAP and CHAP authentication can be set for 3GPP network: in this case, the device
1025  * decides which authentication procedure is performed. For example, the device can have a
1026  * policy to select the most secure authentication mechanism.
1027  *
1028  */
1029 //--------------------------------------------------------------------------------------------------
1031 (
1032  le_mdc_ProfileRef_t profileRef,
1033  ///< [IN] Query this profile object
1034  le_mdc_Auth_t type,
1035  ///< [IN] Authentication type
1036  const char* LE_NONNULL userName,
1037  ///< [IN] UserName used by authentication
1038  const char* LE_NONNULL password
1039  ///< [IN] Password used by authentication
1040 );
1041 
1042 //--------------------------------------------------------------------------------------------------
1043 /**
1044  * Get authentication property
1045  *
1046  * @return
1047  * - LE_OK on success
1048  * - LE_BAD_PARAMETER if an input parameter is not valid
1049  * - LE_OVERFLOW userName or password are too small
1050  * - LE_FAULT on failed
1051  *
1052  * @note
1053  * The process exits, if an invalid profile object is given
1054  */
1055 //--------------------------------------------------------------------------------------------------
1057 (
1058  le_mdc_ProfileRef_t profileRef,
1059  ///< [IN] Query this profile object
1060  le_mdc_Auth_t* typePtr,
1061  ///< [OUT] Authentication type
1062  char* userName,
1063  ///< [OUT] UserName used by authentication
1064  size_t userNameSize,
1065  ///< [IN]
1066  char* password,
1067  ///< [OUT] Password used by authentication
1068  size_t passwordSize
1069  ///< [IN]
1070 );
1071 
1072 //--------------------------------------------------------------------------------------------------
1073 /**
1074  * Get the number of profiles on the modem.
1075  *
1076  * @return
1077  * - number of profiles existing on modem
1078  */
1079 //--------------------------------------------------------------------------------------------------
1080 uint32_t le_mdc_NumProfiles
1081 (
1082  void
1083 );
1084 
1085 //--------------------------------------------------------------------------------------------------
1086 /**
1087  * Get a profile selected by its APN
1088  *
1089  * @return
1090  * - LE_OK on success
1091  * - LE_BAD_PARAMETER if an input parameter is not valid
1092  * - LE_NOT_FOUND if the requested APN is not found
1093  */
1094 //--------------------------------------------------------------------------------------------------
1096 (
1097  const char* LE_NONNULL apnStr,
1098  ///< [IN] The Access Point Name
1099  le_mdc_ProfileRef_t* profileRefPtr
1100  ///< [OUT] profile reference
1101 );
1102 
1103 //--------------------------------------------------------------------------------------------------
1104 /**
1105  * Called to get the disconnection reason.
1106  *
1107  * @return The disconnection reason.
1108  *
1109  * @warning The return value le_mdc_DisconnectionReason_t might be limited by the platform.
1110  * Please refer to the platform documentation @ref platformConstraintsMdc.
1111  *
1112  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1113  * function will not return.
1114  * @note For IPv4v6 mode, pdpType specifies which session's disconnect reason to get(IPv4 or IPv6
1115  * session). For IPv4 and IPv6 mode, pdpType is ignored because there is only one session for
1116  * IPv4 and IPv6 mode.
1117  */
1118 //--------------------------------------------------------------------------------------------------
1119 le_mdc_DisconnectionReason_t le_mdc_GetDisconnectionReasonExt
1120 (
1121  le_mdc_ProfileRef_t profileRef,
1122  ///< [IN] profile reference
1123  le_mdc_Pdp_t pdpType
1124  ///< [IN] pdp type of session
1125 );
1126 
1127 //--------------------------------------------------------------------------------------------------
1128 /**
1129  * Called to get the platform specific disconnection code.
1130  *
1131  * Refer to @ref platformConstraintsSpecificErrorCodes for platform specific
1132  * disconnection code description.
1133  *
1134  * @return The platform specific disconnection code.
1135  *
1136  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1137  * function will not return.
1138  * @note For IPv4v6 mode, pdpType specifies which session's disconnect reason to get(IPv4 or IPv6
1139  * session). For IPv4 and IPv6 mode, pdpType is ignored because there is only one session for
1140  * IPv4 and IPv6 mode.
1141  */
1142 //--------------------------------------------------------------------------------------------------
1144 (
1145  le_mdc_ProfileRef_t profileRef,
1146  ///< [IN] profile reference
1147  le_mdc_Pdp_t pdpType
1148  ///< [IN] pdp type of session
1149 );
1150 
1151 //--------------------------------------------------------------------------------------------------
1152 /**
1153  * Called to get the platform specific connection failure reason.
1154  *
1155  * Refer to @ref platformConstraintsSpecificErrorCodes for platform specific connection failure
1156  * types and code descriptions.
1157  *
1158  * @note If the caller is passing a bad pointer into this function, it is a fatal error, the
1159  * function will not return.
1160  * @note For IPv4v6 mode, pdpType specifies which session's disconnect reason to get(IPv4 or IPv6
1161  * session). For IPv4 and IPv6 mode, pdpType is ignored because there is only one session for
1162  * IPv4 and IPv6 mode.
1163  */
1164 //--------------------------------------------------------------------------------------------------
1166 (
1167  le_mdc_ProfileRef_t profileRef,
1168  ///< [IN] profile reference
1169  le_mdc_Pdp_t pdpType,
1170  ///< [IN] pdp type of session
1171  int32_t* failureTypePtr,
1172  ///< [OUT] platform specific failure type
1173  int32_t* failureCodePtr
1174  ///< [OUT] platform specific failure code
1175 );
1176 
1177 //--------------------------------------------------------------------------------------------------
1178 /**
1179  * Map a profile on a network interface
1180  *
1181  * * @return
1182  * - LE_OK on success
1183  * - LE_UNSUPPORTED if not supported by the target
1184  * - LE_FAULT for all other errors
1185  *
1186  */
1187 //--------------------------------------------------------------------------------------------------
1189 (
1190  le_mdc_ProfileRef_t profileRef,
1191  ///< [IN] Profile reference
1192  const char* LE_NONNULL interfaceName
1193  ///< [IN] Network interface name
1194 );
1195 
1196 //--------------------------------------------------------------------------------------------------
1197 /**
1198  * Get the list of available profiles
1199  *
1200  * @return
1201  * - list of available profiles
1202  * - LE_OK if the retrieval is successful; otherwise, some error code
1203  */
1204 //--------------------------------------------------------------------------------------------------
1206 (
1207  le_mdc_ProfileInfo_t* profileListPtr,
1208  ///< [OUT] list of available profiles
1209  size_t* profileListSizePtr
1210  ///< [INOUT]
1211 );
1212 
1213 #endif // LE_MDC_INTERFACE_H_INCLUDE_GUARD
le_result_t le_mdc_GetSessionState(le_mdc_ProfileRef_t profileRef, le_mdc_ConState_t *connectionStatePtr)
le_mdc_SessionStateHandlerRef_t le_mdc_AddSessionStateHandler(le_mdc_ProfileRef_t profileRef, le_mdc_SessionStateHandlerFunc_t handlerPtr, void *contextPtr)
le_mdc_Pdp_t le_mdc_GetPDP(le_mdc_ProfileRef_t profileRef)
void le_mdc_StartSessionAsync(le_mdc_ProfileRef_t profileRef, le_mdc_SessionHandlerFunc_t handlerPtr, void *contextPtr)
le_result_t le_mdc_GetDataBearerTechnology(le_mdc_ProfileRef_t profileRef, le_mdc_DataBearerTechnology_t *downlinkDataBearerTechPtrPtr, le_mdc_DataBearerTechnology_t *uplinkDataBearerTechPtrPtr)
le_result_t le_mdc_SetAPN(le_mdc_ProfileRef_t profileRef, const char *LE_NONNULL apnStr)
le_result_t
Definition: le_basics.h:45
bool le_mdc_IsIPv4(le_mdc_ProfileRef_t profileRef)
le_result_t le_mdc_GetIPv4GatewayAddress(le_mdc_ProfileRef_t profileRef, char *gatewayAddr, size_t gatewayAddrSize)
le_result_t le_mdc_StopSession(le_mdc_ProfileRef_t profileRef)
le_result_t le_mdc_GetAPN(le_mdc_ProfileRef_t profileRef, char *apnStr, size_t apnStrSize)
le_result_t le_mdc_GetIPv4DNSAddresses(le_mdc_ProfileRef_t profileRef, char *dns1AddrStr, size_t dns1AddrStrSize, char *dns2AddrStr, size_t dns2AddrStrSize)
le_result_t le_mdc_GetIPv6Address(le_mdc_ProfileRef_t profileRef, char *ipAddr, size_t ipAddrSize)
int32_t le_mdc_GetPlatformSpecificDisconnectionCodeExt(le_mdc_ProfileRef_t profileRef, le_mdc_Pdp_t pdpType)
void le_mdc_ConnectService(void)
void le_mdc_StopSessionAsync(le_mdc_ProfileRef_t profileRef, le_mdc_SessionHandlerFunc_t handlerPtr, void *contextPtr)
le_result_t le_mdc_GetInterfaceName(le_mdc_ProfileRef_t profileRef, char *interfaceName, size_t interfaceNameSize)
le_result_t le_mdc_GetProfileList(le_mdc_ProfileInfo_t *profileListPtr, size_t *profileListSizePtr)
le_result_t le_mdc_SetPDP(le_mdc_ProfileRef_t profileRef, le_mdc_Pdp_t pdp)
le_result_t le_mdc_GetCidList(uint8_t *cidPtr, size_t *cidSizePtr)
bool le_mdc_IsIPv6(le_mdc_ProfileRef_t profileRef)
le_result_t le_mdc_GetBytesCounters(uint64_t *rxBytesPtr, uint64_t *txBytesPtr)
void(* le_mdc_DisconnectHandler_t)(void *)
Definition: le_mdc_interface.h:204
le_result_t le_mdc_GetAuthentication(le_mdc_ProfileRef_t profileRef, le_mdc_Auth_t *typePtr, char *userName, size_t userNameSize, char *password, size_t passwordSize)
void le_mdc_RemoveSessionStateHandler(le_mdc_SessionStateHandlerRef_t handlerRef)
void le_mdc_RemoveMtPdpSessionStateHandler(le_mdc_MtPdpSessionStateHandlerRef_t handlerRef)
le_result_t le_mdc_TryConnectService(void)
void le_mdc_GetPlatformSpecificFailureConnectionReasonExt(le_mdc_ProfileRef_t profileRef, le_mdc_Pdp_t pdpType, int32_t *failureTypePtr, int32_t *failureCodePtr)
le_mdc_ProfileRef_t le_mdc_GetProfile(uint32_t index)
#define LE_FULL_API
Definition: le_apiFeatures.h:40
le_result_t le_mdc_StartSession(le_mdc_ProfileRef_t profileRef)
LE_FULL_API void le_mdc_SetServerDisconnectHandler(le_mdc_DisconnectHandler_t disconnectHandler, void *contextPtr)
le_result_t le_mdc_ResetBytesCounter(void)
void le_mdc_DisconnectService(void)
le_result_t le_mdc_GetIPv4Address(le_mdc_ProfileRef_t profileRef, char *ipAddr, size_t ipAddrSize)
le_result_t le_mdc_StartBytesCounter(void)
le_mdc_MtPdpSessionStateHandlerRef_t le_mdc_AddMtPdpSessionStateHandler(le_mdc_SessionStateHandlerFunc_t handlerPtr, void *contextPtr)
le_result_t le_mdc_GetIPv6GatewayAddress(le_mdc_ProfileRef_t profileRef, char *gatewayAddr, size_t gatewayAddrSize)
le_result_t le_mdc_SetAuthentication(le_mdc_ProfileRef_t profileRef, le_mdc_Auth_t type, const char *LE_NONNULL userName, const char *LE_NONNULL password)
le_result_t le_mdc_GetProfileFromApn(const char *LE_NONNULL apnStr, le_mdc_ProfileRef_t *profileRefPtr)
uint32_t le_mdc_GetProfileIndex(le_mdc_ProfileRef_t profileRef)
uint32_t le_mdc_NumProfiles(void)
le_result_t le_mdc_SetDefaultAPN(le_mdc_ProfileRef_t profileRef)
le_result_t le_mdc_StopBytesCounter(void)
le_result_t le_mdc_RejectMtPdpSession(le_mdc_ProfileRef_t profileRef)
le_result_t le_mdc_MapProfileOnNetworkInterface(le_mdc_ProfileRef_t profileRef, const char *LE_NONNULL interfaceName)
le_result_t le_mdc_GetIPv6DNSAddresses(le_mdc_ProfileRef_t profileRef, char *dns1AddrStr, size_t dns1AddrStrSize, char *dns2AddrStr, size_t dns2AddrStrSize)
le_mdc_DisconnectionReason_t le_mdc_GetDisconnectionReasonExt(le_mdc_ProfileRef_t profileRef, le_mdc_Pdp_t pdpType)