Hello,
I am trying to send a single adv packet when a certain condition in the application is met. To do this I am calling ADV_start for the initial adv packet and then I have made a function call pack_send to send an adv packet triggered by a condition in the main loop. However, calling pack_send throws the following error:
app_error_weak.c, 105, Mesh assert at 0x0002BD3E (:0)
Any ideas why and how to resolve? Additionally, changing (p_packet->config.repeats == ADVERTISER_REPEAT_INFINITE) from infinite to 0x01 causes the main loop to slow down substantially, why?
static void adv_start(void)
{
/* Let scanner accept Complete Local Name AD Type. */
bearer_adtype_add(BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME);
advertiser_enable(&m_advertiser);
static const uint8_t adv_data[] =
{
0x02, /* AD data length (including type, but not itself) */
BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME, /* AD data type (Complete local name) */
'N', /* AD data payload (Name of device) */
};
/* Allocate packet */
adv_packet_t * p_packet = advertiser_packet_alloc(&m_advertiser, sizeof(adv_data));
if (p_packet)
{
/* Construct packet contents */
memcpy(p_packet->packet.payload, adv_data, sizeof(adv_data));
/* Repeat forever */
p_packet->config.repeats = 0x01;
advertiser_packet_send(&m_advertiser, p_packet);
}
// advertiser_disable(&m_advertiser);
}
static void pack_send(void)
{
/* Let scanner accept Complete Local Name AD Type. */
// bearer_adtype_add(BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME);
advertiser_flush(&m_advertiser);
// advertiser_enable(&m_advertiser);
static const uint8_t adv_data[] =
{
0x02, /* AD data length (including type, but not itself) */
BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME, /* AD data type (Complete local name) */
'N', /* AD data payload (Name of device) */
};
/* Allocate packet */
adv_packet_t * p_packet = advertiser_packet_alloc(&m_advertiser, sizeof(adv_data));
if (p_packet)
{
/* Construct packet contents */
memcpy(p_packet->packet.payload, adv_data, sizeof(adv_data));
/* Repeat forever */
p_packet->config.repeats = 0x01;
advertiser_packet_send(&m_advertiser, p_packet);
}
__NOP();
advertiser_disable(&m_advertiser);
}