1ROTCTLD(8)                  Rotator Control Daemon                  ROTCTLD(8)
2
3
4

NAME

6       rotctld - Hamlib TCP rotator control daemon
7

SYNOPSIS

9       rotctld [OPTION]...
10

DESCRIPTION

12       The  rotctld  program is an NEW Hamlib rotator control daemon ready for
13       testing that handles client requests via TCP sockets. This allows  mul‐
14       tiple user programs to share one rotator (this needs testing). Multiple
15       rotators can be controlled on different TCP ports by  use  of  multiple
16       rotctld  processes.  The syntax of the commands are the same as rotctl.
17       It is hoped that rotctld will be especially useful for  client  authors
18       using languages such as Perl, Python, PHP, and others.
19
20       rotctld  communicates  to a client through a TCP socket using text com‐
21       mands shared with rotctl. The protocol is simple, commands are sent  to
22       rotctld  on  one  line  and rotctld responds to "get" commands with the
23       requested values, one per line, when successful, otherwise, it responds
24       with  one  line  "RPTR  x", where x is a negative number indicating the
25       error code.  Commands that do not return values respond with  the  line
26       "RPTR x", where x is zero when successful, otherwise is a regative num‐
27       ber indicating the error code.  Each line is terminated with a  newline
28       '\n'  character.   This protocol is primarily for use by the NET rotctl
29       (rot model 2) backend.
30
31       A separate Extended Response protocol extends  the  above  behavior  by
32       echoing the received command string as a header, any returned values as
33       a key: value pair, and the "RPTR x"  string  as  the  end  of  response
34       marker  which  includes  the  Hamlib success or failure value.  See the
35       PROTOCOL section for details.  Consider using this protocol for clients
36       that will interact with rotctld directly through a TCP socket.
37
38       Keep  in mind that Hamlib is BETA level software.  While a lot of back‐
39       end libraries lack complete rotator support, the  basic  functions  are
40       usually  well supported.  The API may change without publicized notice,
41       while an advancement of the minor version (e.g. 1.1.x to  1.2.x)  indi‐
42       cates such a change.
43
44       Please  report bugs and provide feedback at the e-mail address given in
45       the REPORTING BUGS section.  Patches and  code  enhancements  are  also
46       welcome.
47

OPTIONS

49       This  program  follows  the  usual  GNU  command line syntax, with long
50       options starting with two dashes ('-').
51
52       Here is a summary of the supported options:
53
54       -m, --model=id
55              Select rotator model number. See -l, "list" option below.
56
57       -r, --rot-file=device
58              Use device as the file name of the  port  the  rotator  is  con‐
59              nected.   Often  a  serial  port,  but  could be a USB to serial
60              adapter or USB port device.  Typically  /dev/ttyS0,  /dev/ttyS1,
61              /dev/ttyUSB0, etc.
62
63              Default  is  /dev/rotator  (may be a symbolic link to the actual
64              device).
65
66       -s, --serial-speed=baud
67              Set serial speed to baud rate. Uses maximum  serial  speed  from
68              rotor backend capabilities (set by -m above) as the default.
69
70       -T, --listen-addr=IPADDR
71              Use IPADDR as the listening IP address. The default is ANY.
72
73       -t, --port=number
74              Use number as the TCP listening port. The default is 4533.
75
76              N.B.:  As rigctld's default port is 4532, it is advisable to use
77              odd numbered ports for rotctld, e.g. 4533, 4535, 4537, etc.
78
79       -L, --show-conf
80              List all config parameters  for  the  rotator  defined  with  -m
81              above.
82
83       -C, --set-conf=parm=val[,parm=val]*
84              Set config parameter.  e.g. --set-conf=stop_bits=2
85
86              Use -L option for a list.
87
88       -l, --list
89              List all model numbers defined in Hamlib and exit.
90
91       -u, --dump-caps
92              Dump capabilities for the radio defined with -m above and exit.
93
94       -e, --end-marker
95              Use END marker in rotctld protocol.
96
97              N.B.:  This  option  should be considered obsolete.  Please con‐
98              sider using the Extended Response protocol instead (see PROTOCOL
99              below).  This option will be removed in a future Hamlib release.
100
101       -v, --verbose
102              Set verbose mode, cumulative (see DIAGNOSTICS below).
103
104       -h, --help
105              Show a summary of these options and exit.
106
107       -V, --version
108              Show the version of rotctld and exit.
109
110       N.B.  Some  options  may not be implemented by a given backend and will
111       return an error.  This is most likely to occur with the --set-conf  and
112       --show-conf options.
113
114       Please  note  that the backend for the rotator to be controlled, or the
115       rotator itself may not support some commands. In that case, the  opera‐
116       tion will fail with a Hamlib error code.
117

COMMANDS

119       Commands can be sent over the TCP socket either as a single char, or as
120       a long command name plus the value(s) space separated on one '\n'  ter‐
121       minated line. See PROTOCOL.
122
123       Since  most  of  the  Hamlib operations have a set and a get method, an
124       upper case letter will be used for set methods whereas the  correspond‐
125       ing  lower  case  letter refers to the get method.  Each operation also
126       has a long name; prepend a backslash to send a long command name.
127
128       Example (Perl):  `print  $socket  "\\dump_caps\n";'  to  see  what  the
129       rotor's  backend  can  do (NOTE: In Perl and many other languages a '\'
130       will need to be escaped with a preceding '\' so that  even  though  two
131       backslash  characters  appear  in  the code, only one will be passed to
132       rotctld.  This is a possible bug, beware!).
133
134       Please note that the backend for the rotator to be controlled,  or  the
135       rotator  itself may not support some commands. In that case, the opera‐
136       tion will fail with a Hamlib error message.
137
138       Here is a summary of the supported commands (In the case of "set"  com‐
139       mands  the  quoted  string is replaced by the value in the description.
140       In the case of "get" commands the quoted string is the key name of  the
141       value returned.):
142
143       P, set_pos 'Azimuth' 'Elevation'
144              Set position: Azimuth and Elevation as double precision floating
145              point values.
146
147       p, get_pos
148              Get position: 'Azimuth'  and  'Elevation'  as  double  precision
149              floating point values.
150
151       M, move 'Direction' 'Speed'
152              Move the rotator in a specific direction at the given rate.
153
154              Values  are  integers  where Direction is defined as 2 = Up, 4 =
155              Down, 8 = Left, and 16 = Right.  Speed is an integer  between  1
156              and  100.   Not all backends that implement the move command use
157              the Speed value.  At this time  only  the  gs232a  utilizes  the
158              Speed parameter.
159
160       S, stop
161              Stop the rotator.
162
163       K, park
164              Park the antenna.
165
166       C, set_conf 'Token' 'Value'
167              Set Token to Value.
168
169              Backend dependent.  Needs testing.
170
171       R, reset 'Reset'
172              Reset the rotator.
173
174              Integer value of '1' for Reset All.
175
176       _, get_info
177              Get misc information about the rotator.
178
179              At the moment returns 'Model Name'.
180
181       w, send_cmd 'Cmd'
182              Send raw command string to rotator.
183
184              For  binary  protocols  enter  values  as  \0xAA\0xBB.  Expect a
185              'Reply' from the rotator which will likely be a binary block  or
186              an ASCII string.
187
188       Locator Commands
189
190       These  commands  offer  conversions of Degrees Minutes Seconds to other
191       formats, Maidenhead square locator conversions and distance and azimuth
192       conversions.
193
194       L, lonlat2loc 'Longitude' 'Latitude' 'Loc Len [2-12]'
195              Returns  the  Maidenhead  locator  for the given 'Longitude' and
196              'Latitude'.
197
198              Both are floating point values.  The precision of  the  returned
199              square  is  controlled by 'Loc Len' which should be an even num‐
200              bered integer value between 2 and 12.
201
202              For example, "+L -170.000000 -85.000000 12\n" returns  "Locator:
203              AA55AA00AA00\n".
204
205       l, loc2lonlat 'Locator'
206              Returns  'Longitude'  and  'Latitude'  in decimal degrees at the
207              approximate center of the requested grid square (despite the use
208              of  double  precision  variables internally, some rounding error
209              occurs).  West longitude  is  expressed  as  a  negative  value.
210              South latitude is expressed as a negative value.  Locator can be
211              from 2 to 12 characters in length.
212
213              For   example,   "+l   AA55AA00AA00\n"    returns    "Longitude:
214              -169.999983\nLatitude: -84.999991\n".
215
216       D, dms2dec 'Degrees' 'Minutes' 'Seconds' 'S/W'
217              Returns 'Dec Degrees', a signed floating point value.
218
219              Degrees and Minutes are integer values and Seconds is a floating
220              point value.  S/W is a flag with '1' indicating  South  latitude
221              or  West  longitude and '0' North or East (the flag is needed as
222              computers don't recognize a signed zero  even  though  only  the
223              Degrees value only is typically signed in DMS notation).
224
225       d, dec2dms 'Dec Degrees'
226              Returns 'Degrees' 'Minutes' 'Seconds' 'S/W'.
227
228              Values are as in dms2dec above.
229
230       E, dmmm2dec 'Degrees' 'Dec Minutes' 'S/W'
231              Returns 'Dec Degrees', a signed floating point value.
232
233              Degrees  is  an  integer  value  and Minutes is a floating point
234              value.  S/W is a flag with '1' indicating South latitude or West
235              longitude and '0' North or East (the flag is needed as computers
236              don't recognize a signed zero even though only the Degrees value
237              only is typically signed in DMS notation).
238
239       e, dec2dmmm 'Dec Deg'
240              Returns 'Degrees' 'Minutes' 'S/W'.
241
242              Values are as in dmmm2dec above.
243
244       B, qrb 'Lon 1' 'Lat 1' 'Lon 2' 'Lat 2'
245              Returns 'Distance' 'Azimuth' where Distance is in km and Azimuth
246              is in degrees.
247
248              All Lon/Lat values are signed floating point numbers.
249
250       A, a_sp2a_lp 'Short Path Deg'
251              Returns 'Long Path Deg' or -RIG_EINVAL upon input error..
252
253              Both are floating point values within the range 0.00 to 360.00.
254
255       a, d_sp2d_lp 'Short Path km'
256              Returns 'Long Path km'.
257
258              Both are floating point values.
259

PROTOCOL

261       Default Protocol
262
263       The rotctld protocol is intentionally simple. Commands are entered on a
264       single  line  with  any  needed  values.  In Perl, reliable results are
265       obtained by terminating each command string with a  newline  character,
266       '\n'.
267
268       Example set (Perl code):
269
270       print $socket "P 135 10\n";
271
272       print $socket "\\set_pos 135 10\n";   # escape leading '\'
273
274       A one line response will be sent as a reply to set commands, "RPTR x\n"
275       where x is the Hamlib error code with '0'  indicating  success  of  the
276       command.
277
278       Responses  from rotctld get commands are text values and match the same
279       tokens used in the set commands. Each value  is  returned  on  its  own
280       line.  On error the string "RPTR x\n" is returned where x is the Hamlib
281       error code.
282
283       Example get (Perl code):
284
285       print $socket "p\n";
286       "135"
287       "10"
288
289       Most get functions return one to three values. A notable  exception  is
290       the \dump_caps function which returns many lines of key:value pairs.
291
292       This  protocol  is  primarily  used  by the NET rotctl (rotctl model 2)
293       backend which allows applications already written for Hamlib's C API to
294       take  advantage  of  rotctld  without the need of rewriting application
295       code.  An application's user can select rotor model  2  ("NET  rotctl")
296       and   then  set  rot_pathname  to  "localhost:4533"  or  other  network
297       host:port.
298
299       Extended Response Protocol
300
301       An EXPERIMENTAL Extended Response protocol  has  been  introduced  into
302       rotctld  as  of February 10, 2010.  This protocol adds several rules to
303       the strings returned by rotctld and adds a rule for the command syntax.
304
305       1. The command received by rotctld is echoed with its long command name
306       followed  by  the value(s) (if any) received from the client terminated
307       by the  specified  response  separator  as  the  first  record  of  the
308       response.
309
310       2.  The  last  record of each block is the string "RPTR x\n" where x is
311       the numeric return value of the Hamlib backend function that was called
312       by the command.
313
314       3.  Any records consisting of data values returned by the rotor backend
315       are prepended by a string immediately followed by a colon then a  space
316       and then the value terminated by the response separator. e.g. "Azimuth:
317       90.000000\n" when the command was prepended by '+'.
318
319       4. All commands received will be acknowledged by rotctld  with  records
320       from  rules  1  and 2.  Records from rule 3 are only returned when data
321       values must be returned to the client.
322
323       An example response to a +P command (note the prepended '+'):
324
325       $ echo "+P 90 45" | nc -w 1 localhost 4533
326       set_pos: 90 45
327       RPRT 0
328
329       In this case the long command name and values are returned on the first
330       line  and  the  second  line  contains  the end of block marker and the
331       numeric rig backend return value indicating success.
332
333       An example response to a +\get_pos query:
334
335       $ echo "+\get_pos" | nc -w 1 localhost 4533
336       get_pos:
337       Azimuth: 90.000000
338       Elevation: 45.000000
339       RPRT 0
340
341       In this case, as no value is passed to rotctld, the first line consists
342       only  of  the long command name.  The final line shows that the command
343       was processed successfully by the rotor backend.
344
345       Invoking the Extended Response protocol requires prepending  a  command
346       with a punctuation character.  As shown in the examples above, prepend‐
347       ing a '+' character to the command results in the responses being sepa‐
348       rated  by  a newline character ('\n').  Any other punctuation character
349       recognized by the C ispunct() function except '\',  '?',  or  '_'  will
350       cause  that  character  to become the response separator and the entire
351       response will be on one line.
352
353       Separator character summary:
354
355       '+'
356              Each record of the response is appended with a newline ('\n').
357
358       ';', '|', or ','
359              Each record of the response is appended by the  given  character
360              resulting in entire response on one line.
361
362              Common record separators for text representations of spreadsheet
363              data, etc.
364
365       '?'
366              Reserved for 'help' in rotctl short command
367
368       '_'
369              Reserved for \get_info short command
370
371       '#'
372              Reserved for comments when reading a command file script
373
374              Other punctuation characters have not been tested!  Use at  your
375              own risk.
376
377       For example, invoking a ;\get_pos query with a leading ';' returns:
378
379       get_pos:;Azimuth: 90.000000;Elevation: 45.000000;RPRT 0
380
381       Or, using the pipe character '|' returns:
382
383       get_pos:|Azimuth: 90.000000|Elevation: 45.000000|RPRT 0
384
385       And a \set_pos command prepended with a '|' returns:
386
387       set_pos: 135 22.5|RPRT 0
388
389       Such  a  format will allow reading a response as a single event using a
390       prefered response separator.  Other  punctuation  characters  have  not
391       been tested!
392
393       All  commands with the exception of \set_conf have been tested with the
394       Extended Response protocol and the included testrotctld.pl script.
395

EXAMPLES

397       Start rotctld for a Ham IV rotor with the  RotorEZ  installed  using  a
398       USB-to-serial adapter and backgrounding:
399
400       $ rotctld -m 401 -r /dev/ttyUSB1 &
401
402       Connect  to  the  already  running  rotctld,  and set position to 135.0
403       degrees azimuth and 30.0 degrees elevation with a 1 second  read  time‐
404       out:
405
406       $ echo "\set_pos 135.0 30.0" | nc -w 1 localhost 4533
407
408       Connect to a running rotctld with rotctl on the local host:
409
410       $ rotctl -m2
411

DIAGNOSTICS

413       The  -v,  --version option allows different levels of diagnostics to be
414       output to stderr and correspond to -v for BUG, -vv for  ERR,  -vvv  for
415       WARN, -vvvv for VERBOSE, or -vvvvv for TRACE.
416
417       A given verbose level is useful for providing needed debugging informa‐
418       tion to the email address below.  For example, TRACE output  shows  all
419       of  the values sent to and received from the rotator which is very use‐
420       ful for rotator backend library development and may be requested by the
421       developers.   See  the README.betatester and README.developer files for
422       more information.
423

SECURITY

425       No authentication whatsoever; DO NOT leave this TCP port open  wide  to
426       the  Internet.   Please  ask if stronger security is needed or consider
427       using an SSH tunnel.
428
429       As rotctld does not need any greater permissions  than  rotctl,  it  is
430       advisable  to  not start rotctld as root or another system user account
431       in order to limit any vulnerability.
432

BUGS

434       The daemon is not detaching and backgrounding itself.
435
436       Much testing needs to be done.
437

REPORTING BUGS

439       Report bugs to <hamlib-developer@lists.sourceforge.net>.
440
441       We are already aware of the bugs in the previous section :-)
442

AUTHORS

444       Written by Stephane Fillod, Nate Bargmann, and the Hamlib Group
445
446       <http://www.hamlib.org>.
447
449       Copyright © 2000-2009 Stephane Fillod
450       Copyright © 2010 Nate Bargmann
451       Copyright © 2000-2009 the Hamlib Group.
452
453       This is free software; see the source for copying conditions.  There is
454       NO  warranty;  not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
455       PURPOSE.
456

SEE ALSO

458       rotctl(1), hamlib(3)
459
460
461
462Hamlib                           March 1, 2010                      ROTCTLD(8)
Impressum