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 
67 //--------------------------------------------------------------------------------------------------
68 /**
69  * Type for handler called when a server disconnects.
70  */
71 //--------------------------------------------------------------------------------------------------
72 typedef void (*le_rtc_DisconnectHandler_t)(void *);
73 
74 //--------------------------------------------------------------------------------------------------
75 /**
76  *
77  * Connect the current client thread to the service providing this API. Block until the service is
78  * available.
79  *
80  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
81  * called before any other functions in this API. Normally, ConnectService is automatically called
82  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
83  *
84  * This function is created automatically.
85  */
86 //--------------------------------------------------------------------------------------------------
88 (
89  void
90 );
91 
92 //--------------------------------------------------------------------------------------------------
93 /**
94  *
95  * Try to connect the current client thread to the service providing this API. Return with an error
96  * if the service is not available.
97  *
98  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
99  * called before any other functions in this API. Normally, ConnectService is automatically called
100  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
101  *
102  * This function is created automatically.
103  *
104  * @return
105  * - LE_OK if the client connected successfully to the service.
106  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
107  * bound.
108  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
109  * - LE_COMM_ERROR if the Service Directory cannot be reached.
110  */
111 //--------------------------------------------------------------------------------------------------
113 (
114  void
115 );
116 
117 //--------------------------------------------------------------------------------------------------
118 /**
119  * Set handler called when server disconnection is detected.
120  *
121  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
122  * to continue without exiting, it should call longjmp() from inside the handler.
123  */
124 //--------------------------------------------------------------------------------------------------
126 (
127  le_rtc_DisconnectHandler_t disconnectHandler,
128  void *contextPtr
129 );
130 
131 //--------------------------------------------------------------------------------------------------
132 /**
133  *
134  * Disconnect the current client thread from the service providing this API.
135  *
136  * Normally, this function doesn't need to be called. After this function is called, there's no
137  * longer a connection to the service, and the functions in this API can't be used. For details, see
138  * @ref apiFilesC_client.
139  *
140  * This function is created automatically.
141  */
142 //--------------------------------------------------------------------------------------------------
144 (
145  void
146 );
147 
148 
149 //--------------------------------------------------------------------------------------------------
150 /**
151  * Get the current time from the RTC
152  *
153  * @return
154  * - LE_OK Function succeeded.
155  * - LE_FAULT Function failed.
156  */
157 //--------------------------------------------------------------------------------------------------
159 (
160  uint64_t* millisecondsPastGpsEpochPtr
161  ///< [OUT]
162 );
163 
164 //--------------------------------------------------------------------------------------------------
165 /**
166  * Set the RTC with the given time string
167  *
168  * @return
169  * - LE_OK Function succeeded.
170  * - LE_FAULT Function failed.
171  */
172 //--------------------------------------------------------------------------------------------------
174 (
175  uint64_t millisecondsPastGpsEpoch
176  ///< [IN]
177 );
178 
179 #endif // LE_RTC_INTERFACE_H_INCLUDE_GUARD
le_result_t
Definition: le_basics.h:35
void le_rtc_SetServerDisconnectHandler(le_rtc_DisconnectHandler_t disconnectHandler, void *contextPtr)
void le_rtc_ConnectService(void)
le_result_t le_rtc_SetUserTime(uint64_t millisecondsPastGpsEpoch)
le_result_t le_rtc_GetUserTime(uint64_t *millisecondsPastGpsEpochPtr)
void le_rtc_DisconnectService(void)
le_result_t le_rtc_TryConnectService(void)
void(* le_rtc_DisconnectHandler_t)(void *)
Definition: le_rtc_interface.h:72