|
|
@@ -42,28 +42,114 @@ var globalFinishedFlag = false;
|
|
|
var globalInterestRootFlag = false;
|
|
|
|
|
|
|
|
|
+function generateAdapterSelect(devices, status, select_id) {
|
|
|
+ var deviceLength = 0;
|
|
|
+ if ((devices) instanceof Array) {
|
|
|
+ deviceLength = devices.length;
|
|
|
+ } else {
|
|
|
+ deviceLength = 1
|
|
|
+ }
|
|
|
+ var devicesHtml = '';
|
|
|
+ var selectid = select_id;
|
|
|
+ $('#' + selectid).empty();
|
|
|
+ for (var loop = 0; loop < deviceLength; loop++) {
|
|
|
+ var cur = devices[loop];
|
|
|
+ var deviceTemplateData = {
|
|
|
+ loop: loop,
|
|
|
+ deviceName : cur,
|
|
|
+ type: selectid
|
|
|
+ };
|
|
|
+ var pushHtml = '';
|
|
|
+ pushHtml = '<div id="{{type}}_item_{{loop}}" option="{{deviceName}}" class="select_medium hide_with_ellipsis"'
|
|
|
+ if(!(status[loop] & 0x1)) {
|
|
|
+ pushHtml += ' style="color:#C0C0C0;"'
|
|
|
+ } else {
|
|
|
+ pushHtml += ' onclick="AdapterSelectChange(\'{{deviceName}}\')"'
|
|
|
+ }
|
|
|
+ //root.ini 配置
|
|
|
+ if((status[loop] & 0x2)) {
|
|
|
+ pushHtml += '>{{deviceName}} (当前配置)</div>'
|
|
|
+ } else {
|
|
|
+ pushHtml += '>{{deviceName}}</div>'
|
|
|
+ }
|
|
|
+ $('#' + selectid).secureAppend(pushHtml, deviceTemplateData);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function FulfillDevAdapterFileList(device, vendor, root_or_not, flag)
|
|
|
+{
|
|
|
+ let req = new Request();
|
|
|
+ req.root = root_or_not;
|
|
|
+ req.adapter=device;
|
|
|
+ req.vendor=vendor;
|
|
|
+ req.version="";
|
|
|
+ req.batch="";
|
|
|
+
|
|
|
+ RVC.DeviceControlEntityCtrl.GetVendorFileList(req, function(ret) {
|
|
|
+ if(ret.errorCode === 0) {
|
|
|
+ let result = JSON.parse(ret[RVC.EntityController.sigResponseUUID])
|
|
|
+ if(result.result == 0) {
|
|
|
+ var libs = [];
|
|
|
+ var status = [];
|
|
|
+ for (var n = 0; n < result.filenames.length; n++) {
|
|
|
+ console.log(result.filenames[n] + ' ' + result.status[n]);
|
|
|
+ libs.push(result.filenames[n]);
|
|
|
+ status.push(result.status[n]);
|
|
|
+ }
|
|
|
+ generateAdapterSelect(libs, status, 'gui_adapter_config_adapter_list');
|
|
|
+ if(typeof flag !== 'undefined') {
|
|
|
+ utilShowToast("已刷新");
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if(typeof flag !== 'undefined') {
|
|
|
+ utilStartAlertDialog("操作失败:[" + result.result + "] " + result.msg);
|
|
|
+ } else {
|
|
|
+ console.error("操作失败:[" + result.result + "] " + result.msg);
|
|
|
+ }
|
|
|
+ } else if(typeof flag !== 'undefined'){
|
|
|
+ RVC.DeviceControlEntityCtrl.commErrorCallback(ret);
|
|
|
+ } else {
|
|
|
+ console.error("操作失败! ErrorCode: " + ErrorCodeStringfy(ret.errorCode));
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+function LoadDeviceAdaptersWithEvent(flag)
|
|
|
+{
|
|
|
+ var deviceName = $('#gui_adapter_config_device').attr('value');
|
|
|
+ var vendorName = $('#gui_adapter_config_vendor').attr('value').toLowerCase();
|
|
|
+ FulfillDevAdapterFileList(deviceName, vendorName, globalInterestRootFlag, flag);
|
|
|
+}
|
|
|
+
|
|
|
function VendorSelectChanged(name)
|
|
|
{
|
|
|
- utilStartAlertDialog(name);
|
|
|
+ var deviceName = $('#gui_adapter_config_device').attr('value');
|
|
|
+ var vendorName = name.toLowerCase();
|
|
|
+ FulfillDevAdapterFileList(deviceName, vendorName, globalInterestRootFlag, true);
|
|
|
}
|
|
|
|
|
|
function DeviceSelectChange(name)
|
|
|
{
|
|
|
- utilStartAlertDialog(name);
|
|
|
+ var vendorName = $('#gui_adapter_config_vendor').attr('value').toLowerCase();
|
|
|
+ FulfillDevAdapterFileList(name, vendorName, globalInterestRootFlag, true);
|
|
|
}
|
|
|
|
|
|
function AdapterSelectChange(name)
|
|
|
{
|
|
|
- //utilStartAlertDialog(name);
|
|
|
+ //LoadDeviceAdaptersWithEvent(true);
|
|
|
}
|
|
|
|
|
|
-function InterestRootSwitch()
|
|
|
+function InterestRootSwitch(flag)
|
|
|
{
|
|
|
if ($('#gui_adapter_config_root_interest_switch').hasClass('switch_on')) {
|
|
|
globalInterestRootFlag = true;
|
|
|
} else {
|
|
|
globalInterestRootFlag = false;
|
|
|
}
|
|
|
+ if(typeof flag == 'undefined')
|
|
|
+ LoadDeviceAdaptersWithEvent(true);
|
|
|
+ else
|
|
|
+ LoadDeviceAdaptersWithEvent();
|
|
|
}
|
|
|
|
|
|
$(function () {
|
|
|
@@ -281,39 +367,6 @@ $(function () {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function generateAdapterSelect(devices, status, select_id) {
|
|
|
- var deviceLength = 0;
|
|
|
- if ((devices) instanceof Array) {
|
|
|
- deviceLength = devices.length;
|
|
|
- } else {
|
|
|
- deviceLength = 1
|
|
|
- }
|
|
|
- var devicesHtml = '';
|
|
|
- var selectid = select_id;
|
|
|
- $('#' + selectid).empty();
|
|
|
- for (var loop = 0; loop < deviceLength; loop++) {
|
|
|
- var cur = devices[loop];
|
|
|
- var deviceTemplateData = {
|
|
|
- loop: loop,
|
|
|
- deviceName : cur,
|
|
|
- type: selectid
|
|
|
- };
|
|
|
- var pushHtml = '';
|
|
|
- pushHtml = '<div id="{{type}}_item_{{loop}}" option="{{deviceName}}" class="select_medium hide_with_ellipsis"'
|
|
|
- if(!(status[loop] & 0x1)) {
|
|
|
- pushHtml += ' style="color:#C0C0C0;"'
|
|
|
- } else {
|
|
|
- pushHtml += ' onclick="AdapterSelectChange(\'{{deviceName}}\')"'
|
|
|
- }
|
|
|
- //root.ini 配置
|
|
|
- if((status[loop] & 0x2)) {
|
|
|
- pushHtml += '>{{deviceName}} (当前配置)</div>'
|
|
|
- } else {
|
|
|
- pushHtml += '>{{deviceName}}</div>'
|
|
|
- }
|
|
|
- $('#' + selectid).secureAppend(pushHtml, deviceTemplateData);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
function FulfillMediaDeviceList(flag)
|
|
|
{
|
|
|
@@ -368,37 +421,6 @@ $(function () {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- function FulfillDevAdapterFileList(flag)
|
|
|
- {
|
|
|
- let req = new Request();
|
|
|
- req.root = false;
|
|
|
- req.adapter="";
|
|
|
- req.vendor="";
|
|
|
- req.version="";
|
|
|
- req.batch="";
|
|
|
-
|
|
|
- RVC.DeviceControlEntityCtrl.GetVendorFileList(req, function(ret) {
|
|
|
- if(ret.errorCode === 0) {
|
|
|
- let result = JSON.parse(ret[RVC.EntityController.sigResponseUUID])
|
|
|
- if(result.result == 0) {
|
|
|
- var libs = [];
|
|
|
- var status = [];
|
|
|
- for (var n = 0; n < result.filenames.length; n++) {
|
|
|
- console.log(result.filenames[n] + ' ' + result.status[n]);
|
|
|
- libs.push(result.filenames[n]);
|
|
|
- status.push(result.status[n]);
|
|
|
- }
|
|
|
- generateAdapterSelect(libs, status, 'gui_adapter_config_adapter_list');
|
|
|
-
|
|
|
- } else if(typeof flag !== 'undefined') {
|
|
|
- utilStartAlertDialog("操作失败:[" + result.result + "] " + result.msg);
|
|
|
- }
|
|
|
- } else if(typeof flag !== 'undefined'){
|
|
|
- RVC.DeviceControlEntityCtrl.commErrorCallback(ret);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
function SaveMediaDeviceConfig()
|
|
|
{
|
|
|
//话筒扬声器
|
|
|
@@ -604,8 +626,7 @@ $(function () {
|
|
|
FulfillMediaDeviceList();
|
|
|
break;
|
|
|
case CONST.DeployStep_AdapterConfig:
|
|
|
- InterestRootSwitch();
|
|
|
- FulfillDevAdapterFileList();
|
|
|
+ InterestRootSwitch(true);
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
@@ -672,8 +693,6 @@ $(function () {
|
|
|
});
|
|
|
|
|
|
$(document).on('click', '#guide_adapter_config_test', function() {
|
|
|
- var deviceName = $('#gui_adapter_config_device').attr('value');
|
|
|
- var vendorName = $('#gui_adapter_config_vendor').attr('value');
|
|
|
|
|
|
var adapterName = $('#gui_adapter_config_adapter').attr('value');
|
|
|
var paramPort = $('#guide_adapter_config_port_input').val();
|