ttlock / iOS_SDK_Demo

TTLock is a global provider of solutions for smart locks. We provide PCBA and softwares for lock manufactures and end users. We provide open API/SDK for developers. With these APIs/SDKs, you can develop your own applications to manage smart locks. The SDK here is for mobile app to communicate with locks via bluetooth.
MIT License
12 stars 12 forks source link

Lock Handing direction not updated in the original TTLock app. #20

Closed pathanparvezkhan closed 7 months ago

pathanparvezkhan commented 9 months ago

We have implemented setting directions(left and right) functionality in our app. We are calling below TTlock API from our server to set lock handing direction. We are getting success response but handing direction not updated in the original TTLock app.

curl --location 'https://euapi.ttlock.com/v3/lock/updateSetting' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'clientId= 4773aa036f7f49c68d876bb4be85c80c' \ --data-urlencode 'accessToken= dfd5489d0cee31f0bdfaf59d0d42d71f' \ --data-urlencode 'lockId= 163377' \ --data-urlencode 'type=7' \ --data-urlencode 'date=1700891985547'

We are also calling below SDK method to update the same.

TTLock.setUnlockDirection(TTUnlockDirection.left, lockData: lockData) { print(success) } failure: { error, message in print(error) print(message ?? "") }

When we change handing direction from original TTLock app itself then its updated successfully.

Are we missing something here? Please correct if any.

pathanparvezkhan commented 9 months ago

In the TTLock app lock settings there is "Door opening direction" option which is visible for some locks in which handing direction is supported and not visible to some locks in which it is not supported.

I want to achieve the same in our app. So I want to know based on which property we can identify the lock is supported handing directions and we can hide that if it is not supported.

Thank you for your help!

JuannyiOS commented 9 months ago
  1. If the parameters passed through the interface you are calling are all correct, then the ttlock APP will definitely be updated. Please check if there are any missing parameters passed through the interface.

  2. Based on the special value of the lock. BOOL suportFunction = [TTUtil lockFeatureValue:self.lockModel.lockData suportFunction:TTLockFeatureValueUnlockDirection] ;

JackeyPSSPL commented 9 months ago

@JuannyiOS For Android we are using the below SDK method so is it right or not?

TTLockClient.getDefault()
            .setUnlockDirection(
                UnlockDirection.RIGHT,
                lockData,
                object : SetUnlockDirectionCallback {
                    override fun onSetUnlockDirectionSuccess() {

                    }

                    override fun onFail(lockError: LockError) {

                    }
                })

If we used this then automatically synced with the server "https://euapi.ttlock.com/v3" right?

JuannyiOS commented 9 months ago

Yes, the method names for Android and iOS are the same. All SDK methods will not be connected to the network. After setting them up, you can call the server interface and update it yourself.

pathanparvezkhan commented 9 months ago
  1. If the parameters passed through the interface you are calling are all correct, then the ttlock APP will definitely be updated. Please check if there are any missing parameters passed through the interface.
  2. Based on the special value of the lock. BOOL suportFunction = [TTUtil lockFeatureValue:self.lockModel.lockData suportFunction:TTLockFeatureValueUnlockDirection] ;

Thank you for the response.

In iOS:

Yes handing direction got updated after updating parameter values LEFT = 1 and RIGHT = 2.

But first time after resetting device when we try to set handing direction left we got success in API but it shows handing direction right in original TTLock app. It happens only first time after resetting device. Then if we set handing direction right then it started working fine for both directions.

JuannyiOS commented 8 months ago

Has this problem been solved? If the lock is successfully set by sdk and the server interface is successfully set , then TTLock app will be updated. The issue you described is not related to iOS SDK, it is that the server has not been updated. If there is still this issue ,please provide the account and requested server interface. (request parameters and return parameters)

ttlock commented 8 months ago

Has this problem been solved?

pathanparvezkhan commented 8 months ago

Has this problem been solved?

It's not working for very first time after resetting device. Does it require to connect with gateway to sync data with TTlock original app?

ttlock commented 8 months ago

If the lock is successfully set by sdk and the server interface is successfully set , then TTLock app will be updated. The issue you described is not related to iOS SDK, it is that the server has not been updated. If there is still this issue ,please provide the account and requested server interface. (request parameters and return parameters)