Communications/Control
[EDT Digital Imaging Library]


Detailed Description

Serial communications and camera control subroutines.

Subroutines in this section of the library fall into three general categories: 1) low level serial communications and control, 2) framing commands for cameras that have sophisticated command framing protocols, and 3) high level convenience routines for specific operations on selected cameras.

These subroutines are used to communicate with cameras that have a serial command set. Since there is (to date) no standard command set, programmers who wish to embed camera control commands within applications will need to write code that is specific to the camera(s) in use.

Serial control typically consists a command/response sequence, and looks like the following:

 pdv_serial_command(pdv_p, command_string); // ASCII; for binary use pdv_serial_binary_command
 n = pdv_serial_wait(pdv_p, timeout, nchars);
 pdv_serial_read(pdv_p, response_string, n); 

The above is the most general purpose method, but it can be slow since pdv_serial_wait will only return after the timeout period expires, in order to ensure that all of the response characters have come in. If the last character of a response is known and can be assured to always be unique within that response, then the use of a serial wait character can be used. When set, it causes pdv_serial_wait to return immediately when the character is seen, without waiting for the full timeout period to expire:

 pdv_set_waitchar(pdv_p, '\n');    // only needs to be set once
 pdv_serial_command(pdv_p, command_string);
 n = pdv_serial_wait(pdv_p, timeout, nchars); // still use max timeout in case of failure
 pdv_serial_read(pdv_p, response_string, n);

Note:
When this library was originally developed, there were a relatively small number of cameras and camera command sets to deal with. Consequently, subroutines written to directly control specific camera parameters such as pdv_set_exposure, pdv_set_gain and pdv_set_blacklevel were coded to handle those tasks for the majority of cameras that had such functionality. With the proliferation of cameras and command sets over the years, these "convenience routines" have become less useful. They remain helpful for cameras whose command sets conform to the relatively narrow format defined by the serial_exposure, serial_gain and serial_offset config directives, but even then such control is limited, so for full control of cameras it is usually necessary for programmers to code such control with the lower-level subroutines pdv_serial_command, pdv_serial_binary_command, pdv_serial_wait and pdv_serial_read (or specialized framing commands such as pdv_send_basler_frame). One important exception is if the camera and board are to be set up for pulse-width, aka level trigger acquisition control (where the length of the board's shutter timer is used to control the length of the EXPOSE pulse and consequently the camera's integration time). When using that mode (ebabled via the method_camera_shutter_timing configuration directive), pdv_set_exposure should be used, since it also controls the board's expose timer.


Functions

int pdv_get_baud (PdvDev *pdv_p)
 Get the baud rate, typically initialized by the serial_baud directive in the config file (default 9600).
int pdv_get_serial_block_size ()
 Returns the block size for serial writes.
int pdv_get_waitchar (PdvDev *pdv_p, u_char *waitc)
 Get serial wait character, or byte.
int pdv_query_serial (PdvDev *pdv_p, char *cmd, char **resp)
 Send a serial command, get the response in a multiline string, one line per string pointer.
int pdv_read_basler_frame (PdvDev *pdv_p, u_char *frame, int len)
 Read a Basler binary frame command.
int pdv_read_duncan_frame (PdvDev *pdv_p, u_char *frame)
 Read response (binary serial) from a Duncantech MS and DT series camera -- checks for STX and size, then waits for size+1 more bytes.
void pdv_reset_serial (PdvDev *pdv_p)
 Resets the serial interface.
int pdv_send_basler_command (PdvDev *pdv_p, int cmd, int rwflag, int len, int data)
 Send a basler binary command -- do the framing and BCC.
int pdv_send_basler_frame (PdvDev *pdv_p, u_char *cmd, int len)
 Send a Basler formatted serial frame.
void pdv_send_break (PdvDev *pdv_p)
 send serial break (only aiag and related xilinx files)
int pdv_send_duncan_frame (PdvDev *pdv_p, u_char *cmdbuf, int size)
 Send a Duncantech MS / DT series camera frame -- adds the framing and checksum, then sends the command.
int pdv_send_msg (PdvDev *ed, int chan, const char *buf, int size)
 wrapper for edt_send_msg, but added pause between bytes if indicated by pause_for_serial (done initially for imperx cam)
int pdv_serial_binary_command (PdvDev *pdv_p, const char *cmd, int len)
 Sends binary serial command(s) to the camera.
int pdv_serial_binary_command_flagged (PdvDev *pdv_p, const char *cmd, int len, u_int flag)
 Sends a binary serial command.
int pdv_serial_check_enabled (PdvDev *pdv_p)
int pdv_serial_command (PdvDev *pdv_p, const char *cmd)
 Sends an ASCII serial command to the camera, with ASCII camera command formatting.
int pdv_serial_command_flagged (PdvDev *pdv_p, const char *cmd, u_int flag)
 Bottom level serial_command that takes a flag for different options.
int pdv_serial_command_hex (PdvDev *pdv_p, const char *str, int length)
 Send hex byte command (formatted ascii "0xNN") as binary.
int pdv_serial_get_numbytes (PdvDev *pdv_p)
 Returns the number of bytes of unread data in the serial response buffer.
char * pdv_serial_prefix (PdvDev *pdv_p)
 Get the serial prefix.
int pdv_serial_read (PdvDev *pdv_p, char *buf, int count)
 Performs a serial read over the serial control lines.
int pdv_serial_read_blocking (PdvDev *pdv_p, char *buf, int size)
 Performs a serial read over the serial control lines, blocks until all requested serial is read.
int pdv_serial_read_disable (PdvDev *pdv_p)
int pdv_serial_read_enable (PdvDev *pdv_p)
int pdv_serial_read_nullterm (PdvDev *pdv_p, char *buf, int size, int nullterm)
 Preforms a serial read over the RS-422 or RS-232 lines if EDT has provided a special cable to accommodate RS-422 or RS-232 serial control.
char * pdv_serial_term (PdvDev *pdv_p)
 Get the serial terminator.
void pdv_serial_txrx (PdvDev *pdv_p, char *txbuf, int txcount, char *rxbuf, int rxcount, int timeout, u_char *wchar)
 Serial send AND recieve -- send a command and wait for the response.
int pdv_serial_wait (PdvDev *pdv_p, int msecs, int count)
 Waits for response from the camera as a result of a pdv_serial_write or pdv_serial_command.
int pdv_serial_wait_next (EdtDev *pdv_p, int msecs, int count)
 Wait for next serial to come in -- ignore any previous if 0, just wait for the next thing, however many it is.
int pdv_serial_write (PdvDev *pdv_p, const char *buf, int size)
 Performs a serial write over the serial lines.
int pdv_serial_write_available (PdvDev *pdv_p)
 pdv_serial_write_avail Get the number of bytes available in the driver's serial write buffer.
int pdv_serial_write_single_block (PdvDev *pdv_p, const char *buf, int size)
 Writes a serial command buffer to a serial aia (Kodak type) device.
int pdv_set_baud (PdvDev *pdv_p, int baud)
 Sets the baud rate on the serial lines; applies only to cameras with serial control.
void pdv_set_serial_block_size (int newsize)
 Sets the block size for serial writes if the default of 512 is not adequate.
void pdv_set_serial_delimiters (PdvDev *pdv_p, char *prefix, char *term)
 Get the serial prefix.
int pdv_set_serial_parity (PdvDev *pdv_p, char parity)
 Sets parity to even, odd, or none.
int pdv_set_waitchar (PdvDev *pdv_p, int enable, u_char wchar)
 Set serial wait character.


Function Documentation

int pdv_get_baud ( PdvDev pdv_p  ) 

Get the baud rate, typically initialized by the serial_baud directive in the config file (default 9600).

Returns:
baud rate in bits/sec, or 0 on error
See also:
serial_baud directive in the Camera Configuration Guide

Definition at line 7171 of file libpdv.c.

int pdv_get_serial_block_size ( void   ) 

Returns the block size for serial writes.

Returns:
the serial block size
See also:
pdv_get_serial_block_size

Definition at line 3917 of file libpdv.c.

int pdv_get_waitchar ( PdvDev pdv_p,
u_char *  waitc 
)

Get serial wait character, or byte.

This value, if set, is what pdv_serial_wait will return immediately after it comes in instead of waiting for the serial timeout period to expire.

Parameters:
pdv_p same as it ever was
waitc character (byte) to wait for
Returns:
1 if waitchar enabled, 0 if disabled
See also:
pdv_set_waitchar and serial_waitchar directive in the Camera Configuration Guide

Definition at line 6554 of file libpdv.c.

int pdv_query_serial ( PdvDev pdv_p,
char *  cmd,
char **  resp 
)

Send a serial command, get the response in a multiline string, one line per string pointer.

Returns:
the number of strings found. Max return string length is 2048

Definition at line 9138 of file libpdv.c.

int pdv_read_basler_frame ( PdvDev pdv_p,
u_char *  frame,
int  len 
)

Read a Basler binary frame command.

Check the framing and BCC -- ref. BASLER A202K Camera Manual Doc. ID number DA044003

RETURNS number of characters read back, or 0 if none or failure

Definition at line 4438 of file libpdv.c.

int pdv_read_duncan_frame ( PdvDev pdv_p,
u_char *  frame 
)

Read response (binary serial) from a Duncantech MS and DT series camera -- checks for STX and size, then waits for size+1 more bytes.

Ref. DuncanTech User Manual Doc # 9000-0001-05.

Convenience routine for Duncantech (Redlake) DT/MS series cameras only.

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
frame buffer containing the frame read back from the camera
See also:
pdv_send_duncan_frame

Definition at line 4534 of file libpdv.c.

void pdv_reset_serial ( PdvDev pdv_p  ) 

Resets the serial interface.

This is mostly used during initialization (initcam) to make sure any outstanding reads and writes from previous interrupted applications are cleaned up and to put the serial state machine in a known idle state. Applications typically do not need to call this subroutine.

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open

Definition at line 7222 of file libpdv.c.

int pdv_send_basler_command ( PdvDev pdv_p,
int  cmd,
int  rwflag,
int  len,
int  data 
)

Send a basler binary command -- do the framing and BCC.

ref. BASLER A202K Camera Manual Doc. ID number DA044003.

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
cmd basler command
rwflag read/write flag -- 1 if read, 0 if write
len data length
data the data (if any)
Returns:
0 on success, -1 on failure

Definition at line 2675 of file libpdv.c.

int pdv_send_basler_frame ( PdvDev pdv_p,
u_char *  cmd,
int  len 
)

Send a Basler formatted serial frame.

Adds the framing and BCC, ref. BASLER A202K Camera Manual Doc. ID number DA044003

RETURNS 0 on success, -1 on failure

Definition at line 4412 of file libpdv.c.

int pdv_send_duncan_frame ( PdvDev pdv_p,
u_char *  cmdbuf,
int  size 
)

Send a Duncantech MS / DT series camera frame -- adds the framing and checksum, then sends the command.

Ref. DuncanTech User Manual Doc # 9000-0001-05.

cmdbuf: command buf: typically includes command, 2 size bytes, and size-1 message butes size: number of message bytes plus command byte

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
cmdbuf buffer containing the command, minus framing information
size number of bytes in the cmdbuf
Returns:
0 on success, -1 on failure
See also:
pdv_read_duncan_frame

Definition at line 4488 of file libpdv.c.

int pdv_send_msg ( PdvDev ed,
int  chan,
const char *  buf,
int  size 
)

wrapper for edt_send_msg, but added pause between bytes if indicated by pause_for_serial (done initially for imperx cam)

Returns:
0 on success, -1 on failure. If an error occurs, call pdv_perror to get the system error message.

Definition at line 3804 of file libpdv.c.

int pdv_serial_binary_command ( PdvDev pdv_p,
const char *  cmd,
int  len 
)

Sends binary serial command(s) to the camera.

Applicable only to cameras that use RS-232 or RS-422 binary serial for camera-computer communications. Similar to pdv_serial_command, but for binary instead of ASCII commands, it uses a count instead of a terminating NULL to indicate the end of the data. Also, it doesn't add on any terminating CR or LF characters.

Consult your camera manufacturer user's guide for information on serial command format requirements.

For a detailed example of serial communications, see the serial_cmd.c example program.

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
cmd buffer containing serial command(s)
len number of bytes to send
Returns:
0 on success, -1 on failure.
See also:
pdv_serial_command, pdv_serial_read, pdv_serial_wait

Definition at line 4399 of file libpdv.c.

int pdv_serial_binary_command_flagged ( PdvDev pdv_p,
const char *  cmd,
int  len,
u_int  flag 
)

Sends a binary serial command.

convenience wrapper for pdv_serial_write() -- takes the command string and prepends the 'c' to it if FOI, then calls pdv_serial_write(). Because of the FOI issue, applications should ALWAYS use this or one of the other pdv serial command calls (pdv_serial_binary_command, pdv_serial_command_flagged, etc.) instead of calling pdv_serial_write directly

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
cmd command -- must be a valid serial command for the camera in use, as defined in camera manufacturer's user's manual
len number of bytes of cmd to write
flag flag bits -- so far only SCFLAG_NORESP is defined -- tells the driver not to wait for a response before returning
Returns:
0 on success, -1 on failure

Definition at line 4581 of file libpdv.c.

int pdv_serial_command ( PdvDev pdv_p,
const char *  cmd 
)

Sends an ASCII serial command to the camera, with ASCII camera command formatting.

Applies only to cameras that use a serial control method for camera-computer communications.

Appends the required serial terminator onto the string before sending. The default serial terminator is the `\r' (carriage return) character, which is the most common serial terminator character for cameras with use ASCII serial command sets. If the serial_term directive is present in the config file in use, it will use the terminator specified by that instead. For example, if the camera requires a CR/LF (carriage return/line feed) to terminate instead of just a single carriage return, make sure the following command is in the config file in use:

 serial_term: "\r\n"

Also available but much less common is the serial prefix, which can also be added to any command via the serial_prefix camera configuration directive. By default there is no serial prefix.

For a detailed example of serial communications, see the serial_cmd.c example program.

Consult your camera manufacturer's users guide for information on serial command format reqirements.

Example

 pdv_serial_command(pdv_p, "DEF_ON"); // set defect correction on

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
cmd command -- must be a valid serial command for the camera in use, as as defined in the camera manufacturer's user's manual
Returns:
0 on success, -1 on failure
See also:
part of this comment.

pdv_serial_term, pdv_serial_prefix, pdv_set_serial_delimiters, pdv_serial_write

Definition at line 4170 of file libpdv.c.

int pdv_serial_command_flagged ( PdvDev pdv_p,
const char *  cmd,
u_int  flag 
)

Bottom level serial_command that takes a flag for different options.

Primarily for internal use; applications should avoid calling directly and instead use pdv_serial_command.

The only flag is the SCFLAG_NORESP flag, which says whether to wait for response on FOI. Normal case is no, but internally (when called from pdv_set_exposure, for example) the flag is set to 1 so it doesn't slow down the data stream.

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
cmd command to send
flag flag whether to wait for response on FOI
Returns:
0 on success, -1 on failure

Definition at line 4203 of file libpdv.c.

int pdv_serial_command_hex ( PdvDev pdv_p,
const char *  str,
int  length 
)

Send hex byte command (formatted ascii "0xNN") as binary.

Assumes the format has already been checked.

Not all that useful for user applications, mainly it's here for special use by pdv_initcam.

Attention:
length is unused -- here only for future use if/when we want to send more than one byte at a time. For now only one byte at a time (and only used by initcam really...).
Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
str ASCII command string containing "0x%s" hex formatted string
length reserved, for future use

Definition at line 7737 of file libpdv.c.

int pdv_serial_get_numbytes ( PdvDev pdv_p  ) 

Returns the number of bytes of unread data in the serial response buffer.

Similar to pdv_serial_wait but doesn't wait for any timeout period, nor does it have any minimum count parameter.

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
count Maximum number of bytes to wait for before returning.
Returns:
Number of bytes of unread data in the serial response buffer

Definition at line 6471 of file libpdv.c.

char* pdv_serial_prefix ( PdvDev pdv_p  ) 

Get the serial prefix.

See pdv_serial_command for more about the serial prefix.

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
Returns:
a character string containing any serial prefix character(s)
See also:
pdv_serial_command

Definition at line 4287 of file libpdv.c.

int pdv_serial_read ( PdvDev pdv_p,
char *  buf,
int  count 
)

Performs a serial read over the serial control lines.

The serial data read will be stored in a user supplied buffer. That buffer will be NULL-terminated. Use pdv_serial_read_nullterm(pdv_p, FALSE) if you don't want that behavior.

Example

  int count = 64;
  // wait for 64 bytes, or timeout, whichever comes first.
  int got = pdv_serial_wait(pdv_p, 0, count); 
  // read the data we waited for.
  char buf[count+1];
  pdv_serial_read(pdv_p, buf, got);
  if (got < count) {
      printf("timeout occurred while waiting for serial data\n");
  }
  if (got != 0) {
      printf("data read over serial: %s\n", buf);
  }

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
buf pointer to data buffer--must be preallocated to at least count + 1 bytes (count bytes of data plus a one byte NULL terminator).
count Number of bytes to be read.
Returns:
the number of bytes read into the buffer
See also:
pdv_serial_wait

Definition at line 3791 of file libpdv.c.

int pdv_serial_read_blocking ( PdvDev pdv_p,
char *  buf,
int  size 
)

Performs a serial read over the serial control lines, blocks until all requested serial is read.

Similar to pdv_serial_read but blocks until all requested serial bytes have been received. The serial data read will be stored in a user supplied buffer.

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
buf pointer to data buffer--must be preallocated to at least count + 1 bytes (count bytes of data plus a one byte NULL terminator).
count Number of bytes to be read.
Returns:
the number of bytes read in
See also:
pdv_serial_wait, pdv_serial_read

Definition at line 4068 of file libpdv.c.

int pdv_serial_read_nullterm ( PdvDev pdv_p,
char *  buf,
int  size,
int  nullterm 
)

Preforms a serial read over the RS-422 or RS-232 lines if EDT has provided a special cable to accommodate RS-422 or RS-232 serial control.

The buffer passed in will be NULL-terminated if nullterm is true.

Parameters:
pdv_p device struct returned from pdv_open
buf pointer to data buffer--must be preallocated to at least count bytes
size number of bytes to be read, which must be at most one less than the size of the buf (so there is room for the NULL terminator).
nullterm true to null terminate the buffer read in, false to disable that.
Returns:
The number of bytes read into buf.

Definition at line 3710 of file libpdv.c.

char* pdv_serial_term ( PdvDev pdv_p  ) 

Get the serial terminator.

See pdv_serial_command for more about the serial terminator.

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
Returns:
a character string containing any serial terminator character(s)
See also:
pdv_serial_command

Definition at line 4273 of file libpdv.c.

void pdv_serial_txrx ( PdvDev pdv_p,
char *  txbuf,
int  txcount,
char *  rxbuf,
int  rxcount,
int  timeout,
u_char *  wchar 
)

Serial send AND recieve -- send a command and wait for the response.

Takes both expected receive count and char on which to terminate the receive -- if both are specified will return on first one -- that is if there's a count of 4 but the 3rd char back is the one specified in wchar, then will return after 3.

Parameters:
pdv_p device handle returned by pdv_open
txbuf buffer to send out
txcount number of characters to send out
rxbuf buffer to hold response
rxcount number of characters expected back
timeout number of milliseconds to wait for expected response
wchar pointer to terminating char (NULL if none)

Definition at line 9871 of file libpdv.c.

int pdv_serial_wait ( PdvDev pdv_p,
int  msecs,
int  count 
)

Waits for response from the camera as a result of a pdv_serial_write or pdv_serial_command.

After calling this function, use pdv_serial_read to get the data. For a detailed example of serial communications, see the serial_cmd.c example program.

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
msecs number of milliseconds to wait before timing out. If this parameter is 0, the defualt timeout value is used, as specified by the serial_timeout directive in the current configuration file. If no default timout value was specified, the default is 1000 milliseconds (1 second).
count Maximum number of bytes to wait for before returning.
Returns:
Number of bytes of serial data returned from the camera.
See also:
pdv_serial_read for simple example.

Definition at line 6440 of file libpdv.c.

int pdv_serial_wait_next ( EdtDev pdv_p,
int  msecs,
int  count 
)

Wait for next serial to come in -- ignore any previous if 0, just wait for the next thing, however many it is.

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
msecs number of milliseconds to wait before timing out
count number maximum number to wait for
Returns:
number of characters seen, can be passed to pdv_serial_read
See also:
pdv_serial_wait, pdv_serial_read

Definition at line 6498 of file libpdv.c.

int pdv_serial_write ( PdvDev pdv_p,
const char *  buf,
int  size 
)

Performs a serial write over the serial lines.

This command applies only to cameras that use a serial control method.

This function is mainly for sending binary data over the serial lines to the camera. It can be used for ASCII commands, but pdv_serial_command is generally easier.

For a detailed example of serial communications, see the serial_cmd.c example program.

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
buf buffer containing serial command(s)
size number of bytes to send
Returns:
0 on success, -1 on failure.
See also:
pdv_serial_command

Definition at line 3983 of file libpdv.c.

int pdv_serial_write_available ( PdvDev pdv_p  ) 

pdv_serial_write_avail Get the number of bytes available in the driver's serial write buffer.

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
Returns:
the number of bytes available in the driver's write buffer

Definition at line 3886 of file libpdv.c.

int pdv_serial_write_single_block ( PdvDev pdv_p,
const char *  buf,
int  size 
)

Writes a serial command buffer to a serial aia (Kodak type) device.

Note: applications should pretty much ALWAYS use pdv_serial_command or pdv_serial_binary_command instead of calling pdv_serial_write directly since, when a FOI is detected, those two calls prepend the required that is needed to pass the command on to the camera.

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
buf string to send to the device
size number of bytes to write
Returns:
0 on success, -1 on failure (and errno is set). If an error occurs, call pdv_perror to get the system error message.

Definition at line 3843 of file libpdv.c.

int pdv_set_baud ( PdvDev pdv_p,
int  baud 
)

Sets the baud rate on the serial lines; applies only to cameras with serial control.

Valid values are 9600, 19200, 38500, 57500, and 115200.

Note:
The baud rate is ordinarily initialized using the value of the serial_baud directive in the configuration file, and defaults to 9600 if the directive is not present. Under most circumstances, applications do not need to set the baud rate explicitly.
Parameters:
baud the desired baud rate.
pdv_p pointer to pdv device structure returned by pdv_open
Returns:
0 on success, -1 on error

Definition at line 7076 of file libpdv.c.

void pdv_set_serial_block_size ( int  newsize  ) 

Sets the block size for serial writes if the default of 512 is not adequate.

Parameters:
newsize the new serial block size

Definition at line 3905 of file libpdv.c.

void pdv_set_serial_delimiters ( PdvDev pdv_p,
char *  prefix,
char *  term 
)

Get the serial prefix.

The serial prefix (if any) is typically set through the config file, which is that is the preferred way to set up any serial delimiters; calling this subroutine directly should be avoided.

See pdv_serial_command for more about the serial delimiters.

Parameters:
pdv_p pointer to pdv device structure returned by pdv_open
prefix - see pdv_serial_command
term - see pdv_serial_command
See also:
pdv_serial_command

Definition at line 4307 of file libpdv.c.

int pdv_set_serial_parity ( PdvDev pdv_p,
char  parity 
)

Sets parity to even, odd, or none.

Parameters:
parity the desired partity. Should be 'e', 'o', or 'n' for even, odd, or none (respectively).
pdv_p pointer to pdv device structure returned by pdv_open
Returns:
0 on success, -1 on error

Definition at line 7028 of file libpdv.c.

int pdv_set_waitchar ( PdvDev pdv_p,
int  enable,
u_char  wchar 
)

Set serial wait character.

Normally pdv_serial_wait will wait until the serial_timeout period expires before returning (unless the max number of characters is seen). This is the most general purpose and robust method since there's no other way of knowing all different camera response formats. However if the camera formats are known, and specifically a if each response can be expected to be 1 line terminated by the same character (such as a newline) every time, then setting the serial_waitchar to that character can greatly shorten the time it takes for a pdv_serial_wait call to return.

This character can also be initialized in the camera configuration directive serial_waitchar.

Returns:
0 in success, -1 on failure

Definition at line 6525 of file libpdv.c.


Generated on 19 Jun 2015 by  doxygen 1.4.7