-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheasycomm-parser-types.h
608 lines (557 loc) · 14.7 KB
/
easycomm-parser-types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
#pragma once
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Commandos are issued by the host to the controller.
*
* Easycomm 1, 2 and 3 references:
* - description https://github.com/Hamlib/Hamlib/blob/master/rotators/easycomm/easycomm.txt
* - implementation details https://github.com/Hamlib/Hamlib/blob/master/rotators/easycomm/easycomm.c
*/
#include "easycomm-types.h"
#include <inttypes.h>
#include <stdbool.h>
/**
* command: single line
* meaning: get AZ, EL, UP frequency, DN frequency, UP mode and DN mode
* example: "AZnnn.n ELnnn.n UPnnnnnnnnn UUU DNnnnnnnnnn DDD"
* standard: Easycomm 1
*/
typedef struct EasycommSingleLine
{
EasycommCommandId commandId;
float azimuth;
float elevation;
EasycommFrequency uplinkFrequency;
EasycommFrequency downlinkFrequency;
char modeUp[4];
char modeDown[4];
} EasycommSingleLine;
/**
* command: AZ
* meaning: set azimuth in [deg]
* example: "AZnnn.n"
* standard: Easycomm 2
*/
typedef struct EasycommSetAzimuth
{
EasycommCommandId commandId;
float azimuth;
} EasycommSetAzimuth;
/**
* command: AZ
* meaning: get azimuth in [deg]
* example: "AZ"
* standard: Easycomm 2
*/
typedef struct EasycommGetAzimuth
{
EasycommCommandId commandId;
} EasycommGetAzimuth;
/**
* command: EL
* meaning: set elevation in [deg]
* example: "ELnnn.n"
* standard: Easycomm 2
*/
typedef struct EasycommSetElevation
{
EasycommCommandId commandId;
float elevation;
} EasycommSetElevation;
/**
* command: EL
* meaning: get elevation in [deg]
* example: "EL"
* standard: Easycomm 2
*/
typedef struct EasycommGetElevation
{
EasycommCommandId commandId;
float elevation;
} EasycommGetElevation;
/**
* command: UP
* meaning: set uplink frequency in [Hz]
* example: "UPnnnnnnnnn"
* standard: Easycomm 2
*/
typedef struct EasycommSetUplinkFrequency
{
EasycommCommandId commandId;
EasycommFrequency frequency;
} EasycommSetUplinkFrequency;
/**
* command: UP
* meaning: get uplink frequency in [Hz]
* example: "UP"
* standard: Easycomm 2
*/
typedef struct EasycommGetUplinkFrequency
{
EasycommCommandId commandId;
} EasycommGetUplinkFrequency;
/**
* command: DN
* meaning: set downlink frequeny in [Hz]
* example: "DNnnnnnnnnn"
* standard: Easycomm 2
*/
typedef struct EasycommSetDownlinkFrequency
{
EasycommCommandId commandId;
EasycommFrequency frequency;
} EasycommSetDownlinkFrequency;
/**
* command: DN
* meaning: get downlink frequeny in [Hz]
* example: "DN"
* standard: Easycomm 2
*/
typedef struct EasycommGetDownlinkFrequency
{
EasycommCommandId commandId;
} EasycommGetDownlinkFrequency;
/**
* command: UM
* meaning: set uplink mode as string
* example: "UMccc"
* standard: Easycomm 2
*/
typedef struct EasycommSetUplinkMode
{
EasycommCommandId commandId;
char mode[4];
} EasycommSetUplinkMode;
/**
* command: UM
* meaning: get uplink mode as string
* example: "UM"
* standard: Easycomm 2
*/
typedef struct EasycommGetUplinkMode
{
EasycommCommandId commandId;
} EasycommGetUplinkMode;
/**
* command: DM
* meaning: set downlink mode as string
* examples: "DMccc"
* standard: Easycomm 2
*/
typedef struct EasycommSetDownlinkMode
{
EasycommCommandId commandId;
char mode[4];
} EasycommSetDownlinkMode;
/**
* command: DM
* meaning: get downlink mode as string
* examples: "DM"
* standard: Easycomm 2
*/
typedef struct EasycommGetDownlinkMode
{
EasycommCommandId commandId;
} EasycommGetDownlinkMode;
/**
* command: DR
* meaning: set downlink radio number
* example: "DRnnn"
* standard: Easycomm 2
*/
typedef struct EasycommSetDownlinkRadio
{
EasycommCommandId commandId;
uint16_t number;
} EasycommSetDownlinkRadio;
/**
* command: DR
* meaning: get downlink radio number
* example: "DR"
* standard: Easycomm 2
*/
typedef struct EasycommGetDownlinkRadio
{
EasycommCommandId commandId;
} EasycommGetDownlinkRadio;
/**
* command: UR
* meaning: set uplink radio number
* example: "URnnn"
* standard: Easycomm 2
*/
typedef struct EasycommSetUplinkRadio
{
EasycommCommandId commandId;
uint16_t number;
} EasycommSetUplinkRadio;
/**
* command: UR
* meaning: get uplink radio number
* example: "UR"
* standard: Easycomm 2
*/
typedef struct EasycommGetUplinkRadio
{
EasycommCommandId commandId;
} EasycommGetUplinkRadio;
/**
* command: ML
* meaning: move left
* example: "ML"
* standard: Easycomm 2
*/
typedef struct EasycommDoMoveLeft
{
EasycommCommandId commandId;
} EasycommDoMoveLeft;
/**
* command: MR
* meaning: move right
* example: "MR"
* standard: Easycomm 2
*/
typedef struct EasycommDoMoveRight
{
EasycommCommandId commandId;
} EasycommDoMoveRight;
/**
* command: MU
* meaning: move up
* example: "MU"
* standard: Easycomm 2
*/
typedef struct EasycommDoMoveUp
{
EasycommCommandId commandId;
} EasycommDoMoveUp;
/**
* command: MD
* meaning: move down
* example: "MD"
* standard: Easycomm 2
*/
typedef struct EasycommDoMoveDown
{
EasycommCommandId commandId;
} EasycommDoMoveDown;
/**
* command: SA
* meaning: stop azimuth movement
* example: "SA"
* standard: Easycomm 2
*/
typedef struct EasycommDoStopAzimuthMove
{
EasycommCommandId commandId;
} EasycommDoStopAzimuthMove;
/**
* command: SE
* meaning: stop elevation movement
* example: "SE"
* standard: Easycomm 2
*/
typedef struct EasycommDoStopElevationMove
{
EasycommCommandId commandId;
} EasycommDoStopElevationMove;
/**
* command: AO
* meaning: acquisition of signal (AOS, TODO: bearing, elevation, signal or time?)
* example: "AO"
* standard: Easycomm 2
*/
typedef struct EasycommAcquisitionOfSignal
{
EasycommCommandId commandId;
} EasycommAcquisitionOfSignal;
/**
* command: LO
* meaning: acquisition of signal (LOS, TODO: bearing, elevation, signal or time?)
* example: "LO"
* standard: Easycomm 2
*/
typedef struct EasycommLossOfSignal
{
EasycommCommandId commandId;
} EasycommLossOfSignal;
/**
* command: OP
* meaning: set digital output [0|1]
* example: "OPnnn,b"
* standard: Easycomm 2
*/
typedef struct EasycommSetDigitalOutput
{
EasycommCommandId commandId;
uint16_t number;
bool value;
} EasycommSetDigitalOutput;
/**
* command: IP
* meaning: read digital input, [0|1]
* example: "IPnnn"
* standard: Easycomm 2
*/
typedef struct EasycommGetDigitalInput
{
EasycommCommandId commandId;
uint16_t number;
} EasycommGetDigitalInput;
/**
* command: AN
* meaning: read analogue input, raw value [0-n]
* example: "ANnnn"
* standard: Easycomm 2
*/
typedef struct EasycommGetAnalogueInput
{
EasycommCommandId commandId;
uint16_t number;
} EasycommGetAnalogueInput;
/**
* command: ST
* meaning: set current time [y]{1,2}:[m]{1,2}:[d]{1,2}:[M]{1,2}:[h]{1,2}:[s]{1,2}
* example: "STyy:mm:dd:hh:MM:ss"
* standard: Easycomm 2
*/
typedef struct EasycommSetTime
{
EasycommCommandId commandId;
uint8_t year;
uint8_t month;
uint8_t day;
uint8_t hour;
uint8_t minute;
uint8_t second;
} EasycommSetTime;
/**
* command: ST
* meaning: Get current time [y]{1,2}:[m]{1,2}:[d]{1,2}:[M]{1,2}:[h]{1,2}:[s]{1,2}
* example: "ST"
* standard: Easycomm 2
*/
typedef struct EasycommGetTime
{
EasycommCommandId commandId;
} EasycommGetTime;
/**
* command: VE
* meaning: request version
* example: "VE"
* standard: Easycomm 2
*/
typedef struct EasycommGetVersion
{
EasycommCommandId commandId;
} EasycommGetVersion;
/**
* command: VL
* meaning: set velocity for left movement [deg*10^-3/sec]
* example: "VLnnn"
* standard: Easycomm 3
*/
typedef struct EasycommSetVelocityLeft
{
EasycommCommandId commandId;
uint16_t milliDegSecond;
} EasycommSetVelocityLeft;
/**
* command: VL
* meaning: get velocity for left movement [deg*10^-3/sec]
* example: "VL"
* standard: Easycomm 3
*/
typedef struct EasycommGetVelocityLeft
{
EasycommCommandId commandId;
} EasycommGetVelocityLeft;
/**
* command: VR
* meaning: set velocity for right movement [deg*10^-3/sec]
* example: "VRnnn"
* standard: Easycomm 3
*/
typedef struct EasycommSetVelocityRight
{
EasycommCommandId commandId;
uint16_t milliDegSecond;
} EasycommSetVelocityRight;
/**
* command: VR
* meaning: get velocity for right movement [deg*10^-3/sec]
* example: "VR"
* standard: Easycomm 3
*/
typedef struct EasycommGetVelocityRight
{
EasycommCommandId commandId;
} EasycommGetVelocityRight;
/**
* command: VU
* meaning: set velocity for up movement [deg*10^-3/sec]
* example: "VUnnn"
* standard: Easycomm 3
*/
typedef struct EasycommSetVelocityUp
{
EasycommCommandId commandId;
uint16_t milliDegSecond;
} EasycommSetVelocityUp;
/**
* command: VU
* meaning: get velocity for up movement [deg*10^-3/sec]
* example: "VU"
* standard: Easycomm 3
*/
typedef struct EasycommGetVelocityUp
{
EasycommCommandId commandId;
} EasycommGetVelocityUp;
/**
* command: VD
* meaning: set velocity for down movement [deg*10^-3/sec]
* example: "VDnnn"
* standard: Easycomm 3
*/
typedef struct EasycommSetVelocityDown
{
EasycommCommandId commandId;
uint16_t milliDegSecond;
} EasycommSetVelocityDown;
/**
* command: VD
* meaning: set velocity for down movement [deg*10^-3/sec]
* example: "VDnnn"
* standard: Easycomm 3
*/
typedef struct EasycommGetVelocityDown
{
EasycommCommandId commandId;
} EasycommGetVelocityDown;
/**
* command: CR
* meaning: read configuration value from register
* example: "CRnnn"
* standard: Easycomm 3
*/
typedef struct EasycommGetConfigRegister
{
EasycommCommandId commandId;
uint16_t registerNumber;
} EasycommGetConfigRegister;
/**
* command: CW
* meaning: write configuration value to register
* example: "CWnnn,nnn"
* standard: Easycomm 3
*/
typedef struct EasycommSetConfigRegister
{
EasycommCommandId commandId;
uint16_t registerNumber;
EasycommConfigRegisterValue value;
} EasycommSetConfigRegister;
/**
* command: GS
* meaning: get status register
* example: "GS"
* standard: Easycomm 3
*/
typedef struct EasycommGetStatusRegister
{
EasycommCommandId commandId;
} EasycommGetStatusRegister;
/**
* command: GE
* meaning: get error register
* example: "GE"
* standard: Easycomm 3
*/
typedef struct EasycommGetErrorRegister
{
EasycommCommandId commandId;
} EasycommGetErrorRegister;
/**
* command: RESET
* meaning: reset
* example: "RESET"
* standard: Easycomm ?
*/
typedef struct EasycommDoReset
{
EasycommCommandId commandId;
} EasycommDoReset;
/**
* command: PARK
* meaning: park
* example: "PARK"
* standard: Easycomm ?
*/
typedef struct EasycommDoPark
{
EasycommCommandId commandId;
} EasycommDoPark;
/*!
* Convenience union for cast in between message types.
*/
typedef union EasycommPayload
{
EasycommCommandId commandId;
EasycommSingleLine singleLine;
EasycommSetAzimuth setAzimuth;
EasycommGetAzimuth getAzimuth;
EasycommSetElevation setElevation;
EasycommGetElevation getElevation;
EasycommSetUplinkFrequency setUplinkFrequency;
EasycommGetUplinkFrequency getUplinkFrequency;
EasycommSetDownlinkFrequency setDownlinkFrequency;
EasycommGetDownlinkFrequency getDownlinkFrequency;
EasycommSetUplinkMode setUplinkMode;
EasycommGetUplinkMode getUplinkMode;
EasycommSetDownlinkMode setDownlinkMode;
EasycommGetDownlinkMode getDownlinkMode;
EasycommSetUplinkRadio setUplinkRadio;
EasycommGetUplinkRadio getUplinkRadio;
EasycommSetDownlinkRadio setDownlinkRadio;
EasycommGetDownlinkRadio getDownlinkRadio;
EasycommDoMoveLeft doMoveLeft;
EasycommDoMoveRight doMoveRight;
EasycommDoMoveUp doMoveUp;
EasycommDoMoveDown doMoveDown;
EasycommDoStopAzimuthMove doStopAzimuthMove;
EasycommDoStopElevationMove doStopElevationMove;
EasycommAcquisitionOfSignal acquisitionOfSignal;
EasycommLossOfSignal lossOfSignal;
EasycommSetDigitalOutput setDigitalOutput;
EasycommGetDigitalInput getDigitalInput;
EasycommGetAnalogueInput getAnalogueInput;
EasycommSetTime setTime;
EasycommGetTime getTime;
EasycommGetVersion getVersion;
EasycommSetVelocityLeft setVelocityLeft;
EasycommGetVelocityLeft getVelocityLeft;
EasycommSetVelocityRight setVelocityRight;
EasycommGetVelocityRight getVelocityRight;
EasycommSetVelocityUp setVelocityUp;
EasycommGetVelocityUp getVelocityUp;
EasycommSetVelocityDown setVelocityDown;
EasycommGetVelocityDown getVelocityDown;
EasycommGetConfigRegister getConfigRegister;
EasycommSetConfigRegister setConfigRegister;
EasycommGetStatusRegister getStatusRegister;
EasycommGetErrorRegister getErrorRegister;
EasycommDoReset doReset;
EasycommDoPark doPark;
} EasycommPayload;
typedef union EasycommData
{
EasycommCommandId commandId;
EasycommPayload as;
} EasycommData;
#ifdef __cplusplus
}
#endif