0

I am developing a solution for connection between OBD2(Vehicle ECU scanner) with the mobile app. I want that when ever that OBD device is found and it is already paired then the application automatically connect with the device and create a socket for transmission of data . without showing the dialog box to choose a paired device.

Muhammad Jamal
  • 442
  • 4
  • 21

1 Answers1

0

You can connect to any paired Bluetooth device, to do so, you have to know device's address and UUID. Embedded devices may have some defined uuid (for example, hc05 adapter), you can get that uuid from documentation. The tricky part here is that you have to monitor failure and loss of connection so you can retry again. I'm implementing that feature in my home project, fell free to see code: https://github.com/AlexShutov/LEDLights

Alex Shutov
  • 3,217
  • 2
  • 13
  • 11
  • Thanks a lot for your response. It means when ever i paired with device I have to save UUID e.g in preferences or Database for next time... Are you sure then it will not ask again for choose device in UI ? – Muhammad Jamal Nov 08 '16 at 10:26
  • Unless if you tell Android to pick device manually. Actually, you can scan scan for devices without UI. (see BtScanPort in project). When you connect two phones, UUID is app - specific key, describing connection between applications - you generate it by yourself. For embedded devices it usually pre- defined. – Alex Shutov Nov 08 '16 at 11:10
  • Yep I am working with embedded device (OBD2 Vehicle ECU Scanner). – Muhammad Jamal Nov 08 '16 at 11:16
  • @MuhammadJamal can you please help me , How we will generate UUID – GNK Aug 21 '20 at 01:27