File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load diff This file was deleted.
Original file line number Diff line number Diff line change @@ -8,15 +8,66 @@ import (
88)
99
1010const (
11+ SelectVFOUUID = "com.thecodingflow.hamlibplugin.selectvfo"
1112 VFOOpUUID = "com.thecodingflow.hamlibplugin.vfoop"
1213 VFOOpEncoderUUID = "com.thecodingflow.hamlibplugin.vfoopencoder"
1314)
1415
1516func init () {
17+ Factories [SelectVFOUUID ] = NewSelectVFO
1618 Factories [VFOOpUUID ] = NewVFOOp
1719 Factories [VFOOpEncoderUUID ] = NewVFOOpEncoder
1820}
1921
22+ type SelectVFO struct {
23+ basicAction
24+ }
25+
26+ func NewSelectVFO (context string , client RigClient , deck Deck ) Action {
27+ return & SelectVFO {
28+ basicAction : basicAction {
29+ context : context ,
30+ client : client ,
31+ deck : deck ,
32+ },
33+ }
34+ }
35+
36+ func (a * SelectVFO ) parseSettings (settings map [string ]any ) hl.VFO {
37+ vfo , ok := settings ["vfo" ].(string )
38+ if ! ok {
39+ vfo = ""
40+ }
41+ return hl .VFO (vfo )
42+ }
43+
44+ func (a * SelectVFO ) DidReceiveSettings (payload * sdk.ReceivedEventPayload ) error {
45+ a .UpdateVisual (payload )
46+ return nil
47+ }
48+
49+ func (a * SelectVFO ) UpdateVisual (payload * sdk.ReceivedEventPayload ) error {
50+ vfo := a .parseSettings (payload .Settings )
51+ if vfo == "" {
52+ vfo = "VFO"
53+ }
54+ a .deck .SetTitle (a .context , string (vfo ), sdk .HardwareAndSoftware )
55+ return nil
56+ }
57+
58+ func (a * SelectVFO ) KeyDown (payload * sdk.ReceivedEventPayload ) error {
59+ vfo := a .parseSettings (payload .Settings )
60+ if vfo == "" {
61+ return nil
62+ }
63+
64+ err := a .client .SetVFO (vfo )
65+ if err != nil {
66+ log .Printf ("[ERROR] select vfo: %v" , err )
67+ }
68+ return nil
69+ }
70+
2071type VFOOperation struct {
2172 basicAction
2273}
You can’t perform that action at this time.
0 commit comments