le_rtc_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_rtc User Timebase
14  *
15  * @ref le_rtc_interface.h "API Reference" <br>
16  * @ref howToSetUserTimebase how-to
17  * <HR>
18  *
19  * This API provides definitions to read and set the @e user timebase for a target's real time clock (RTC).
20  *
21  * Usually, the time daemon automatically updates the system time (i.e., gets time value
22  * when calling le_clk_GetAbsoluteTime() or using Linux @c date command). In some cases, the RTC
23  * time value may require a user timebase value based on other domains (e.g., GPS) to offset
24  * differences between the battery-powered RTC and the system time.
25  *
26  * If you're synchronizng with cellular network time only, the time daemon will update the
27  * system time (the time you get when calling le_clk_GetAbsoluteTime() or using linux 'date'
28  * command) automatically.
29  *
30  * @section c_rtc_disableDaemon Disable Time Daemon
31  *
32  * If you need to set the system time from a saved user timebase value, first disable the time
33  * daemon by commenting out the
34  * @c TIME_SERVICES="qcom_time" line in @c /etc/time_service.conf to prevent the system time from being
35  * updated if the modem receives a new time from a cellular network.
36  *
37  * @section c_rtc_getSet Get/Set Time Value
38  *
39  * You use le_rtc_GetUserTime() to read the current RTC time, and le_rtc_SetUserTime()
40  * to set the user timebase adjustment (plus/minus in milliseconds).
41  *
42  * The time stored in the user timebase is incremented on a millisecond basis;
43  * Unix time is incremented by the second. When storing Unix time in the user timebase, it
44  * must be multiplied by 1000, and must be divided by 1000 when retrieved.
45  *
46  * Typically, it's sufficient to use Unix epoch time x 1000 as the time base.
47  *
48  * <HR>
49  *
50  * Copyright (C) Sierra Wireless Inc.
51  */
52 /**
53  * @file le_rtc_interface.h
54  *
55  * Legato @ref c_rtc include file.
56  *
57  * Copyright (C) Sierra Wireless Inc.
58  */
59 
60 #ifndef LE_RTC_INTERFACE_H_INCLUDE_GUARD
61 #define LE_RTC_INTERFACE_H_INCLUDE_GUARD
62 
63 
64 #include "legato.h"
65 
66 // Internal includes for this interface
67 #include "le_rtc_common.h"
68 /** @addtogroup le_rtc le_rtc API Reference
69  * @{
70  * @file le_rtc_common.h
71  * @file le_rtc_interface.h **/
72 //--------------------------------------------------------------------------------------------------
73 /**
74  * Type for handler called when a server disconnects.
75  */
76 //--------------------------------------------------------------------------------------------------
77 typedef void (*le_rtc_DisconnectHandler_t)(void *);
78 
79 //--------------------------------------------------------------------------------------------------
80 /**
81  *
82  * Connect the current client thread to the service providing this API. Block until the service is
83  * available.
84  *
85  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
86  * called before any other functions in this API. Normally, ConnectService is automatically called
87  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
88  *
89  * This function is created automatically.
90  */
91 //--------------------------------------------------------------------------------------------------
93 (
94  void
95 );
96 
97 //--------------------------------------------------------------------------------------------------
98 /**
99  *
100  * Try to connect the current client thread to the service providing this API. Return with an error
101  * if the service is not available.
102  *
103  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
104  * called before any other functions in this API. Normally, ConnectService is automatically called
105  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
106  *
107  * This function is created automatically.
108  *
109  * @return
110  * - LE_OK if the client connected successfully to the service.
111  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
112  * bound.
113  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
114  * - LE_COMM_ERROR if the Service Directory cannot be reached.
115  */
116 //--------------------------------------------------------------------------------------------------
118 (
119  void
120 );
121 
122 //--------------------------------------------------------------------------------------------------
123 /**
124  * Set handler called when server disconnection is detected.
125  *
126  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
127  * to continue without exiting, it should call longjmp() from inside the handler.
128  */
129 //--------------------------------------------------------------------------------------------------
131 (
132  le_rtc_DisconnectHandler_t disconnectHandler,
133  void *contextPtr
134 );
135 
136 //--------------------------------------------------------------------------------------------------
137 /**
138  *
139  * Disconnect the current client thread from the service providing this API.
140  *
141  * Normally, this function doesn't need to be called. After this function is called, there's no
142  * longer a connection to the service, and the functions in this API can't be used. For details, see
143  * @ref apiFilesC_client.
144  *
145  * This function is created automatically.
146  */
147 //--------------------------------------------------------------------------------------------------
149 (
150  void
151 );
152 
153 
154 //--------------------------------------------------------------------------------------------------
155 /**
156  * Get the current time from the RTC
157  *
158  * @return
159  * - LE_OK Function succeeded.
160  * - LE_FAULT Function failed.
161  */
162 //--------------------------------------------------------------------------------------------------
164 (
165  uint64_t* millisecondsPastGpsEpochPtr
166  ///< [OUT]
167 );
168 
169 //--------------------------------------------------------------------------------------------------
170 /**
171  * Set the RTC with the given time string
172  *
173  * @return
174  * - LE_OK Function succeeded.
175  * - LE_FAULT Function failed.
176  */
177 //--------------------------------------------------------------------------------------------------
179 (
180  uint64_t millisecondsPastGpsEpoch
181  ///< [IN]
182 );
183 
184 /** @} **/
185 
186 #endif // LE_RTC_INTERFACE_H_INCLUDE_GUARD
le_result_t le_rtc_SetUserTime(uint64_t millisecondsPastGpsEpoch)
void le_rtc_DisconnectService(void)
le_result_t
Definition: le_basics.h:46
le_result_t le_rtc_TryConnectService(void)
LE_FULL_API void le_rtc_SetServerDisconnectHandler(le_rtc_DisconnectHandler_t disconnectHandler, void *contextPtr)
#define LE_FULL_API
Definition: le_apiFeatures.h:40
void le_rtc_ConnectService(void)
void(* le_rtc_DisconnectHandler_t)(void *)
Definition: le_rtc_interface.h:77
le_result_t le_rtc_GetUserTime(uint64_t *millisecondsPastGpsEpochPtr)