hamlib 0.4.1 → 0.4.3

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.
@@ -32,7 +32,7 @@ extern "C" {
32
32
  #define SHIM_API
33
33
  #endif
34
34
 
35
- /* Opaque handle type - hides RIG* from the addon */
35
+ /* Opaque handle type - hides RIG* / ROT* from the addon */
36
36
  typedef void* hamlib_shim_handle_t;
37
37
 
38
38
  /* ===== Constants (mirror Hamlib values) ===== */
@@ -147,7 +147,50 @@ typedef void* hamlib_shim_handle_t;
147
147
  #define SHIM_RIG_RESET_MASTER 8
148
148
 
149
149
  /* Antenna */
150
- #define SHIM_RIG_ANT_CURR 0
150
+ #define SHIM_RIG_ANT_CURR ((int)0x80000000u)
151
+
152
+ /* ===== Rotator constants (mirror Hamlib values) ===== */
153
+ #define SHIM_ROT_TYPE_OTHER 0
154
+ #define SHIM_ROT_TYPE_AZIMUTH (1 << 1)
155
+ #define SHIM_ROT_TYPE_ELEVATION (1 << 2)
156
+ #define SHIM_ROT_TYPE_AZEL (SHIM_ROT_TYPE_AZIMUTH | SHIM_ROT_TYPE_ELEVATION)
157
+
158
+ #define SHIM_ROT_MOVE_UP (1 << 1)
159
+ #define SHIM_ROT_MOVE_DOWN (1 << 2)
160
+ #define SHIM_ROT_MOVE_LEFT (1 << 3)
161
+ #define SHIM_ROT_MOVE_CCW SHIM_ROT_MOVE_LEFT
162
+ #define SHIM_ROT_MOVE_RIGHT (1 << 4)
163
+ #define SHIM_ROT_MOVE_CW SHIM_ROT_MOVE_RIGHT
164
+ #define SHIM_ROT_MOVE_UP_LEFT (1 << 5)
165
+ #define SHIM_ROT_MOVE_UP_CCW SHIM_ROT_MOVE_UP_LEFT
166
+ #define SHIM_ROT_MOVE_UP_RIGHT (1 << 6)
167
+ #define SHIM_ROT_MOVE_UP_CW SHIM_ROT_MOVE_UP_RIGHT
168
+ #define SHIM_ROT_MOVE_DOWN_LEFT (1 << 7)
169
+ #define SHIM_ROT_MOVE_DOWN_CCW SHIM_ROT_MOVE_DOWN_LEFT
170
+ #define SHIM_ROT_MOVE_DOWN_RIGHT (1 << 8)
171
+ #define SHIM_ROT_MOVE_DOWN_CW SHIM_ROT_MOVE_DOWN_RIGHT
172
+ #define SHIM_ROT_SPEED_NOCHANGE (-1)
173
+
174
+ #define SHIM_ROT_RESET_ALL 1
175
+ #define SHIM_ROT_LEVEL_SPEED (1ULL << 0)
176
+
177
+ #define SHIM_ROT_STATUS_NONE 0
178
+ #define SHIM_ROT_STATUS_BUSY (1 << 0)
179
+ #define SHIM_ROT_STATUS_MOVING (1 << 1)
180
+ #define SHIM_ROT_STATUS_MOVING_AZ (1 << 2)
181
+ #define SHIM_ROT_STATUS_MOVING_LEFT (1 << 3)
182
+ #define SHIM_ROT_STATUS_MOVING_RIGHT (1 << 4)
183
+ #define SHIM_ROT_STATUS_MOVING_EL (1 << 5)
184
+ #define SHIM_ROT_STATUS_MOVING_UP (1 << 6)
185
+ #define SHIM_ROT_STATUS_MOVING_DOWN (1 << 7)
186
+ #define SHIM_ROT_STATUS_LIMIT_UP (1 << 8)
187
+ #define SHIM_ROT_STATUS_LIMIT_DOWN (1 << 9)
188
+ #define SHIM_ROT_STATUS_LIMIT_LEFT (1 << 10)
189
+ #define SHIM_ROT_STATUS_LIMIT_RIGHT (1 << 11)
190
+ #define SHIM_ROT_STATUS_OVERLAP_UP (1 << 12)
191
+ #define SHIM_ROT_STATUS_OVERLAP_DOWN (1 << 13)
192
+ #define SHIM_ROT_STATUS_OVERLAP_LEFT (1 << 14)
193
+ #define SHIM_ROT_STATUS_OVERLAP_RIGHT (1 << 16)
151
194
 
152
195
  /* Rig type mask and types */
153
196
  #define SHIM_RIG_TYPE_MASK 0x7F000000
@@ -293,6 +336,68 @@ typedef struct {
293
336
  int rig_type;
294
337
  } shim_rig_info_t;
295
338
 
339
+ typedef struct {
340
+ unsigned int rot_model;
341
+ const char* model_name;
342
+ const char* mfg_name;
343
+ const char* version;
344
+ int status;
345
+ int rot_type;
346
+ } shim_rot_info_t;
347
+
348
+ #define SHIM_CONF_NAME_MAX 64
349
+ #define SHIM_CONF_LABEL_MAX 128
350
+ #define SHIM_CONF_TOOLTIP_MAX 256
351
+ #define SHIM_CONF_DEFAULT_MAX 128
352
+ #define SHIM_CONF_COMBO_MAX 16
353
+ #define SHIM_CONF_COMBO_VALUE_MAX 64
354
+ #define SHIM_PORT_TYPE_MAX 32
355
+ #define SHIM_PARITY_MAX 32
356
+ #define SHIM_HANDSHAKE_MAX 32
357
+
358
+ typedef struct {
359
+ int token;
360
+ char name[SHIM_CONF_NAME_MAX];
361
+ char label[SHIM_CONF_LABEL_MAX];
362
+ char tooltip[SHIM_CONF_TOOLTIP_MAX];
363
+ char dflt[SHIM_CONF_DEFAULT_MAX];
364
+ int type;
365
+ double numeric_min;
366
+ double numeric_max;
367
+ double numeric_step;
368
+ int combo_count;
369
+ char combo_options[SHIM_CONF_COMBO_MAX][SHIM_CONF_COMBO_VALUE_MAX];
370
+ } shim_confparam_info_t;
371
+
372
+ typedef struct {
373
+ char port_type[SHIM_PORT_TYPE_MAX];
374
+ int serial_rate_min;
375
+ int serial_rate_max;
376
+ int serial_data_bits;
377
+ int serial_stop_bits;
378
+ char serial_parity[SHIM_PARITY_MAX];
379
+ char serial_handshake[SHIM_HANDSHAKE_MAX];
380
+ int write_delay;
381
+ int post_write_delay;
382
+ int timeout;
383
+ int retry;
384
+ } shim_rig_port_caps_t;
385
+
386
+ typedef struct {
387
+ int rot_type;
388
+ double min_az;
389
+ double max_az;
390
+ double min_el;
391
+ double max_el;
392
+ uint64_t has_get_level;
393
+ uint64_t has_set_level;
394
+ uint64_t has_get_func;
395
+ uint64_t has_set_func;
396
+ uint64_t has_get_parm;
397
+ uint64_t has_set_parm;
398
+ int has_status;
399
+ } shim_rot_caps_t;
400
+
296
401
  typedef struct {
297
402
  int id;
298
403
  char name[64];
@@ -331,6 +436,10 @@ typedef int (*shim_spectrum_cb_t)(void* handle, const shim_spectrum_line_t* line
331
436
 
332
437
  /* Rig list callback: (info, data) -> int */
333
438
  typedef int (*shim_rig_list_cb_t)(const shim_rig_info_t* info, void* data);
439
+ /* Rotator list callback: (info, data) -> int */
440
+ typedef int (*shim_rot_list_cb_t)(const shim_rot_info_t* info, void* data);
441
+ /* Rig config callback: (info, data) -> int */
442
+ typedef int (*shim_rig_cfg_cb_t)(const shim_confparam_info_t* info, void* data);
334
443
 
335
444
  /* ===== Lifecycle functions ===== */
336
445
 
@@ -347,12 +456,27 @@ SHIM_API int shim_rig_get_debug(void);
347
456
  SHIM_API const char* shim_rig_get_version(void);
348
457
  SHIM_API int shim_rig_load_all_backends(void);
349
458
  SHIM_API int shim_rig_list_foreach(shim_rig_list_cb_t cb, void* data);
459
+ SHIM_API int shim_rig_cfgparams_foreach(hamlib_shim_handle_t h, shim_rig_cfg_cb_t cb, void* data);
460
+ SHIM_API int shim_rig_get_port_caps(hamlib_shim_handle_t h, shim_rig_port_caps_t* out_caps);
350
461
  SHIM_API const char* shim_rig_strstatus(int status);
462
+ SHIM_API hamlib_shim_handle_t shim_rot_init(unsigned int model);
463
+ SHIM_API int shim_rot_open(hamlib_shim_handle_t h);
464
+ SHIM_API int shim_rot_close(hamlib_shim_handle_t h);
465
+ SHIM_API int shim_rot_cleanup(hamlib_shim_handle_t h);
466
+ SHIM_API int shim_rot_load_all_backends(void);
467
+ SHIM_API int shim_rot_list_foreach(shim_rot_list_cb_t cb, void* data);
468
+ SHIM_API int shim_rot_cfgparams_foreach(hamlib_shim_handle_t h, shim_rig_cfg_cb_t cb, void* data);
469
+ SHIM_API int shim_rot_get_port_caps(hamlib_shim_handle_t h, shim_rig_port_caps_t* out_caps);
470
+ SHIM_API int shim_rot_get_caps(hamlib_shim_handle_t h, shim_rot_caps_t* out_caps);
471
+ SHIM_API const char* shim_rot_strstatus(int status);
472
+ SHIM_API const char* shim_rot_type_str(int rot_type);
351
473
 
352
474
  /* ===== Port configuration (before open) ===== */
353
475
 
354
476
  SHIM_API void shim_rig_set_port_path(hamlib_shim_handle_t h, const char* path);
355
477
  SHIM_API void shim_rig_set_port_type(hamlib_shim_handle_t h, int type);
478
+ SHIM_API void shim_rot_set_port_path(hamlib_shim_handle_t h, const char* path);
479
+ SHIM_API void shim_rot_set_port_type(hamlib_shim_handle_t h, int type);
356
480
 
357
481
  /* Serial port configuration */
358
482
  SHIM_API void shim_rig_set_serial_rate(hamlib_shim_handle_t h, int rate);
@@ -550,6 +674,39 @@ SHIM_API int shim_rig_mW2power(hamlib_shim_handle_t h, float* power, unsigned in
550
674
  /* ===== Reset ===== */
551
675
 
552
676
  SHIM_API int shim_rig_reset(hamlib_shim_handle_t h, int reset_type);
677
+ SHIM_API int shim_rot_set_position(hamlib_shim_handle_t h, double azimuth, double elevation);
678
+ SHIM_API int shim_rot_get_position(hamlib_shim_handle_t h, double* azimuth, double* elevation);
679
+ SHIM_API int shim_rot_stop(hamlib_shim_handle_t h);
680
+ SHIM_API int shim_rot_park(hamlib_shim_handle_t h);
681
+ SHIM_API int shim_rot_reset(hamlib_shim_handle_t h, int reset_type);
682
+ SHIM_API int shim_rot_move(hamlib_shim_handle_t h, int direction, int speed);
683
+ SHIM_API const char* shim_rot_get_info(hamlib_shim_handle_t h);
684
+ SHIM_API int shim_rot_get_status(hamlib_shim_handle_t h, int* status);
685
+ SHIM_API int shim_rot_set_conf(hamlib_shim_handle_t h, const char* name, const char* val);
686
+ SHIM_API int shim_rot_get_conf(hamlib_shim_handle_t h, const char* name, char* buf, int buflen);
687
+ SHIM_API uint64_t shim_rot_get_caps_has_get_level(hamlib_shim_handle_t h);
688
+ SHIM_API uint64_t shim_rot_get_caps_has_set_level(hamlib_shim_handle_t h);
689
+ SHIM_API uint64_t shim_rot_get_caps_has_get_func(hamlib_shim_handle_t h);
690
+ SHIM_API uint64_t shim_rot_get_caps_has_set_func(hamlib_shim_handle_t h);
691
+ SHIM_API uint64_t shim_rot_get_caps_has_get_parm(hamlib_shim_handle_t h);
692
+ SHIM_API uint64_t shim_rot_get_caps_has_set_parm(hamlib_shim_handle_t h);
693
+ SHIM_API int shim_rot_set_level_f(hamlib_shim_handle_t h, uint64_t level, float value);
694
+ SHIM_API int shim_rot_set_level_i(hamlib_shim_handle_t h, uint64_t level, int value);
695
+ SHIM_API int shim_rot_get_level_f(hamlib_shim_handle_t h, uint64_t level, float* value);
696
+ SHIM_API int shim_rot_get_level_i(hamlib_shim_handle_t h, uint64_t level, int* value);
697
+ SHIM_API int shim_rot_get_level_auto(hamlib_shim_handle_t h, uint64_t level, double* value);
698
+ SHIM_API int shim_rot_set_func(hamlib_shim_handle_t h, uint64_t func, int enable);
699
+ SHIM_API int shim_rot_get_func(hamlib_shim_handle_t h, uint64_t func, int* state);
700
+ SHIM_API int shim_rot_set_parm_f(hamlib_shim_handle_t h, uint64_t parm, float value);
701
+ SHIM_API int shim_rot_set_parm_i(hamlib_shim_handle_t h, uint64_t parm, int value);
702
+ SHIM_API int shim_rot_get_parm_f(hamlib_shim_handle_t h, uint64_t parm, float* value);
703
+ SHIM_API int shim_rot_get_parm_i(hamlib_shim_handle_t h, uint64_t parm, int* value);
704
+ SHIM_API uint64_t shim_rot_parse_level(const char* level_str);
705
+ SHIM_API uint64_t shim_rot_parse_func(const char* func_str);
706
+ SHIM_API uint64_t shim_rot_parse_parm(const char* parm_str);
707
+ SHIM_API const char* shim_rot_strlevel(uint64_t level);
708
+ SHIM_API const char* shim_rot_strfunc(uint64_t func);
709
+ SHIM_API const char* shim_rot_strparm(uint64_t parm);
553
710
 
554
711
  /* ===== Callbacks ===== */
555
712