Main Page | Data Structures | File List | Data Fields | Globals

image.c File Reference

AzCam Image Writing Command Functions. More...

#include "azcam.h"

Functions

int SetSocket (azcam_t *cam, int client, char *host, int port, char *reply)
 Open/Close socket connections to various AzCam server clients.
int WriteImage (azcam_t *cam, char *filename, char *reply)
 Write an image from memory to disk.
int SendImage (azcam_t *cam, int client, char *host, int port, char *reply)
 Send the image in memory to the named client.


Detailed Description

AzCam Image Writing Command Functions.

The following are a suite of interface functions that provide access to all of the AzCam server image writing functions.

All routines call the communication layer routines in iosubs.c to take care of common handling of timeout, errors, and reply processing.

All of the image writing commands documented in Section 8 of the AzCam Programmers Reference Manual are implemented.

Author:
R. Pogge, OSU Astronomy Dept. (pogge@astronomy.ohio-state.edu)
Date:
2005 May 17

Function Documentation

int SetSocket azcam_t cam,
int  client,
char *  host,
int  port,
char *  reply
 

Open/Close socket connections to various AzCam server clients.

Parameters:
cam pointer to an azcam struct with the server parameters
client client code, one of (GUIDER_CLIENT, GUIDER_CLOSE, MESSAGE_CLIENT, MESSAGE_CLOSE, DISPLAY_CLIENT, FILE_CLIENT).
host string with the hostname of the target client
port port number of the target client
reply string to contain any reply text
Returns:
0 if successful, -1 on errors, with error text in reply
Instructs the AzCam server to open a client connection socket to one of a set of possible remote clients. For Guider and Message clients, there are also options to close that client socket. Those clients designed to handle image data are sent image data using the SendImage() function.

Supported client codes are:

    GUIDER_CLIENT  - opens a connection to an autoguider client
    GUIDER_CLOSE   - closes a connection to an autoguider client
    MESSAGE_CLIENT - opens a connection to a message client (sees all status messages)
    MESSAGE_CLOSE  - closes a connection to a messge client
    DISPLAY_CLIENT - defines a display client (SendImage() will open/close socket)
    FILE_CLIENT    - defines a file handler client (SendImage() will open/close socket)
  

There are two classes of clients at work: persistent clients whose socket connections are opened or closed by this function (Guider and Message clients), and non-persistent clients that are opened/closed by the SendImage() function.

See also:
SendImage()

int WriteImage azcam_t cam,
char *  filename,
char *  reply
 

Write an image from memory to disk.

Parameters:
cam pointer to an azcam struct with the server parameters
filename full path and name of the file to create.
reply string to contain any reply text
Returns:
0 if successful, -1 on errors, with error text in reply
Writes the contents of the AzCam server's internal image buffer to a disk file. This function is issued after readout has finished. If the image is a multi-detector mosaic, the format code is ignored and the image is written as a multi-extension FITS (MEF) format image (same as format=EXTFITS) as indicated by the azcam::FileFormat value.

The filename provided must be the full name of the file including all counters, paths, etc. The calling application is responsible for building a full valid filename; this function cannot do validation. The path must be a valid file path on the AzCam server proper.

On successful completion, this function sets the azcam::LastFile datum to tell the calling application the name of the file just written. It does not, however advance file counters. That is the responsibility of the calling application (since counters are optional).

int SendImage azcam_t cam,
int  client,
char *  host,
int  port,
char *  reply
 

Send the image in memory to the named client.

Parameters:
cam pointer to an azcam struct with the server parameters
client client type, one of DISPLAY_CLIENT, FILE_CLIENT, or GUIDER_CLIENT.
host hostname of the target client
port port number of the target client
reply string to contain any reply text
Returns:
0 if successful, -1 on errors, with error text in reply
Sends the current image in memory to the specified client.

If client is DISPLAY_CLIENT, the AzCam server opens the client socket, sends the data, then closes the client socket.

If client is FILE_CLIENT, the AzCam server opens the client socket, sends the complete image (header+data), then closes the client socket.

If client is GUIDER_CLIENT, the AzCam server sends the image data to the client. The AzCam server does not first open the guider client, this must be done with a previous call to SetSocket().


Generated on Tue May 24 13:55:31 2005 for AzCam CCD Camera Client API by  doxygen 1.4.2