kai-morich / SimpleBluetoothLeTerminal

Android terminal app for Bluetooth LE devices using custom serial profiles
MIT License
285 stars 110 forks source link

How to configure UUID in SerialSocket.java #47

Open suoko opened 6 months ago

suoko commented 6 months ago

Hi, I was able to configure the original app where you can insert devices while using configuring the app on the phone. I see that this app does not allow to do so, but you have to put the UUIDs in the code. I tried putting Service UUID, Read Characteristic UUID and Write Characteristic UUID taken from the full app into the serialSocket.java file as below:

    private static final UUID BLUETOOTH_LE_TIO_SERVICE          = UUID.fromString("xxxx-xxxx-xxxx-xxxx-xxxx");
    private static final UUID BLUETOOTH_LE_TIO_CHAR_TX          = UUID.fromString("yyyy-xxxx-xxxx-xxxx-xxxx"); // WNR
    private static final UUID BLUETOOTH_LE_TIO_CHAR_RX          = UUID.fromString("zzzz-xxxx-xxxx-xxxx-xxxx"); // N
    private static final UUID BLUETOOTH_LE_TIO_CHAR_TX_CREDITS  = UUID.fromString("yyyy-xxxx-xxxx-xxxx-xxxx"); // W
    private static final UUID BLUETOOTH_LE_TIO_CHAR_RX_CREDITS  = UUID.fromString("zzzz-xxxx-xxxx-xxxx-xxxx"); // I

I considered RX as READ, and TX as WRITE, but I got "read credits characteristic not found". What am I missing ? Thanks

suoko commented 6 months ago

Sometimes I have GATT status 133 Sometimes I have "read characteristic CCCD descriptor not writable

kai-morich commented 6 months ago

LE_TIO is not a good example to clone from, as this has special flow control credits. Better try with the simpler ones.

suoko commented 5 months ago

simpler ones

Thanks, but what are you referring to with "simpler ones" ?

These are data I got from BLE-SCAN which are the same as those used in the full-version app


ble-scan  -d 48:87:2D:11:5A:4B 
Started general BLE scan

48:87:2D:11:5A:4B (rssi=-65): ELEGOO BT16

Finished general BLE scan
Started deep scan of 48:87:2D:11:5A:4B

Found device 48:87:2D:11:5A:4B: ELEGOO BT16 (out of 1)
SERVICE 0000ffe0-0000-1000-8000-00805f9b34fb (Handle: 1): Vendor specific
     CHARACTERISTIC 0000ffe2-0000-1000-8000-00805f9b34fb (Handle: 5): Vendor specific ['write-without-response']
     CHARACTERISTIC 0000ffe1-0000-1000-8000-00805f9b34fb (Handle: 2): Vendor specific ['notify']
         DESCRIPTOR 00002902-0000-1000-8000-00805f9b34fb (Handle: 4): Client Characteristic Configuration

Completed deep scan of 48:87:2D:11:5A:4B
kai-morich commented 5 months ago

you need a mixture of Cc245XDelegate and MicrochipDelegate class. UUIDs from the first, but separate characteristics from the second.