Skip to content

Commit 0e3548b

Browse files
committed
add actions to adjust and toggle the RIT and XIT functions
1 parent 1ae6cad commit 0e3548b

5 files changed

Lines changed: 390 additions & 0 deletions

File tree

manifest.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,30 @@
127127
"PropertyInspectorPath": "pi/setparm.html",
128128
"Controllers": ["Keypad"],
129129
"States": [{ "Title": "Parm" }]
130+
},
131+
{
132+
"Name": "RIT",
133+
"UUID": "com.thecodingflow.hamlibplugin.rit",
134+
"Tooltip": "Adjust RIT offset and toggle RIT on/off",
135+
"Icon": "icons/radio_light",
136+
"DisableAutomaticStates": false,
137+
"VisibleInActionsList": true,
138+
"SupportedInMultiActions": true,
139+
"PropertyInspectorPath": "pi/rit.html",
140+
"Controllers": ["Encoder", "Keypad"],
141+
"States": [{ "Title": "RIT" }]
142+
},
143+
{
144+
"Name": "XIT",
145+
"UUID": "com.thecodingflow.hamlibplugin.xit",
146+
"Tooltip": "Adjust XIT offset and toggle XIT on/off",
147+
"Icon": "icons/radio_light",
148+
"DisableAutomaticStates": false,
149+
"VisibleInActionsList": true,
150+
"SupportedInMultiActions": true,
151+
"PropertyInspectorPath": "pi/xit.html",
152+
"Controllers": ["Encoder", "Keypad"],
153+
"States": [{ "Title": "XIT" }]
130154
}
131155
],
132156
"OS": [{ "Platform": "linux" }],

pi/rit.html

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<script>
5+
let update = () => {};
6+
let vfoSetting = "";
7+
let stepSetting = "";
8+
9+
function connectOpenActionSocket(
10+
inPort,
11+
inPropertyInspectorUUID,
12+
inRegisterEvent,
13+
inInfo,
14+
inActionInfo,
15+
) {
16+
const websocket = new WebSocket("ws://localhost:" + inPort);
17+
inActionInfo = JSON.parse(inActionInfo);
18+
websocket.onopen = () => {
19+
websocket.send(
20+
JSON.stringify({
21+
event: inRegisterEvent,
22+
uuid: inPropertyInspectorUUID,
23+
}),
24+
);
25+
};
26+
27+
vfoSetting = inActionInfo.payload.settings.vfo ?? "";
28+
stepSetting = inActionInfo.payload.settings.step ?? "";
29+
30+
websocket.onmessage = (event) => {
31+
const data = JSON.parse(event.data);
32+
if (data.event == "didReceiveSettings") {
33+
vfoSetting = data.payload.settings.vfo ?? "";
34+
stepSetting = data.payload.settings.step ?? "";
35+
}
36+
if (data.event == "sendToPropertyInspector") {
37+
// TODO: receive available vfos from the plugin
38+
}
39+
};
40+
41+
const vfoElement = document.getElementById("vfo");
42+
vfoElement.value = inActionInfo.payload.settings.vfo ?? "";
43+
44+
const stepElement = document.getElementById("step");
45+
stepElement.value = inActionInfo.payload.settings.step ?? "";
46+
47+
update = () => {
48+
websocket.send(
49+
JSON.stringify({
50+
event: "setSettings",
51+
context: inActionInfo.context,
52+
payload: {
53+
vfo: vfoElement.value || "",
54+
step: stepElement.value || "",
55+
},
56+
}),
57+
);
58+
};
59+
}
60+
61+
const connectElgatoStreamDeckSocket = connectOpenActionSocket;
62+
</script>
63+
64+
<style>
65+
* {
66+
font-family: system-ui, sans-serif;
67+
font-size: 16px;
68+
color: oklch(92.2% 0 0);
69+
}
70+
body {
71+
margin: 16px;
72+
background-color: oklch(26.9% 0 0);
73+
}
74+
label {
75+
margin-right: 4px;
76+
}
77+
input {
78+
margin: 4px;
79+
padding: 4px;
80+
background-color: oklch(37.1% 0 0);
81+
border: 1px solid oklch(43.9% 0 0);
82+
border-radius: 8px;
83+
}
84+
</style>
85+
</head>
86+
87+
<body>
88+
<div>
89+
<label for="vfo">VFO:</label>
90+
<!-- should be a combo box with all VFOs -->
91+
<input id="vfo" oninput="update()" type="text" />
92+
<br />
93+
<label for="step">Step (Hz):</label>
94+
<input id="step" oninput="update()" type="text" />
95+
</div>
96+
</body>
97+
</html>

pi/xit.html

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<script>
5+
let update = () => {};
6+
let vfoSetting = "";
7+
let stepSetting = "";
8+
9+
function connectOpenActionSocket(
10+
inPort,
11+
inPropertyInspectorUUID,
12+
inRegisterEvent,
13+
inInfo,
14+
inActionInfo,
15+
) {
16+
const websocket = new WebSocket("ws://localhost:" + inPort);
17+
inActionInfo = JSON.parse(inActionInfo);
18+
websocket.onopen = () => {
19+
websocket.send(
20+
JSON.stringify({
21+
event: inRegisterEvent,
22+
uuid: inPropertyInspectorUUID,
23+
}),
24+
);
25+
};
26+
27+
vfoSetting = inActionInfo.payload.settings.vfo ?? "";
28+
stepSetting = inActionInfo.payload.settings.step ?? "";
29+
30+
websocket.onmessage = (event) => {
31+
const data = JSON.parse(event.data);
32+
if (data.event == "didReceiveSettings") {
33+
vfoSetting = data.payload.settings.vfo ?? "";
34+
stepSetting = data.payload.settings.step ?? "";
35+
}
36+
if (data.event == "sendToPropertyInspector") {
37+
// TODO: receive available vfos from the plugin
38+
}
39+
};
40+
41+
const vfoElement = document.getElementById("vfo");
42+
vfoElement.value = inActionInfo.payload.settings.vfo ?? "";
43+
44+
const stepElement = document.getElementById("step");
45+
stepElement.value = inActionInfo.payload.settings.step ?? "";
46+
47+
update = () => {
48+
websocket.send(
49+
JSON.stringify({
50+
event: "setSettings",
51+
context: inActionInfo.context,
52+
payload: {
53+
vfo: vfoElement.value || "",
54+
step: stepElement.value || "",
55+
},
56+
}),
57+
);
58+
};
59+
}
60+
61+
const connectElgatoStreamDeckSocket = connectOpenActionSocket;
62+
</script>
63+
64+
<style>
65+
* {
66+
font-family: system-ui, sans-serif;
67+
font-size: 16px;
68+
color: oklch(92.2% 0 0);
69+
}
70+
body {
71+
margin: 16px;
72+
background-color: oklch(26.9% 0 0);
73+
}
74+
label {
75+
margin-right: 4px;
76+
}
77+
input {
78+
margin: 4px;
79+
padding: 4px;
80+
background-color: oklch(37.1% 0 0);
81+
border: 1px solid oklch(43.9% 0 0);
82+
border-radius: 8px;
83+
}
84+
</style>
85+
</head>
86+
87+
<body>
88+
<div>
89+
<label for="vfo">VFO:</label>
90+
<!-- should be a combo box with all VFOs -->
91+
<input id="vfo" oninput="update()" type="text" />
92+
<br />
93+
<label for="step">Step (Hz):</label>
94+
<input id="step" oninput="update()" type="text" />
95+
</div>
96+
</body>
97+
</html>

pkg/action/action.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ type RigClient interface {
4343
GetParm(hl.Parameter) (string, error)
4444
SetParm(hl.Parameter, string) error
4545
VFOOp(hl.VFO, hl.VFOOp) error
46+
GetRIT(hl.VFO) (hl.Frequency, error)
47+
SetRIT(hl.VFO, hl.Frequency) error
48+
GetXIT(hl.VFO) (hl.Frequency, error)
49+
SetXIT(hl.VFO, hl.Frequency) error
4650
}
4751

4852
type Deck interface {

0 commit comments

Comments
 (0)