Browse Source

上传pid绑定代码

weicu
liwei1dao 1 year ago
parent
commit
d3bdc3083d
  1. 6
      lib/modules/pairing/controllers/pairing_controller.dart
  2. 12
      local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift
  3. 25
      local_plugins/chat_api/android/src/main/kotlin/com/yunqiinnovation/chat_api/SystemFunctionHandler.kt
  4. 15
      local_plugins/qq_music/android/src/main/kotlin/com/yunqiinnovation/qq_music/QQMusicSingleton.kt

6
lib/modules/pairing/controllers/pairing_controller.dart

@ -862,11 +862,13 @@ class PairingController extends GetxController with WidgetsBindingObserver {
String macFromHex = extractMacFromHex(hexData, device.address);
if (macFromHex.isNotEmpty) {
String code = "";
_verifiedDevicePid = extractAndReverseBytesToInt(hexData, 6, 7);
// 找到匹配的设备,提取授权码
if (Platform.isIOS) {
// iOS设备,提取13-22字节的授权码
code = extractAndReverseBytes(hexData, 13, 22);
_verifiedDevicePid =
extractAndReverseBytesToInt(hexData, 4, 5);
print('找到匹配设备,获取到 code: $code');
if (code != "") {
_bleManager.stopScan();
@ -901,6 +903,8 @@ class PairingController extends GetxController with WidgetsBindingObserver {
} else if (Platform.isAndroid) {
// Android设备,提取15-24字节的授权码
code = extractAndReverseBytes(hexData, 15, 24);
_verifiedDevicePid =
extractAndReverseBytesToInt(hexData, 6, 7);
print('找到匹配设备,获取到 code: $code');
if (code != "") {
_bleManager.stopScan();

12
local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift

@ -993,6 +993,18 @@ private func jsonToString(_ json: [String: Any]) -> String? {
print("启动导航: 从 \(start) 到 \(destination), 坐标: \(endlatitude),\(endlongitude), 模式: \(mode)")
// 检查应用状态
let appState = UIApplication.shared.applicationState
// 如果应用在后台,直接使用内置导航
if appState == .background || appState == .inactive {
print("应用在后台,直接启动内置导航模式")
// startInternalNavigation(start: start, destination: destination,
// latitude: endlatitude, longitude: endlongitude, mode: mode)
return true
}
// 应用在前台时的原有逻辑
// 根据导航模式选择不同的导航方式
switch mode {
case "internal_gaode":

25
local_plugins/chat_api/android/src/main/kotlin/com/yunqiinnovation/chat_api/SystemFunctionHandler.kt

@ -69,7 +69,7 @@ class SystemFunctionHandler(private val context: Context? = null) {
"properties" to mapOf(
"contact" to mapOf(
"type" to "string",
"description" to "联系人姓名或电话号码"
"description" to "电话号码"
),
"message" to mapOf(
"type" to "string",
@ -112,7 +112,7 @@ class SystemFunctionHandler(private val context: Context? = null) {
"properties" to mapOf(
"contact" to mapOf(
"type" to "string",
"description" to "联系人姓名或电话号码"
"description" to "电话号码"
)
),
"required" to listOf("contact")
@ -1412,33 +1412,20 @@ private class GetContactsListHandler(private val context: Context?) : FunctionHa
try {
val contentResolver = context.contentResolver
// 构建查询条件
val selection = if (!searchKeyword.isNullOrBlank()) {
"${ContactsContract.Contacts.DISPLAY_NAME} LIKE ?"
} else {
null
}
val selectionArgs = if (!searchKeyword.isNullOrBlank()) {
arrayOf("%$searchKeyword%")
} else {
null
}
val projection = arrayOf(
ContactsContract.Contacts._ID,
ContactsContract.Contacts.DISPLAY_NAME,
ContactsContract.Contacts.HAS_PHONE_NUMBER
)
// 按姓名排序,限制数量
val sortOrder = "${ContactsContract.Contacts.DISPLAY_NAME} ASC LIMIT $limit"
// 按姓名排序
val sortOrder = "${ContactsContract.Contacts.DISPLAY_NAME} ASC"
contentResolver.query(
ContactsContract.Contacts.CONTENT_URI,
projection,
selection,
selectionArgs,
null, // 不使用任何筛选条件
null, // 不使用任何筛选参数
sortOrder
)?.use { cursor ->

15
local_plugins/qq_music/android/src/main/kotlin/com/yunqiinnovation/qq_music/QQMusicSingleton.kt

@ -558,19 +558,20 @@ class QQMusicSingleton private constructor() {
action(musicManager!!, object : QQMusicManager.PlayCallback {
override fun onSuccess() {
Log.d(TAG, "${actionName}成功")
handler.post {
callback(Result.success(Unit))
}
checkPlaybackStateOnError(actionName, 0, "Success", callback)
// handler.post {
// callback(Result.success(Unit))
// }
}
override fun onError(errorCode: Int, errorMessage: String) {
if (allagain > 0 && curragain < allagain){ //重试机制
executePlaybackAction(actionName,curragain+1,allagain,action)(callback)
}else{
// if (allagain > 0 && curragain < allagain){ //重试机制
// executePlaybackAction(actionName,curragain+1,allagain,action)(callback)
// }else{
//播放失败时,检查当前播放状态
Log.d(TAG, "${actionName}失败,检查当前播放状态: $errorCode $errorMessage")
checkPlaybackStateOnError(actionName, errorCode, errorMessage, callback)
}
// }
}
})
}

Loading…
Cancel
Save