Go up one levelGo to Previous Go to Next

rtdImageEvent(3)

NAME

 
 rtdImageEvent     - Real-Time image event client interface.

 rtdInitImageEvt   - initialize and register to rtdServer.

 rtdSendImageInfo  - send image event information to rtdServer.

 rtdAttachImageEvt - attach to image event notification.

 rtdDetachImageEvt - detach notification of image events.

 rtdRecvImageInfo  - receive image event information from rtdServer.

 rtdClose          - close event handel.

SYNOPSIS

 
#include "rtdImageEvent.h"
int rtdInitImageEvt(char              *requestor,
                    rtdIMAGE_EVT_HNDL *eventHndl,
                    char              *error)

int rtdSendImageInfo(rtdIMAGE_EVT_HNDL  *eventHndl,
                     rtdIMAGE_INFO      *imageInfo,
                     char               *error)

int rtdAttachImageEvt(rtdIMAGE_EVT_HNDL *eventHndl,
                      char              *camera,
                      char              *error)

int rtdDetachImageEvt(rtdIMAGE_EVT_HNDL *eventHndl,
                      char              *camera,
                      char              *error)

int rtdRecvImageInfo(rtdIMAGE_EVT_HNDL *eventHndl,
                     rtdIMAGE_INFO     *imageInfo,
                     int                verbose,
                     char              *error)

int rtdClose(rtdIMAGE_EVT_HNDL *eventHndl,
             char              *error)

DESCRIPTION

 
rtdInitImageEvt() registers the current process e.g. image
aquisition process or rtdWidget to the rtdServer running on
the local workstation. The requestor is a string passed to identify
the process. The function returns with a valid event handle
which is used for subsequent calls to the rtdServer.

rtdSendImageInfo() is used to send image event information
when an image is ready to be displayed in shared memory.
The eventHndl is the one passed from rtdInitImageEvt,
the imageInfo is information about the image.

rtdAttachImageEvt() attaches a process to event notification of
an image source. eventHndl is the handle returned by rtdRecvImageInfo.
camera is the name of the system providing images e.g. aquisition
system. After an attach the received image events can be retrieved
by a call to rtdRecvImageInfo().

rtdDetachImageEvt() stops the notification of image events. eventHndl
is the handle returned by rtdRecvImageInfo. camera is the name of the
system providing images.

rtdRecvImageInfo() is used to receive the image event information
from the rtdServer. Image events are received when the process is
attached to event notification. eventHndl is the handle returned
by rtdInitImageEvt, imageInfo a pointer to a rtdIMAGE_INFO structure.
If verbose is non-zero diagnostic messages are printed.

rtdClose()
Closes connection to rtdServer. Use when finished with real-time display
or repeated errors occuring on rtdSendImageInfo.

RETURN VALUES

 
RTD_OK upon success or
RTD_ERROR upon failure.

NOTE

 
The error field in all functions is reserved for future use.

ENVIRONMENT

 
The port number of rtdServer is normally specified in /etc/services.
If the user want to use a different port number the this can be set
in the environment RTD_SERVER_PORT.

EXAMPLE

 
// sample application which send a SHORT image to real-time display
#include <sys/ipc.h>
#include <sys/shm.h>
#include "rtdImageEvent.h"

rtdIMAGE_EVT_HNDL  eventHndl;
rtdIMAGE_INFO      imageInfo;
char               *errMsg;
int                shmId;
char               *shmPtr;

if (rtdInitImageEvt("My_CCD_Camera",&eventHndl,errMsg) == RTD_ERROR)
    {
    fprintf(stderr,"rtdInitImageEvt error:%s",errMsg);
    ... handle error ...
    }

shmId    = shmget(IPC_PRIVATE,512*512*sizeof(short),0666);

 shmPtr   = (char *)shmat(shmId,NULL,0);
if (shmPtr == -1)
    { .. handle error ... }

... generate the image ...

memset(&imageInfo, '\0', sizeof(rtdIMAGE_INFO));
imageInfo.dataType = SHORT;
imageInfo.shmId    = shmId;
imageInfo.xPixels  = 512;
imageInfo.yPixels  = 512;

/ send image event
f (rtdSendImageInfo(&eventHndl,&imageInfo,errMsg) == RTD_ERROR)
    {
    fprintf(stderr,"rtdSendImageInfo error:%s",errMsg);
    ... handle error ...
    }

/ if finishing close connection and delete shared memory
tdClose((&eventHndl,errMsg);

f (shmId) shmctl(shmId,IPC_RMID,NULL);

SEE ALSO

 
rtdServer(1)

 


- - - - - -
Last change: 07 May 99

 


Go up one levelGo to Previous Go to Next

Please send questions or comments to abrighto@eso.org.
Copyright © 1998 ESO - European Southern Observatory