connection_profile_h profile);
/**
+ * @brief Check if the time has been updated by NTP.
+ * @since_tizen 6.5
+ * @param[in] connection The connection handle
+ * @param[out] updated true if the system time is updated by NTP, false otherwise
+ * @return 0 on success, otherwise a negative error value
+ * @retval #CONNECTION_ERROR_NONE Successful
+ * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
+ */
+int connection_clock_is_updated(connection_h connection, bool *updated);
+
+/**
* @}
*/
int _connection_libnet_stop_tcpdump(connection_handle_s *conn_handle);
int _connection_libnet_get_tcpdump_state(connection_handle_s *conn_handle,
gboolean *tcpdump_state);
+int _connection_libnet_get_clock_updated(connection_handle_s *conn_handle, bool *updated);
void _connection_lock(void);
void _connection_unlock(void);
Name: capi-network-connection
Summary: Network Connection library in TIZEN C API
-Version: 1.0.123
+Version: 1.0.124
Release: 2
Group: System/Network
License: Apache-2.0
CONN_UNLOCK;
return CONNECTION_ERROR_NONE;
}
+
+EXPORT_API int connection_clock_is_updated(connection_h connection, bool *updated)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!(_connection_check_handle_validity(connection))) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ CONN_UNLOCK; //LCOV_EXCL_LINE
+ return CONNECTION_ERROR_INVALID_PARAMETER;//LCOV_EXCL_LINE
+ }
+
+ int rv = _connection_libnet_get_clock_updated(connection, updated);
+
+ if (rv != CONNECTION_ERROR_NONE) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Fail to get clock update information[%d]", rv); //LCOV_EXCL_LINE
+ CONN_UNLOCK; //LCOV_EXCL_LINE
+ return rv; //LCOV_EXCL_LINE
+ }
+
+ CONNECTION_LOG(CONNECTION_INFO, "Clock updated: %s", updated ? "true" : "false");
+ CONN_UNLOCK;
+
+ return CONNECTION_ERROR_NONE;
+}
}
//LCOV_EXCL_STOP
+int _connection_libnet_get_clock_updated(connection_handle_s *conn_handle, bool *updated)
+{
+ int rv = 0;
+
+ rv = net_get_clock_update_info(conn_handle->network_info_handle, updated);
+ if (rv == NET_ERR_ACCESS_DENIED) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+ return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+ } else if (rv != NET_ERR_NONE) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to get clock update information[%d]", rv); //LCOV_EXCL_LINE
+ return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
+ return CONNECTION_ERROR_NONE;
+}
+
void _connection_lock(void)
{
if (g_conn_thread_mutex_ref == 0)
return 1;
}
+int test_get_clock_update_info(void)
+{
+ int rv = 0;
+ bool updated;
+
+ rv = connection_clock_is_updated(connection, &updated);
+
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to get clock update information [%s]\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Retval = [%s] clock updated [%s]\n",
+ test_print_error(rv), updated ? "TRUE" : "FALSE");
+
+ return 1;
+}
+
int main(int argc, char **argv)
{
GMainLoop *mainloop;
printf("R - Destroy Handle(unset callbacks automatically in C# API)\n");
printf("S - Connect Ethernet EAP)\n");
printf("T - Get EAPoL info)\n");
+ printf("U - Get Clock update info)\n");
printf(LOG_RED "0 - Exit \n" LOG_END);
printf("ENTER - Show options menu.......\n");
}
case 'T':
rv = test_get_eapol_info();
break;
-
+ case 'U':
+ rv = test_get_clock_update_info();
+ break;
}
if (rv == 1)