Changeset 196adb5 in subsurface


Ignore:
Timestamp:
Jun 24, 2017, 9:58:01 PM (5 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
63fc06e
Parents:
03badea
git-author:
Linus Torvalds <torvalds@…> (06/12/17 19:47:50)
git-committer:
Dirk Hohndel <dirk@…> (06/24/17 21:58:01)
Message:

Very early and likely quite broken BLE GATT code

This is some very early and hacky code to be able to access BLE-enabled
dive computers that use the GATT protocol to send packets back and forth
(which seems to be pretty much all of them: a vendor-specific GATT
service with a write characteristic and a notification characteristic
for reading).

For testing only. But it does successfully let me download dives from
my EON Steel and my Scubapro G2.

NOTE! There are several very hacky pieces in here, including just
"knowing" that the write characteristic is the first one, and the
notification characteristic is second. The code should actually check
the properties rather than have those kinds of hardcoded assumptions.

It also checks "vendor specific" by looking at the UUID string
representation, and knowing that the standard ones start with zero.
Crazily, there doesn't seem to be any normal way to test for this,
although I guess that maybe the uuid.minimumSize() function could be
used.

There are other nasty corners. Don't complain, send me patches.

Signed-off-by: Linus Torvalds <torvalds@…>
Signed-off-by: Dirk Hohndel <dirk@…>

Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r3775f45 r196adb5  
    217217endif()
    218218
     219#I can't test MacOS, and Windows Qt doesn't support BLE at all afaik
     220if (BTSUPPORT AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
     221        set(BLESUPPORT ON)
     222endif()
     223
    219224if(BTSUPPORT)
    220225        add_definitions(-DBT_SUPPORT)
     226endif()
     227
     228if(BLESUPPORT)
     229        add_definitions(-DBLE_SUPPORT)
    221230endif()
    222231
  • core/CMakeLists.txt

    rb14a522 r196adb5  
    2323        set(BT_SRC_FILES desktop-widgets/btdeviceselectiondialog.cpp)
    2424        set(BT_CORE_SRC_FILES qtserialbluetooth.cpp)
     25endif()
     26
     27if(BLESUPPORT)
     28        add_definitions(-DBLE_SUPPORT)
     29        set(BT_CORE_SRC_FILES qt-ble.cpp)
    2530endif()
    2631
  • core/qtserialbluetooth.cpp

    radd253c r196adb5  
    1919
    2020#include <libdivecomputer/custom_io.h>
     21
     22#ifdef BLE_SUPPORT
     23# include "qt-ble.h"
     24#endif
    2125
    2226QList<QBluetoothUuid> registeredUuids;
     
    415419        .serial_set_rts = NULL,
    416420        .serial_set_halfduplex = NULL,
    417         .serial_set_break = NULL
     421        .serial_set_break = NULL,
     422
     423#ifdef BLE_SUPPORT
     424        .packet_size  = 20,
     425        .packet_open  = qt_ble_open,
     426        .packet_close = qt_ble_close,
     427        .packet_read  = qt_ble_read,
     428        .packet_write = qt_ble_write,
     429#endif
    418430};
    419431
  • scripts/build.sh

    r6bfb1f5 r196adb5  
    2020exec 1> >(tee build.log) 2>&1
    2121
     22export CMAKE_PREFIX_PATH=/home/torvalds/src/qt5/qtbase/lib/cmake
    2223SRC=$(pwd)
    2324PLATFORM=$(uname)
Note: See TracChangeset for help on using the changeset viewer.