hamlib 0.1.27 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/hamlib.h CHANGED
@@ -1,12 +1,9 @@
1
1
  #pragma once
2
2
 
3
3
  #include <napi.h>
4
- #include <hamlib/rig.h>
4
+ #include "shim/hamlib_shim.h"
5
5
  #include <memory>
6
- //forward declarations
7
- //typedef struct s_rig RIG;
8
- //typedef unsigned int vfo_t;
9
- //typedef double freq_t;
6
+ #include <string>
10
7
 
11
8
  // Forward declaration
12
9
  class NodeHamLib;
@@ -45,28 +42,28 @@ class NodeHamLib : public Napi::ObjectWrap<NodeHamLib> {
45
42
  Napi::Value Close(const Napi::CallbackInfo&);
46
43
  Napi::Value Destroy(const Napi::CallbackInfo&);
47
44
  Napi::Value GetConnectionInfo(const Napi::CallbackInfo&);
48
-
45
+
49
46
  // Memory Channel Management
50
47
  Napi::Value SetMemoryChannel(const Napi::CallbackInfo&);
51
48
  Napi::Value GetMemoryChannel(const Napi::CallbackInfo&);
52
49
  Napi::Value SelectMemoryChannel(const Napi::CallbackInfo&);
53
-
50
+
54
51
  // RIT/XIT Control
55
52
  Napi::Value SetRit(const Napi::CallbackInfo&);
56
53
  Napi::Value GetRit(const Napi::CallbackInfo&);
57
54
  Napi::Value SetXit(const Napi::CallbackInfo&);
58
55
  Napi::Value GetXit(const Napi::CallbackInfo&);
59
56
  Napi::Value ClearRitXit(const Napi::CallbackInfo&);
60
-
57
+
61
58
  // Scanning Operations
62
59
  Napi::Value StartScan(const Napi::CallbackInfo&);
63
60
  Napi::Value StopScan(const Napi::CallbackInfo&);
64
-
61
+
65
62
  // Level Controls
66
63
  Napi::Value SetLevel(const Napi::CallbackInfo&);
67
64
  Napi::Value GetLevel(const Napi::CallbackInfo&);
68
65
  Napi::Value GetSupportedLevels(const Napi::CallbackInfo&);
69
-
66
+
70
67
  // Function Controls
71
68
  Napi::Value SetFunction(const Napi::CallbackInfo&);
72
69
  Napi::Value GetFunction(const Napi::CallbackInfo&);
@@ -82,14 +79,14 @@ class NodeHamLib : public Napi::ObjectWrap<NodeHamLib> {
82
79
  Napi::Value GetSplitMode(const Napi::CallbackInfo&);
83
80
  Napi::Value SetSplit(const Napi::CallbackInfo&);
84
81
  Napi::Value GetSplit(const Napi::CallbackInfo&);
85
-
82
+
86
83
  // VFO Operations
87
84
  Napi::Value VfoOperation(const Napi::CallbackInfo&);
88
-
85
+
89
86
  // Antenna Selection
90
87
  Napi::Value SetAntenna(const Napi::CallbackInfo&);
91
88
  Napi::Value GetAntenna(const Napi::CallbackInfo&);
92
-
89
+
93
90
  // Serial Port Configuration
94
91
  Napi::Value SetSerialConfig(const Napi::CallbackInfo&);
95
92
  Napi::Value GetSerialConfig(const Napi::CallbackInfo&);
@@ -98,27 +95,27 @@ class NodeHamLib : public Napi::ObjectWrap<NodeHamLib> {
98
95
  Napi::Value SetDcdType(const Napi::CallbackInfo&);
99
96
  Napi::Value GetDcdType(const Napi::CallbackInfo&);
100
97
  Napi::Value GetSupportedSerialConfigs(const Napi::CallbackInfo&);
101
-
98
+
102
99
  // Power Control
103
100
  Napi::Value SetPowerstat(const Napi::CallbackInfo&);
104
101
  Napi::Value GetPowerstat(const Napi::CallbackInfo&);
105
-
102
+
106
103
  // PTT Status Detection
107
104
  Napi::Value GetPtt(const Napi::CallbackInfo&);
108
-
105
+
109
106
  // Data Carrier Detect
110
107
  Napi::Value GetDcd(const Napi::CallbackInfo&);
111
-
108
+
112
109
  // Tuning Step Control
113
110
  Napi::Value SetTuningStep(const Napi::CallbackInfo&);
114
111
  Napi::Value GetTuningStep(const Napi::CallbackInfo&);
115
-
112
+
116
113
  // Repeater Control
117
114
  Napi::Value SetRepeaterShift(const Napi::CallbackInfo&);
118
115
  Napi::Value GetRepeaterShift(const Napi::CallbackInfo&);
119
116
  Napi::Value SetRepeaterOffset(const Napi::CallbackInfo&);
120
117
  Napi::Value GetRepeaterOffset(const Napi::CallbackInfo&);
121
-
118
+
122
119
  // CTCSS/DCS Tone Control
123
120
  Napi::Value SetCtcssTone(const Napi::CallbackInfo&);
124
121
  Napi::Value GetCtcssTone(const Napi::CallbackInfo&);
@@ -128,40 +125,40 @@ class NodeHamLib : public Napi::ObjectWrap<NodeHamLib> {
128
125
  Napi::Value GetCtcssSql(const Napi::CallbackInfo&);
129
126
  Napi::Value SetDcsSql(const Napi::CallbackInfo&);
130
127
  Napi::Value GetDcsSql(const Napi::CallbackInfo&);
131
-
128
+
132
129
  // Parameter Control
133
130
  Napi::Value SetParm(const Napi::CallbackInfo&);
134
131
  Napi::Value GetParm(const Napi::CallbackInfo&);
135
-
132
+
136
133
  // DTMF Support
137
134
  Napi::Value SendDtmf(const Napi::CallbackInfo&);
138
135
  Napi::Value RecvDtmf(const Napi::CallbackInfo&);
139
-
136
+
140
137
  // Memory Channel Advanced Operations
141
138
  Napi::Value GetMem(const Napi::CallbackInfo&);
142
139
  Napi::Value SetBank(const Napi::CallbackInfo&);
143
140
  Napi::Value MemCount(const Napi::CallbackInfo&);
144
-
141
+
145
142
  // Morse Code Support
146
143
  Napi::Value SendMorse(const Napi::CallbackInfo&);
147
144
  Napi::Value StopMorse(const Napi::CallbackInfo&);
148
145
  Napi::Value WaitMorse(const Napi::CallbackInfo&);
149
-
146
+
150
147
  // Voice Memory Support
151
148
  Napi::Value SendVoiceMem(const Napi::CallbackInfo&);
152
149
  Napi::Value StopVoiceMem(const Napi::CallbackInfo&);
153
-
150
+
154
151
  // Complex Split Frequency/Mode Operations
155
152
  Napi::Value SetSplitFreqMode(const Napi::CallbackInfo&);
156
153
  Napi::Value GetSplitFreqMode(const Napi::CallbackInfo&);
157
-
154
+
158
155
  // Power Conversion Functions
159
156
  Napi::Value Power2mW(const Napi::CallbackInfo&);
160
157
  Napi::Value MW2Power(const Napi::CallbackInfo&);
161
-
158
+
162
159
  // Reset Function
163
160
  Napi::Value Reset(const Napi::CallbackInfo&);
164
-
161
+
165
162
  // Static method to get supported rig models
166
163
  static Napi::Value GetSupportedRigs(const Napi::CallbackInfo&);
167
164
 
@@ -174,22 +171,23 @@ class NodeHamLib : public Napi::ObjectWrap<NodeHamLib> {
174
171
 
175
172
  static Napi::Function GetClass(Napi::Env);
176
173
 
177
- static int freq_change_cb(RIG*, vfo_t, freq_t, void*);
174
+ // Frequency change callback (uses basic C types via shim)
175
+ static int freq_change_cb(void* handle, int vfo, double freq, void* arg);
178
176
 
179
177
  public:
180
- RIG *my_rig;
178
+ hamlib_shim_handle_t my_rig; // Opaque handle instead of RIG*
181
179
  bool rig_is_open = false;
182
180
  bool is_network_rig = false; // Flag to indicate if using network connection
183
- rig_model_t original_model = 0; // Store original model when using network
181
+ unsigned int original_model = 0; // Store original model when using network
184
182
  int count = 0;
185
183
  void* freq_emit_cb;
186
- char port_path[HAMLIB_FILPATHLEN]; // Store the port path
184
+ char port_path[SHIM_HAMLIB_FILPATHLEN]; // Store the port path
187
185
  static Napi::FunctionReference constructor;
188
186
  Napi::CallbackInfo * m_currentInfo;
189
-
187
+
190
188
  // Helper method to detect network address format
191
189
  bool isNetworkAddress(const char* path);
192
-
193
- // Static callback helper for rig_list_foreach
194
- static int rig_list_callback(const struct rig_caps *caps, void *data);
195
- };
190
+
191
+ // Static callback helper for shim_rig_list_foreach
192
+ static int rig_list_callback(const shim_rig_info_t* info, void* data);
193
+ };