Dear all i have a very funny situaton.
I can only send 1 byte in my service data when I increase it to two bytes it doesn't send. and says invalid parameters
When i change the AVL service data count to 2 it seems to crash......Please help..
static uint8_t m_Service_data[2] = /**< Information advertised by the Beacon. */
{
APP_DEVICE_TYPE, // Manufacturer specific information. Specifies the device type in this
// implementation.
APP_ADV_DATA_LENGTH, // Manufacturer specific information. Specifies the length of the
// manufacturer specific data in this implementation.
// APP_BEACON_UUID, // 128 bit UUID value.
//APP_MAJOR_VALUE, // Major arbitrary value that can be used to distinguish between Beacons.
//APP_MINOR_VALUE, // Minor arbitrary value that can be used to distinguish between Beacons.
//APP_MEASURED_RSSI // Manufacturer specific information. The Beacon's measured TX power in
// this implementation.
};
static void advertising_init(void)
{
uint32_t err_code;
ble_advdata_t advdata;
uint8_t flags = BLE_GAP_ADV_FLAG_CUSTOM_SUPPORTED;
ble_advdata_manuf_data_t manuf_specific_data;
ble_advdata_service_data_t service_data;
manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER;
ble_gap_conn_sec_mode_t sec_mode;
sec_mode.lv=0;
sec_mode.sm=0;
err_code = sd_ble_gap_device_name_set(&sec_mode,
(const uint8_t *)DEVICE_NAME,
strlen(DEVICE_NAME));
// manuf_specific_data.data.p_data = (uint8_t *) m_beacon_info;
//manuf_specific_data.data.size = APP_BEACON_INFO_LENGTH;
service_data.service_uuid=BLE_UUID_HUMAN_INTERFACE_DEVICE_SERVICE;
service_data.data.p_data=(uint8_t *)m_Service_data;
service_data.data.size=2;
// Build and set advertising data.
memset(&advdata, 0, sizeof(advdata));
advdata.name_type = BLE_ADVDATA_SHORT_NAME;
advdata.short_name_len =4;
advdata.flags = flags;
//advdata.p_manuf_specific_data = &manuf_specific_data;
// advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
// advdata.uuids_complete.p_uuids = m_adv_uuids;
advdata.p_service_data_array = &service_data;
advdata.service_data_count = 2;
err_code = ble_advdata_set(&advdata, NULL);
APP_ERROR_CHECK(err_code);
// Initialize advertising parameters (used when starting advertising).
memset(&m_adv_params, 0, sizeof(m_adv_params));
m_adv_params.type = BLE_GAP_ADV_TYPE_ADV_NONCONN_IND;
m_adv_params.p_peer_addr = NULL; // Undirected advertisement.
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;
}
/**@brief Function for starting advertising.
*/
static void advertising_start(void)
{
uint32_t err_code;
err_code = sd_ble_gap_adv_start(&m_adv_params);
APP_ERROR_CHECK(err_code);
err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
APP_ERROR_CHECK(err_code);
}