Hamlib  1.2.15.3
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rotator.h
Go to the documentation of this file.
1 /*
2  * Hamlib Interface - Rotator API header
3  * Copyright (c) 2000-2005 by Stephane Fillod
4  *
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  */
21 
22 #ifndef _ROTATOR_H
23 #define _ROTATOR_H 1
24 
25 #include <hamlib/rig.h>
26 #include <hamlib/rotlist.h>
27 
42 __BEGIN_DECLS
43 
44 /* Forward struct references */
45 
46 struct rot;
47 struct rot_state;
48 
52 typedef struct rot ROT;
53 
54 
71 typedef float elevation_t;
72 typedef float azimuth_t;
73 
75 #define NETROTCTL_RET "RPRT "
76 
81 #define ROT_RESET_ALL 1
82 
89 typedef int rot_reset_t;
90 
91 
93 typedef enum {
94  ROT_FLAG_AZIMUTH = (1<<1),
96 } rot_type_t;
97 
98 #define ROT_TYPE_MASK (ROT_FLAG_AZIMUTH|ROT_FLAG_ELEVATION)
99 
100 #define ROT_TYPE_OTHER 0
101 #define ROT_TYPE_AZIMUTH ROT_FLAG_AZIMUTH
102 #define ROT_TYPE_ELEVATION ROT_FLAG_ELEVATION
103 #define ROT_TYPE_AZEL (ROT_FLAG_AZIMUTH|ROT_FLAG_ELEVATION)
104 
105 
156 #define ROT_MOVE_UP (1<<1)
157 #define ROT_MOVE_DOWN (1<<2)
158 #define ROT_MOVE_LEFT (1<<3)
159 #define ROT_MOVE_CCW ROT_MOVE_LEFT
160 #define ROT_MOVE_RIGHT (1<<4)
161 #define ROT_MOVE_CW ROT_MOVE_RIGHT
162 
163 /* Basic rot type, can store some useful
164  * info about different rotators. Each lib must
165  * be able to populate this structure, so we can make
166  * useful enquiries about capablilities.
167  */
168 
185 struct rot_caps {
187  const char *model_name;
188  const char *mfg_name;
189  const char *version;
190  const char *copyright;
193  int rot_type;
205  int timeout;
206  int retry;
208  /*
209  * Movement range, az is relative to North
210  * negative values allowed for overlap
211  */
218  const struct confparams *cfgparams;
219  const rig_ptr_t priv;
221  /*
222  * Rot Admin API
223  *
224  */
225 
226  int (*rot_init)(ROT *rot);
227  int (*rot_cleanup)(ROT *rot);
228  int (*rot_open)(ROT *rot);
229  int (*rot_close)(ROT *rot);
230 
231  int (*set_conf)(ROT *rot, token_t token, const char *val);
232  int (*get_conf)(ROT *rot, token_t token, char *val);
233 
234  /*
235  * General API commands, from most primitive to least.. :()
236  * List Set/Get functions pairs
237  */
238 
239  int (*set_position)(ROT *rot, azimuth_t azimuth, elevation_t elevation);
240  int (*get_position)(ROT *rot, azimuth_t *azimuth, elevation_t *elevation);
241 
242  int (*stop)(ROT *rot);
243  int (*park)(ROT *rot);
244  int (*reset)(ROT *rot, rot_reset_t reset);
245  int (*move)(ROT *rot, int direction, int speed);
246 
247  /* get firmware info, etc. */
248  const char* (*get_info)(ROT *rot);
249 
250  /* more to come... */
251 };
252 
253 
265 struct rot_state {
266  /*
267  * overridable fields
268  */
274  /*
275  * non overridable fields, internal use
276  */
280  rig_ptr_t priv;
281  rig_ptr_t obj;
283  /* etc... */
284 };
285 
298 struct rot {
299  struct rot_caps *caps;
300  struct rot_state state;
301 };
302 
303 /* --------------- API function prototypes -----------------*/
304 
305 extern HAMLIB_EXPORT(ROT *) rot_init HAMLIB_PARAMS((rot_model_t rot_model));
306 extern HAMLIB_EXPORT(int) rot_open HAMLIB_PARAMS((ROT *rot));
307 extern HAMLIB_EXPORT(int) rot_close HAMLIB_PARAMS((ROT *rot));
308 extern HAMLIB_EXPORT(int) rot_cleanup HAMLIB_PARAMS((ROT *rot));
309 
310 extern HAMLIB_EXPORT(int) rot_set_conf HAMLIB_PARAMS((ROT *rot, token_t token, const char *val));
311 extern HAMLIB_EXPORT(int) rot_get_conf HAMLIB_PARAMS((ROT *rot, token_t token, char *val));
312  /*
313  * General API commands, from most primitive to least.. )
314  * List Set/Get functions pairs
315  */
316 extern HAMLIB_EXPORT(int) rot_set_position HAMLIB_PARAMS((ROT *rot, azimuth_t azimuth, elevation_t elevation));
317 extern HAMLIB_EXPORT(int) rot_get_position HAMLIB_PARAMS((ROT *rot, azimuth_t *azimuth, elevation_t *elevation));
318 extern HAMLIB_EXPORT(int) rot_stop HAMLIB_PARAMS((ROT *rot));
319 extern HAMLIB_EXPORT(int) rot_park HAMLIB_PARAMS((ROT *rot));
320 extern HAMLIB_EXPORT(int) rot_reset HAMLIB_PARAMS((ROT *rot, rot_reset_t reset));
321 extern HAMLIB_EXPORT(int) rot_move HAMLIB_PARAMS((ROT *rot, int direction, int speed));
322 extern HAMLIB_EXPORT(const char*) rot_get_info HAMLIB_PARAMS((ROT *rot));
323 
324 extern HAMLIB_EXPORT(int) rot_register HAMLIB_PARAMS((const struct rot_caps *caps));
325 extern HAMLIB_EXPORT(int) rot_unregister HAMLIB_PARAMS((rot_model_t rot_model));
326 extern HAMLIB_EXPORT(int) rot_list_foreach HAMLIB_PARAMS((int (*cfunc)(const struct rot_caps*, rig_ptr_t), rig_ptr_t data));
327 extern HAMLIB_EXPORT(int) rot_load_backend HAMLIB_PARAMS((const char *be_name));
328 extern HAMLIB_EXPORT(int) rot_check_backend HAMLIB_PARAMS((rot_model_t rot_model));
329 extern HAMLIB_EXPORT(int) rot_load_all_backends HAMLIB_PARAMS((void));
330 extern HAMLIB_EXPORT(rot_model_t) rot_probe_all HAMLIB_PARAMS((hamlib_port_t *p));
331 
332 extern HAMLIB_EXPORT(int) rot_token_foreach HAMLIB_PARAMS((ROT *rot, int (*cfunc)(const struct confparams *, rig_ptr_t), rig_ptr_t data));
333 extern HAMLIB_EXPORT(const struct confparams*) rot_confparam_lookup HAMLIB_PARAMS((ROT *rot, const char *name));
334 extern HAMLIB_EXPORT(token_t) rot_token_lookup HAMLIB_PARAMS((ROT *rot, const char *name));
335 
336 extern HAMLIB_EXPORT(const struct rot_caps *) rot_get_caps HAMLIB_PARAMS((rot_model_t rot_model));
337 
338 extern HAMLIB_EXPORT(int) qrb HAMLIB_PARAMS((double lon1, double lat1,
339  double lon2, double lat2,
340  double *distance, double *azimuth));
341 extern HAMLIB_EXPORT(double) distance_long_path HAMLIB_PARAMS((double distance));
342 extern HAMLIB_EXPORT(double) azimuth_long_path HAMLIB_PARAMS((double azimuth));
343 
344 extern HAMLIB_EXPORT(int) longlat2locator HAMLIB_PARAMS((double longitude,
345  double latitude, char *locator_res, int pair_count));
346 extern HAMLIB_EXPORT(int) locator2longlat HAMLIB_PARAMS((double *longitude,
347  double *latitude, const char *locator));
348 
349 extern HAMLIB_EXPORT(double) dms2dec HAMLIB_PARAMS((int degrees, int minutes,
350  double seconds, int sw));
351 extern HAMLIB_EXPORT(int) dec2dms HAMLIB_PARAMS((double dec, int *degrees,
352  int *minutes, double *seconds, int *sw));
353 
354 extern HAMLIB_EXPORT(int) dec2dmmm HAMLIB_PARAMS((double dec, int *degrees,
355  double *minutes, int *sw));
356 extern HAMLIB_EXPORT(double) dmmm2dec HAMLIB_PARAMS((int degrees,
357  double minutes, int sw));
358 
367 #define rot_debug rig_debug
368 
369 __END_DECLS
370 
371 #endif /* _ROTATOR_H */
372 

Generated by doxygen 1.8.1.1

Hamlib documentation for version 1.2.15.3 -- Fri Jan 11 2013 22:08:12
Project page: http://www.hamlib.org