BLUETOOTH_DEVICE_INFO 函数

typedef struct _BLUETOOTH_DEVICE_INFO {
DWORD dwSize;
BLUETOOTH_ADDRESS Address;
ULONG ulClassofDevice;
BOOL fConnected;
BOOL fRemembered;
BOOL fAuthenticated;
SYSTEMTIME stLastSeen;
SYSTEMTIME stLastUsed;
WCHAR szName[BLUETOOTH_MAX_NAME_SIZE]; } BLUETOOTH_DEVICE_INFO;

dwSize

Size of the BLUETOOTH_DEVICE_INFO structure, in bytes.      BLUETOOTH_DEVICE_INFO结构的大小(单位为字节)。

Address

Address of the device.    设备地址

ulClassofDevice

Class of the device.  设备的类。

fConnected

Specifies whether the device is connected.   指定设备是否连接。

fRemembered

Specifies whether the device is a remembered device. Not all remembered devices are authenticated.  指定设备是否为已记忆的设备。不是所有记住的设备都经过身份验证。

fAuthenticated

Specifies whether the device is authenticated, paired, or bonded. All authenticated devices are remembered.  指定设备是否经过身份验证、配对或绑定。所有经过身份验证的设备都会被记住。

stLastSeen

Last time the device was seen, in the form of a SYSTEMTIME structure.   上次我们以系统时间结构的形式看到了这个设备。

stLastUsed

Last time the device was used, in the form of a SYSTEMTIME structure.  上次以系统时间结构的形式使用该设备。

szName

Name of the device. 设备名称。

 

Header

Declared in BluetoothAPIs.h; include Bthsdpdef.h and BluetoothAPIs.h.

转载于:https://www.cnblogs.com/qiwu1314/p/9981494.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 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、付费专栏及课程。

余额充值