包含本次会话修复: - iOS clickReady 警告 bug(默认 false 永远显示) - BLE 'handle is invalid' 排查(stale handle auto-retry 实验 + 回退) 项目结构: - glass-mouse/: 眼镜端原生 Kotlin App,前台服务 MouseService + 自定义 BLE GATT 桥接 ProxyBleServer + 无障碍 GestureDescription 注入 - ios/GlassRemote/: iPhone 端 SwiftUI + CoreBluetooth,通过 BLE 直连眼镜 - HTTP 投屏服务(:8000) 接 PPT/WPS 备注宏 POST 推送 技术栈: Android Kotlin (gradle 8.14.4, compileSdk 34), iOS Swift 5.10 (Xcode 26.5)
34 lines
1.3 KiB
Python
34 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""诊断:扫描 16 秒,打印所有可见 BLE 设备的名称/RSSI/服务UUID,确认眼镜是否在广播。"""
|
|
import time, sys
|
|
from Foundation import NSObject, NSRunLoop, NSDate
|
|
from CoreBluetooth import CBCentralManager, CBUUID
|
|
|
|
class Del(NSObject):
|
|
def centralManagerDidUpdateState_(self, mgr):
|
|
self.mgr = mgr
|
|
if mgr.state() == 5:
|
|
print("[蓝牙已开启] 开始扫描 16 秒…")
|
|
mgr.scanForPeripheralsWithServices_options_(None, None)
|
|
else:
|
|
print("[蓝牙状态] state =", mgr.state(), "(5=已开启)")
|
|
|
|
def centralManager_didDiscoverPeripheral_advertisementData_RSSI_(self, mgr, perp, adv, rssi):
|
|
name = perp.name()
|
|
print("发现设备: %s | RSSI=%s | id=%s" % (name, rssi, perp.identifier().UUIDString()))
|
|
try:
|
|
sd = adv.objectForKey_("kCBAdvDataServiceUUIDs")
|
|
if sd:
|
|
print(" 广播服务UUIDs:", [u.UUIDString() for u in sd])
|
|
except Exception:
|
|
pass
|
|
|
|
d = Del.alloc().init()
|
|
mgr = CBCentralManager.alloc().initWithDelegate_queue_options_(d, None, None)
|
|
loop = NSRunLoop.currentRunLoop()
|
|
t0 = time.time()
|
|
while time.time() - t0 < 16:
|
|
loop.runUntilDate_(NSDate.dateWithTimeIntervalSinceNow_(0.1))
|
|
mgr.stopScan()
|
|
print("=== 扫描结束 ===")
|