[libdivecomputer] #14: Native bluetooth communication

Libdivecomputer Bug Tracking System trac at libdivecomputer.org
Mon Mar 9 06:24:09 PDT 2015

#14: Native bluetooth communication
                                            Reporter:|      Owner:  jefdriesen
  jefdriesen                         |
                                                Type:|     Status:  new
  enhancement                        |
                                            Priority:|  Component:  Device communication
  major                              |
                                             Version:|   Keywords:
  master                             |
Plattform (please give specifics in  |
  the ticket text):  All             |
 A while ago, I have been prototyping a native bluetooth communication
 backend for libdivecomputer. The goal is to be able to replace the serial
 emulation in the future. The main reason behind this effort is that the
 current situation, where we rely on serial emulation, is less than ideal.
 It requires some setup by the end-user, and last but not least it doesn't
 appear to work very well on linux!

 I have arrived at a point where I have a functional implementation for
 windows and linux. With functional, I mean I'm able to connect to the dive
 computer and successfully download dives. What is still missing is device
 discovery, which means you have to figure out the bluetooth address of the
 device manually. Certainly not perfect yet, but it does work!

 I have attached the patches with my prototype code. These patches include
 the bluetooth communication code, together with the necessary changes to
 integrate it into the Shearwater Predator and Petrel backend (the same
 could be done for the Heinrichs Weikamp Frog too).

 The linux and windows implementations are very similar because they both
 provide a socket interface ![1,2]. (I actually spend most of the time
 debugging a failure on Windows. In the end, the problem turned out to be
 caused by a bug in the mingw header files, and not my code. The bug was
 already fixed upstream ![3], but not yet included in the packages I was

 I'm now looking at Mac OS X support, but this appears to be much harder
 than I expected. The developer documentation ![4] isn't very helpful. It
 contains lots of information, but appears to lack the info I'm looking
 after (e.g. how to connect to a device, send/receive data, etc). The fact
 that I don't have any experience with Objective-C code or the Mac
 framework doesn't really help either. So if anyone can provide some
 assistance here, that would be great! Ideally, I would like to avoid using
 Objective-C code completely and use the C api of the Mac framework

 Of course help is not limited to the Mac OS X part only. If you have some
 knowledge about bluetooth in general, or have some experience with the
 Windows and Linux bluetooth api's, then any help in that area is
 appreciated too!

 ![1] http://people.csail.mit.edu/albert/bluez-intro/
 ![3] http://sourceforge.net/p/mingw-w64/code/6249/

Ticket URL: <http://trac.libdivecomputer.org/ticket/14>
libdivecomputer <www.libdivecomputer.org>
a cross-platform and open source library for communication with dive computers from various manufacturers

More information about the tickets mailing list