quick_blue icon indicating copy to clipboard operation
quick_blue copied to clipboard

serviceHandler never triggered on windows?

Open F3xil opened this issue 3 years ago • 8 comments

Hi, First thank you for providing this BLE package which will be very usefull :). Nevertheless, Is there a complete implementation of the serviceHandler under windows? When using it as described in the example, it seems not to be triggered. (see code below). May I did something wrong?

class CustomClient extends GenericClient(){
    CustomClient (){
        QuickBlue.setConnectionHandler(_handleConnectionChange);
        QuickBlue.setServiceHandler(_handleServiceDiscovery);
        QuickBlue.setValueHandler(_handleValueChange);
    }
    
     _handleConnectionChange(String deviceId, BlueConnectionState state){ //works well
        if(state == BlueConnectionState.connected){
            QuickBlue.discoverServices(deviceId);
        }
    }

    void _handleServiceDiscovery(String deviceId, String serviceId) { //never triggered
        print('_handleServiceDiscovery $deviceId, $serviceId');
    }

    void _handleValueChange(String deviceId, String characteristicId, Uint8List value) { //works well
        print('_handleValueChange $deviceId, $characteristicId, ${value.toList()}');
    }

}

Regards

F3xil avatar Mar 23 '22 11:03 F3xil

Yep. Windows API is a little different. It is unnecessary to discover services before using them for now

  } else if (method_name.compare("discoverServices") == 0) {
    // TODO
    result->Success(nullptr);

And it is difficult to add a fake implementation for now.

I'm planning to refactor the whole Windows implementation in the early of next month

Sunbreak avatar Mar 23 '22 11:03 Sunbreak

Thank you for the answer,

Ok, it means that it's not possible to discover and use custom services and characteristics "on the fly" for now without previously knowing the specific uuids. great job anyway! :)

Have you planned to add this functionality during the refactorization?

Thank you for your answers.

F3xil avatar Mar 23 '22 12:03 F3xil

Have you planned to add this functionality during the refactorization?

Will do. But it takes time. Windows APIs are too cumbersome

Sunbreak avatar Mar 23 '22 12:03 Sunbreak

Of course...

Thank you for your answers.

Regards!

F3xil avatar Mar 23 '22 13:03 F3xil

Ok, it means that it's not possible to discover and use custom services and characteristics "on the fly" for now without previously knowing the specific uuids. great job anyway! :)

Could you try https://github.com/timsneath/win32/pull/392? Does it help?

Sunbreak avatar Mar 29 '22 09:03 Sunbreak

Sorry for my late answer,

No it won't help, but it's fine, I can use quick_blue as is for the moment, and wait for improvements

F3xil avatar Apr 05 '22 07:04 F3xil

@Sunbreak are there any news about this matter? Could you give us some guidelines in how to help with this issue? I may be able to fix this issue and open a PR.

xDefcon avatar Mar 06 '23 16:03 xDefcon

Same issue, tryed to skip calling QuickBlue.discoverServices for windows platform and use subscribe to hardcoded service and characteristic, doesn't help...

iBog avatar Mar 25 '23 20:03 iBog