These are customized UUIDS declared by me
110 | read_str, NULL, BT_DIS_MODEL_REF),
| ^
75 | BT_GATT_PERM_NONE, NULL, NULL, NULL),
| ^
55 | &battery_level),
| ^
244 | read_name, write_name, bt_dev.name),
| ^
These are customized UUIDS declared by me
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.
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.
Thank You ble pairing is working fine.
iam having the same issue,can u provide me the sample code as iam new to nrf.
The code I have developed works fine and can be used as a sample but the code is long enough, it may not fit here. If you are able to provide your mail ID , I will mail it.
Hi Vivek,
You can attach a file by Insert -> Image/video/file.
If you attach a whole project, pleas remove the build folder it will make the .zip file much smaller.
//Function definitions of BLE #include "ble_config.h" ssize_t read_battery(struct bt_conn *conn, const struct bt_gatt_attr *attr,void *buf,uint16_t len,uint16_t offset) { const char *value= battery_value; return bt_gatt_attr_read(conn,attr,buf,len,offset,value,strlen(value)); } ssize_t read_emg(struct bt_conn *conn,const struct bt_gatt_attr *attr,void *buf,uint16_t len,uint16_t offset) { const char *emg_buffer[20]; snprintf(emg_buffer,sizeof(emg_buffer),"%s,%s",emg_value[0],emg_value[1]); return bt_gatt_attr_read(conn,attr,buf,len,offset,emg_buffer,strlen(emg_buffer)); } const struct bt_data ad[]={ BT_DATA_BYTES(BT_DATA_FLAGS,(BT_LE_AD_GENERAL|BT_LE_AD_NO_BREDR)), BT_DATA(BT_DATA_NAME_COMPLETE,DEVICE_NAME,DEVICE_NAME_LEN), }; const struct bt_data sd[] = { BT_DATA_BYTES(BT_DATA_UUID128_ALL, BT_UUID_CUSTOM_SERVICE_VAL), }; /* @ref about advertising intervals 800 - Min Advertising Interval 500ms (800*0.625ms) 801 - Max Advertising Interval 500.625ms (801*0.625ms) NULL - Indicates undirected advertising */ struct bt_le_adv_param *adv_pram = BT_LE_ADV_PARAM((BT_LE_ADV_OPT_CONNECTABLE|BT_LE_ADV_OPT_USE_IDENTITY), 800,801,NULL); /* static void update_phy(struct bt_conn *conn) { int err; const struct bt_conn_le_phy_param preferred_phy = { .options = BT_CONN_LE_PHY_OPT_NONE, .pref_rx_phy = BT_GAP_LE_PHY_2M, .pref_tx_phy = BT_GAP_LE_PHY_2M, }; err = bt_conn_le_phy_update(conn,&preferred_phy); if(err) { LOG_ERR("bt_conn_le_phy_update() returned %d",err); } } */ struct bt_conn *my_conn = NULL; void on_connected(struct bt_conn *conn,uint8_t err) { if(err) { printk("Connection error %d",err); return; } printk("Connected"); my_conn = bt_conn_ref(conn); struct bt_conn_info info; err = bt_conn_get_info(conn,&info); if(!err) { double connection_interval = info.le.interval*1.25;//in ms uint32_t supervision_timeout = info.le.timeout*10;//in ms printk("Connection parameters: interval %.2f ms, latency %d intervals,timeout %d ms",connection_interval,info.le.latency,supervision_timeout); } // update_phy(my_conn); } void on_disconnected(struct bt_conn *conn, uint8_t reason) { printk("Disconnected. Reason %d",reason); bt_conn_unref(my_conn); } struct bt_conn_cb connection_callbacks = { .connected = on_connected, .disconnected = on_disconnected, }; void bt_ready(void) { int err; err=bt_enable(NULL); printk("Bluetooth Intialied\n"); err=bt_le_adv_start(adv_pram,ad,ARRAY_SIZE(ad),sd,ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return; } printk("Advertising successfully started\n"); }