This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

about s120 & s130 send data

At s120,i used the following code to send data (to s110)

if(	( wIndicationFlag_Get() == true ) && ( wConfirmFlag_Get() == true ) )		
{
	//APPL_LOG("Write Data\r\n");
	pSend_aray = Load_data();													
	ble_gip_c_bl_write(&m_ble_bas_c,pSend_aray);
}

At s130,how to send data(to s110)?Is have a example code? thanks.

Parents Reply
  • If you send the data over Nordic UART Service (NUS), you can set the bettery level characteristics value by calling the function ble_bas_battery_level_update() with the value received over NUS as second argument. See the BLE UART Central and Peripheral examples to see how to send and receive data over NUS.

    If you want to write directly to the Battery Level characteristic, you can set write permissions in ble_bas.c by adding the line char_md.char_props.write = 1; in function battery_level_char_add(). You also need to replace (or add if not present) the line BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&bas_init.battery_level_char_attr_md.write_perm); with BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_char_attr_md.write_perm); when you initialize the battery service. Notice that allowing writes to the battery service does not comply with the Battery service defined by Bluetooth SIG.

Children
No Data
Related