ttlock / Android_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.
23 stars 24 forks source link

Wireless gateway integration issue using new SDK #4

Open AAkanksha26 opened 4 years ago

AAkanksha26 commented 4 years ago

Hello!

I've used the SDK "ttlock-sdk-2.0.aar" and "ttlock-gateway-sdk-2.0.aar" in my project for the smart locks. Now I want to integrate the wireless gateway into my project. So I tried using GatewayAPI and followed the instruction given in TTLock documentation. It couldn't work for me and I don't know where I'm going wrong. So I tried the new SDK "com.tongtonglock:ttlock:3.0.6" for gateway integration. Using that I could scan the gateway, connect the gateway and scan wifi networks for gateway; but I couldn't init the gateway. I used the credentials of my TTLock account for this. I used the method as below -

        configureGatewayInfo.uid = MY_INTEGER_USER_ID;
        configureGatewayInfo.userPwd = MY_PASSWORD;
        configureGatewayInfo.ssid = binding.wifiName.getText().toString().trim();
        configureGatewayInfo.plugName = binding.gatewayName.getText().toString().trim();
        configureGatewayInfo.wifiPwd = binding.wifiPwd.getText().toString().trim();
        GatewayClient.getDefault().initGateway(configureGatewayInfo, new InitGatewayCallback() {
            @Override
            public void onInitGatewaySuccess(DeviceInfo deviceInfo) {
                makeToast("gateway init success");
            }

            @Override
            public void onFail(GatewayError error) {
                makeToast(error.getDescription());
            }
        });

It is not showing the message in onFail, not in onInitGatewaySuccess and not even showing some error or exception and after some time, the gateway times out.

Can you please tell me where I'm going wrong or help to solve the issue? Also please let me know if there is any way to integrate "ttlock-sdk-2.0.aar" along with "com.tongtonglock:ttlock:3.0.6".

Thanks in advance!

the-code-chef commented 4 years ago

Hello @AAkanksha26 , Did you get any solution?

I am also facing a similar issue. For me, it's not even scanning.

@ttlock , @lxk123 Please help