Instrument Neutral Distributed Interface INDI  1.9.5
Classes | Macros | Enumerations | Functions | Variables
stv.c File Reference
#include <cstring>
#include <sys/stat.h>
#include <stdio.h>
#include <zlib.h>
#include <unistd.h>
#include <termios.h>
#include "indidevapi.h"
#include "eventloop.h"
#include "indicom.h"
#include <config.h>
#include <fitsio.h>
#include "stvdriver.h"

Go to the source code of this file.

Classes

struct  img_t
 

Macros

#define mydev   "STV Guider" /* Device name */
 
#define CONNECTION_GROUP   "Connection" /* Group name */
 
#define SETTINGS_GROUP   "Setings" /* Group name */
 
#define BUTTONS_GROUP   "Buttons and Knobs" /* Button Pannel */
 
#define IMAGE_GROUP   "Download" /* Button Pannel */
 
#define currentBuffer   BufferN[0].value
 
#define currentX   WindowingN[0].value
 
#define currentY   WindowingN[1].value
 
#define currentLines   WindowingN[2].value
 
#define currentLength   WindowingN[3].value
 
#define currentCompression   CompressionS[0].s
 
#define TEMPFILE_LEN   16
 

Enumerations

enum  STVFrames { LIGHT_FRAME = 0, BIAS_FRAME, DARK_FRAME, FLAT_FRAME }
 

Functions

void addFITSKeywords (fitsfile *fptr, IMAGE_INFO *image_info)
 
int writeFITS (const char *filename, IMAGE_INFO *image_info, char errmsg[])
 
void uploadFile (const char *filename)
 
int ISTerminateTXDisplay (void)
 
int ISRestoreTXDisplay (void)
 
int ISMessageImageInfo (int buffer, IMAGE_INFO *image_info)
 
int ISRequestImageData (int compression, int buffer, int x_offset, int y_offset, int length, int lines)
 
int STV_LRRotaryDecrease (void)
 
int STV_LRRotaryIncrease (void)
 
int STV_UDRotaryDecrease (void)
 
int STV_UDRotaryIncrease (void)
 
int STV_AKey (void)
 
int STV_BKey (void)
 
int STV_Setup (void)
 
int STV_Interrupt (void)
 
int STV_Focus (void)
 
int STV_Image (void)
 
int STV_Monitor (void)
 
int STV_Calibrate (void)
 
int STV_Track (void)
 
int STV_Display (void)
 
int STV_FileOps (void)
 
int STV_RequestImageInfo (int imagebuffer, IMAGE_INFO *image_info)
 
int STV_BufferStatus (int buffer)
 
int STV_RequestImage (int compression, int buffer, int x_offset, int y_offset, int *length, int *lines, int image[][320], IMAGE_INFO *image_info)
 
int STV_Download (void)
 
int STV_TXDisplay (void)
 
int STV_TerminateTXDisplay (void)
 
int STV_RequestAck (void)
 
unsigned int STV_GetBits (unsigned int x, int p, int n)
 
int STV_PrintBuffer (unsigned char *cmdbuf, int n)
 
void handleError (ISwitchVectorProperty *svp, int err, const char *msg)
 
void ISCallBack (void)
 
int init_serial (char *device_name, int bit_rate, int word_size, int parity, int stop_bits)
 
int STV_ReceivePacket (unsigned char *buf, int mode)
 
int STV_Connect (char *device, int baud)
 
int STV_SetDateTime (char *times)
 
double STV_SetCCDTemperature (double set_value)
 
void ISResetButtons (char *message)
 
void ISGetProperties (const char *dev)
 Get Device Properties. More...
 
void ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
 Update the value of an existing switch vector property. More...
 
void ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n)
 Update the value of an existing text vector property. More...
 
void ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n)
 
void ISNewBLOB (const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
 Update data of an existing blob vector property. More...
 
void ISSnoopDevice (XMLEle *root)
 Function defined by Drivers that is called when another Driver it is snooping (by having previously called IDSnoopDevice()) sent any INDI message. More...
 
void ISUpdateDisplay (int buffer, int line)
 

Variables

int fd
 
char tracking_buf [1024]
 
ITextVectorProperty UTCTP
 

Macro Definition Documentation

◆ BUTTONS_GROUP

#define BUTTONS_GROUP   "Buttons and Knobs" /* Button Pannel */

Definition at line 61 of file stv.c.

◆ CONNECTION_GROUP

#define CONNECTION_GROUP   "Connection" /* Group name */

Definition at line 59 of file stv.c.

◆ currentBuffer

#define currentBuffer   BufferN[0].value

Definition at line 64 of file stv.c.

◆ currentCompression

#define currentCompression   CompressionS[0].s

Definition at line 70 of file stv.c.

◆ currentLength

#define currentLength   WindowingN[3].value

Definition at line 68 of file stv.c.

◆ currentLines

#define currentLines   WindowingN[2].value

Definition at line 67 of file stv.c.

◆ currentX

#define currentX   WindowingN[0].value

Definition at line 65 of file stv.c.

◆ currentY

#define currentY   WindowingN[1].value

Definition at line 66 of file stv.c.

◆ IMAGE_GROUP

#define IMAGE_GROUP   "Download" /* Button Pannel */

Definition at line 62 of file stv.c.

◆ mydev

#define mydev   "STV Guider" /* Device name */

Definition at line 58 of file stv.c.

◆ SETTINGS_GROUP

#define SETTINGS_GROUP   "Setings" /* Group name */

Definition at line 60 of file stv.c.

◆ TEMPFILE_LEN

#define TEMPFILE_LEN   16

Definition at line 85 of file stv.c.

Enumeration Type Documentation

◆ STVFrames

enum STVFrames
Enumerator
LIGHT_FRAME 
BIAS_FRAME 
DARK_FRAME 
FLAT_FRAME 

Definition at line 78 of file stv.c.

Function Documentation

◆ addFITSKeywords()

void addFITSKeywords ( fitsfile *  fptr,
IMAGE_INFO image_info 
)

Definition at line 1597 of file stv.c.

◆ handleError()

void handleError ( ISwitchVectorProperty svp,
int  err,
const char *  msg 
)

◆ init_serial()

int init_serial ( char *  device_name,
int  bit_rate,
int  word_size,
int  parity,
int  stop_bits 
)

Definition at line 1526 of file stvdriver.c.

◆ ISCallBack()

void ISCallBack ( void  )

Definition at line 462 of file stv.c.

◆ ISGetProperties()

void ISGetProperties ( const char *  dev)

Get Device Properties.

Parameters
devthe name of the device.

This function is called by the framework whenever the driver has received a getProperties message from an INDI client. The argument

Parameters
devis either a string containing the name of the device specified within the message, or NULL if no device was specified. If the driver does not recognize the device, it should ignore the message and do nothing. If dev matches the device the driver is implementing, or dev is NULL, the driver must respond by sending one defXXX message to describe each property defined by this device, including its current (or initial) value. The recommended way to send these messages is to call the appropriate IDDef functions.

Definition at line 641 of file stv.c.

◆ ISMessageImageInfo()

int ISMessageImageInfo ( int  buffer,
IMAGE_INFO image_info 
)

Definition at line 1859 of file stv.c.

◆ ISNewBLOB()

void ISNewBLOB ( const char *  dev,
const char *  name,
int  sizes[],
int  blobsizes[],
char *  blobs[],
char *  formats[],
char *  names[],
int  n 
)

Update data of an existing blob vector property.

Parameters
devthe name of the device.
namethe name of the blob vector property to update.
sizesan array of base64 blob sizes in bytes before decoding.
blobsizesan array of the sizes of blobs after decoding from base64.
blobsan array of decoded data. Each blob size is found in blobsizes array.
formatsBlob data format (e.g. fits.z).
namesnames of blob members to update.
nthe number of blobs to update.
Note
You do not need to call this function, it is called by INDI when new blob values arrive from the client. e.g. BLOB element with name names[0] has data located in blobs[0] with size sizes[0] and format formats[0].

Definition at line 1541 of file stv.c.

◆ ISNewNumber()

void ISNewNumber ( const char *  dev,
const char *  name,
double  values[],
char *  names[],
int  n 
)

Definition at line 1464 of file stv.c.

◆ ISNewSwitch()

void ISNewSwitch ( const char *  dev,
const char *  name,
ISState states,
char *  names[],
int  n 
)

Update the value of an existing switch vector property.

Parameters
devthe name of the device.
namethe name of the switch vector property to update.
statesan array of switch states.
namesparallel names to the array of switch states.
nthe dimension of states[].
Note
You do not need to call this function, it is called by INDI when new switch values arrive from the client.

Definition at line 686 of file stv.c.

◆ ISNewText()

void ISNewText ( const char *  dev,
const char *  name,
char *  texts[],
char *  names[],
int  n 
)

Update the value of an existing text vector property.

Parameters
devthe name of the device.
namethe name of the text vector property to update.
textsan array of text values.
namesparallel names to the array of text values.
nthe dimension of texts[].
Note
You do not need to call this function, it is called by INDI when new text values arrive from the client.

Definition at line 1406 of file stv.c.

◆ ISRequestImageData()

int ISRequestImageData ( int  compression,
int  buffer,
int  x_offset,
int  y_offset,
int  length,
int  lines 
)

Definition at line 1897 of file stv.c.

◆ ISResetButtons()

void ISResetButtons ( char *  message)

Definition at line 415 of file stv.c.

◆ ISRestoreTXDisplay()

int ISRestoreTXDisplay ( void  )

Definition at line 1833 of file stv.c.

◆ ISSnoopDevice()

void ISSnoopDevice ( XMLEle root)

Function defined by Drivers that is called when another Driver it is snooping (by having previously called IDSnoopDevice()) sent any INDI message.

Parameters
rootThe argument contains the full message exactly as it was sent by the driver. Hint: use the IUSnoopXXX utility functions to help crack the message if it was one of setXXX or defXXX.

Definition at line 1553 of file stv.c.

◆ ISTerminateTXDisplay()

int ISTerminateTXDisplay ( void  )

Definition at line 1789 of file stv.c.

◆ ISUpdateDisplay()

void ISUpdateDisplay ( int  buffer,
int  line 
)

Definition at line 1952 of file stv.c.

◆ STV_AKey()

int STV_AKey ( void  )

Definition at line 123 of file stvdriver.c.

◆ STV_BKey()

int STV_BKey ( void  )

Definition at line 129 of file stvdriver.c.

◆ STV_BufferStatus()

int STV_BufferStatus ( int  buffer)

Definition at line 756 of file stvdriver.c.

◆ STV_Calibrate()

int STV_Calibrate ( void  )

Definition at line 165 of file stvdriver.c.

◆ STV_Connect()

int STV_Connect ( char *  device,
int  baud 
)

Definition at line 1482 of file stvdriver.c.

◆ STV_Display()

int STV_Display ( void  )

Definition at line 177 of file stvdriver.c.

◆ STV_Download()

int STV_Download ( void  )

Definition at line 739 of file stvdriver.c.

◆ STV_FileOps()

int STV_FileOps ( void  )

Definition at line 183 of file stvdriver.c.

◆ STV_Focus()

int STV_Focus ( void  )

Definition at line 147 of file stvdriver.c.

◆ STV_GetBits()

unsigned int STV_GetBits ( unsigned int  x,
int  p,
int  n 
)

Definition at line 1190 of file stvdriver.c.

◆ STV_Image()

int STV_Image ( void  )

Definition at line 153 of file stvdriver.c.

◆ STV_Interrupt()

int STV_Interrupt ( void  )

Definition at line 141 of file stvdriver.c.

◆ STV_LRRotaryDecrease()

int STV_LRRotaryDecrease ( void  )

Definition at line 99 of file stvdriver.c.

◆ STV_LRRotaryIncrease()

int STV_LRRotaryIncrease ( void  )

Definition at line 105 of file stvdriver.c.

◆ STV_Monitor()

int STV_Monitor ( void  )

Definition at line 159 of file stvdriver.c.

◆ STV_PrintBuffer()

int STV_PrintBuffer ( unsigned char *  cmdbuf,
int  n 
)

Definition at line 1041 of file stvdriver.c.

◆ STV_ReceivePacket()

int STV_ReceivePacket ( unsigned char *  buf,
int  mode 
)

Definition at line 825 of file stvdriver.c.

◆ STV_RequestAck()

int STV_RequestAck ( void  )

Definition at line 749 of file stvdriver.c.

◆ STV_RequestImage()

int STV_RequestImage ( int  compression,
int  buffer,
int  x_offset,
int  y_offset,
int *  length,
int *  lines,
int  image[][320],
IMAGE_INFO image_info 
)

Definition at line 430 of file stvdriver.c.

◆ STV_RequestImageInfo()

int STV_RequestImageInfo ( int  imagebuffer,
IMAGE_INFO image_info 
)

Definition at line 189 of file stvdriver.c.

◆ STV_SetCCDTemperature()

double STV_SetCCDTemperature ( double  set_value)

Definition at line 1230 of file stvdriver.c.

◆ STV_SetDateTime()

int STV_SetDateTime ( char *  times)

Definition at line 1288 of file stvdriver.c.

◆ STV_Setup()

int STV_Setup ( void  )

Definition at line 135 of file stvdriver.c.

◆ STV_TerminateTXDisplay()

int STV_TerminateTXDisplay ( void  )

Definition at line 714 of file stvdriver.c.

◆ STV_Track()

int STV_Track ( void  )

Definition at line 171 of file stvdriver.c.

◆ STV_TXDisplay()

int STV_TXDisplay ( void  )

Definition at line 708 of file stvdriver.c.

◆ STV_UDRotaryDecrease()

int STV_UDRotaryDecrease ( void  )

Definition at line 111 of file stvdriver.c.

◆ STV_UDRotaryIncrease()

int STV_UDRotaryIncrease ( void  )

Definition at line 117 of file stvdriver.c.

◆ uploadFile()

void uploadFile ( const char *  filename)

Definition at line 1710 of file stv.c.

◆ writeFITS()

int writeFITS ( const char *  filename,
IMAGE_INFO image_info,
char  errmsg[] 
)

Definition at line 1558 of file stv.c.

Variable Documentation

◆ fd

int fd

Definition at line 107 of file stv.c.

◆ tracking_buf

char tracking_buf[1024]

Definition at line 109 of file stv.c.

◆ UTCTP

Initial value:
= { mydev, "TIME_UTC", "UTC Time", SETTINGS_GROUP, IP_RW, 0, IPS_IDLE, UTCT,
NARRAY(UTCT), "", 0 }

Definition at line 222 of file stv.c.

mydev
#define mydev
Definition: stv.c:58
NARRAY
#define NARRAY(a)
Handy macro to find the number of elements in array a[]. Must be used with actual array,...
Definition: indiapi.h:499
SETTINGS_GROUP
#define SETTINGS_GROUP
Definition: stv.c:60
IPS_IDLE
@ IPS_IDLE
Definition: indiapi.h:160
IP_RW
@ IP_RW
Definition: indiapi.h:185