00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
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
00079 #define ROT_RESET_ALL 1
00080
00087 typedef int rot_reset_t;
00088
00089
00096 #define ROT_FLAG_AZIMUTH (1<<1)
00097 #define ROT_FLAG_ELEVATION (1<<2)
00098
00099 #define ROT_TYPE_OTHER 0
00100
00101
00152 #define ROT_MOVE_UP (1<<1)
00153 #define ROT_MOVE_DOWN (1<<2)
00154 #define ROT_MOVE_LEFT (1<<3)
00155 #define ROT_MOVE_CCW ROT_MOVE_LEFT
00156 #define ROT_MOVE_RIGHT (1<<4)
00157 #define ROT_MOVE_CW ROT_MOVE_RIGHT
00158
00159
00160
00161
00162
00163
00164
00181 struct rot_caps {
00182 rot_model_t rot_model;
00183 const char *model_name;
00184 const char *mfg_name;
00185 const char *version;
00186 const char *copyright;
00187 enum rig_status_e status;
00189 int rot_type;
00190 enum rig_port_e port_type;
00192 int serial_rate_min;
00193 int serial_rate_max;
00194 int serial_data_bits;
00195 int serial_stop_bits;
00196 enum serial_parity_e serial_parity;
00197 enum serial_handshake_e serial_handshake;
00199 int write_delay;
00200 int post_write_delay;
00201 int timeout;
00202 int retry;
00204
00205
00206
00207
00208 azimuth_t min_az;
00209 azimuth_t max_az;
00210 elevation_t min_el;
00211 elevation_t max_el;
00214 const struct confparams *cfgparams;
00215 const rig_ptr_t priv;
00217
00218
00219
00220
00221
00222 int (*rot_init)(ROT *rot);
00223 int (*rot_cleanup)(ROT *rot);
00224 int (*rot_open)(ROT *rot);
00225 int (*rot_close)(ROT *rot);
00226
00227 int (*set_conf)(ROT *rot, token_t token, const char *val);
00228 int (*get_conf)(ROT *rot, token_t token, char *val);
00229
00230
00231
00232
00233
00234
00235 int (*set_position)(ROT *rot, azimuth_t azimuth, elevation_t elevation);
00236 int (*get_position)(ROT *rot, azimuth_t *azimuth, elevation_t *elevation);
00237
00238 int (*stop)(ROT *rot);
00239 int (*park)(ROT *rot);
00240 int (*reset)(ROT *rot, rot_reset_t reset);
00241 int (*move)(ROT *rot, int direction, int speed);
00242
00243
00244 const char* (*get_info)(ROT *rot);
00245
00246
00247 };
00248
00249
00261 struct rot_state {
00262
00263
00264
00265 azimuth_t min_az;
00266 azimuth_t max_az;
00267 elevation_t min_el;
00268 elevation_t max_el;
00270
00271
00272
00273 hamlib_port_t rotport;
00275 int comm_state;
00276 rig_ptr_t priv;
00277 rig_ptr_t obj;
00279
00280 };
00281
00294 struct rot {
00295 struct rot_caps *caps;
00296 struct rot_state state;
00297 };
00298
00299
00300
00301 extern HAMLIB_EXPORT(ROT *) rot_init HAMLIB_PARAMS((rot_model_t rot_model));
00302 extern HAMLIB_EXPORT(int) rot_open HAMLIB_PARAMS((ROT *rot));
00303 extern HAMLIB_EXPORT(int) rot_close HAMLIB_PARAMS((ROT *rot));
00304 extern HAMLIB_EXPORT(int) rot_cleanup HAMLIB_PARAMS((ROT *rot));
00305
00306 extern HAMLIB_EXPORT(int) rot_set_conf HAMLIB_PARAMS((ROT *rot, token_t token, const char *val));
00307 extern HAMLIB_EXPORT(int) rot_get_conf HAMLIB_PARAMS((ROT *rot, token_t token, char *val));
00308
00309
00310
00311
00312 extern HAMLIB_EXPORT(int) rot_set_position HAMLIB_PARAMS((ROT *rot, azimuth_t azimuth, elevation_t elevation));
00313 extern HAMLIB_EXPORT(int) rot_get_position HAMLIB_PARAMS((ROT *rot, azimuth_t *azimuth, elevation_t *elevation));
00314 extern HAMLIB_EXPORT(int) rot_stop HAMLIB_PARAMS((ROT *rot));
00315 extern HAMLIB_EXPORT(int) rot_park HAMLIB_PARAMS((ROT *rot));
00316 extern HAMLIB_EXPORT(int) rot_reset HAMLIB_PARAMS((ROT *rot, rot_reset_t reset));
00317 extern HAMLIB_EXPORT(int) rot_move HAMLIB_PARAMS((ROT *rot, int direction, int speed));
00318 extern HAMLIB_EXPORT(const char*) rot_get_info HAMLIB_PARAMS((ROT *rot));
00319
00320 extern HAMLIB_EXPORT(int) rot_register HAMLIB_PARAMS((const struct rot_caps *caps));
00321 extern HAMLIB_EXPORT(int) rot_unregister HAMLIB_PARAMS((rot_model_t rot_model));
00322 extern HAMLIB_EXPORT(int) rot_list_foreach HAMLIB_PARAMS((int (*cfunc)(const struct rot_caps*, rig_ptr_t), rig_ptr_t data));
00323 extern HAMLIB_EXPORT(int) rot_load_backend HAMLIB_PARAMS((const char *be_name));
00324 extern HAMLIB_EXPORT(int) rot_check_backend HAMLIB_PARAMS((rot_model_t rot_model));
00325 extern HAMLIB_EXPORT(int) rot_load_all_backends HAMLIB_PARAMS((void));
00326 extern HAMLIB_EXPORT(rot_model_t) rot_probe_all HAMLIB_PARAMS((hamlib_port_t *p));
00327
00328 extern HAMLIB_EXPORT(int) rot_token_foreach HAMLIB_PARAMS((ROT *rot, int (*cfunc)(const struct confparams *, rig_ptr_t), rig_ptr_t data));
00329 extern HAMLIB_EXPORT(const struct confparams*) rot_confparam_lookup HAMLIB_PARAMS((ROT *rot, const char *name));
00330 extern HAMLIB_EXPORT(token_t) rot_token_lookup HAMLIB_PARAMS((ROT *rot, const char *name));
00331
00332 extern HAMLIB_EXPORT(const struct rot_caps *) rot_get_caps HAMLIB_PARAMS((rot_model_t rot_model));
00333
00334 extern HAMLIB_EXPORT(int) qrb HAMLIB_PARAMS((double lon1, double lat1,
00335 double lon2, double lat2,
00336 double *distance, double *azimuth));
00337 extern HAMLIB_EXPORT(double) distance_long_path HAMLIB_PARAMS((double distance));
00338 extern HAMLIB_EXPORT(double) azimuth_long_path HAMLIB_PARAMS((double azimuth));
00339
00340 extern HAMLIB_EXPORT(int) longlat2locator HAMLIB_PARAMS((double longitude,
00341 double latitude, char *locator, int pair_count));
00342 extern HAMLIB_EXPORT(int) locator2longlat HAMLIB_PARAMS((double *longitude,
00343 double *latitude, const char *locator));
00344
00345 extern HAMLIB_EXPORT(double) dms2dec HAMLIB_PARAMS((int degrees, int minutes,
00346 double seconds, int sw));
00347 extern HAMLIB_EXPORT(int) dec2dms HAMLIB_PARAMS((double dec, int *degrees,
00348 int *minutes, double *seconds, int *sw));
00349
00350 extern HAMLIB_EXPORT(int) dec2dmmm HAMLIB_PARAMS((double dec, int *degrees,
00351 double *minutes, int *sw));
00352 extern HAMLIB_EXPORT(double) dmmm2dec HAMLIB_PARAMS((int degrees,
00353 double minutes, int sw));
00354
00363 #define rot_debug rig_debug
00364
00365 __END_DECLS
00366
00367 #endif
00368