RDK Documentation (Open Sourced RDK Components)
Device_Time.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 /**
21  * @file Device_Time.h
22  *
23  * @brief TR-069 Device.Time object Public API.
24  *
25  * Description of Time module.
26  *
27  *
28  * @par Document
29  * Document reference.
30  *
31  *
32  * @par Open Issues (in no particular order)
33  * -# Issue 1
34  * -# Issue 2
35  *
36  *
37  * @par Assumptions
38  * -# Assumption
39  * -# Assumption
40  *
41  *
42  * @par Abbreviations
43  * - ACK: Acknowledge.
44  * - BE: Big-Endian.
45  * - cb: Callback function (suffix).
46  * - config: Configuration.
47  * - desc: Descriptor.
48  * - dword: Double word quantity, i.e., four bytes or 32 bits in size.
49  * - intfc: Interface.
50  * - LE: Little-Endian.
51  * - LS: Least Significant.
52  * - MBZ: Must be zero.
53  * - MS: Most Significant.
54  * - _t: Type (suffix).
55  * - word: Two byte quantity, i.e. 16 bits in size.
56  * - xfer: Transfer.
57  *
58  *
59  * @par Implementation Notes
60  * -# Note
61  * -# Note
62  *
63  */
64 
65 
66 
67 /**
68 * @defgroup tr69hostif
69 * @{
70 * @defgroup hostif
71 * @{
72 **/
73 
74 
75 #ifndef DEVICE_TIME_H_
76 #define DEVICE_TIME_H_
77 
78 /*****************************************************************************
79  * TR069-SPECIFIC INCLUDE FILES
80  *****************************************************************************/
81 #include "hostIf_main.h"
82 #include "hostIf_tr69ReqHandler.h"
83 #include "hostIf_utils.h"
84 #include "hostIf_updateHandler.h"
85 #include "XrdkCentralComBSStore.h"
86 
87 /** @defgroup TR_069_DEVICE_TIME_API TR-069 Device.Time object API.
88  * @ingroup TR_069_API
89  *
90  * The Device.Time object contains parameters relating an NTP or SNTP time client in
91  * the CPE.
92  *
93  */
94 
95 /** @addtogroup TR_069_DEVICE_TIME_GETTER_API TR-069 Device.Time Getter API.
96  * @ingroup TR_069_DEVICE_TIME_API
97  *
98  * \section dev_time_getter TR-069 Device.Time Getter API
99  *
100  * This is the getter group of API for the <b>Device.Time</b> object.
101  *
102  * The interface for all functions is identical and is described here.
103  *
104  * @param[in] *name This is the complete path name of the parameter extracted from
105  * soap message, e.g. ::get_Device_Time_Enable.
106  * In this case, the path is "Device.Time.Enable".
107  * @param[in] *type Data type of parameter defined for TR-069. This is same as the
108  * data type used in the Xi3 data-model.xml file.
109  * (see parameter.h)
110  * @param[out] *value This is the value of the parameter requested by the ACS.
111  * (see paramaccess.h)
112  *
113  * @return The status of the operation.
114  * @retval OK If parameter requested was successfully fetched. (Same as <b>NO_ERROR</b>).
115  * @retval NO_ERROR If parameter requested was successfully fetched. (Same as <b>OK</b>).
116  * @retval DIAG_ERROR Diagnostic error.
117  * @retval ERR_??? Appropriate error value otherwise (see dimark_globals.h).
118  *
119  * @todo Clarify description of DIAG_ERROR.
120  *
121  * @{
122  */
123 
124 /**
125  * @brief Get the status of the time client.
126  *
127  * This function provides the status (enabled or disabled) of the NTP or SNTP time
128  * client.
129  *
130  * See @ref dev_time_getter
131  *
132  */
133 
134 class hostIf_Time {
135 
136  static GHashTable *ifHash;
137 
138  static GMutex *m_mutex;
139 
140  static GHashTable *m_notifyHash;
141 
142  static XBSStore *m_bsStore;
143 
144  int dev_id;
145 
146  bool bCalledLocalTimeZone;
147  bool bCalledCurrentLocalTime;
148  char backupLocalTimeZone[_BUF_LEN_64];
149  char backupCurrentLocalTime[_BUF_LEN_64];
150  hostIf_Time(int dev_id);
151 
152  ~hostIf_Time();
153 public:
154 
155  static hostIf_Time* getInstance(int dev_id);
156 
157  static void closeInstance(hostIf_Time*);
158 
159  static GList* getAllInstances();
160 
161  static void closeAllInstances();
162 
163  static void getLock();
164 
165  static void releaseLock();
166 
167  static GHashTable* getNotifyHash();
168 
169 
170  int get_Device_Time_Enable(HOSTIF_MsgData_t *, bool *pChanged = NULL);
171 
172  /**
173  * @brief Get the status of time support on the CPE.
174  *
175  * This function provides the status of time support on the CPE. This is an
176  * enumeration of:
177  *
178  * <tt>
179  * <ul><li>Disabled</li>
180  * <li>Unsynchronized</li>
181  * <li>Synchronized</li>
182  * <li>Error_FailedToSynchronize</li>
183  * <li>Error (OPTIONAL)</li></ul>
184  * </tt>
185  *
186  * @note <ul>
187  * <li>The <tt>Unsynchronized</tt> value indicates that the CPE's absolute time
188  * has not yet been set.</li>
189  *
190  * <li>The <tt>Synchronized</tt> value indicates that the CPE has acquired
191  * accurate absolute time; its current time is accurate.</li>
192  *
193  * <li>The <tt>Error_FailedToSynchronize</tt> value indicates that the CPE
194  * failed to acquire accurate absolute time; its current time is not
195  * accurate.</li>
196  *
197  * <li>The Error value MAY be used by the CPE to indicate a locally
198  * defined error condition.</li>
199  * </ul>
200  *
201  * See @ref dev_time_getter
202  *
203  */
204 
205  int get_Device_Time_Status(HOSTIF_MsgData_t *, bool *pChanged = NULL);
206 
207  /**
208  * @brief Get the first NTP timeserver.
209  *
210  * This function provides the address of the first NTP timeserver. This can be either
211  * a host name or IP address.
212  *
213  * See @ref dev_time_getter
214  *
215  */
216 
217  int get_Device_Time_NTPServer1(HOSTIF_MsgData_t *, bool *pChanged = NULL);
218 
219  /**
220  * @brief Get the second NTP timeserver.
221  *
222  * This function provides the address of the second NTP timeserver. This can be either
223  * a host name or IP address.
224  *
225  * See @ref dev_time_getter
226  *
227  */
228 
229  int get_Device_Time_NTPServer2(HOSTIF_MsgData_t *, bool *pChanged = NULL);
230 
231  /**
232  * @brief Get the third NTP timeserver.
233  *
234  * This function provides the address of the third NTP timeserver. This can be either
235  * a host name or IP address.
236  *
237  * See @ref dev_time_getter
238  *
239  */
240 
241  int get_Device_Time_NTPServer3(HOSTIF_MsgData_t *, bool *pChanged = NULL);
242 
243  /**
244  * @brief Get the fourth NTP timeserver.
245  *
246  * This function provides the address of the fourth NTP timeserver. This can be either
247  * a host name or IP address.
248  *
249  * See @ref dev_time_getter
250  *
251  */
252 
253  int get_Device_Time_NTPServer4(HOSTIF_MsgData_t *, bool *pChanged = NULL);
254 
255  /**
256  * @brief Get the fifth NTP timeserver.
257  *
258  * This function provides the address of the fifth NTP timeserver. This can be either
259  * a host name or IP address.
260  *
261  * See @ref dev_time_getter
262  *
263  */
264 
265  int get_Device_Time_NTPServer5(HOSTIF_MsgData_t *, bool *pChanged = NULL);
266 
267  /**
268  * @brief Get the current dates & time.
269  *
270  * This function provides the current date and time in the CPE's local time zone.
271  *
272  * See @ref dev_time_getter
273  *
274  */
275 
276  int get_Device_Time_CurrentLocalTime(HOSTIF_MsgData_t *, bool *pChanged = NULL);
277 
278  /**
279  * @brief Get the local time zone definition.
280  *
281  * This function provides the local time zone definition, encoded according to IEEE
282  * 1003.1 (POSIX). The following is an example value:
283  *
284  * <tt>EST+5 EDT,M4.1.0/2,M10.5.0/2</tt>
285  *
286  * See @ref dev_time_getter
287  *
288  */
289 
290  int get_Device_Time_LocalTimeZone(HOSTIF_MsgData_t *, bool *pChanged = NULL);
291 
292  /* End of TR_069_DEVICE_TIME_GETTER_API doxygen group. */
293  /**
294  * @}
295  */
296 
297  /** @addtogroup TR_069_DEVICE_TIME_SETTER_API TR-069 Device.Time Setter API.
298  * @ingroup TR_069_DEVICE_TIME_API
299  *
300  * \section dev_time_setter TR-069 Device.Time Setter API
301  *
302  * This is the setter group of API for the <b>Device.Time</b> object.
303  *
304  * The interface for all functions is identical and is described here.
305  *
306  * @param[in] *name This is the complete path name of the parameter extracted from
307  * soap message, e.g. ::set_Device_Time_Enable.
308  * In this case, the path is "Device.Time.Enable".
309  * @param[in] *type Data type of parameter defined for TR-069. This is same as the
310  * data type used in the Xi3 data-model.xml file.
311  * (see parameter.h)
312  * @param[in] *value This is the value to which the parameter requested by the ACS
313  * must be set.
314  * (see paramaccess.h)
315  *
316  * @return The status of the operation.
317  * @retval OK If parameter requested was successfully fetched. (Same as <b>NO_ERROR</b>).
318  * @retval NO_ERROR If parameter requested was successfully fetched. (Same as <b>OK</b>).
319  * @retval DIAG_ERROR Diagnostic error.
320  * @retval ERR_??? Appropriate error value otherwise (see dimark_globals.h).
321  *
322  * @todo Clarify description of DIAG_ERROR.
323  *
324  * @{
325  */
326 
327  /**
328  * @brief Set the status of the time client.
329  *
330  * This function sets enables or disables the NTP or SNTP time client.
331  *
332  * See @ref dev_time_setter
333  *
334  */
335 
337 
338  /**
339  * @brief Set the first NTP timeserver.
340  *
341  * This function sets the address of the first NTP timeserver. This can be either
342  * a host name or IP address.
343  *
344  * See @ref dev_time_setter
345  *
346  */
347 
349 
350  /**
351  * @brief Set the second NTP timeserver.
352  *
353  * This function sets the address of the second NTP timeserver. This can be either
354  * a host name or IP address.
355  *
356  * See @ref dev_time_setter
357  *
358  */
359 
361 
362  /**
363  * @brief Set the third NTP timeserver.
364  *
365  * This function sets the address of the third NTP timeserver. This can be either
366  * a host name or IP address.
367  *
368  * See @ref dev_time_setter
369  *
370  */
371 
373 
374  /**
375  * @brief Set the fourth NTP timeserver.
376  *
377  * This function sets the address of the fourth NTP timeserver. This can be either
378  * a host name or IP address.
379  *
380  * See @ref dev_time_setter
381  *
382  */
383 
385 
386  /**
387  * @brief Set the fifth NTP timeserver.
388  *
389  * This function sets the address of the fifth NTP timeserver. This can be either
390  * a host name or IP address.
391  *
392  * See @ref dev_time_setter
393  *
394  */
395 
397 
398  /**
399  * @brief Set the local time zone definition.
400  *
401  * This function sets the local time zone definition, encoded according to IEEE
402  * 1003.1 (POSIX). The following is an example value:
403  *
404  * <tt>EST+5 EDT,M4.1.0/2,M10.5.0/2</tt>
405  *
406  * See @ref dev_time_setter
407  *
408  */
409 
411 
412  /**
413  * @brief Set the bootstrap parameters.
414  *
415  * This function sets the bootstrap parameters
416  *
417  */
419 
420  /**
421  * @brief Get the bootstrap parameters.
422  *
423  * This function gets the bootstrap parameters
424  *
425  */
427 
428 };
429 /* End of TR_069_DEVICE_TIME_SETTER_API doxygen group. */
430 /**
431  * @}
432  */
433 
434 #endif /* DEVICE_TIME_H_ */
435 
436 
437 /** @} */
438 /** @} */
hostIf_Time::set_Device_Time_NTPServer5
int set_Device_Time_NTPServer5(HOSTIF_MsgData_t *)
Set the fifth NTP timeserver.
Definition: Device_Time.cpp:293
hostIf_Time::get_Device_Time_Status
int get_Device_Time_Status(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the status of time support on the CPE.
Definition: Device_Time.cpp:196
hostIf_Time::get_Device_Time_NTPServer5
int get_Device_Time_NTPServer5(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the fifth NTP timeserver.
Definition: Device_Time.cpp:216
XBSStore
Definition: XrdkCentralComBSStore.h:33
hostIf_Time::get_Device_Time_LocalTimeZone
int get_Device_Time_LocalTimeZone(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the local time zone definition.
Definition: Device_Time.cpp:163
_HostIf_MsgData_t
Definition: hostIf_tr69ReqHandler.h:170
hostIf_Time::set_Device_Time_NTPServer1
int set_Device_Time_NTPServer1(HOSTIF_MsgData_t *)
Set the first NTP timeserver.
Definition: Device_Time.cpp:277
hostIf_Time::set_Device_Time_NTPServer3
int set_Device_Time_NTPServer3(HOSTIF_MsgData_t *)
Set the third NTP timeserver.
Definition: Device_Time.cpp:285
hostIf_main.h
hostIf_main API.
hostIf_Time::get_Device_Time_NTPServer4
int get_Device_Time_NTPServer4(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the fourth NTP timeserver.
Definition: Device_Time.cpp:212
hostIf_Time::get_xRDKCentralComBootstrap
int get_xRDKCentralComBootstrap(HOSTIF_MsgData_t *)
Get the bootstrap parameters.
Definition: Device_Time.cpp:263
hostIf_Time::set_Device_Time_NTPServer2
int set_Device_Time_NTPServer2(HOSTIF_MsgData_t *)
Set the second NTP timeserver.
Definition: Device_Time.cpp:281
hostIf_Time::get_Device_Time_NTPServer1
int get_Device_Time_NTPServer1(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the first NTP timeserver.
Definition: Device_Time.cpp:200
hostIf_Time::get_Device_Time_NTPServer2
int get_Device_Time_NTPServer2(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the second NTP timeserver.
Definition: Device_Time.cpp:204
hostIf_Time::set_Device_Time_Enable
int set_Device_Time_Enable(HOSTIF_MsgData_t *)
Set the status of the time client.
Definition: Device_Time.cpp:273
hostIf_Time::get_Device_Time_CurrentLocalTime
int get_Device_Time_CurrentLocalTime(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the current dates & time.
Definition: Device_Time.cpp:221
hostIf_Time::get_Device_Time_NTPServer3
int get_Device_Time_NTPServer3(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the third NTP timeserver.
Definition: Device_Time.cpp:208
hostIf_Time
Get the status of the time client.
Definition: Device_Time.h:134
hostIf_Time::set_Device_Time_LocalTimeZone
int set_Device_Time_LocalTimeZone(HOSTIF_MsgData_t *)
Set the local time zone definition.
Definition: Device_Time.cpp:297
hostIf_Time::set_Device_Time_NTPServer4
int set_Device_Time_NTPServer4(HOSTIF_MsgData_t *)
Set the fourth NTP timeserver.
Definition: Device_Time.cpp:289
hostIf_Time::set_xRDKCentralComBootstrap
int set_xRDKCentralComBootstrap(HOSTIF_MsgData_t *)
Set the bootstrap parameters.
Definition: Device_Time.cpp:268