GATT services and characteristic declaration error

These are customized UUIDS declared by me 

/* Custom Service Variables */
#define BT_UUID_CUSTOM_SERVICE_VAL  BT_UUID_128_ENCODE(0x821675c3, 0x4046, 0x45f9, 0xb8df, 0xcdc9da1c71a7)

#define CUSTOM_EMG_UUID BT_UUID_128_ENCODE(0x30645c07,0x5a3c,0x4f2d,0xbee5,0x7eafcbf0c790)
#define CUSTOM_BATTERY_UUID BT_UUID_128_ENCODE(0xd7b5a586,0x6191,0x4c0f,0x93e0,0xc2fa666d5ca3)

#define BT_UUID_EMG_DEV BT_UUID_DECLARE_128(BT_UUID_CUSTOM_SERVICE_VAL)
#define BT_UUID_BAT     BT_UUID_DECLARE_128(CUSTOM_BATTERY_UUID)
#define BT_UUID_EMG     BT_UUID_DECLARE_128(CUSTOM_EMG_UUID)
I call this UUIDs to define services and characteristics as follows 
BT_GATT_SERVICE_DEFINE(custom_svc,
BT_GATT_PRIMARY_SERVICE(BT_UUID_EMG_DEV),

BT_GATT_CHARACTERISTIC(BT_UUID_BAT,
                       BT_GATT_CHRC_READ,
                       BT_GATT_PERM_READ,
                       read_battery,NULL,&battery_value),        
                       
BT_GATT_CHARACTERISTIC(BT_UUID_EMG,
                  BT_GATT_CHRC_READ,
                  BT_GATT_PERM_READ,
                  read_emg,NULL,&emg_value)
);
But I am encountering errors such as expecting a comma even if I have put a comma.
error: expected expression before ',' token
110 | read_str, NULL, BT_DIS_MODEL_REF),
| ^
error: expected expression before ',' token
75 | BT_GATT_PERM_NONE, NULL, NULL, NULL),
| ^
error: expected expression before ',' token
55 | &battery_level),
| ^
error: expected expression before ',' token
244 | read_name, write_name, bt_dev.name),
| ^
Could any one please figure me out how to solve this errors.
Parents
  • Hi Vivek, 

    The error complains were not about your declaration but the declaration for DIS service. You may need to check what inside \zephyr\subsys\bluetooth\services\dis.c 
    Please show the whole log. 
    Also please try to test with peripheral_lbs or peripheral_uart . These examples do pretty much what you are trying to do. 
    In case you are not aware, we have a Dev Academy course that can help you to get familiar with Nordic BLE stack. 

Reply
  • Hi Vivek, 

    The error complains were not about your declaration but the declaration for DIS service. You may need to check what inside \zephyr\subsys\bluetooth\services\dis.c 
    Please show the whole log. 
    Also please try to test with peripheral_lbs or peripheral_uart . These examples do pretty much what you are trying to do. 
    In case you are not aware, we have a Dev Academy course that can help you to get familiar with Nordic BLE stack. 

Children
Related