コード例 #1
0
ファイル: NtpClient.cpp プロジェクト: BorntraegerMarc/Sming
NtpClient::NtpClient(String reqServer, int reqIntervalSeconds, NtpTimeResultDelegate delegateFunction /* = NULL */)
{
	// init timer but do not start, correct interval set later below.
	autoUpdateTimer.initializeMs(NTP_DEFAULT_QUERY_INTERVAL_SECONDS * 1000,
			TimerDelegate(&NtpClient::requestTime, this));

	timeoutTimer.initializeMs(NTP_RESPONSE_TIMEOUT_MS,
			TimerDelegate(&NtpClient::requestTime, this));


	this->server = reqServer;
	this->delegateCompleted = delegateFunction;
	if (!delegateFunction)
	{
		autoUpdateSystemClock = true;
	}

	if (reqIntervalSeconds == 0)
	{
		setAutoQuery(false);
	}
	else
	{
		setAutoQueryInterval(reqIntervalSeconds);
		setAutoQuery(true);
		requestTime();
	}
}
コード例 #2
0
ファイル: NtpClient.cpp プロジェクト: Bravo13/Sming
NtpClient::NtpClient(String reqServer, int reqIntervalSeconds, NtpTimeResultCallback onTimeReceivedCb)
// : NtpClient(reqServer, reqIntervalSeconds, NtpClientResultCallback (onTimeReceivedCb))
{
	autoUpdateTimer.initializeMs(NTP_DEFAULT_AUTO_UPDATE_INTERVAL, Delegate<void()>(&NtpClient::requestTime, this));
	this->server = reqServer;
	this->onCompleted = onTimeReceivedCb;
	if (!onTimeReceivedCb)
	{
		autoUpdateSystemClock = true;
	}
	if (reqIntervalSeconds == 0)
	{
		setAutoQuery(false);
	}
	else
	{
		setAutoQueryInterval(reqIntervalSeconds);
		setAutoQuery(true);
		requestTime();
	}
}
コード例 #3
0
ファイル: NtpClient.cpp プロジェクト: Bravo13/Sming
NtpClient::NtpClient(String reqServer, int reqIntervalSeconds, NtpClientResultCallback delegateFunction /* = NULL */)
{
	autoUpdateTimer.initializeMs(NTP_DEFAULT_AUTO_UPDATE_INTERVAL, Delegate<void()>(&NtpClient::requestTime, this));
	this->server = reqServer;
	this->delegateCompleted = delegateFunction;
	if (!delegateFunction)
	{
		autoUpdateSystemClock = true;
	}

	if (reqIntervalSeconds == 0)
	{
		setAutoQuery(false);
	}
	else
	{
		setAutoQueryInterval(reqIntervalSeconds);
		setAutoQuery(true);
		requestTime();
	}

}