Giter VIP home page Giter VIP logo

Comments (6)

PolarGoose avatar PolarGoose commented on August 30, 2024 1

@AryanRai ,
I have asked the same question before but didn't get any answer:
https://stackoverflow.com/questions/62502414/how-to-connect-to-the-paired-audio-bluetooth-device-using-windows-uwp-api
The problem is also that not all devices support a notion of "connect". It is a big mess.
The best what I could find is this answer:
https://superuser.com/a/1427538/1182474
It proposes to use a special utility to manually enable every service of your device. But you need to know upfront what services this device exposes. There is no way to just say "connect to everything". Also the proposed in the answer btutils doesn't support Bluetooth Low Energy.

from bluetoothdevicepairing.

PolarGoose avatar PolarGoose commented on August 30, 2024

Hello @AryanRai,

Thank you for the interest in my utility.
It is important to know that BluetoothDevicePairing uses Windows.Devices.Enumeration API and therefore is limited by what this API provides.

As far as i know discovery isn't required while connecting with mac address directly.

Given what I said above it is important that it is not only possible in general but also that it is possible using the abovementioned API.
However, I have checked the API and indeed I think there is hope, the following code
var device = Windows.Devices.Enumeration.DeviceInformation.CreateFromIdAsync("<Bluetooth or BluetoothLe> and <mac address>").GetAwaiter().GetResult()
should give me a device class which has Pairing functionality.

Ok. Let me try to check that. If it works I will add it to the program. I don't know when I will have time though. I hope I will be able to do it this weekend. Please be patient.

Also the code which you use "BluetoothDevicePairing.exe pair --mac 12:34:56:78:9A:BC -discovery-time 1 unfortunately doesn't work reliably because 1 second is not enough to discover the device, you can easily get an error like "Pairing failed, device discovering hasn't discovered a device with this mac address". But I understand that you don't have any other choice.

from bluetoothdevicepairing.

AryanRai avatar AryanRai commented on August 30, 2024

Yea I read about it on StackOverflow, I will try forking and modifying the code and maybe issue a pull req if any success.

Ok. Let me try to check that. If it works I will add it to the program. I don't know when I will have time though. I hope I will be able to do it this weekend. Please be patient.
Take your time and thanks for your reply. 👍

from bluetoothdevicepairing.

PolarGoose avatar PolarGoose commented on August 30, 2024

@AryanRai ,

I have created a new release. Now pairing and unpairing using mac address is much faster. I have used the strategy I have described in my previous message. Now it doesn't need to waste time discovering devices.

Could you please test that it works?

from bluetoothdevicepairing.

AryanRai avatar AryanRai commented on August 30, 2024

Yes i have tested and it indeed does work. Thankyou👍. I have one more question, if my device is already paired i am supposed to disconnect it before running the connect command, is there a better way to just "connect" an "already paired device" (same for disconnect without unpairing)?

from bluetoothdevicepairing.

AryanRai avatar AryanRai commented on August 30, 2024

Yea I had already taken a look at bt command line tools before looking at your project and hav seen this thread but somehow bt cl tools just didn't suit my project in 2 ways. Firstly, it was quite unreliable on my pc and the other reason was it cannot be freely distributed as-in i cannot use it on a GitHub project. Anyways thanks a lot for all your help. If u ever do find a working solution to this please do let me know. For now I'm still gonna be using your project. For now I'd be closing this issue

from bluetoothdevicepairing.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.