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