00001
00015 #ifndef __instctrl_h
00016 #define __instctrl_h 1
00017
00018 #include "serial.h"
00019 #include "semaphore.h"
00020 #include <time.h>
00021 #include <sys/types.h>
00022 #include <unistd.h>
00023
00024 #define instctrl_status_idle 0
00025 #define instctrl_status_ok 1
00026 #define instctrl_status_busy 2
00027 #define instctrl_status_fail 3
00028
00029 struct instctrl_struct {
00030 char command[1000];
00031 };
00032
00033 struct instctrl_filter_struct {
00034 char name[1000];
00035 };
00036
00037 struct instctrl_filterlist_struct {
00038 struct instctrl_filter_struct filters[100];
00039 };
00040
00041 struct instctrl_status_struct {
00042 char filtername[1000];
00043 double camerafocus;
00044 double telescopefocus;
00045 char ccdname[1000];
00046 double ccdtemperature;
00047 int statuslight;
00048 int lockbusy;
00049 double lockbusytime;
00050 };
00051
00052 struct instctrl_filename_struct {
00053 char statusfilename[1000];
00054 char commandsendfilename[1000];
00055 char commandreceivefilename[1000];
00056 char filterlistfilename[1000];
00057 char statuslightfilename[1000];
00058 };
00059
00060 extern sem_t instctrl_sem;
00061 extern sem_t instctrl_status_sem;
00062 extern sem_t instctrl_filters_sem;
00063
00064 int instctrl_parse_statusfile();
00065 char *instctrl_status_message( int code );
00066 int instctrl_send_commands();
00067 void instctrl_set_telescopefocus(long focus);
00068 int instctrl_parse_filterfile();
00069 struct instctrl_status_struct instctrl_get_status();
00070 void instctrl_set_filters(struct instctrl_filterlist_struct input);
00071 void instctrl_set_filter(char* filter);
00072 struct instctrl_filterlist_struct instctrl_get_filters();
00073 volatile double instctrl_get_tel_focus();
00074 extern void ui_instctrl_numbers_changed(struct instctrl_status_struct);
00075 extern void ui_instctrl_strings_changed(struct instctrl_status_struct);
00076 extern void ui_instctrl_statuslight_changed(struct instctrl_status_struct);
00077 extern void ui_instctrl_filters_changed(struct instctrl_filterlist_struct);
00078 void instctrl_init();
00079 void instctrl_set_status_async(struct instctrl_status_struct input) ;
00080 void instctrl_set_filenames(struct instctrl_filename_struct input);
00081 #endif