9 years, 7 months ago.  This question has been closed. Reason: Unclear question

Nordic Pucks - update seems limited to allowing only one server/characteristic..

based on:

Quote:

The Puck library is updated, and should be working with the newest version of the mbed library posted by Stian Jensen 27 Feb 2015

i took an attempt to start using the nRF51-DK and the Puck example - if i have a single service with a single characteristic; everything works as expected. was not a problem to subscribe to it, use the buttons of the device to set the characteristic and see what was going on.. the problems started when i was attempting to add a secondary characteristic..

very basic example:

const UUID nRF51_GATT_SERVICE               = stringToUUID("nRF51-DK service");
const UUID nRF51_BUTTON_GATT_CHARACTERISTIC = stringToUUID("nRF51-DK button characteristic");
const int  nRF51_BUTTON_GATT_DATA_LENGTH    = 1;
const UUID nRF51_LED_GATT_CHARACTERISTIC    = stringToUUID("nRF51-DK led characteristic");
const int  nRF51_LED_GATT_DATA_LENGTH       = 1;

and then during the initialization.. adding:

    puck -> addCharacteristic(
              nRF51_GATT_SERVICE,
              nRF51_BUTTON_GATT_CHARACTERISTIC,
              nRF51_BUTTON_GATT_DATA_LENGTH,
              GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | 
              GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY);

    puck -> addCharacteristic(
              nRF51_GATT_SERVICE,
              nRF51_LED_GATT_CHARACTERISTIC,
              nRF51_LED_GATT_DATA_LENGTH,
              GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ |   
              GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE |
              GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY);

the first one gets added.. second one doesn't.. if i swap them around, which ever one i declare first is added. the other one seems to be lost in the abyss. of course; would be nice to have multiple characteristics under a single service.. or even having multiple services.. something seems to be broken :(

Question relating to:

/ Puck Featured
A library for easier setup and prototyping of IoT devices (pucks), by collecting everything that is common for all pucks in one place. BLE, bluetooth, nRF51822

for the sake of sanity - i put some debugging code in the Puck.h file where addCharacteristic() is being called:

// debugging: AA
    printf("characteristiccount = %d\r\n", characteristicsLength);
    for (int i = 0; i < characteristicsLength; i++) {
        GattCharacteristic* characteristic = characteristics[i];
        printf("characteristic @%lu\r\n", (long)characteristic);
    }
// debugging: end

    LOG_DEBUG("Added characteristic.\n");
}

and while running; i do see that it has references to both of the characteristics:

[main.cpp:INFO] Start
characteristiccount = 1
characteristic @536882136
characteristiccount = 2
characteristic @536882136
characteristic @536882576
[main.cpp:INFO] monitoring: BUTTON_GATT_CHARACTERISTIC
[main.cpp:INFO] monitoring: LED_GATT_CHARACTERISTIC
[main.cpp:INFO]      led state: 0

so it seems the problem may be a little deeper than the Nordic Puck handling.. i am using LightBlue on MacOSX to view/traverse the puck services and characteristics.

posted by Aaron Ardiri 05 Apr 2015

i did a little bit more digging on this - seems to not be the device, but more the software i was using to scan for services/characteristics.. a more verbose debugging of the setup is shown below:

[D] Inited BLEDevice.
[D] Changed state to 3
[D] Accumulate advertising payload: BREDR_NOT_SUPPORTED | LE_GENERAL_DISCOVERABLE.
[D] Accumulate advertising payload: beacon data.
[D] Setting advertising type: ADV_CONNECTABLE_UNDIRECTED.
[D] Set advertising interval: 160 (100 ms).
[D] Hooked up internal event handlers.
 +service
 6e 52 46 35 31 2d 44 4b 20 20 20 20 20 20 20 20
 +characteristic
 6e 52 46 35 31 2d 44 4b 20 62 75 74 74 6f 6e 20
 +characteristic
 6e 52 46 35 31 2d 44 4b 20 6c 65 64 20 20 20 20
[D] Added service 20003338 to BLEDevice
[I] Inited puck as 0xFEED.
[V] Updated characteristic value.
[V] Updated characteristic value.
[main.cpp:INFO]monitoring: BUTTON_GATT_CHARACTERISTIC
[V] Bound characteristic write callback (uuid: 200021ac, callback: 16131)
[main.cpp:INFO]monitoring: LED_GATT_CHARACTERISTIC
[main.cpp:INFO]     led state: 0
[I] Starting to advertise.
[D] Changed state to 2

when i used an iOS or Android application to scan for the services/characteristics; they appear as they should. seems this was/is a bug within the Mac OSX based BLE tool called LightBlue from PunchthroughDesign

posted by Aaron Ardiri 07 Apr 2015