Browse Source

#IQRV #comment [Other] 媒体配置优化

gifur 4 years ago
parent
commit
96ee8a8869
1 changed files with 48 additions and 13 deletions
  1. 48 13
      addin/res/ManagerDesktop/js/guide.js

+ 48 - 13
addin/res/ManagerDesktop/js/guide.js

@@ -690,12 +690,39 @@ $(function () {
                 var microphones = [];
                 var loundspeakers = [];
                 var cameras = [];
+
+                var microphones_in_value = $('#gui_media_config_audio_input_infree').attr('value');
+                var microphones_in_exist = false;
+
+                var microphones_out_value = $('#gui_media_config_audio_input_outfree').attr('value');
+                var microphones_out_exist = false;
+
+                var loundspeakers_in_value = $('#gui_media_config_audio_output_infree').attr('value');
+                var loundspeakers_in_exist = false;
+
+                var loundspeakers_out_value = $('#gui_media_config_audio_output_outfree').attr('value');
+                var loundspeakers_out_exist = false;
+
+
                 for (var n = 0; n < result.AvailableList.length; n++) {
                     console.log(result.AvailableList[n] + ' ' + result.ListItemType[n] + ' ' + result.ListItemStatus[n]);
                     if(result.ListItemType[n] == MEDIA_TYPE.MICROPHONE) {
                         microphones.push(result.AvailableList[n]);
+                        if(microphones_in_value !== '' && microphones_in_value === result.AvailableList[n]){
+                            microphones_in_exist = true;
+                        }
+                        if(microphones_out_value !== '' && microphones_out_value === result.AvailableList[n]){
+                            microphones_out_exist = true;
+                        }
+
                     } else if(result.ListItemType[n] == MEDIA_TYPE.LOUNDSPEAKER) {
                         loundspeakers.push(result.AvailableList[n]);
+                        if(loundspeakers_out_value !== '' && loundspeakers_out_value === result.AvailableList[n]){
+                            loundspeakers_out_exist = true;
+                        }
+                        if(loundspeakers_in_value !== '' && loundspeakers_in_value === result.AvailableList[n]){
+                            loundspeakers_in_exist = true;
+                        }
                     } else if(result.ListItemType[n] == MEDIA_TYPE.CAMERA) {
                         cameras.push(result.AvailableList[n]);
                     }
@@ -704,18 +731,28 @@ $(function () {
                 generateMediaDeviceSelect(loundspeakers, 'gui_media_config_audio_output_infree_list');
                 generateMediaDeviceSelect(microphones, 'gui_media_config_audio_input_outfree_list');
                 generateMediaDeviceSelect(microphones, 'gui_media_config_audio_input_infree_list');
+
                 if(typeof flag !== 'undefined') {
-                    $('#gui_media_config_audio_input_infree').empty();
-                    $('#gui_media_config_audio_input_infree').attr('value', '');
 
-                    $('#gui_media_config_audio_input_outfree').empty();
-                    $('#gui_media_config_audio_input_outfree').attr('value', '');
+                    if(!microphones_in_exist) {
+                        $('#gui_media_config_audio_input_infree').empty();
+                        $('#gui_media_config_audio_input_infree').attr('value', '');
+                    }
+
+                    if(!microphones_out_exist){
+                        $('#gui_media_config_audio_input_outfree').empty();
+                        $('#gui_media_config_audio_input_outfree').attr('value', '');
+                    }
 
-                    $('#gui_media_config_audio_output_infree').empty();
-                    $('#gui_media_config_audio_output_infree').attr('value', '');
+                    if(!loundspeakers_in_exist){
+                        $('#gui_media_config_audio_output_infree').empty();
+                        $('#gui_media_config_audio_output_infree').attr('value', '');
+                    }
 
-                    $('#gui_media_config_audio_output_outfree').empty();
-                    $('#gui_media_config_audio_output_outfree').attr('value', '');
+                    if(!loundspeakers_out_exist) {
+                        $('#gui_media_config_audio_output_outfree').empty();
+                        $('#gui_media_config_audio_output_outfree').attr('value', '');
+                    }
 
                     utilShowToast("已刷新");
                 }
@@ -824,6 +861,7 @@ $(function () {
         req.param2 = 0;
         req.param3 = "";
         req.param4 = "";
+        req.timeout = 60000;
 
         console.log("check adapter: " + adapter + " " + port + " " + baudrate);
 
@@ -837,14 +875,11 @@ $(function () {
                 let result = JSON.parse(ret[RVC.EntityController.sigResponseUUID])
                 if(result.status == 0) {
                     utilShowToast("适配器文件成功加载;尝试打开设备成功!", 1500);
-                    //utilStartAlertDialog("适配器文件成功加载;尝试打开设备成功!");
                 } else {
-                    //utilShowToast("验证失败:[" + result.status + "] " + result.msg, 3000);
                     utilStartAlertDialog("验证失败:[" + result.status + "] " + result.msg);
                 }
             } else {
                 
-                //RVC.DeviceControlEntityCtrl.commErrorCallback(ret);
                 if(parseInt(ret.errorCode, 10) == ErrorCodeEnum.Error_NetBroken) {
                     adapterTestFailedCount++;
                     if(adapterTestFailedCount >= 3) {
@@ -1206,9 +1241,9 @@ $(function () {
             if (ret.errorCode === 0) {
                 let result = JSON.parse(ret[RVC.EntityController.sigResponseUUID])
                 if(result.terminalNo === '') {
-                    $('#page_footer #terminal_no').hide();
+                    $('#page_footer #termina_no_td').hide();
                 } else {
-                    $('#page_footer #terminal_no').show();
+                    $('#page_footer #termina_no_td').show();
                     $('#page_footer #terminal_no').html('终端号:' + result.terminalNo);
                 }
                 //$('#machineType span').html(result.machineType);