This commit is contained in:
844143714@qq,com 2026-07-19 04:01:37 +08:00
parent 65943334b1
commit f7def3a7f6
3 changed files with 16 additions and 13 deletions

View File

@ -26,7 +26,7 @@ public class CallBackResolution {
private static int speckType = 1; private static int speckType = 1;
private static String talkId = ""; private static String talkId = "";
private static String talkName = ""; private static String talkName = "";
private static final Map<String, GroupInfoDto> groupInfos = new LinkedHashMap<>(MAX_GROUP_INFOS); private static final Map<String, GroupInfoDto> groupInfos = new LinkedHashMap<>(MAX_GROUP_INFOS);
private static String oldLoginSate = "00"; private static String oldLoginSate = "00";
private static int logNum = 0; private static int logNum = 0;
private static long offlineTime = 0; private static long offlineTime = 0;
@ -93,6 +93,10 @@ public class CallBackResolution {
com.stand.standapp.MainActivity.onPttLoginSuccess(); com.stand.standapp.MainActivity.onPttLoginSuccess();
com.stand.standapp.MainActivity.executeJs("updatePttLoginStatus('" + pttLoginStatus + "','" + pttLoginId + "')"); com.stand.standapp.MainActivity.executeJs("updatePttLoginStatus('" + pttLoginStatus + "','" + pttLoginId + "')");
} }
if ("01".equals(errorNum)) {
com.stand.standapp.MainActivity.onPttLoginSuccess();
com.stand.standapp.MainActivity.executeJs("updatePttLoginStatus('02','" + pttLoginId + "')");
}
break; break;
case "a2"://账号有视频功能 case "a2"://账号有视频功能

View File

@ -310,7 +310,7 @@ class MainActivity : AppCompatActivity() {
// 3. 强制清缓存,确保 JS/CSS 等资源获取最新版本 // 3. 强制清缓存,确保 JS/CSS 等资源获取最新版本
try { try {
// runtime.storageController.clearData(ClearFlags.ALL) // runtime.storageController.clearData(ClearFlags.ALL)
Timber.tag("MainActivity").i("GeckoView cache cleared") Timber.tag("MainActivity").i("GeckoView cache cleared")
} catch (e: Exception) { } catch (e: Exception) {
Timber.tag("MainActivity").w(e, "Failed to clear GeckoView cache") Timber.tag("MainActivity").w(e, "Failed to clear GeckoView cache")
@ -516,12 +516,12 @@ class MainActivity : AppCompatActivity() {
// } catch (e: Exception) { // } catch (e: Exception) {
// Timber.tag("MainActivity").e(e, "PTT cancel failed") // Timber.tag("MainActivity").e(e, "PTT cancel failed")
// } // }
// try { try {
// com.example.kingway.ptt.SendAtUtil.toLogout() com.example.kingway.ptt.SendAtUtil.toLogout()
// Timber.tag("MainActivity").i("PTT logout sent") Timber.tag("MainActivity").i("PTT logout sent")
// } catch (e: Exception) { } catch (e: Exception) {
// Timber.tag("MainActivity").e(e, "PTT logout failed") Timber.tag("MainActivity").e(e, "PTT logout failed")
// } }
// 2. Stop GPIO listening // 2. Stop GPIO listening
try { try {
@ -548,7 +548,6 @@ class MainActivity : AppCompatActivity() {
// 3. Destroy/release AudioTrack in PTT Native // 3. Destroy/release AudioTrack in PTT Native
try { try {
com.stand.standapp.MyApplication.pNative?.destory() com.stand.standapp.MyApplication.pNative?.destory()
com.stand.standapp.MyApplication.pNative = null
Timber.tag("MainActivity").i("PTT native AudioTrack destroyed") Timber.tag("MainActivity").i("PTT native AudioTrack destroyed")
} catch (e: Exception) { } catch (e: Exception) {
Timber.tag("MainActivity").e(e, "PTT native destroy failed") Timber.tag("MainActivity").e(e, "PTT native destroy failed")

View File

@ -17,7 +17,7 @@ object GpioManager {
private var mIsRunning = false private var mIsRunning = false
private var mThread: Thread? = null private var mThread: Thread? = null
private var lastGpioValue = 1 // 默认松开状态 (1) private var lastGpioValue = 1 // 默认松开状态 (1)
fun init(context: Context) { fun init(context: Context) {
if (mZysjSystemManager != null) return if (mZysjSystemManager != null) return
try { try {
@ -38,10 +38,10 @@ object GpioManager {
// 硬件轮询频率优化150ms 既能保证响应速度,又能降低 CPU 消耗 // 硬件轮询频率优化150ms 既能保证响应速度,又能降低 CPU 消耗
Thread.sleep(150) Thread.sleep(150)
val manager = mZysjSystemManager ?: continue val manager = mZysjSystemManager ?: continue
// 获取 GPIO 1 的值 (0 按下, 1 松开) // 获取 GPIO 1 的值 (0 按下, 1 松开)
val currentValue = manager.get_zysj_gpio_value(1) val currentValue = manager.get_zysj_gpio_value(1)
if (currentValue != lastGpioValue) { if (currentValue != lastGpioValue) {
Timber.tag("GPIO").d("GPIO 1 Value changed: $lastGpioValue -> $currentValue") Timber.tag("GPIO").d("GPIO 1 Value changed: $lastGpioValue -> $currentValue")
handleGpioChange(currentValue) handleGpioChange(currentValue)
@ -96,7 +96,7 @@ object GpioManager {
if (isSpeaking) { if (isSpeaking) {
val now = System.currentTimeMillis() val now = System.currentTimeMillis()
val duration = now - lastSpeakTime val duration = now - lastSpeakTime
if (duration < MIN_SPEAK_DURATION) { if (duration < MIN_SPEAK_DURATION) {
val delay = MIN_SPEAK_DURATION - duration val delay = MIN_SPEAK_DURATION - duration
Timber.tag("GPIO").d("Hardware speak duration too short ($duration ms), delaying release by $delay ms") Timber.tag("GPIO").d("Hardware speak duration too short ($duration ms), delaying release by $delay ms")