1 #ifndef __GTK_ROT_CTRL_H__ 2 #define __GTK_ROT_CTRL_H__ 1 3 4 #include <glib.h> 5 #include <glib/gi18n.h> 6 #include <gtk/gtk.h> 7 8 #include "gtk-sat-module.h" 9 #include "predict-tools.h" 10 #include "rotor-conf.h" 11 #include "sgpsdp/sgp4sdp4.h" 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif /* __cplusplus */ 16 17 #define GTK_TYPE_ROT_CTRL (gtk_rot_ctrl_get_type ()) 18 #define GTK_ROT_CTRL(obj) G_TYPE_CHECK_INSTANCE_CAST (obj,\ 19 gtk_rot_ctrl_get_type (),\ 20 GtkRotCtrl) 21 22 #define GTK_ROT_CTRL_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass,\ 23 gtk_rot_ctrl_get_type (),\ 24 GtkRotCtrlClass) 25 26 #define IS_GTK_ROT_CTRL(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gtk_rot_ctrl_get_type ()) 27 28 typedef struct _gtk_rot_ctrl GtkRotCtrl; 29 typedef struct _GtkRotCtrlClass GtkRotCtrlClass; 30 31 struct _gtk_rot_ctrl { 32 GtkBox box; 33 34 /* Azimuth widgets */ 35 GtkWidget *AzSat, *AzSet, *AzRead, *AzDevSel; 36 37 /* Elevation widgets */ 38 GtkWidget *ElSat, *ElSet, *ElRead, *ElDevSel, *ElDev; 39 40 /* other widgets */ 41 GtkWidget *SatSel; 42 GtkWidget *SatCnt; 43 GtkWidget *DevSel; 44 GtkWidget *plot; /*!< Polar plot widget */ 45 GtkWidget *LockBut; 46 GtkWidget *MonitorCheckBox; 47 GtkWidget *track; 48 49 rotor_conf_t *conf; 50 gdouble t; /*!< Time when sat data last has been updated. */ 51 52 /* satellites */ 53 GSList *sats; /*!< List of sats in parent module */ 54 sat_t *target; /*!< Target satellite */ 55 pass_t *pass; /*!< Next pass of target satellite */ 56 qth_t *qth; /*!< The QTH for this module */ 57 gboolean flipped; /*!< Whether the current pass loaded is a flip pass or not */ 58 59 guint delay; /*!< Timeout delay. */ 60 guint timerid; /*!< Timer ID */ 61 gdouble tolerance; /*!< Error tolerance */ 62 63 gboolean tracking; /*!< Flag set when we are tracking a target. */ 64 gboolean monitor; /*!< Flag indicating that rig is in monitor mode. */ 65 gboolean engaged; /*!< Flag indicating that rotor device is engaged. */ 66 67 gint errcnt; /*!< Error counter. */ 68 69 /* TCP client to rotctld */ 70 struct { 71 GThread *thread; 72 GTimer *timer; 73 GMutex mutex; 74 gint socket; /* network socket to rotctld */ 75 gfloat azi_in; /* last AZI angle read from rotctld */ 76 gfloat ele_in; /* last ELE angle read from rotctld */ 77 gfloat azi_out; /* AZI target */ 78 gfloat ele_out; /* ELE target */ 79 gboolean new_trg; /* new target position set */ 80 gboolean running; 81 gboolean io_error; 82 } client; 83 }; 84 85 struct _GtkRotCtrlClass { 86 GtkBoxClass parent_class; 87 }; 88 89 GType gtk_rot_ctrl_get_type(void); 90 GtkWidget *gtk_rot_ctrl_new(GtkSatModule * module); 91 void gtk_rot_ctrl_update(GtkRotCtrl * ctrl, gdouble t); 92 void gtk_rot_ctrl_select_sat(GtkRotCtrl * ctrl, gint catnum); 93 94 #ifdef __cplusplus 95 } 96 #endif /* __cplusplus */ 97 98 #endif /* __GTK_ROT_CTRL_H__ */ 99