⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
7 posts / 0 new
Last post
dmueller.
Offline
Last seen:3 years 10 months ago
Joined:2017-04-12 10:04
ble stack state

Dear dialog support,

is there a simple way to check if the ble stack state is free?

I would like to write a program, which always sends a numerical value via bluetooth, as soon as the old numerical value is sent.

Kind regards.

Device:
MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
Joined:2015-06-08 11:34
Hi DMueller,

Hi DMueller,

I am sorry, but i dont quite get the question, can you please clarify ?

If you would like to do what you are describing on the second line of your post, you can use indications (the central has to confirm the reception of the message so you will get a completetion message as soon as the central receives the indication). On the other hand notifications are also used but there is no confirmation by the client for the reception on application level.

Thanks MT_dialog

dmueller.
Offline
Last seen:3 years 10 months ago
Joined:2017-04-12 10:04
Hi MT_dialog,

Hi MT_dialog,

if i want to send two bytes, this bytes are stored on a stack. I can fill the stack like a buffer. Or is this not true?

My question was, can i recognize by means of a flag or another indicator whether this stack/buffer is full or empty?

Yes i want it to do. On the central there is notify. But i want that the server is able to recognize whether it can send or not.

Kind regards.

MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
Joined:2015-06-08 11:34
Hi DMueller,

Hi DMueller,

与缓冲区一样交换BLE堆栈是非常简单的,因为它实现了整个BLE堆栈,事情并不是那么简单,并且作为最终用户,您可以与BLE概念接口,而不是堆栈如何处理RX / TX消息,但在底线让我们可以假设我们可以通过通知发送具有2个字节长度长度的特征的值,然后堆栈将与指针队一起队列,该指针将指向该特征数据到18中的指针长度消息缓冲区。因此,如同通知,所以允许拍摄例如在BLE_APP_PERITELAL中实现的自定义配置文件,该应用程序将发送CUSTS1_VAL_IND_REQ(应用程序特定消息),配置文件将发出CUTTC_SEND_EVT_CMD,以将堆栈发送到TX缓冲区在下一个连接间隔中会发生发送。现在,通知不涉及从另一侧的确认(来自连接主机的ACK),但一旦发送Gattc_send_evt_cmd,堆栈将回复该消息,即通知已放入缓冲区中。为了让您知道通知已输入缓冲区,它将与GattC_CMP_EVT和来自GattC_CMP_EVT_HANDLER()回复配置文件将通知应用程序(使用CUSTS1_VAL_NTF_CFM消息)通知已成功输入缓冲区和它将留在下一个连接间隔。您可以在user_catch_rest_hndl()中捕获此消息。

Thanks MT_dialog

dmueller.
Offline
Last seen:3 years 10 months ago
Joined:2017-04-12 10:04
Hi MT_dialog,

Hi MT_dialog,

thank you for the answer. Unfortunately it isn't quite what i meant, because the CUSTS1_VAL_NTF_CFM message came only after i send something. But i want to recognize if nothing is in the ble stack, too.

I want to send every time a new value, when no values are in the ble stack. At the beginn of the programm usually the ble stack is emty. I wanted to implement something like this:
if (nothing in the ble stack)
{
年代truct custs1_val_ntf_req* req = KE_MSG_ALLOC_DYN(CUSTS1_VAL_NTF_REQ, TASK_CUSTS1, TASK_APP, custs1_val_ntf_req, DEF_CUST1_ADC_VAL_1_CHAR_LEN);

年代tatic uint16_t sample;
年代ample = (sample <= 0xffff) ? (sample + 1) : 0;

req->conhdl = app_env->conhdl;
req->handle = CUST1_IDX_ADC_VAL_1_VAL;
req->length = DEF_CUST1_ADC_VAL_1_CHAR_LEN;
memcpy(req->value, &sample, DEF_CUST1_ADC_VAL_1_CHAR_LEN);
ke_msg_send(req);

if (ke_state_get(TASK_APP) == APP_CONNECTED)
{
// Set it once again until Stop command is received in Control Characteristic
timer_used = app_easy_timer(APP_PERIPHERAL_CTRL_TIMER_DELAY, app_adcval1_timer_cb_handler);
}
}

存在一种实现这一目标的方法吗?

Kind regards.

MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
Joined:2015-06-08 11:34
Hi DMuller,

Hi DMuller,

I am not sure i understand the reason for this kind of implementation, yes the confirmation message is send back to the application as soon as the notification is successfully placed in the TX buffer until the connection interval moment comes and the data are released. You can try to use the l2cm_get_nb_buffer_available() function which will return the available size of the data in the low level buffer.

Thanks MT_dialog

dmueller.
Offline
Last seen:3 years 10 months ago
Joined:2017-04-12 10:04
Hi MT_dialog,

Hi MT_dialog,

i want to send one value after the next value. And the new value may not be sent until the prevous one is sent.

Many thanks for the great help. Now it works.

Kind regards.