You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need detailed guidance on implementing the "Calibrate time" and "Daylight saving setting" features using the TTLock SDK.
Current Implementation:
For "Calibrate time," our current approach involves using the TTLock.getLockTime method to retrieve the lock's current time and the TTLock.setLockTimeWithTimestamp method to calibrate the lock time. However, we're uncertain if this is the correct approach, as we have not used any specific API and have noticed a time variation between our app and the TTLock official app.
Please find below code snippets for our current implementation:
//To get lock time
func getLockTime() {
appLoaderView.startAnimating()
TTLock.getLockTime(withLockData: lockData) { time in
appLoaderView.stopAnimating()
self.labelTime.text = self.convertTimeIntervalToDate(timeInterval: time)
} failure: { error, message in
appLoaderView.stopAnimating()
self.ShowAlert(titleStr: "", message: message ?? "")
}
}
//To set lock time, we call below method to calibrate time.
func setLockTime() {
let currentDate = Date()
let timestamp = Int64(currentDate.timeIntervalSince1970 * 1000)
appLoaderView.startAnimating()
TTLock.setLockTimeWithTimestamp(timestamp, lockData: self.lockData) {
appLoaderView.stopAnimating()
self.labelTime.text = self.convertTimeIntervalToDate(timeInterval: timestamp)
} failure: { error, message in
appLoaderView.stopAnimating()
self.ShowAlert(titleStr: "", message: message ?? "")
}
}
//Convert time interval to date
func convertTimeIntervalToDate(timeInterval: Int64) -> String {
let date = Date(timeIntervalSince1970: TimeInterval(timeInterval) / 1000.0)
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy.MM.dd HH:mm:ss"
return dateFormatter.string(from: date)
}
Queries:
Is our current implementation for "Calibrate time" correct?
Do we need to use any additional API along with the TTLock.getLockTime and TTLock.setLockTimeWithTimestamp methods?
Could you provide a step-by-step guide to properly implement this feature?
Clarification on Methods:
TTLock.getLockTime: How exactly does this method work?
TTLock.setLockTimeWithTimestamp: What should we consider while using this method?
TTLock.getLightTime and TTLock.setLightTime: What is the purpose of these methods, and how should they be implemented?
Daylight Saving Setting:
We have not yet implemented the "Daylight saving setting" feature as we're unsure of its exact purpose and usage.
Could you please explain what this feature does and provide a step-by-step guide to implementing it using the TTLock SDK?
Reference:
I have previously posted an issue regarding the "Daylight saving setting" feature but didn't get a clear idea about its implementation. Here is the link to that issue: Issue #25.
Your assistance with these questions and a detailed implementation guide would be greatly appreciated.
Thank you for your support!
The text was updated successfully, but these errors were encountered:
1 correct, no need other steps
2 TTLock.getLockTime is to connect the lock and read the time of the clock in the lock
TTLock.setLockTimeWithTimestamp is nothing to consider
TTLock.getLightTime and TTLock.setLightTime belong to the safe lock, used to control the lighting time
3 Daylight Saving Setting: The method given earlier is not easy to understand, use the following method
first step: call API : https://euopen.sciener.com/document/doc?urlName=cloud%2Flock%2FchangeTimezoneRawOffsetEn.html , this api will return new "lockData"
second step: use the new "lockData" to setLockTime
func setLockTime() {
let currentDate = Date()
let timestamp = Int64(currentDate.timeIntervalSince1970 * 1000)
I need detailed guidance on implementing the "Calibrate time" and "Daylight saving setting" features using the TTLock SDK.
Current Implementation:
For "Calibrate time," our current approach involves using the TTLock.getLockTime method to retrieve the lock's current time and the TTLock.setLockTimeWithTimestamp method to calibrate the lock time. However, we're uncertain if this is the correct approach, as we have not used any specific API and have noticed a time variation between our app and the TTLock official app.
Please find below code snippets for our current implementation:
Queries:
Reference:
I have previously posted an issue regarding the "Daylight saving setting" feature but didn't get a clear idea about its implementation. Here is the link to that issue: Issue #25.
Your assistance with these questions and a detailed implementation guide would be greatly appreciated.
Thank you for your support!
The text was updated successfully, but these errors were encountered: