久久精品国产精品国产一区,少妇扒开毛毛自慰喷水,国产精品无码电影在线观看 ,久久天天躁夜夜躁狠狠85麻豆

思澈科技軟件開發(fā)工具包  2.20
串口傳輸服務(wù)

串行傳輸服務(wù)允許用戶通過 BLE 簡單快速地傳輸串行數(shù)據(jù)。

服務(wù) UUID 是 7369666c-695f-7364-0000-0000000000000。 它有兩個(gè)特點(diǎn):

  • 串口傳輸配置:UUID 7369666c-695f-7364-0001-0000000000000(須通知)。
  • 串口傳輸數(shù)據(jù):UUID 7369666c-695f-7364-0002-0000000000000(可讀可寫可通知)

尚未使用配置特性。

數(shù)據(jù)特性用于傳輸串行數(shù)據(jù)。 其數(shù)據(jù)格式為:

  • CateID, is categoryID for differernt users.
  • Flag, is for fragmentation.
    • 0x00: Completed packet.
    • 0x01: First packet.
    • 0x02: Continue packet.
    • 0x03: Last packet.
  • Length Packet length, is only available when flag equal 0x00;
  • Data, is serial data.

實(shí)現(xiàn)傳輸串行數(shù)據(jù)

用戶只需與客戶端協(xié)商確認(rèn) categoryID 并確保該 ID 與設(shè)備中的其他用戶不同。 然后就可以傳輸數(shù)據(jù)了。

有關(guān)串行傳輸 API 的詳細(xì)信息,請參閱 Serial transmission service 。

這是示例代碼:

// Make sure the cagegoryID is different with other IDs in local.
#define APP_BLE_SERIAL_ID 0x1F
// Handle data from client.
void ble_app_serial_callback(uint8_t conn_idx, ble_serial_tran_data_t *data)
{
int ret;
uint8_t test_data[] = {0x01, 0x02, 0x03, 0x04};
// The cateID should be same as registerdID APP_BLE_SERIAL_ID.
LOG_I("cateID(%d), data(%d) %s\r\n", data->cateID, data->len, data->data);
// Handle data from peer device start.
// Handle data from peer device end.
// Prepare send data to client
send_data.cateID = APP_BLE_SERIAL_ID;
send_data.len = sizeof(test_data);
send_data.data = test_data;
ret = ble_serial_tran_send_data(conn_idx, &send_data);
LOG_I("result %d",ret);
}
// Register user defined cagegoryID and assoicated callback.
BLE_SERIAL_TRAN_EXPORT(APP_BLE_SERIAL_ID, ble_app_serial_callback);
ble_serial_tran_send_data
int ble_serial_tran_send_data(ble_serial_tran_data_t *data)
Send serial transmission data.
ble_serial_tran_data_t::data
uint8_t * data
Definition: bf0_sibles_serial_trans_service.h:145
ble_serial_tran_data_t
The structure of transmission data.
Definition: bf0_sibles_serial_trans_service.h:141
ble_serial_tran_data_t::len
uint16_t len
Definition: bf0_sibles_serial_trans_service.h:144
data
uint8_t data[]
Definition: bf0_ble_ancs.h:227
BLE_SERIAL_TRAN_EXPORT
#define BLE_SERIAL_TRAN_EXPORT(cate_id, callback)
The macro that register user categoryID and callback.
Definition: bf0_sibles_serial_trans_service.h:198