@@ -135,6 +135,12 @@ async function get_trx() {
135
135
let currentCat = { } ;
136
136
currentCat . vfo = await getInfo ( 'rig.get_vfo' ) ;
137
137
currentCat . mode = await getInfo ( 'rig.get_mode' ) ;
138
+ currentCat . ptt = await getInfo ( 'rig.get_ptt' ) ;
139
+ currentCat . power = await getInfo ( 'rig.get_power' ) ?? 0 ;
140
+ currentCat . split = await getInfo ( 'rig.get_split' ) ;
141
+ currentCat . vfoB = await getInfo ( 'rig.get_vfoB' ) ;
142
+ currentCat . modeB = await getInfo ( 'rig.get_modeB' ) ;
143
+
138
144
$ ( "#current_trx" ) . html ( ( currentCat . vfo / ( 1000 * 1000 ) ) + " MHz / " + currentCat . mode ) ;
139
145
if ( ! ( isDeepEqual ( oldCat , currentCat ) ) ) {
140
146
// console.log(currentCat);
@@ -146,21 +152,21 @@ async function get_trx() {
146
152
147
153
async function getInfo ( which ) {
148
154
const response = await fetch (
149
- "http://" + $ ( "#flrig_host" ) . val ( ) + ':' + $ ( "#flrig_port" ) . val ( ) ,
150
- {
155
+ "http://" + $ ( "#flrig_host" ) . val ( ) + ':' + $ ( "#flrig_port" ) . val ( ) , {
151
156
method : 'POST' ,
152
157
// mode: 'no-cors',
153
- headers : {
154
- 'Accept' : 'application/json, application/xml, text/plain, text/html, *.*' ,
155
- 'Content-Type' : 'application/x-www-form-urlencoded; charset=utf-8'
156
- } ,
157
- body : '<?xml version="1.0"?><methodCall><methodName>' + which + '</methodName></methodCall>'
158
- } ) ;
159
- const data = await response . text ( ) ;
158
+ headers : {
159
+ 'Accept' : 'application/json, application/xml, text/plain, text/html, *.*' ,
160
+ 'Content-Type' : 'application/x-www-form-urlencoded; charset=utf-8'
161
+ } ,
162
+ body : '<?xml version="1.0"?><methodCall><methodName>' + which + '</methodName></methodCall>'
163
+ }
164
+ ) ;
165
+ const data = await response . text ( ) ;
160
166
var parser = new DOMParser ( ) ;
161
- var xmlDoc = parser . parseFromString ( data , "text/xml" ) ;
162
- var qrgplain = xmlDoc . getElementsByTagName ( "value" ) [ 0 ] . textContent ;
163
- return qrgplain ;
167
+ var xmlDoc = parser . parseFromString ( data , "text/xml" ) ;
168
+ var qrgplain = xmlDoc . getElementsByTagName ( "value" ) [ 0 ] . textContent ;
169
+ return qrgplain ;
164
170
}
165
171
166
172
async function getsettrx ( ) {
@@ -199,7 +205,28 @@ const isObject = (object) => {
199
205
} ;
200
206
201
207
async function informWavelog ( CAT ) {
202
- let data = { radio : "WLGate" , key : cfg . wavelog_key , radio : cfg . wavelog_radioname , frequency : ( CAT . vfo ) , mode : CAT . mode } ;
208
+ let data = {
209
+ radio : "WLGate" ,
210
+ key : cfg . wavelog_key ,
211
+ radio : cfg . wavelog_radioname
212
+ } ;
213
+ if ( CAT . power !== undefined && CAT . power !== 0 ) {
214
+ data . power = CAT . power ;
215
+ }
216
+ // if (CAT.ptt !== undefined) { // not impleented yet in Wavelog, so maybe later
217
+ // data.ptt = CAT.ptt;
218
+ // }
219
+ if ( CAT . split == '1' ) {
220
+ // data.split=true; // not implemented yet in Wavelog
221
+ data . frequency = CAT . vfoB ;
222
+ data . mode = CAT . modeB ;
223
+ data . frequency_rx = CAT . vfo ;
224
+ data . mode_rx = CAT . mode ;
225
+ } else {
226
+ data . frequency = CAT . vfo ;
227
+ data . mode = CAT . mode ;
228
+ }
229
+
203
230
let x = await fetch ( cfg . wavelog_url + '/api/radio' , {
204
231
method : 'POST' ,
205
232
rejectUnauthorized : false ,
0 commit comments