Cypress技术william hill官网
直播中

许伟星

7年用户 191经验值
私信 关注
[问答]

如何知道是否发送了BLE通知?

我用psoc4 BLE和发送通知给同伴时,我的设备关闭,用原因代码使同伴知道为什么我被关闭的设备(如用户行为,闲置超时、电池低等等)。显然,在关机后cyble_gattsnotification()我需要循环cyble_processevents(),但我也要避免不必要的循环太长。
那么有没有办法知道如果/当我通知了吗?这是一个迹象,所以我不在乎同伴不会/不能处理它,所以没有必要使用指示和等待同伴的确认。所有我想知道的是,如果是送我的消息,而如果同伴得到它或不。
谢谢,
卡洛里

以上来自于百度翻译


     以下为原文
  I am using the PSoC4 BLE and sending a notification to the peer when my device shuts down, with a reason code so that the peer knows why my device was turned off (e.g. user action, inactivity timeout, battery low and so on). Obviously on shutdown after CyBle_GattsNotification() I  need to loop on CyBle_ProcessEvents(), but I also want to avoid looping too long unnecessarily.

So is there a way to know if / when my notification was put on air? This is an indication so I don't care if the peer doesn't / cannot process it, so there is no need to e.g. use indication and wait for the peer to confirm. All I want to know is if my message was sent, irrespective if the peer got it or not.

Thx,
Karoly

回帖(5)

张涵

2018-8-31 17:28:29
你好,
检查API CyBygGATSnNoTIFICTION()的返回值。当它返回CyByEyrRoRoxOK时,发送通知。您可以使用UART调试打印或切换任何LED。
伪代码---
“”“”选项“”
当(CyByyReloRook)!= CyBLY-GATSSENTIFITCION()
{
cyble_processevents();
}
UARTUDUBG(“通知发送”);
“”“”选项“”
-吉安

以上来自于百度翻译


     以下为原文
  Hello,
 
  Check the return value of API CyBle_GattsNotification(). When it returns CYBLE_ERROR_OK, the notification is sent. You can use either UART debug print or toggle any LED.
 
Pseudo code---
 
""""""""""""""""""""""""""""""
 
while(CYBLE_ERROR_OK!=CyBle_GattsNotification())
{
CyBle_ProcessEvents();
}
UART_DEBUG("Notification Sent");
 
""""""""""""""""""""""""""""""""""
 
 
-Gyan
举报

许伟星

2018-8-31 17:35:10
引用: YHYDZ 发表于 2018-8-31 08:16
你好,
检查API CyBygGATSnNoTIFICTION()的返回值。当它返回CyByEyrRoRoxOK时,发送通知。您可以使用UART调试打印或切换任何LED。
伪代码---

我想当它返回CyByEyrRoRoxOK时,它只意味着通知已经成功地在栈内排队。你确信当它返回CyByEyrRoRoSok时,是否意味着通知已经在空中发送到那个时候?

以上来自于百度翻译


     以下为原文
  I thought when it returns CYBLE_ERROR_OK it only means the notification has been successfully queued inside the stack. Are you sure when it returns CYBLE_ERROR_OK it means the notifications has already been sent on the air by that time?
举报

张涵

2018-8-31 17:42:41
引用: asp60399 发表于 2018-8-31 08:23
我想当它返回CyByEyrRoRoxOK时,它只意味着通知已经成功地在栈内排队。你确信当它返回CyByEyrRoRoSok时,是否意味着通知已经在空中发送到那个时候?

以上来自于百度翻译

您好,KPY2418181,
这只检查确认通知数据包已成功进入双栈的应用层之后,堆栈应该照顾在空中发送数据。你的理解是正确的。正如你已经知道,在通知分组情况不会有从对等设备的ACK任何因此我们(的应用)永远不会知道已接到通知对端设备或不。
-吉安

以上来自于百度翻译


     以下为原文
  Hello kp_2418181 ,,
 
 
     This check only confirms that the Notification data packet has been successfully pushed into the BLE stack from the application layer and after that the stack should take care of sending the data over the air. Your understanding is correct. As you already know that in case of Notification packet there would not be any kind of ACK from the peer device and hence we ( The application) will never come to know that the Notification has been received by the peer device or not.
 
 
-Gyan
举报

许伟星

2018-8-31 17:55:59
引用: YHYDZ 发表于 2018-8-31 08:30
您好,KPY2418181,
这只检查确认通知数据包已成功进入双栈的应用层之后,堆栈应该照顾在空中发送数据。你的理解是正确的。正如你已经知道,在通知分组情况不会有从对等设备的ACK任何因此我们(的应用)永远不会知道已接到通知对端设备或不。
-吉安

嗨,我知道,我已经写在原来的问题。我不是在寻找来自同行的ACK。我正在寻找一种方法来知道通知是否被发送,而不管它是否到达对等点。

以上来自于百度翻译


     以下为原文
  Hi, I know that, I have written that in the original question. I am not looking for an ACK from the peer. I am looking for a way to know if the notification was sent, irrespective if it arrived at the peer or not.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分