Closed LiliaRud closed 6 months ago
https://developer.tuya.com/en/docs/app-development/meshsig?id=Ka6km4aeuygxr
@LiliaRud do you need this? if not, Could you please provide specific issues encountered so that we can support them
@taojingGino
I'm using ThingHomeSdk.getThingBlueMeshConfig().newThingBlueMeshSearch(searchBuilder) for search according to documentation. It seems work almost as expected, as there no errors and callback onSearchFinish works properly. However, I never get callback onSearched but my device is in pairing mode and can be discovered by Smart Life app and by my custom iOS app with Tuya SDK.
All permissions (even more) are set:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
On Kotlin my code looks this way
val iThingBlueMeshSearchListener: IThingBlueMeshSearchListener = object : IThingBlueMeshSearchListener {
override fun onSearched(deviceBean: SearchDeviceBean) {
Log.i("MYLOGS", "--------------deviceBean: $deviceBean");
}
override fun onSearchFinish() {
Log.i("MYLOGS", "--------------SEARCH FINISHED");
}
}
val searchBuilder: SearchBuilder = SearchBuilder()
.setMeshName("out_of_mesh")
.setTimeOut(300)
.setThingBlueMeshSearchListener(iThingBlueMeshSearchListener)
.build()
mMeshSearch = ThingHomeSdk.getThingBlueMeshConfig().newThingBlueMeshSearch(searchBuilder)
mMeshSearch?.startSearch()
I also tried to use .setServiceUUIDs(MESH_PROVISIONING_UUID) instead .setMeshName("out_of_mesh") but it change nothing.
@LiliaRud pls use this method
and we have a demo that you can refer to
// Starts a connection. ThingHomeSdk.getThingSigMeshClient().startClient(mSigMeshBean);
// Starts a connection with a specified scanning period. ThingHomeSdk.getThingSigMeshClient().startClient(mSigMeshBean,searchTime);
startSearch() can only be used to discover sub devices ready for pairing.
@taojingGino @JiyeHoo Sorry, but I don't really get it. I need to discover device which is not connected yet and is in pairing mode. So which method should I use then? As I understand it's startSearch. But as I can see ThingHomeSdk.getThingSigMeshClient also has a startSearch method. Is there some callback to get discovered devices? I can't find it.
And as for this demo, there no SigMesh search implemented (or I can't find it somehow)
1. Scans for a Bluetooth mesh device ready for pairing.
This startSearch() is only used to discover devices without cloud activation.
mMeshSearch = ThingHomeSdk.getThingBlueMeshConfig().newThingBlueMeshSearch(searchBuilder);
mMeshSearch.startSearch();
2. Reconnect the paired device
Devices that have already been paired do not need to be scanned. The scan function has been implemented in startClient()
// Starts a connection.
ThingHomeSdk.getThingSigMeshClient().startClient(mSigMeshBean);
// Starts a connection with a specified scanning period.
ThingHomeSdk.getThingSigMeshClient().startClient(mSigMeshBean,searchTime);
ThingHomeSdk.getThingSigMeshClient().startSearch() is a scan function used for connections, and I think you may not need it
In addition, our Java demo function is quite comprehensive. You can take a look at it: https://github.com/tuya/tuya-home-android-sdk-sample-java
Hi! Are there plans to implement mesh search and connection? It's presented on the App screenshot but there no implementation.
I have issues implementing Mesh scanning for Android, although no problems with iOS. So it would be good to have some example or help.