Multiple bluetooth connection

后端 未结 8 1923
后悔当初
后悔当初 2020-11-28 19:46

I want to connect 3 devices via bluetooth (My Droid must connect to 2 bluetooth devices). I \'ve connected my Droid to 1 device using Bluetooth chat How should I modify it f

8条回答
  •  孤街浪徒
    2020-11-28 20:03

    You can take a look here ( this is not a solution but the idea is here)

    sample multi client with the google chat example

    what you have to change/do :

    • separate server and client logique in different classes

    • for the client you need an object to manage one connect thread and on connected thread

    • for the server you need an object to manage one listening thread per client, and one connected thread per client

    • the server open a listening thread on each UUID (one per client)

    • each client try to connect to each uuid (the uuid already taken will fail the connection => first come first served)

    Any question ?

提交回复
热议问题