Which GATT Profile and Services are used by OBD BLE Adapters like LELink, Automatic, Carista?

核能气质少年 提交于 2020-01-11 10:43:10

问题


I am exploring building apps (Android & iOS) for Car OBD2 Adapters that support BLE (Bluetooth Low Energy). In order for the app to be able to work with such adapters from different vendors, I presume there would be a standard set of GATT profile i.e. Services and Characteristics that these adapters would be using for standard features like engine RPM, Fuel level etc. Is this info available somewhere that I can refer while building the mobile app?


回答1:


OBD2 BLE adapters don't use any fixed GATT profiles. The way most (if not all) BLE OBD2 adapters work, is that they offer one service with one or two characteristics:

  1. A write characteristic. This one is where the mobile device can write its AT commands (in the case of, e.g., an ELM327) and PIDs to.
  2. A notify characteristic. This is the one where the results from the car (ECUs) are returned.

Once you have access to these characteristics, you can implement the OBD2 serial protocol (e.g. using a command queue that writes and waits for the response, before transmitting the finished command to the application layer).

Some BLE adapters merge these two into one characteristic. If you want to support arbitrary adapters, you will have to add a 'select your adapter' screen where you probe the found adapters, remember the characteristics, and then communicate.

That way it's possible to write apps that work with all kinds of BLE OBD2 adapters, and not only support a selected handful of vendors, e.g., such as OBD2 Expert (Disclaimer: I'm the author of that software).

Hope that helps!



来源:https://stackoverflow.com/questions/52075456/which-gatt-profile-and-services-are-used-by-obd-ble-adapters-like-lelink-automa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!