hello ,
i want to know if there an example available that has both peripheral + Broadcaster role running at the same time , Broadcaster advertise the service in the peripheral and its rssi ?
Thanks
hello ,
i want to know if there an example available that has both peripheral + Broadcaster role running at the same time , Broadcaster advertise the service in the peripheral and its rssi ?
Thanks
I'm actually not aware of any example, but there are several questions about this on DevZone.
It should be simply to set the advertising data with sd_ble_gap_adv_data_set() (through ble_advdata_set()) and call sd_ble_gap_adv_start(). See this MSC.
Please be aware that you per spec only can do non-connectable advertising while in a connection.
Putting in an UUID (service) shouldn't be too hard. I'm not sure what RSSI you would be putting in? What received signal strength would you be putting in?
Edit1:
Q1) Yes. Something like this:
ble_gap_adv_params_t m_adv_params;
m_adv_params.type = BLE_GAP_ADV_TYPE_ADV_NONCONN_IND;
m_adv_params.p_peer_addr = NULL;
m_adv_params.fp = BLE_GAP_ADV_FP_ANY;
m_adv_params.interval = NON_CONNECTABLE_ADV_INTERVAL;
m_adv_params.timeout = APP_CFG_NON_CONN_ADV_TIMEOUT;
err_code = sd_ble_gap_adv_start(&m_adv_params);
APP_ERROR_CHECK(err_code);
Q2) You need to add your UUID to the ble_advdata_t struct that you give to ble_advdata_set(). You can have a look at how this is populated in one of our examples.
Q3) Both
Edit2:
int main(void)
{
uint32_t err_code;
ble_stack_init();
ble_uuid_t ble_uuid;
ble_uuid128_t base_uuid = {{0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x00, 0x00, 0x40, 0x6E}};
err_code = sd_ble_uuid_vs_add(&base_uuid, &ble_uuid.type);
APP_ERROR_CHECK(err_code);
ble_uuid.uuid = 0x0001;
ble_gap_conn_sec_mode_t sec_mode;
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
err_code = sd_ble_gap_device_name_set(&sec_mode, "propUUID", 8);
APP_ERROR_CHECK(err_code);
ble_advdata_t advdata;
memset(&advdata, 0, sizeof(advdata));
advdata.name_type = BLE_ADVDATA_FULL_NAME;
advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
advdata.uuids_complete.p_uuids = &ble_uuid;
advdata.uuids_complete.uuid_cnt = 1;
err_code = ble_advdata_set(&advdata, NULL);
APP_ERROR_CHECK(err_code);
ble_gap_adv_params_t adv_params;
memset(&adv_params, 0, sizeof(adv_params));
adv_params.type = BLE_GAP_ADV_TYPE_ADV_NONCONN_IND;
adv_params.interval = 200;
adv_params.timeout = 0;
err_code = sd_ble_gap_adv_start(&adv_params);
APP_ERROR_CHECK(err_code);
// Enter main loop.
for (;;)
{
power_manage();
}
}
@petter
thanks again.
q4) I wanted to brodcast an exising service that is available in periperal role , not a new one is it possible? q5) I also didnt see any example of Observer role , can you direct me to that example.
@petter
thanks again.
q4) I wanted to brodcast an exising service that is available in periperal role , not a new one is it possible? q5) I also didnt see any example of Observer role , can you direct me to that example.