Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serviceHandler never triggered on windows? #76

Open
F3xil opened this issue Mar 23, 2022 · 8 comments
Open

serviceHandler never triggered on windows? #76

F3xil opened this issue Mar 23, 2022 · 8 comments

Comments

@F3xil
Copy link

F3xil commented Mar 23, 2022

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

@Sunbreak
Copy link
Collaborator

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

@F3xil
Copy link
Author

F3xil commented Mar 23, 2022

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.

@Sunbreak
Copy link
Collaborator

Have you planned to add this functionality during the refactorization?

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

@F3xil
Copy link
Author

F3xil commented Mar 23, 2022

Of course...

Thank you for your answers.

Regards!

@Sunbreak
Copy link
Collaborator

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 dart-windows/win32#392? Does it help?

@F3xil
Copy link
Author

F3xil commented Apr 5, 2022

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

@xDefcon
Copy link

xDefcon commented Mar 6, 2023

@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.

@iBog
Copy link

iBog commented Mar 25, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants