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