Bluetooth pairing without user confirmation

前端 未结 6 568
感动是毒
感动是毒 2020-11-28 02:41

Can I pair two devices over Bluetooth without a need to confirm this in user interface, accept to pair this devices. Can I exchange some extra data over, for example NFC, an

6条回答
  •  孤街浪徒
    2020-11-28 03:19

    Well, this should really be broken into 2 parts:

    1. Can you pair 2 Bluetooth devices without going through a Bluetooth pairing handshake? No, you can't. That's baked into the protocol so there is no way around this.
    2. Can you perform the handshake without a user interface? Yes, you can: that's just code.

    I'm not sure how you do it in Windows land, but in *nix land there are functions buried in the Bluez stack that let you receive notifications about when a new device appears, and send it the pairing code (clearly there have to be these functions: those are what the user interface use). Given sufficient time and experience I'm sure you could figure out how to write your own version of the Bluetooth Settings app that somehow:

    • Detected a new device had arrived
    • Looked at the name/bluetooth mac address and checked some internal database for the pairing code to use.
    • Sent the pairing code and completed the operation

    All without having to pop up a user interface.

    If you go ahead and write the code I'd LOVE to get my hands on it.

提交回复
热议问题