hamlib 0.1.6 → 0.1.8

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
@@ -11,16 +11,20 @@
11
11
  // Forward declaration
12
12
  class NodeHamLib;
13
13
 
14
- // Base AsyncWorker class for hamlib operations
14
+ // Base AsyncWorker class for hamlib operations with Promise support
15
15
  class HamLibAsyncWorker : public Napi::AsyncWorker {
16
16
  public:
17
- HamLibAsyncWorker(Napi::Function& callback, NodeHamLib* hamlib_instance);
17
+ HamLibAsyncWorker(Napi::Env env, NodeHamLib* hamlib_instance);
18
18
  virtual ~HamLibAsyncWorker() = default;
19
19
 
20
+ // Get the promise that will be resolved/rejected
21
+ Napi::Promise GetPromise() { return deferred_.Promise(); }
22
+
20
23
  protected:
21
24
  NodeHamLib* hamlib_instance_;
22
25
  int result_code_;
23
26
  std::string error_message_;
27
+ Napi::Promise::Deferred deferred_;
24
28
  };
25
29
 
26
30
 
@@ -91,6 +95,69 @@ class NodeHamLib : public Napi::ObjectWrap<NodeHamLib> {
91
95
  Napi::Value GetDcdType(const Napi::CallbackInfo&);
92
96
  Napi::Value GetSupportedSerialConfigs(const Napi::CallbackInfo&);
93
97
 
98
+ // Power Control
99
+ Napi::Value SetPowerstat(const Napi::CallbackInfo&);
100
+ Napi::Value GetPowerstat(const Napi::CallbackInfo&);
101
+
102
+ // PTT Status Detection
103
+ Napi::Value GetPtt(const Napi::CallbackInfo&);
104
+
105
+ // Data Carrier Detect
106
+ Napi::Value GetDcd(const Napi::CallbackInfo&);
107
+
108
+ // Tuning Step Control
109
+ Napi::Value SetTuningStep(const Napi::CallbackInfo&);
110
+ Napi::Value GetTuningStep(const Napi::CallbackInfo&);
111
+
112
+ // Repeater Control
113
+ Napi::Value SetRepeaterShift(const Napi::CallbackInfo&);
114
+ Napi::Value GetRepeaterShift(const Napi::CallbackInfo&);
115
+ Napi::Value SetRepeaterOffset(const Napi::CallbackInfo&);
116
+ Napi::Value GetRepeaterOffset(const Napi::CallbackInfo&);
117
+
118
+ // CTCSS/DCS Tone Control
119
+ Napi::Value SetCtcssTone(const Napi::CallbackInfo&);
120
+ Napi::Value GetCtcssTone(const Napi::CallbackInfo&);
121
+ Napi::Value SetDcsCode(const Napi::CallbackInfo&);
122
+ Napi::Value GetDcsCode(const Napi::CallbackInfo&);
123
+ Napi::Value SetCtcssSql(const Napi::CallbackInfo&);
124
+ Napi::Value GetCtcssSql(const Napi::CallbackInfo&);
125
+ Napi::Value SetDcsSql(const Napi::CallbackInfo&);
126
+ Napi::Value GetDcsSql(const Napi::CallbackInfo&);
127
+
128
+ // Parameter Control
129
+ Napi::Value SetParm(const Napi::CallbackInfo&);
130
+ Napi::Value GetParm(const Napi::CallbackInfo&);
131
+
132
+ // DTMF Support
133
+ Napi::Value SendDtmf(const Napi::CallbackInfo&);
134
+ Napi::Value RecvDtmf(const Napi::CallbackInfo&);
135
+
136
+ // Memory Channel Advanced Operations
137
+ Napi::Value GetMem(const Napi::CallbackInfo&);
138
+ Napi::Value SetBank(const Napi::CallbackInfo&);
139
+ Napi::Value MemCount(const Napi::CallbackInfo&);
140
+
141
+ // Morse Code Support
142
+ Napi::Value SendMorse(const Napi::CallbackInfo&);
143
+ Napi::Value StopMorse(const Napi::CallbackInfo&);
144
+ Napi::Value WaitMorse(const Napi::CallbackInfo&);
145
+
146
+ // Voice Memory Support
147
+ Napi::Value SendVoiceMem(const Napi::CallbackInfo&);
148
+ Napi::Value StopVoiceMem(const Napi::CallbackInfo&);
149
+
150
+ // Complex Split Frequency/Mode Operations
151
+ Napi::Value SetSplitFreqMode(const Napi::CallbackInfo&);
152
+ Napi::Value GetSplitFreqMode(const Napi::CallbackInfo&);
153
+
154
+ // Power Conversion Functions
155
+ Napi::Value Power2mW(const Napi::CallbackInfo&);
156
+ Napi::Value MW2Power(const Napi::CallbackInfo&);
157
+
158
+ // Reset Function
159
+ Napi::Value Reset(const Napi::CallbackInfo&);
160
+
94
161
  // Static method to get supported rig models
95
162
  static Napi::Value GetSupportedRigs(const Napi::CallbackInfo&);
96
163
 
@@ -0,0 +1,44 @@
1
+ #pragma once
2
+
3
+ /**
4
+ * hamlib_compat.h - Hamlib compatibility layer for different versions
5
+ *
6
+ * This header handles compatibility issues between different versions of hamlib
7
+ * Some functions are only available in newer versions and may not be present
8
+ * in older Linux distribution packages.
9
+ */
10
+
11
+ #include <hamlib/rig.h>
12
+
13
+ // Check for hamlib version if available
14
+ #ifdef HAMLIB_VERSION
15
+ // Version-specific feature detection
16
+ #if HAMLIB_VERSION >= 0x040500 // Version 4.5.0 and later
17
+ #define HAVE_RIG_STOP_VOICE_MEM 1
18
+ #define HAVE_RIG_SPLIT_FREQ_MODE 1
19
+ #endif
20
+ #else
21
+ // If version is not available, assume older version
22
+ // We'll disable newer functions for maximum compatibility
23
+ #undef HAVE_RIG_STOP_VOICE_MEM
24
+ #undef HAVE_RIG_SPLIT_FREQ_MODE
25
+ #endif
26
+
27
+ // Manual feature detection based on typical availability
28
+ // These functions were added in recent hamlib versions
29
+ // Comment out these lines if your hamlib version doesn't have them
30
+
31
+ // Uncomment if you have a newer hamlib version with these functions:
32
+ // #define HAVE_RIG_STOP_VOICE_MEM 1
33
+ // #define HAVE_RIG_SPLIT_FREQ_MODE 1
34
+
35
+ // For maximum compatibility with older distributions, keep these disabled
36
+ // Users with newer hamlib can enable them manually
37
+
38
+ #ifndef HAVE_RIG_STOP_VOICE_MEM
39
+ #define HAVE_RIG_STOP_VOICE_MEM 0
40
+ #endif
41
+
42
+ #ifndef HAVE_RIG_SPLIT_FREQ_MODE
43
+ #define HAVE_RIG_SPLIT_FREQ_MODE 0
44
+ #endif