mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
start-stop rigctld
This commit is contained in:
parent
d0f0031ca4
commit
4c27009f0e
72
gui/main.js
72
gui/main.js
|
@ -801,12 +801,84 @@ ipcMain.on('request-stop-rigctld',(event,data)=>{
|
||||||
if(os.platform()=='linux'){
|
if(os.platform()=='linux'){
|
||||||
|
|
||||||
exec('pkill', ['-9', 'rigctld'])
|
exec('pkill', ['-9', 'rigctld'])
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(os.platform()=='darwin'){
|
if(os.platform()=='darwin'){
|
||||||
|
|
||||||
exec('pkill', ['-9', 'rigctld'])
|
exec('pkill', ['-9', 'rigctld'])
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
mainLog.error(e)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// CHECK RIGCTLD
|
||||||
|
ipcMain.on('request-check-rigctld',(event,data)=>{
|
||||||
|
try {
|
||||||
|
|
||||||
|
if(os.platform()=='win32' || os.platform()=='win64'){
|
||||||
|
var state = exec('tasklist', ['/svc', '/FI', 'ImageName eq rigctld*'])
|
||||||
|
state.on('close', function(code) {
|
||||||
|
if(code == 0){
|
||||||
|
let Data = {
|
||||||
|
state: "running",
|
||||||
|
};
|
||||||
|
win.webContents.send('action-check-rigctld', Data);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
let Data = {
|
||||||
|
state: "unknown",
|
||||||
|
};
|
||||||
|
win.webContents.send('action-check-rigctld', Data);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(os.platform()=='linux'){
|
||||||
|
|
||||||
|
var state = exec('pgrep', ['rigctld'])
|
||||||
|
state.on('close', function(code) {
|
||||||
|
if(code == 0){
|
||||||
|
let Data = {
|
||||||
|
state: "running",
|
||||||
|
};
|
||||||
|
win.webContents.send('action-check-rigctld', Data);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
let Data = {
|
||||||
|
state: "unknown",
|
||||||
|
};
|
||||||
|
win.webContents.send('action-check-rigctld', Data);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(os.platform()=='darwin'){
|
||||||
|
|
||||||
|
var state = exec('pgrep', ['rigctld'])
|
||||||
|
state.on('close', function(code) {
|
||||||
|
if(code == 0){
|
||||||
|
let Data = {
|
||||||
|
state: "running",
|
||||||
|
};
|
||||||
|
win.webContents.send('action-check-rigctld', Data);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
let Data = {
|
||||||
|
state: "unknown",
|
||||||
|
};
|
||||||
|
win.webContents.send('action-check-rigctld', Data);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
mainLog.error(e)
|
mainLog.error(e)
|
||||||
|
|
|
@ -527,16 +527,27 @@ document.getElementById('hamlib_rigctld_path').addEventListener('click', () => {
|
||||||
|
|
||||||
document.getElementById('hamlib_rigctld_start').addEventListener('click', () => {
|
document.getElementById('hamlib_rigctld_start').addEventListener('click', () => {
|
||||||
var rigctldPath = document.getElementById("hamlib_rigctld_path").value;
|
var rigctldPath = document.getElementById("hamlib_rigctld_path").value;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var paramList = []
|
||||||
|
|
||||||
var hamlib_deviceid = document.getElementById("hamlib_deviceid").value;
|
var hamlib_deviceid = document.getElementById("hamlib_deviceid").value;
|
||||||
var hamlib_deviceport = document.getElementById("hamlib_deviceport").value;
|
paramList = paramList.concat('-m', hamlib_deviceid)
|
||||||
|
|
||||||
|
if (document.getElementById('enable_hamlib_deviceport').checked){
|
||||||
|
var hamlib_deviceport = document.getElementById("hamlib_deviceport").value;
|
||||||
|
paramList = paramList.concat('-r', hamlib_deviceport)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
document.getElementById('hamlib_rigctld_command').value = paramList
|
||||||
|
|
||||||
|
console.log(paramList)
|
||||||
|
|
||||||
ipcRenderer.send('request-start-rigctld',{
|
ipcRenderer.send('request-start-rigctld',{
|
||||||
path: rigctldPath,
|
path: rigctldPath,
|
||||||
parameters: ['-m', hamlib_deviceid,
|
parameters: paramList
|
||||||
'-r', hamlib_deviceport
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -2155,4 +2166,13 @@ function enable_setting(enable_switch, enable_object){
|
||||||
function set_setting_switch(setting_switch, enable_object, state){
|
function set_setting_switch(setting_switch, enable_object, state){
|
||||||
document.getElementById(setting_switch).checked = state
|
document.getElementById(setting_switch).checked = state
|
||||||
enable_setting(setting_switch, enable_object)
|
enable_setting(setting_switch, enable_object)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setInterval(checkRigctld, 500)
|
||||||
|
function checkRigctld(){
|
||||||
|
ipcRenderer.send('request-check-rigctld');
|
||||||
|
}
|
||||||
|
ipcRenderer.on('action-check-rigctld', (event, data) => {
|
||||||
|
console.log(data)
|
||||||
|
document.getElementById("hamlib_rigctld_status").value = data["state"];
|
||||||
|
});
|
|
@ -721,14 +721,13 @@
|
||||||
<!-- RADIO CONTROL RIGCTLD INFO-->
|
<!-- RADIO CONTROL RIGCTLD INFO-->
|
||||||
<div id="radio-control-rigctld-info">
|
<div id="radio-control-rigctld-info">
|
||||||
<div class="input-group input-group-sm mb-1">
|
<div class="input-group input-group-sm mb-1">
|
||||||
<span class="input-group-text" id="basic-addon1">Rigctld Status</span>
|
<span class="input-group-text" id="basic-addon1">Cmd</span>
|
||||||
<input type="text" class="form-control" placeholder="Status" id="hamlib_rigctld_status" aria-label="Device IP" aria-describedby="basic-addon1">
|
<input type="text" class="form-control" placeholder="Command" id="hamlib_rigctld_command" aria-label="Device Port" aria-describedby="basic-addon1">
|
||||||
<span class="input-group-text" id="basic-addon1">Rigctld Version</span>
|
|
||||||
<input type="text" class="form-control" placeholder="Version" id="hamlib_rigctld_version" aria-label="Device Port" aria-describedby="basic-addon1">
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-group input-group-sm mb-1">
|
<div class="input-group input-group-sm mb-1">
|
||||||
<span class="input-group-text" id="hamlib_rigctld_start">start</span>
|
<span class="input-group-text" id="hamlib_rigctld_start">start</span>
|
||||||
|
<input type="text" class="form-control" placeholder="Status" id="hamlib_rigctld_status" aria-label="State" aria-describedby="basic-addon1">
|
||||||
<span class="input-group-text" id="hamlib_rigctld_stop">stop</span>
|
<span class="input-group-text" id="hamlib_rigctld_stop">stop</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue