This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BLE stack thermometer profile

It seems that thermometer profile of BLE stack 1.4.0 does not meet the specifications of Bluetooth SIG

According to bluetooth health thermometer specification "Measurment interval" characteristic should be 2 bytes(containing org.bluetooth.unit.time.second), and "valid range"descriptor should contain 2 uint16.

But in BLE stack "measurment interval" is 1 byte, and "valid range" is 2 bytes

Solution:

  •  thermometerservice.h
BLE stack 1.4.0: Should be:

/**
 * Thermometer Interval Range
 */

typedef struct
{
  uint8 low;         
  uint8 high;
} thermometerIRange_t;

/**
 * Thermometer Interval Range
 */

typedef struct
{
  uint16 low;         
  uint16 high;
} thermometerIRange_t;

// Length of bytes  
#define THERMOMETER_INTERVAL_LEN         1
#define THERMOMETER_TYPE_LEN                 1    
#define THERMOMETER_IRANGE_LEN             2
// Length of bytes  
#define THERMOMETER_INTERVAL_LEN    2
#define THERMOMETER_TYPE_LEN            1    
#define THERMOMETER_IRANGE_LEN        4

  •  thermometerservice.c
BLE stack 1.4.0: Should be:
//validate range
  if ((*pValue >= thermometerIRange.high) | ((*pValue <= thermometerIRange.low) & (*pValue != 0)))
//validate range
  if ((*(uint16 *)pValue >= thermometerIRange.high) | ((*(uint16 *)pValue <= thermometerIRange.low) & (*(uint16 *)pValue != 0)))
static uint8  thermometerInterval=30;  //default static uint16  thermometerInterval=30;  //default
// 10. Characteristic Value
    {
      { ATT_BT_UUID_SIZE, thermometerIntervalUUID },
      GATT_PERMIT_READ | GATT_PERMIT_AUTHEN_WRITE,
      0,
      &thermometerInterval
    },
// 10. Characteristic Value
    {
      { ATT_BT_UUID_SIZE, thermometerIntervalUUID },
      GATT_PERMIT_READ | GATT_PERMIT_AUTHEN_WRITE,
      0,
      (uint8 *)&thermometerInterval
    },
case THERMOMETER_INTERVAL:
      *((uint8*)value) = thermometerInterval;
      break;
case THERMOMETER_INTERVAL:
      *((uint16*)value) = thermometerInterval;
      break;