思澈科技软件开发工具包  2.20
Serial transmission service

Data Structures

struct  ble_serial_open_t
 The structure of transmission channel open. More...
 
struct  ble_serial_tran_data_t
 The structure of transmission data. More...
 
struct  ble_serial_tran_error_t
 The structure of transmission data. More...
 
struct  ble_serial_close_t
 The structure of transmission channel close. More...
 
struct  ble_serial_tran_export_t
 The structure of transmission export. More...
 

Macros

#define BLE_DFU_CATEID   0x01
 
#define BLE_CONSOLE_CATEID   0x02
 
#define BLE_CUSTOMIZE_CATEID   0x10
 
#define BLE_LOG_CATEID   0x03
 
#define BLE_WATCHFACE_CATEID   0x04
 
#define BLE_EQ_CONFIG_CATEID   0x05
 
#define serial_tran_svc_uuid
 
#define serial_tran_configure_uuid
 
#define serial_tran_data_uuid
 
#define BLE_SERIAL_TRAN_EXPORT(cate_id, callback)
 The macro that register user categoryID and callback. More...
 

Enumerations

enum  ble_serial_tran_event_t {
  BLE_SERIAL_TRAN_OPEN,
  BLE_SERIAL_TRAN_DATA,
  BLE_SERIAL_TRAN_SEND_AVAILABLE,
  BLE_SERIAL_TRAN_CLOSE,
  BLE_SERIAL_TRAN_ERROR
}
 The structure of transmission event. More...
 
enum  ble_serial_tran_error_event_t {
  BLE_SERIAL_TRAN_ERROR_CATE_ID,
  BLE_SERIAL_TRAN_ERROR_LACK_OF_MEMORY,
  BLE_SERIAL_TRAN_ERROR_ASSEMBLE_OVER_LEN,
  BLE_SERIAL_TRAN_ERROR_ASSEMBLE_ERROR
}
 

Functions

int ble_serial_tran_send_data (ble_serial_tran_data_t *data)
 Send serial transmission data. More...
 
void ble_serial_tran_init (void)
 Enable serial transmission service.
 
int rt_ble_serial_dev_register (const char *name)
 Register serial device for BLE serial service. More...
 
int ble_serial_tran_send_data_advance (uint8_t handle, uint8_t *data, uint16_t data_len)
 

Detailed Description

Macro Definition Documentation

◆ BLE_SERIAL_TRAN_EXPORT

#define BLE_SERIAL_TRAN_EXPORT (   cate_id,
  callback 
)
Value:
RT_USED static const ble_serial_tran_export_t _serial_tran_export \
SECTION("SerialTranExport") = \
{ \
callback, \
cate_id, \
}

The macro that register user categoryID and callback.

Parameters
[in]cate_idcategoryID.
[in]callbackuser callback.

◆ serial_tran_configure_uuid

#define serial_tran_configure_uuid
Value:
{ \
0x73, 0x69, 0x66, 0x6c, \
0x69, 0x5f, 0x73, 0x64, \
0x00, 0x01, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00 \
}

◆ serial_tran_data_uuid

#define serial_tran_data_uuid
Value:
{ \
0x73, 0x69, 0x66, 0x6c, \
0x69, 0x5f, 0x73, 0x64, \
0x00, 0x02, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00 \
}

◆ serial_tran_svc_uuid

#define serial_tran_svc_uuid
Value:
{ \
0x73, 0x69, 0x66, 0x6c, \
0x69, 0x5f, 0x73, 0x64, \
0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00 \
};

Enumeration Type Documentation

◆ ble_serial_tran_event_t

The structure of transmission event.

Enumerator
BLE_SERIAL_TRAN_OPEN 

BLE serial transmission channel opened.

BLE_SERIAL_TRAN_DATA 

BLE serial transmission data received.

BLE_SERIAL_TRAN_SEND_AVAILABLE 

BLE serial transmission can try send data if last send failed.

BLE_SERIAL_TRAN_CLOSE 

BLE serial transmission channel closed.

BLE_SERIAL_TRAN_ERROR 

BLE serial transmission error due to packet lose or other reason

Function Documentation

◆ ble_serial_tran_send_data()

int ble_serial_tran_send_data ( ble_serial_tran_data_t data)

Send serial transmission data.

Parameters
[in]dataserial transmission data.
Return values
result0 is successful, others are failed.

◆ rt_ble_serial_dev_register()

int rt_ble_serial_dev_register ( const char *  name)

Register serial device for BLE serial service.

Parameters
[in]namefor the device.
Return values
result0 is successful, others are failed.
ble_serial_tran_export_t
The structure of transmission export.
Definition: bf0_sibles_serial_trans_service.h:171