Main Page | Class List | Directories | File List | Class Members | File Members

ui.c File Reference

implements callbacks triggered by hardware events and sends corresponing INDI objects to the INDI Clients. More...

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "ccu.h"
#include "instctrl.h"
#include "background.h"
#include "fitsoutput.h"
#include "error.h"
#include "acquisition.h"
#include "progress.h"
#include "telescope.h"
#include "indidevapi.h"
#include "eventloop.h"
#include "indicom.h"
#include "vectors.h"
#include "semaphore.h"
#include "indiboccia.h"
#include "base64.h"
#include <zlib.h>
#include "preview.h"
#include <string.h>
#include <sys/stat.h>

Functions

void ui_init_acquisition ()
 set up the gui for a beginning acquisition
void ui_fill_previewbuf (unsigned char *data, int size)
 fills previewbuf with data, without drawing anything
void ui_ccu_progress_changed (struct ccu_status_struct status)
 called by ccu.c whenever its progress-/status- property has changed.
int to_switch (int input)
 Converts an int to an INDI switch state.
void ui_ccu_switches_changed (struct ccu_status_struct input)
 called by ccu.c whenever its switches property changed.
void ui_ccu_codes_changed (struct ccu_status_struct input)
 called by ccu.c whenever its codes property changed.
void ui_ccu_sequences_changed (struct ccu_sequence_struct input)
 called by ccu.c whenever the sequence list changed.
void ui_ccu_zero_volt_set (void)
 called by ccu.c whenever the zero volt sequence has been successfully executed.
void ui_acquisition_stopped ()
 called by acquisition.c whenever an accquisition was stopped or has finished.
void ui_acq_progress_changed (struct progress_struct input)
 called by acquisition.c whenever its progress-/status- property has changed.
void ui_acq_readout_finished ()
 called by acquisition.c whenever a readout has been completed successfully.
void ui_ccu_ser_in (const char *str)
 called by ccu.c whenever something is received from the CCU's serial port.
void ui_ccu_ser_out (const char *str)
 called by ccu.c whenever something is send to the CCU's serial port.
void ui_fitsoutput_status_changed (struct fitsoutput_status_struct status)
 called by fitsoutput.c whenever its status changed.
int instctrl2indi (int input)
 translates Instrument Control status codes to an INDI status code
int ccu2indi (int input)
 translates CCD Controller status codes to an INDI status code
void ui_instctrl_numbers_changed (struct instctrl_status_struct input)
 called by instctrl.c whenever its status numbers have changed.
void ui_instctrl_strings_changed (struct instctrl_status_struct input)
 called by instctrl.c whenever its status strings have changed.
void ui_instctrl_statuslight_changed (struct instctrl_status_struct input)
 called by instctrl.c whenever its status light has changed.
void ui_instctrl_filters_changed (struct instctrl_filterlist_struct filterlist)
 called by instctrl.c whenever the list of filters has changed.
int telescope2indi (int input)
 converts a telescope status code to an INDI status code.
void ui_telescope_numbers_changed (struct telescope_status_struct input)
 called by telescope.c whenever its status numbers have changed.
void ui_telescope_strings_changed (struct telescope_status_struct input)
 called by telescope.c whenever its status strings have changed.
void ui_telescope_statuslight_changed (struct telescope_status_struct input)
 called by telescope.c whenever its status light has changed.
void ui_telescope_codes_changed (struct telescope_status_struct input)
 called by telescope.c whenever its status codes have changed.
void ui_timer (void)
 called by background.c approximately each 0.05 seconds.
void ui_preview_data (unsigned char *Data, unsigned long sendBytes)
 is called by preview.c whenever new data is ready for display
void ui_preview_reset (int width, int height)
 is called by preview.c whenever the preview resets itself
void ui_image_statistics_changed (struct image_statistics_struct input)
 called by prewiev.c and fisoutout.c whenever the image statistics have changed.
void ui_auto_msg (char *msg)
 called by auto.c whenever it wants to tell the user a message.
void ui_auto_ended (char *msg)
 called by auto.c whenever and automated operatin has ended.
void ui_auto_flats_done_changed (int flats_done)
 called by auto.c whenever the number of flats done has changed.
void ui_auto_shutter_offset_changed (double offset)
 called by auto.c whenever the shutter_offset has changed.
void ui_texoutput_ready_for_edit (char *filename)
 called by texout.c whenever the texfile is ready to be edited.
void ui_texoutput_appended (char *data)
 called by texout.c whenever something has been appended to the texfile.

Variables

instctrl_filterlist_struct filters
char ui_ccu_progress_msg [1000]
double ui_ccu_progress_percentage
sem_t ui_ccu_progress_msg_sem


Detailed Description

implements callbacks triggered by hardware events and sends corresponing INDI objects to the INDI Clients.

Copyright (C) 2001-2003 Dirk Huenniger (dhun@astro.uni-bonn.de)

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.

It calls the INDI Server API and the INDI Server send the information to the clients.


Function Documentation

int ccu2indi int  input  ) 
 

translates CCD Controller status codes to an INDI status code

Parameters:
input a CCD Controller Status Code
Returns:
the corresponding INDI Status Code
This function translates CCD Controller status codes to an INDI status code

int instctrl2indi int  input  ) 
 

translates Instrument Control status codes to an INDI status code

Parameters:
input an Instrument Control Status Code
Returns:
the corresponding INDI Status Code
This function translates Instrument Control status codes to an INDI status code

int telescope2indi int  input  ) 
 

converts a telescope status code to an INDI status code.

Parameters:
input a telescope status code.
Returns:
an indi status code.
This function converts a telescope status code to an INDI status code.

int to_switch int  input  ) 
 

Converts an int to an INDI switch state.

Parameters:
input the int
Returns:
an IND switch state
This function converts an int to an INDI switch state 0 corresponds to OFF,

void ui_acq_progress_changed struct progress_struct  input  ) 
 

called by acquisition.c whenever its progress-/status- property has changed.

Parameters:
input a structure descibin the progress made in acquisition.c
Returns:
void
This function is called by acquisition.c whenever its progress-/status- property has changed. It is declared as an abstract function in acquisition.h and implemented here.

void ui_acq_readout_finished  ) 
 

called by acquisition.c whenever a readout has been completed successfully.

Returns:
void
This function is called by acquisition.c whenever a readout has been completed successfully. It is declared as an abstract function in acquisition.h and implemented here.

void ui_acquisition_stopped  ) 
 

called by acquisition.c whenever an accquisition was stopped or has finished.

Returns:
void
This function is called by acquisition.c whenever an accquisition was stopped or has finished. It is declared as an abstract function in acquisition.h and implemented here.

void ui_auto_ended char *  msg  ) 
 

called by auto.c whenever and automated operatin has ended.

Parameters:
msg a text string desribing why the automated mode ended
Returns:
void
This function is called by auto.c whenever and automated operatin has ended.. It is declared as an abstract function in auto.h and implemented here.

void ui_auto_flats_done_changed int  flats_done  ) 
 

called by auto.c whenever the number of flats done has changed.

Parameters:
msg the message string
Returns:
void
This function is called by acquisition.c whenever the number of flats done has changed. It is declared as an abstract function in auto.h and implemented here.

void ui_auto_msg char *  msg  ) 
 

called by auto.c whenever it wants to tell the user a message.

Parameters:
msg the message string
Returns:
void
This function is called by auto.c whenever it wants to tell the user a message. It is declared as an abstract function in auto.h and implemented here.

void ui_auto_shutter_offset_changed double  offset  ) 
 

called by auto.c whenever the shutter_offset has changed.

Parameters:
offset the message string
Returns:
void
This function is called by acquisition.c whenever the number of flats done has changed. It is declared as an abstract function in auto.h and implemented here.

void ui_ccu_codes_changed struct ccu_status_struct  input  ) 
 

called by ccu.c whenever its codes property changed.

Parameters:
status a ccu_status_struct preresenting the current status of ccu.c
Returns:
void
This function is called by ccu.c whenever its codes property changed. It is declared as an abstract function in ccu.h and implemented here.

void ui_ccu_progress_changed struct ccu_status_struct  status  ) 
 

called by ccu.c whenever its progress-/status- property has changed.

Parameters:
status a ccu_status_struct preresenting the current status of ccu.c
Returns:
void
This function is called by ccu.c whenever its progress-/status- property has changed. It is declared as an abstract function in ccu.h and implemented here.

void ui_ccu_sequences_changed struct ccu_sequence_struct  input  ) 
 

called by ccu.c whenever the sequence list changed.

Parameters:
sequence_context a ccu_status_struct preresenting the current status of ccu.c
Returns:
void
This function is called by ccu.c whenever the sequence list changed. It is declared as an abstract function in ccu.h and implemented here.

void ui_ccu_ser_in const char *  str  ) 
 

called by ccu.c whenever something is received from the CCU's serial port.

Parameters:
str the string recieved form the serial port
Returns:
void
This function is called by ccu.c whenever something is received from the CCU's serial port. It is declaredas an abstract function in ccu.h and implemented here.

void ui_ccu_ser_out const char *  str  ) 
 

called by ccu.c whenever something is send to the CCU's serial port.

Parameters:
str the string send to the serial port
Returns:
void
This function is called by ccu.c whenever something is send to the CCU's serial port. It is declared as an abstract function in ccu.h and implemented here.

void ui_ccu_switches_changed struct ccu_status_struct  input  ) 
 

called by ccu.c whenever its switches property changed.

Parameters:
status a ccu_status_struct preresenting the current status of ccu.c
Returns:
void
This function is called by ccu.c whenever its switches property changed. It is declared as an abstract function in ccu.h and implemented here.

void ui_ccu_zero_volt_set void   ) 
 

called by ccu.c whenever the zero volt sequence has been successfully executed.

Returns:
void
This function is called by ccu.c whenever the zero volt sequence has been successfully executed. It is declared as an abstract function in ccu.h and implemented here.

void ui_fill_previewbuf unsigned char *  data,
int  size
 

fills previewbuf with data, without drawing anything

Parameters:
data a pointer to the data to be filled into previewbuf
size the number of bytes to be read from data
Returns:
void
fills previewbuf without changing or redrawing rgbbuffer. It is called by the readout thread and receives the same data as routine writing the fits file

void ui_fitsoutput_status_changed struct fitsoutput_status_struct  status  ) 
 

called by fitsoutput.c whenever its status changed.

Parameters:
status a fitsoutput_status_struct preresenting the current status of fitsoutput.c.
Returns:
void
This function is called by fitsoutput.c whenever its status changed. It is declared as an abstract function in fitsoutput.h and implemented here.

void ui_image_statistics_changed struct image_statistics_struct  input  ) 
 

called by prewiev.c and fisoutout.c whenever the image statistics have changed.

Parameters:
input a structure describing the current image statistics.
Returns:
void
This function is called by prewiev.c and fisoutout.c whenever the image statistics have changed. It is declared as an abstract function in preview.h and implemented here.

void ui_init_acquisition  ) 
 

set up the gui for a beginning acquisition

Returns:
void
This function sets the button labels and diables all buttons with exeption of the exposurebutton ("Break"). previewbuf is filled with the value 0. The counters gui_x and gui_y are reset to 0.

void ui_instctrl_filters_changed struct instctrl_filterlist_struct  filterlist  ) 
 

called by instctrl.c whenever the list of filters has changed.

Parameters:
filters the fitler list (an array, it end is marked by the entry with Null sting as name)
Returns:
void
This function is called by instctrl.c whenever the list of filters has changed. It is declared as an abstract function in instctrl.h and implemented here.

void ui_instctrl_numbers_changed struct instctrl_status_struct  input  ) 
 

called by instctrl.c whenever its status numbers have changed.

Parameters:
input a structure describing the current status of instctrl.c
Returns:
void
This function is called by instctrl.c whenever its status numbers have changed. It is declared as an abstract function in instctrl.h and implemented here.

void ui_instctrl_statuslight_changed struct instctrl_status_struct  input  ) 
 

called by instctrl.c whenever its status light has changed.

Parameters:
input a structure describing the current status of instctrl.c
Returns:
void
This function is called by instctrl.c whenever its status status light changed. It is declared as an abstract function in instctrl.h and implemented here.

void ui_instctrl_strings_changed struct instctrl_status_struct  input  ) 
 

called by instctrl.c whenever its status strings have changed.

Parameters:
input a structure describing the current status of instctrl.c
Returns:
void
This function is called by instctrl.c whenever its status strings have changed. It is declared as an abstract function in instctrl.h and implemented here.

void ui_preview_data unsigned char *  Data,
unsigned long  sendBytes
 

is called by preview.c whenever new data is ready for display

Parameters:
data a pointer to the data to be filled into previewbuf
size the number of bytes to be read from data
Returns:
void
This funcition is called by preview.c whenever new data is ready for display. It is defnined as an abstract function in preview.h and implemented here.

void ui_preview_reset int  width,
int  height
 

is called by preview.c whenever the preview resets itself

Returns:
void
This funcition is called by preview.c whenever the preview resets itself. It is defnined as an abstract function in preview.h and implemented here.

void ui_telescope_codes_changed struct telescope_status_struct  input  ) 
 

called by telescope.c whenever its status codes have changed.

Parameters:
input a structure describing the current status of telescope.c
Returns:
void
This function is called by telescope.c whenever its status codes changed. It is declared as an abstract function in telescope.h and implemented here.

void ui_telescope_numbers_changed struct telescope_status_struct  input  ) 
 

called by telescope.c whenever its status numbers have changed.

Parameters:
input a structure describing the current status of telescope.c
Returns:
void
This function is called by telescope.c whenever its status numbers have changed. It is declared as an abstract function in telescope.h and implemented here.

void ui_telescope_statuslight_changed struct telescope_status_struct  input  ) 
 

called by telescope.c whenever its status light has changed.

Parameters:
input a structure describing the current status of telescope.c
Returns:
void
This function is called by telescope.c whenever its status status light changed. It is declared as an abstract function in telescope.h and implemented here.

void ui_telescope_strings_changed struct telescope_status_struct  input  ) 
 

called by telescope.c whenever its status strings have changed.

Parameters:
input a structure describing the current status of telescope.c
Returns:
void
This function is called by telescope.c whenever its status strings have changed. It is declared as an abstract function in telescope.h and implemented here.

void ui_texoutput_appended char *  data  ) 
 

called by texout.c whenever something has been appended to the texfile.

Parameters:
the sting appended
Returns:
void This function is called by texout.c whenever something has been appended to the texfile. This way a userinterface can send only the appended lines to the client and does not have to transfer the whole file each time something changes.

void ui_texoutput_ready_for_edit char *  filename  ) 
 

called by texout.c whenever the texfile is ready to be edited.

Parameters:
the filename of the texfile
Returns:
void
This function is called by texout.c whenever the texfile is ready to be edited. It is declared as an abstract function in texoutput.h and implemented here. In order to let the user edit the textfile you have to call texoutput_queue_edit_vigilance(). After a while ui_texoutput_ready_for_edit will be called. Now you are allowed to read the texfile, but not to change it. You have to make a copy of it and do your changes there. Than you have to pass this copy this copy to texoutout via texoutput_editing_done(char* filename). This texoutput_editing_done will only acceopt your changes if less then 10 seconds passed since ui_texoutput_ready_for_edit. Or you called texoutput_reset_vigilance_device in intervalls of less that 10 seconds. This rather complex procedure is necessary to allow a client to crash without crashing the whole texoutput facility.

void ui_timer void   ) 
 

called by background.c approximately each 0.05 seconds.

Returns:
void
This function is called by background.c approximately each 0.05 seconds. It is declared as an abstract function in background.h and implemented here.


Variable Documentation

struct instctrl_filterlist_struct filters
 

The list of filters available

char ui_ccu_progress_msg[1000]
 

the progress message of the CCD Controller to be send to the user

sem_t ui_ccu_progress_msg_sem
 

a semaphore protecting ui_ccu_progress_percentage and instctrl_filterlist_struct

double ui_ccu_progress_percentage
 

the progress percentage of the CCD Controller to be send to the user


Generated on Fri Dec 16 22:23:40 2005 for gboccia by  doxygen 1.4.2