[玩转BLE]标准GATT特征值属性类型

摘自 蓝牙标准GATT特征值属性

  • GATT配置文件的属性类型。
  • 表中的所有服务编号均为标准编号。权威的法规遵循信息包含在适用的Bluetooth®规范中。
NameUniform Type IdentifierAssigned NumberSpecification
Characteristic Aggregate Formatorg.bluetooth.descriptor.gatt.characteristic_aggregate_format0x2905GSS
Characteristic Extended Propertiesorg.bluetooth.descriptor.gatt.characteristic_extended_properties0x2900GSS
Characteristic Presentation Formatorg.bluetooth.descriptor.gatt.characteristic_presentation_format0x2904GSS
Characteristic User Descriptionorg.bluetooth.descriptor.gatt.characteristic_user_description0x2901GSS
Client Characteristic Configurationorg.bluetooth.descriptor.gatt.client_characteristic_configuration0x2902GSS
Environmental Sensing Configurationorg.bluetooth.descriptor.es_configuration0x290BGSS
Environmental Sensing Measurementorg.bluetooth.descriptor.es_measurement0x290CGSS
Environmental Sensing Trigger Settingorg.bluetooth.descriptor.es_trigger_setting0x290DGSS
External Report Referenceorg.bluetooth.descriptor.external_report_reference0x2907GSS
Number of Digitalsorg.bluetooth.descriptor.number_of_digitals0x2909GSS
Report Referenceorg.bluetooth.descriptor.report_reference0x2908GSS
Server Characteristic Configurationorg.bluetooth.descriptor.gatt.server_characteristic_configuration0x2903GSS
Time Trigger Settingorg.bluetooth.descriptor.time_trigger_setting0x290EGSS
Valid Rangeorg.bluetooth.descriptor.valid_range0x2906GSS
Value Trigger Settingorg.bluetooth.descriptor.value_trigger_setting0x290AGSS
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
#define DEVICE_NAME "BL618_GATT" // 设备名称 #define PROFILE_NUM 1 // 设备支持的服务数量 #define PROFILE_A_APP_ID 0 // 第一个服务的ID static void gap_event_handler(ble_event_t *event) { // 处理 GAP 事件 } static void gatt_event_handler(ble_event_t *event) { // 处理 GATT 事件 } int main(void) { // 初始化蓝牙协议栈 bluetooth_init(gap_event_handler, gatt_event_handler); // 设置设备名称 bluetooth_set_device_name(DEVICE_NAME); // 创建一个服务 bluetooth_gatt_create_service(PROFILE_NUM); // 添加服务的特征值 bluetooth_gatt_add_char(PROFILE_A_APP_ID, "CHAR_A", 0xFF01, 0x20, NULL); // 开始广播 bluetooth_start_advertising(); while (1) { // 等待事件 bluetooth_wait_for_event(); } return 0; static void gap_event_handler(ble_event_t *event) { switch (event->type) { case BLE_GAP_EVENT_ADV_IND: { // 收到广播包,可以连接该设备 ble_gap_connect(&event->gap_event.adv_ind.address); break; } case BLE_GAP_EVENT_CONNECTED: { // 连接成功,可以开始 GATT 操作 break; } case BLE_GAP_EVENT_DISCONNECTED: { // 断开连接,重新开始广播 bluetooth_start_advertising(); break; } default: break; } } static void gatt_event_handler(ble_event_t *event) { switch (event->type) { case BLE_GATT_EVENT_READ: { // 处理读操作 break; } case BLE_GATT_EVENT_WRITE: { // 处理写操作 ble_gatt_server_send_indication(event->conn_handle, 0x1234, raw_data, sizeof(raw_data)); // 发送通知给主机 break; } default: break; } } } }优化
最新发布
05-24

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值