Hello I am using QCA4020 in my project.
I need to set RTC on connecting with wifi. in short i want to sync RTC with network time.
How can i get time from network..? are there any api or functions provided for QCA4020.
also I would like to know how to generate 32byte random number or string, which illl be using as referenceID in sending data to AWS.
I have found similar issue on this forum , there they have following line commented as reply.
Example using QCLI_demo to verify locally:
//----------------------------------------------------------------------
> wlan enable
> wlan setdevice 1
> wlan SetWpaPassphrase password
> wlan SetWpaParameters WPA2 CCMP CCMP
> wlan connect SSID
WLAN: devid - 1 1 CONNECTED MAC addr xx:xx:xx:xx:xx:xx
WLAN: 4 way handshake success for device=1
> net dhcpv4c wlan1
Net: DHCPv4c: IP=10.xxx.xxx.x Subnet Mask=255.255.254.0 Gateway=10.xxx.xxx.x
> net dnsc start
> net sntpc start
> net sntpc utc
Net: Jan 16, 2020 Thu 19:23:26 UTC
//----------------------------------------------------------------------
I dont know how to execute this on QCA4020.
Thank you.
//----------------------------------------------------------------------
By default system time is set to 2020-1-1 0.0.0.
Kindly modify build.bat file and set "CFG_FEATURE_ENABLE_DEFAULT_RTC_TIME" to false.
This will disable setting system time to reasonable timeslot during bootup.
This function is available under platform_demo.c
#ifdef CONFIG_ENABLE_DEFAULT_RTC_TIME
/* Set default system time to reasonable timeslot */
qapi_Time_t test_tm;
memset(&test_tm, 0, sizeof(qapi_Time_t));
test_tm.year = 2020;
test_tm.month = 1;
test_tm.day = 1;
if(qapi_Core_RTC_Set(&test_tm) != 0)
{
QCLI_Printf(qcli_platform_handle, "Platform can't set time\n");
}
#endif
Hi
I understand the use of function "qapi_Core_RTC_Set(&tm)" .
here i dont have current time available with me, thus i want to get the time in current time zone of network to which my QCA4020 is connected. On getting time from network after boot up, ill set RTC with that time. and use the RTC time further.
Do you know how to get time from connected network ( wifi router ) .?