Hamlib
1.2.14
|
00001 /* 00002 * Hamlib Interface - Rotator API header 00003 * Copyright (c) 2000-2005 by Stephane Fillod 00004 * 00005 * $Id: rotator.h,v 1.16 2008-10-27 22:23:36 fillods Exp $ 00006 * 00007 * This library is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU Library General Public License as 00009 * published by the Free Software Foundation; either version 2 of 00010 * the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Library General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Library General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00020 * 00021 */ 00022 00023 #ifndef _ROTATOR_H 00024 #define _ROTATOR_H 1 00025 00026 #include <hamlib/rig.h> 00027 #include <hamlib/rotlist.h> 00028 00043 __BEGIN_DECLS 00044 00045 /* Forward struct references */ 00046 00047 struct rot; 00048 struct rot_state; 00049 00053 typedef struct rot ROT; 00054 00055 00072 typedef float elevation_t; 00073 typedef float azimuth_t; 00074 00076 #define NETROTCTL_RET "RPRT " 00077 00082 #define ROT_RESET_ALL 1 00083 00090 typedef int rot_reset_t; 00091 00092 00094 typedef enum { 00095 ROT_FLAG_AZIMUTH = (1<<1), 00096 ROT_FLAG_ELEVATION = (1<<2) 00097 } rot_type_t; 00098 00099 #define ROT_TYPE_MASK (ROT_FLAG_AZIMUTH|ROT_FLAG_ELEVATION) 00100 00101 #define ROT_TYPE_OTHER 0 00102 #define ROT_TYPE_AZIMUTH ROT_FLAG_AZIMUTH 00103 #define ROT_TYPE_ELEVATION ROT_FLAG_ELEVATION 00104 #define ROT_TYPE_AZEL (ROT_FLAG_AZIMUTH|ROT_FLAG_ELEVATION) 00105 00106 00157 #define ROT_MOVE_UP (1<<1) 00158 #define ROT_MOVE_DOWN (1<<2) 00159 #define ROT_MOVE_LEFT (1<<3) 00160 #define ROT_MOVE_CCW ROT_MOVE_LEFT 00161 #define ROT_MOVE_RIGHT (1<<4) 00162 #define ROT_MOVE_CW ROT_MOVE_RIGHT 00163 00164 /* Basic rot type, can store some useful 00165 * info about different rotators. Each lib must 00166 * be able to populate this structure, so we can make 00167 * useful enquiries about capablilities. 00168 */ 00169 00186 struct rot_caps { 00187 rot_model_t rot_model; 00188 const char *model_name; 00189 const char *mfg_name; 00190 const char *version; 00191 const char *copyright; 00192 enum rig_status_e status; 00194 int rot_type; 00195 enum rig_port_e port_type; 00197 int serial_rate_min; 00198 int serial_rate_max; 00199 int serial_data_bits; 00200 int serial_stop_bits; 00201 enum serial_parity_e serial_parity; 00202 enum serial_handshake_e serial_handshake; 00204 int write_delay; 00205 int post_write_delay; 00206 int timeout; 00207 int retry; 00209 /* 00210 * Movement range, az is relative to North 00211 * negative values allowed for overlap 00212 */ 00213 azimuth_t min_az; 00214 azimuth_t max_az; 00215 elevation_t min_el; 00216 elevation_t max_el; 00219 const struct confparams *cfgparams; 00220 const rig_ptr_t priv; 00222 /* 00223 * Rot Admin API 00224 * 00225 */ 00226 00227 int (*rot_init)(ROT *rot); 00228 int (*rot_cleanup)(ROT *rot); 00229 int (*rot_open)(ROT *rot); 00230 int (*rot_close)(ROT *rot); 00231 00232 int (*set_conf)(ROT *rot, token_t token, const char *val); 00233 int (*get_conf)(ROT *rot, token_t token, char *val); 00234 00235 /* 00236 * General API commands, from most primitive to least.. :() 00237 * List Set/Get functions pairs 00238 */ 00239 00240 int (*set_position)(ROT *rot, azimuth_t azimuth, elevation_t elevation); 00241 int (*get_position)(ROT *rot, azimuth_t *azimuth, elevation_t *elevation); 00242 00243 int (*stop)(ROT *rot); 00244 int (*park)(ROT *rot); 00245 int (*reset)(ROT *rot, rot_reset_t reset); 00246 int (*move)(ROT *rot, int direction, int speed); 00247 00248 /* get firmware info, etc. */ 00249 const char* (*get_info)(ROT *rot); 00250 00251 /* more to come... */ 00252 }; 00253 00254 00266 struct rot_state { 00267 /* 00268 * overridable fields 00269 */ 00270 azimuth_t min_az; 00271 azimuth_t max_az; 00272 elevation_t min_el; 00273 elevation_t max_el; 00275 /* 00276 * non overridable fields, internal use 00277 */ 00278 hamlib_port_t rotport; 00280 int comm_state; 00281 rig_ptr_t priv; 00282 rig_ptr_t obj; 00284 /* etc... */ 00285 }; 00286 00299 struct rot { 00300 struct rot_caps *caps; 00301 struct rot_state state; 00302 }; 00303 00304 /* --------------- API function prototypes -----------------*/ 00305 00306 extern HAMLIB_EXPORT(ROT *) rot_init HAMLIB_PARAMS((rot_model_t rot_model)); 00307 extern HAMLIB_EXPORT(int) rot_open HAMLIB_PARAMS((ROT *rot)); 00308 extern HAMLIB_EXPORT(int) rot_close HAMLIB_PARAMS((ROT *rot)); 00309 extern HAMLIB_EXPORT(int) rot_cleanup HAMLIB_PARAMS((ROT *rot)); 00310 00311 extern HAMLIB_EXPORT(int) rot_set_conf HAMLIB_PARAMS((ROT *rot, token_t token, const char *val)); 00312 extern HAMLIB_EXPORT(int) rot_get_conf HAMLIB_PARAMS((ROT *rot, token_t token, char *val)); 00313 /* 00314 * General API commands, from most primitive to least.. ) 00315 * List Set/Get functions pairs 00316 */ 00317 extern HAMLIB_EXPORT(int) rot_set_position HAMLIB_PARAMS((ROT *rot, azimuth_t azimuth, elevation_t elevation)); 00318 extern HAMLIB_EXPORT(int) rot_get_position HAMLIB_PARAMS((ROT *rot, azimuth_t *azimuth, elevation_t *elevation)); 00319 extern HAMLIB_EXPORT(int) rot_stop HAMLIB_PARAMS((ROT *rot)); 00320 extern HAMLIB_EXPORT(int) rot_park HAMLIB_PARAMS((ROT *rot)); 00321 extern HAMLIB_EXPORT(int) rot_reset HAMLIB_PARAMS((ROT *rot, rot_reset_t reset)); 00322 extern HAMLIB_EXPORT(int) rot_move HAMLIB_PARAMS((ROT *rot, int direction, int speed)); 00323 extern HAMLIB_EXPORT(const char*) rot_get_info HAMLIB_PARAMS((ROT *rot)); 00324 00325 extern HAMLIB_EXPORT(int) rot_register HAMLIB_PARAMS((const struct rot_caps *caps)); 00326 extern HAMLIB_EXPORT(int) rot_unregister HAMLIB_PARAMS((rot_model_t rot_model)); 00327 extern HAMLIB_EXPORT(int) rot_list_foreach HAMLIB_PARAMS((int (*cfunc)(const struct rot_caps*, rig_ptr_t), rig_ptr_t data)); 00328 extern HAMLIB_EXPORT(int) rot_load_backend HAMLIB_PARAMS((const char *be_name)); 00329 extern HAMLIB_EXPORT(int) rot_check_backend HAMLIB_PARAMS((rot_model_t rot_model)); 00330 extern HAMLIB_EXPORT(int) rot_load_all_backends HAMLIB_PARAMS((void)); 00331 extern HAMLIB_EXPORT(rot_model_t) rot_probe_all HAMLIB_PARAMS((hamlib_port_t *p)); 00332 00333 extern HAMLIB_EXPORT(int) rot_token_foreach HAMLIB_PARAMS((ROT *rot, int (*cfunc)(const struct confparams *, rig_ptr_t), rig_ptr_t data)); 00334 extern HAMLIB_EXPORT(const struct confparams*) rot_confparam_lookup HAMLIB_PARAMS((ROT *rot, const char *name)); 00335 extern HAMLIB_EXPORT(token_t) rot_token_lookup HAMLIB_PARAMS((ROT *rot, const char *name)); 00336 00337 extern HAMLIB_EXPORT(const struct rot_caps *) rot_get_caps HAMLIB_PARAMS((rot_model_t rot_model)); 00338 00339 extern HAMLIB_EXPORT(int) qrb HAMLIB_PARAMS((double lon1, double lat1, 00340 double lon2, double lat2, 00341 double *distance, double *azimuth)); 00342 extern HAMLIB_EXPORT(double) distance_long_path HAMLIB_PARAMS((double distance)); 00343 extern HAMLIB_EXPORT(double) azimuth_long_path HAMLIB_PARAMS((double azimuth)); 00344 00345 extern HAMLIB_EXPORT(int) longlat2locator HAMLIB_PARAMS((double longitude, 00346 double latitude, char *locator_res, int pair_count)); 00347 extern HAMLIB_EXPORT(int) locator2longlat HAMLIB_PARAMS((double *longitude, 00348 double *latitude, const char *locator)); 00349 00350 extern HAMLIB_EXPORT(double) dms2dec HAMLIB_PARAMS((int degrees, int minutes, 00351 double seconds, int sw)); 00352 extern HAMLIB_EXPORT(int) dec2dms HAMLIB_PARAMS((double dec, int *degrees, 00353 int *minutes, double *seconds, int *sw)); 00354 00355 extern HAMLIB_EXPORT(int) dec2dmmm HAMLIB_PARAMS((double dec, int *degrees, 00356 double *minutes, int *sw)); 00357 extern HAMLIB_EXPORT(double) dmmm2dec HAMLIB_PARAMS((int degrees, 00358 double minutes, int sw)); 00359 00368 #define rot_debug rig_debug 00369 00370 __END_DECLS 00371 00372 #endif /* _ROTATOR_H */ 00373
Hamlib documentation for version 1.2.14 -- Fri Dec 23 2011 23:24:31
Project page: http://www.hamlib.org