simplified web console
This commit is contained in:
@@ -30,12 +30,7 @@
|
||||
"python-shell": "^0.4.0",
|
||||
"redis": "^2.6.3",
|
||||
"request": "^2.79.0",
|
||||
"ua-parser-js": "^0.7.12",
|
||||
"ffi": "^2.2.0",
|
||||
"ref": "^1.3.3",
|
||||
"ref-array": "^1.2.0",
|
||||
"ref-struct": "^1.1.0",
|
||||
"socket.io": "^1.7.2"
|
||||
"ua-parser-js": "^0.7.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"supervisor": "^0.12.0"
|
||||
|
||||
@@ -84,9 +84,7 @@
|
||||
<button id="download_bin_button" class="btn btn-normal btn-info" onclick="downloadBin();" style="font-size: 14px;">
|
||||
<span class="glyphicon glyphicon-cloud-download" style="vertical-align:middle; margin-bottom: 3px;"></span>
|
||||
</button>
|
||||
<button id="decode_bin_button" class="btn btn-normal btn-primary" onclick="onDecodeBin();" style="font-size: 14px;">
|
||||
<span class="glyphicon glyphicon-flash" style="vertical-align:middle; margin-bottom: 3px;"></span>
|
||||
</button>
|
||||
|
||||
<button id="transfer_bin_button" class="btn btn-normal btn-primary" onclick="onTransferBin();" style="font-size: 14px;">
|
||||
<span class="glyphicon glyphicon-import" style="vertical-align:middle; margin-bottom: 3px;"></span>
|
||||
</button>
|
||||
@@ -310,113 +308,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- decode dialog -->
|
||||
<div class="modal fade" id="decode_dialog" role="dialog" aria-labelledby="myModalLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">解码测试</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="decode_panel">
|
||||
<div style="width: 100%;">
|
||||
<div style="width: 100%;">
|
||||
<textarea id="ir_wave_value" rows="1" style="resize: none; width: 100%; overflow-x: scroll; white-space: nowrap;"></textarea>
|
||||
</div>
|
||||
<div class="row" style="text-align: center;">
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
<button id="btn_0" class="cbtn btn btn-danger glyphicon glyphicon-off"></button>
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
<button id="btn_8" class="cbtn btn btn-info glyphicon glyphicon-home"></button>
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
<button id="btn_9" class="cbtn btn btn-info glyphicon glyphicon-chevron-left"></button>
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
<button id="btn_10" class="cbtn btn btn-info glyphicon glyphicon-list"></button>
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
<button id="btn_6" class="cbtn btn btn-primary glyphicon glyphicon-plus"></button>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row" style="text-align: center;">
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
<button id="btn_1" class="cbtn btn btn-warning glyphicon glyphicon-arrow-up"></button>
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row" style="text-align: center;">
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
<button id="btn_3" class="cbtn btn btn-warning glyphicon glyphicon-arrow-left"></button>
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
<button id="btn_5" class="cbtn btn btn-success glyphicon glyphicon-star"></button>
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
<button id="btn_4" class="cbtn btn btn-warning glyphicon glyphicon-arrow-right"></button>
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row" style="text-align: center;">
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
<button id="btn_2" class="cbtn btn btn-warning glyphicon glyphicon-arrow-down"></button>
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
|
||||
</div>
|
||||
<div class="col-lg-2" style="text-align: center;">
|
||||
<button id="btn_7" class="cbtn btn btn-primary glyphicon glyphicon-minus"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-info" onclick="quitDecoding();">退出</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- publish hint dialog -->
|
||||
<div class="modal fade" id="publish_dialog" role="dialog" aria-labelledby="myModalLabel"
|
||||
aria-hidden="true">
|
||||
|
||||
@@ -71,12 +71,6 @@ var pass = 0;
|
||||
var brandsToPublish = [];
|
||||
var remoteIndexesToPublish = [];
|
||||
|
||||
var decodeSock;
|
||||
var currentTicket;
|
||||
var currentControl = new Object();
|
||||
|
||||
var localSocketAddr = "irext.net";
|
||||
|
||||
///////////////////////////// Initialization /////////////////////////////
|
||||
|
||||
$('#menu_toggle').click(function(e) {
|
||||
@@ -1457,40 +1451,6 @@ function downloadBin() {
|
||||
}
|
||||
}
|
||||
|
||||
function onDecodeBin() {
|
||||
if(null == selectedRemote) {
|
||||
popUpHintDialog('请先选中一个索引');
|
||||
return;
|
||||
}
|
||||
|
||||
if(1 == selectedRemote.category_id) {
|
||||
popUpHintDialog('空调在线解码不支持,您可以将编码下载到外部设备进行离线解码');
|
||||
return;
|
||||
}
|
||||
|
||||
freezeAllControlButtons();
|
||||
var remoteToDecode = selectedRemote;
|
||||
remoteToDecode.admin_id = id;
|
||||
remoteToDecode.token = token;
|
||||
$.ajax({
|
||||
url: '/irext/decode/prepare_decoding_remote_index',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: selectedRemote,
|
||||
timeout: 20000,
|
||||
success: function (response) {
|
||||
if(response.status.code == 0) {
|
||||
enterDecoding(response.entity);
|
||||
} else {
|
||||
popUpHintDialog('启动解码失败');
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
popUpHintDialog('启动解码失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onTransferBin() {
|
||||
if(null == selectedRemote) {
|
||||
popUpHintDialog('请先选中一个索引');
|
||||
@@ -1512,88 +1472,6 @@ function showPublishDialog() {
|
||||
$('#publish_dialog').modal();
|
||||
}
|
||||
|
||||
///////////////////////////// control functions /////////////////////////////
|
||||
function enterDecoding(ticketKey) {
|
||||
currentTicket = ticketKey;
|
||||
decodeSock = io.connect('http://' + localSocketAddr, {
|
||||
reconnection: false
|
||||
});
|
||||
decodeSock.on('connect', function() {
|
||||
onDecodeSocketConnected(decodeSock);
|
||||
});
|
||||
|
||||
decodeSock.on('disconnect', function() {
|
||||
onDecodeSocketDisconnected();
|
||||
});
|
||||
|
||||
decodeSock.on('init', function(result) {
|
||||
onDecodeSocketInit(result, decodeSock);
|
||||
});
|
||||
|
||||
decodeSock.on('decode', function(result) {
|
||||
onDecodeSockDecode(result);
|
||||
});
|
||||
|
||||
|
||||
$('#decode_dialog').modal();
|
||||
}
|
||||
|
||||
function quitDecoding() {
|
||||
decodeSock.disconnect();
|
||||
$('#decode_dialog').modal('hide');
|
||||
}
|
||||
|
||||
function onDecodeSocketConnected(socket) {
|
||||
socket.emit('init', currentTicket);
|
||||
}
|
||||
|
||||
function onDecodeSocketEvent(data) {
|
||||
console.log('decode socket data received : ' + data);
|
||||
}
|
||||
|
||||
function onDecodeSocketDisconnected() {
|
||||
|
||||
}
|
||||
|
||||
function onDecodeSocketInit(result, decodeSock) {
|
||||
if (result.status.code != 0) {
|
||||
console.log(result.status.code);
|
||||
decodeSock.disconnect();
|
||||
$('#decode_dialog').modal('hide');
|
||||
} else {
|
||||
currentControl.category_id = result.entity.category_id;
|
||||
currentControl.sub_category_id = result.entity.sub_category_id;
|
||||
unfreezeAllControlButtons();
|
||||
}
|
||||
}
|
||||
|
||||
function onDecodeSockDecode(result) {
|
||||
var codeArray = result.code.slice(0, result.len);
|
||||
$('#ir_wave_value').val(JSON.stringify(codeArray));
|
||||
}
|
||||
|
||||
function unfreezeAllControlButtons() {
|
||||
$('.cbtn').prop('disabled', false);
|
||||
}
|
||||
|
||||
function freezeAllControlButtons() {
|
||||
$('.cbtn').prop('disabled', true);
|
||||
}
|
||||
|
||||
function onControlClick(buttonID) {
|
||||
currentControl.key_id = buttonID.substring(4);
|
||||
var acStatus = {
|
||||
power: 0,
|
||||
temp: 0,
|
||||
mode: 0,
|
||||
wind_dir: 0,
|
||||
wind_speed: 0
|
||||
};
|
||||
currentControl.ac_status = acStatus;
|
||||
decodeSock.emit('control', currentControl);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////// UI functions /////////////////////////////
|
||||
function fillProtocolList(protocols) {
|
||||
$('#protocol_id')
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
"highcharts": "^5.0.6",
|
||||
"jquery": "^2.2.4",
|
||||
"select2": "^4.0.3",
|
||||
"toastr": "^2.1.3",
|
||||
"socket.io-client": "^1.7.2"
|
||||
"toastr": "^2.1.3"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user