cVISCA Class Reference

Talk to cameras with the VISCA protocol. More...

#include <cVISCA.h>

List of all members.

Public Member Functions

 ~cVISCA ()
 Destructor.
void Log (int flag=1)
 Switch logging.
void NoCameraResponse (int flag=1)
 Specify whether or not camera responses are expected.
void ResetOnError (int flag=1)
 Specify whether or not a camera reset should be attempted when an error is detected.
void setCameraIndex (int i)
 Specify which of the VISCA camera we want to communicate with.
int SerialOpen (const char *device_name)
 Connect to the cameras.
void SerialClose ()
 Close connection.
int Reset ()
 Reset the cameras.
int SetAddress (int *camera_num)
 Find how many cameras are on the VISCA connection.
int clear ()
 Broadcast a clear to all cameras.
int get_camera_info (int &vendor, int &model)
 Read some information about the camera.
int setLive (int i)
 Select the camera view to simulate.
int pantilt_set (unsigned int pan_speed, unsigned int tilt_speed, int pan_position, int tilt_position)
 Send absolute pan and tilt position to camera.
int pantilt_get_value (int &pan_pos, int &tilt_pos)
 Get absolute pan and tilt position from camera.
int pantilt_drive_start (int leftright, int speed)
 Start Drive the pan_tilt camera.
int pantilt_drive_stop ()
 Stop Drive the pan_tilt camera.
int pantilt_home ()
 Move camera back to pan tilt home.
int zoom_set_value (int value)
 Set the zooom.
int zoom_get_value ()
 Get current camera zoom value.
int zoom_drive_start (int LRUDIO, int speed)
 Start zooming.
int zoom_drive_stop ()
 Stop the zoom drive.
int set_focus_value (int value)
 Set the focus value.
int IsSim ()
 True if simulator running.
int IsOpen ()
 True if there is an open VISCA connection.

Public Attributes

int myError
 They happen.


Detailed Description

Talk to cameras with the VISCA protocol.

Copyright (c) 2008 by James Bremner All rights reserved.

Use license: Modified from standard BSD license.

Redistribution and use in source and binary forms are permitted provided that the above copyright notice and this paragraph are duplicated in all such forms and that any documentation, advertising materials, Web server pages, and other materials related to such distribution and use acknowledge that the software was developed by James Bremner. The name "James Bremner" may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.


Constructor & Destructor Documentation

cVISCA::~cVISCA  ) 
 

Destructor.

Closes log file. Closes serial connection.


Member Function Documentation

int cVISCA::get_camera_info int &  vendor,
int &  model
 

Read some information about the camera.

Parameters:
[out] vendor 
[out] model Sony is vendor 1 Simulator returns 0xABCD for vendor and model

void cVISCA::Log int  flag = 1  ) 
 

Switch logging.

Parameters:
[in] flag 1 ON ( the default ) , 0 Off
The log file is named visca.log

void cVISCA::NoCameraResponse int  flag = 1  ) 
 

Specify whether or not camera responses are expected.

Parameters:
[in] flag true if no camera responses are expected, default true
If this routine is not called, the class defaults to responses expected

If no camera responses are expected, the class makes do as best it can. In particular, the get position routines return the last ordered position

int cVISCA::pantilt_drive_start int  leftright,
int  speed
 

Start Drive the pan_tilt camera.

Parameters:
[in] leftright 1 drive left, 2 drive right, 3 up 4 down
[in] speed 1 to 24

int cVISCA::pantilt_get_value int &  pan_pos,
int &  tilt_pos
 

Get absolute pan and tilt position from camera.

Parameters:
[out] pan_pos 
[out] tilt_pos 
Returns:
1 for success, 0 for failure
Simulator returns last set pan and tilt position

int cVISCA::pantilt_set unsigned int  pan_speed,
unsigned int  tilt_speed,
int  pan_position,
int  tilt_position
 

Send absolute pan and tilt position to camera.

Parameters:
[in] pan_speed 
[in] tilt_speed 
[in] pan_position degrees
[in] tilt_position degrees
We always use the maximum speed ( for BRC300 24 = 0x18 )

int cVISCA::Reset  ) 
 

Reset the cameras.

Returns:
1 on success, 0 on failure
Broadcasts a clear, then a set address

Updates myCameraNumber attribute

void cVISCA::ResetOnError int  flag = 1  ) 
 

Specify whether or not a camera reset should be attempted when an error is detected.

Parameters:
[in] flag true if camera reset required, default true
If this routine is not called, the class defaults to NO reset

If resets are not set, a detected error will cause the class methods to return 0 and set the myError attribute.

If resets are set, a detected error will cause the class to call the reset and THROW AN EXCEPTION. The exception will be an instance of the class Croak with attribute what = "Rest On Error". The class will be left in an undefined state, but the camera hardware should be reset and a call to any public class method should work correctly.

int cVISCA::SerialOpen const char *  interface_name  ) 
 

Connect to the cameras.

Parameters:
[in] interface_name 
Returns:
1 for success, 0 for failure
A typical interface name would be "COM1"

The interface name "STB" switches on the camera stub API The interface name "SIM" switches on the camera simulation

If the COM port is successfully opened, the cameras are reset and the number of cameras present are counted.

If the reset does not respond as expected, or the number of cameras are not valid, then the connection is closed and failure is returned. This can happen if some other device, a modem perhaps, is present on the port.

int cVISCA::set_focus_value int  value  ) 
 

Set the focus value.

Parameters:
[in] value 
Returns:
1 on success
The values ranges from 1000 ( near ) to 8400 ( far ) Is this hex or dec?

int cVISCA::SetAddress int *  camera_num  ) 
 

Find how many cameras are on the VISCA connection.

Parameters:
[out] camera_num number of camera detected
Simulator returns 3 cameras

void cVISCA::setCameraIndex int  i  ) 
 

Specify which of the VISCA camera we want to communicate with.

Parameters:
[in] i index of camera [1-7]
No error checking is done

int cVISCA::setLive int  i  ) 
 

Select the camera view to simulate.

Parameters:
[in] i 1-based camera index
Returns:
always 1
This does nothing unless connected to the camera simulator

int cVISCA::zoom_drive_start int  LRUDIO,
int  speed
 

Start zooming.

Parameters:
[in] LRUDIO 5 for in, 6 for out
[in] speed The zooming will continue until zoom_drive_stop is called

int cVISCA::zoom_get_value  ) 
 

Get current camera zoom value.

Returns:
degrees of field of view

int cVISCA::zoom_set_value int  value  ) 
 

Set the zooom.

Parameters:
[in] value 


The documentation for this class was generated from the following files:
Generated on Tue Sep 9 11:15:36 2008 by  doxygen 1.4.6-NO