Reduce read (characteristic) timeout for BLE

7 ビュー (過去 30 日間)
Joris Lambrecht
Joris Lambrecht 2021 年 2 月 5 日
回答済み: Rohit Pappu 2021 年 2 月 9 日
b = ble(...)
c = charachteristic(...)
read(c, 'oldest')
% read(c, 'latest')
If there is no data, read will wait for 10s and then issue error message:
Device has not sent new data. If device is disconnected, then clear existing ble object and recreate it.
Is there a way to reduce the timeout from 10s? The serialport object for example has a Timeout property.
Alternatively, is there a way to check if there is data available to read without actually calling read?

回答 (1 件)

Rohit Pappu
Rohit Pappu 2021 年 2 月 9 日
  • As of the current release, the default timeout of read cannot be configured.
  • If a given characteristic supports 'Notify' attribute, subscribe method can be used to check if data is available. Documentation about it can be found here.

カテゴリ

Help Center および File ExchangeSerial and USB Communication についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by