|
|
|
@ -33,6 +33,12 @@ public class BleService: NSObject { |
|
|
|
// 唤醒信号回调 |
|
|
|
func onWakeupSignalReceived() |
|
|
|
|
|
|
|
// 开始 AI 单次对话回调 |
|
|
|
func onStartSingleDialogReceived() |
|
|
|
|
|
|
|
// 结束 AI 单次对话回调 |
|
|
|
func onEndSingleDialogReceived() |
|
|
|
|
|
|
|
// 设备信息相关回调 |
|
|
|
func onDeviceInfoReceived(infoType: Int, infoData: [String: Any]) |
|
|
|
} |
|
|
|
@ -592,6 +598,20 @@ private var cmdReplyType: UInt8 = 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// 通知所有回调接收到开始 AI 单次对话信号 |
|
|
|
private func notifyStartSingleDialogReceived() { |
|
|
|
for callback in callbacks { |
|
|
|
callback.onStartSingleDialogReceived() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// 通知所有回调接收到结束 AI 单次对话信号 |
|
|
|
private func notifyEndSingleDialogReceived() { |
|
|
|
for callback in callbacks { |
|
|
|
callback.onEndSingleDialogReceived() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// 通知所有回调接收到设备信息 |
|
|
|
private func notifyDeviceInfoReceived(infoType: Int, infoData: [String: Any]) { |
|
|
|
for callback in callbacks { |
|
|
|
@ -1219,7 +1239,12 @@ private var cmdReplyType: UInt8 = 0 |
|
|
|
|
|
|
|
|
|
|
|
notifyWakeupSignalReceived() |
|
|
|
|
|
|
|
case BleConst.CMD_START_SINGLE_DIALOG: |
|
|
|
os_log("📢 收到开始 AI 单次对话指令", log: logger, type: .info) |
|
|
|
notifyStartSingleDialogReceived() |
|
|
|
case BleConst.CMD_END_SINGLE_DIALOG: |
|
|
|
os_log("📢 收到结束 AI 单次对话指令", log: logger, type: .info) |
|
|
|
notifyEndSingleDialogReceived() |
|
|
|
default: |
|
|
|
// 对于未知上报类型,返回原始数据 |
|
|
|
let resultMap: [String: Any] = [ |
|
|
|
|