Fawkes API  Fawkes Development Version
Visca Class Reference

Visca control protocol implementation over a serial line. More...

#include "visca.h"

Inheritance diagram for Visca:

Public Member Functions

 Visca (const char *device_file, unsigned int def_timeout_ms=10, bool blocking=true)
 Constructor. More...
 
virtual ~Visca ()
 Destructor. More...
 
void open ()
 Open serial port. More...
 
void close ()
 Close port. More...
 
void set_address ()
 Set addresses of cameras. More...
 
void clear ()
 Clear command buffers. More...
 
void send ()
 Send outbound queue. More...
 
void recv (unsigned int timeout_ms=0xFFFFFFFF)
 Receive data. More...
 
void recv_ack (unsigned int *socket=NULL)
 Receive ACK packet. More...
 
void send_with_reply ()
 Send and wait for reply, blocking. More...
 
void send_nonblocking (unsigned int *socket=NULL)
 Send non-blocking. More...
 
void cancel_command (unsigned int socket)
 Cancel a running command. More...
 
bool data_available ()
 Check data availability. More...
 
void process ()
 Process incoming data. More...
 
void reset_pan_tilt ()
 Reset pan/tilt. More...
 
void start_get_pan_tilt ()
 Query for pan/tilt but do not wait until finished This will send an inquire to the camera that asks for pan/tilt values but it does not wait for the data! A later call to getPanTilt will then block and wait until the results arrive. More...
 
void set_pan_tilt (int pan, int tilt)
 Set pan tilt. More...
 
void get_pan_tilt (int &pan, int &tilt)
 Get pan and tilt values. More...
 
void set_pan_tilt_limit (int pan_left, int pan_right, int tilt_up, int tilt_down)
 Set pan tilt limit. More...
 
void reset_pan_tilt_limit ()
 Reset pan/tilt limit. More...
 
void set_pan_tilt_speed (unsigned char pan_speed, unsigned char tilt_speed)
 Set pan/tilt speed. More...
 
void get_pan_tilt_speed (unsigned char &pan_speed, unsigned char &tilt_speed)
 Get pan/tilt speed. More...
 
bool is_nonblocking_finished (unsigned int item) const
 Check if a non-blocking operation has been finished. More...
 
void reset_zoom ()
 Reset zoom. More...
 
void set_zoom (unsigned int zoom)
 Set zoom. More...
 
void get_zoom (unsigned int *zoom)
 Get zoom. More...
 
void set_zoom_speed_tele (unsigned int speed)
 Set zoom speed in tele. More...
 
void set_zoom_speed_wide (unsigned int speed)
 Set zoom speed in wide angle. More...
 
void set_zoom_digital_enabled (bool enabled)
 Enable or disable digital zoome. More...
 
void reset_effect ()
 Reset effects. More...
 
void apply_effect (unsigned char effect)
 Apply effect. More...
 
void apply_effect_pastel ()
 Apply pastel effect. More...
 
void apply_effect_neg_art ()
 Apply negative art effect. More...
 
void apply_effect_sepia ()
 Apply sepia effect. More...
 
void apply_effect_bnw ()
 Apply B/W effect. More...
 
void apply_effect_solarize ()
 Apply solarize effect. More...
 
void apply_effect_mosaic ()
 Apply mosaic effect. More...
 
void apply_effect_slim ()
 Apply slim effect. More...
 
void apply_effect_stretch ()
 Apply stretch effect. More...
 
unsigned int get_white_balance_mode ()
 Get white balance mode. More...
 

Static Public Attributes

static const unsigned int VISCA_WHITEBLANCE_AUTO = VISCA_WB_AUTO
 Automatic white balance. More...
 
static const unsigned int VISCA_WHITEBALANCE_INDOOR = VISCA_WB_INDOOR
 Indoor white balance preset. More...
 
static const unsigned int VISCA_WHITEBALANCE_OUTDOOR = VISCA_WB_OUTDOOR
 Outdoor white balance preset. More...
 
static const unsigned int VISCA_WHITEBALANCE_ONE_PUSH = VISCA_WB_ONE_PUSH
 One push white balance preset. More...
 
static const unsigned int VISCA_WHITEBALANCE_ATW = VISCA_WB_ATW
 ATW white balance preset. More...
 
static const unsigned int VISCA_WHITEBALANCE_MANUAL = VISCA_WB_MANUAL
 Manual white balance. More...
 
static const unsigned int NONBLOCKING_PANTILT = 0
 Non-blocking pan/tilt item. More...
 
static const unsigned int NONBLOCKING_ZOOM = 1
 Non-blocking zoom item. More...
 
static const unsigned int NONBLOCKING_NUM = 2
 Number of non-blocking items. More...
 
static const unsigned int MAX_PAN_SPEED = 0x18
 Number of non-blocking items. More...
 
static const unsigned int MAX_TILT_SPEED = 0x14
 Number of non-blocking items. More...
 

Detailed Description

Visca control protocol implementation over a serial line.

Author
Tim Niemueller

Definition at line 51 of file visca.h.

Constructor & Destructor Documentation

Visca::Visca ( const char *  device_file,
unsigned int  def_timeout_ms = 10,
bool  blocking = true 
)

Constructor.

Parameters
device_fileserial device file (e.g. /dev/ttyUSB0)
def_timeout_msdefault timeout for read operations applied if no explicit timeout is given.
blockingif true, setting the pan/tilt values will only cause sending the request, you need to call process() when there is time to process and handle incoming messages.

Definition at line 107 of file visca.cpp.

Visca::~Visca ( )
virtual

Destructor.

Definition at line 130 of file visca.cpp.

Member Function Documentation

void Visca::apply_effect ( unsigned char  filter)

Apply effect.

Parameters
filterfilter

Definition at line 1050 of file visca.cpp.

References fawkes::Exception::append().

void Visca::apply_effect_bnw ( )

Apply B/W effect.

Definition at line 1121 of file visca.cpp.

References fawkes::Exception::append().

void Visca::apply_effect_mosaic ( )

Apply mosaic effect.

Definition at line 1147 of file visca.cpp.

References fawkes::Exception::append().

void Visca::apply_effect_neg_art ( )

Apply negative art effect.

Definition at line 1095 of file visca.cpp.

References fawkes::Exception::append().

void Visca::apply_effect_pastel ( )

Apply pastel effect.

Definition at line 1082 of file visca.cpp.

References fawkes::Exception::append().

void Visca::apply_effect_sepia ( )

Apply sepia effect.

Definition at line 1108 of file visca.cpp.

References fawkes::Exception::append().

void Visca::apply_effect_slim ( )

Apply slim effect.

Definition at line 1160 of file visca.cpp.

References fawkes::Exception::append().

void Visca::apply_effect_solarize ( )

Apply solarize effect.

Definition at line 1134 of file visca.cpp.

References fawkes::Exception::append().

void Visca::apply_effect_stretch ( )

Apply stretch effect.

Definition at line 1173 of file visca.cpp.

References fawkes::Exception::append().

void Visca::cancel_command ( unsigned int  socket)

Cancel a running command.

Parameters
socketsocket that the command was send on

Definition at line 527 of file visca.cpp.

References fawkes::Exception::append(), and ViscaException::ViscaException().

void Visca::clear ( void  )

Clear command buffers.

Definition at line 250 of file visca.cpp.

References fawkes::Exception::append(), and ViscaException::ViscaException().

void Visca::close ( )

Close port.

Definition at line 217 of file visca.cpp.

bool Visca::data_available ( )

Check data availability.

Returns
true if data is available, false otherwise

Definition at line 299 of file visca.cpp.

void Visca::get_pan_tilt ( int &  pan,
int &  tilt 
)

Get pan and tilt values.

If you used startGetPanTilt() to initiate the query the result is received and returned, otherwise a request is sent and the method blocks until the answer has been received.

Parameters
pancontains pan upon return
tiltcontains tilt upon return

Definition at line 689 of file visca.cpp.

References ViscaException::ViscaException().

Referenced by SonyEviD100PVisca::get_pan_tilt_rad().

void Visca::get_pan_tilt_speed ( unsigned char &  pan_speed,
unsigned char &  tilt_speed 
)

Get pan/tilt speed.

Parameters
pan_speedupon return contains pan speed index
tilt_speedupon return contains tilt speed index

Definition at line 652 of file visca.cpp.

Referenced by SonyEviD100PVisca::get_speed_radsec().

unsigned int Visca::get_white_balance_mode ( )

Get white balance mode.

Returns
white balance mode

Definition at line 1188 of file visca.cpp.

References fawkes::Exception::append(), and ViscaException::ViscaException().

void Visca::get_zoom ( unsigned int *  zoom)

Get zoom.

Parameters
zoomcontains zoom upon return.

Definition at line 990 of file visca.cpp.

References fawkes::Exception::append(), and ViscaException::ViscaException().

bool Visca::is_nonblocking_finished ( unsigned int  item) const

Check if a non-blocking operation has been finished.

Parameters
itemthe non-blocking item to check
Returns
true if the non-blocking operation has been finished, false otherwise

Definition at line 420 of file visca.cpp.

References ViscaException::ViscaException().

Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().

void Visca::open ( )

Open serial port.

Definition at line 139 of file visca.cpp.

References ViscaException::ViscaException().

void Visca::process ( )

Process incoming data.

Definition at line 553 of file visca.cpp.

Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().

void Visca::recv ( unsigned int  timeout_ms = 0xFFFFFFFF)

Receive data.

Parameters
timeout_msread timeout in miliseconds

Definition at line 311 of file visca.cpp.

References fawkes::Exception::append().

void Visca::recv_ack ( unsigned int *  socket = NULL)

Receive ACK packet.

Parameters
socketcontains the socket that the ACK was received on upon return

Definition at line 350 of file visca.cpp.

References fawkes::Exception::append(), and ViscaException::ViscaException().

void Visca::reset_effect ( )

Reset effects.

Definition at line 1069 of file visca.cpp.

References fawkes::Exception::append().

void Visca::reset_pan_tilt ( )

Reset pan/tilt.

Definition at line 879 of file visca.cpp.

References fawkes::Exception::append().

void Visca::reset_pan_tilt_limit ( )

Reset pan/tilt limit.

Definition at line 797 of file visca.cpp.

References fawkes::Exception::append().

void Visca::reset_zoom ( )

Reset zoom.

Definition at line 897 of file visca.cpp.

References fawkes::Exception::append().

void Visca::send ( )

Send outbound queue.

Definition at line 271 of file visca.cpp.

References ViscaException::ViscaException().

void Visca::send_nonblocking ( unsigned int *  socket = NULL)

Send non-blocking.

Does a non-blocking send.

Parameters
socketthe socket that was used to send the request.

Definition at line 385 of file visca.cpp.

References fawkes::Exception::append(), and ViscaException::ViscaException().

void Visca::send_with_reply ( )

Send and wait for reply, blocking.

Definition at line 432 of file visca.cpp.

References fawkes::Exception::append().

void Visca::set_address ( )

Set addresses of cameras.

Definition at line 228 of file visca.cpp.

void Visca::set_pan_tilt ( int  pan,
int  tilt 
)

Set pan tilt.

Parameters
panpan
tilttilt

Definition at line 575 of file visca.cpp.

References fawkes::Exception::append().

Referenced by SonyEviD100PVisca::set_pan_tilt_rad().

void Visca::set_pan_tilt_limit ( int  pan_left,
int  pan_right,
int  tilt_up,
int  tilt_down 
)

Set pan tilt limit.

Parameters
pan_leftmost left pan value
pan_rightmost right pan value
tilt_upmost up tilt value
tilt_downmost down tilt value

Definition at line 834 of file visca.cpp.

References fawkes::Exception::append().

void Visca::set_pan_tilt_speed ( unsigned char  pan_speed,
unsigned char  tilt_speed 
)

Set pan/tilt speed.

Parameters
pan_speeda value between 0 and MAX_PAN_SPEED
tilt_speeda value between 0 and MAX_TILT_SPEED
Exceptions
Exceptionthrown if desired pan or tilt speed is too high

Definition at line 633 of file visca.cpp.

Referenced by SonyEviD100PVisca::set_speed_radsec().

void Visca::set_zoom ( unsigned int  zoom)

Set zoom.

Parameters
zoomzoom value

Definition at line 964 of file visca.cpp.

References fawkes::Exception::append().

void Visca::set_zoom_digital_enabled ( bool  enabled)

Enable or disable digital zoome.

Parameters
enabledtrue to enable digital zoom, false to disable

Definition at line 1025 of file visca.cpp.

References fawkes::Exception::append().

void Visca::set_zoom_speed_tele ( unsigned int  speed)

Set zoom speed in tele.

Parameters
speedspeed

Definition at line 918 of file visca.cpp.

References fawkes::Exception::append().

void Visca::set_zoom_speed_wide ( unsigned int  speed)

Set zoom speed in wide angle.

Parameters
speedspeed

Definition at line 941 of file visca.cpp.

References fawkes::Exception::append().

void Visca::start_get_pan_tilt ( )

Query for pan/tilt but do not wait until finished This will send an inquire to the camera that asks for pan/tilt values but it does not wait for the data! A later call to getPanTilt will then block and wait until the results arrive.

Initiate a pan/tilt request, but do not wait for the reply.

Not that you can not run another inquire (get*) method until this call has finished! You will get VISCA_E_INQRUNNING as error message.

Definition at line 660 of file visca.cpp.

References fawkes::Exception::append(), and ViscaInquiryRunningException::ViscaInquiryRunningException().

Member Data Documentation

const unsigned int Visca::MAX_PAN_SPEED = 0x18
static

Number of non-blocking items.

Definition at line 65 of file visca.h.

Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().

const unsigned int Visca::MAX_TILT_SPEED = 0x14
static

Number of non-blocking items.

Definition at line 66 of file visca.h.

Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().

const unsigned int Visca::NONBLOCKING_NUM = 2
static

Number of non-blocking items.

Definition at line 63 of file visca.h.

Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().

const unsigned int Visca::NONBLOCKING_PANTILT = 0
static
const unsigned int Visca::NONBLOCKING_ZOOM = 1
static

Non-blocking zoom item.

Definition at line 62 of file visca.h.

Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().

const unsigned int Visca::VISCA_WHITEBALANCE_ATW = VISCA_WB_ATW
static

ATW white balance preset.

Definition at line 58 of file visca.h.

Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().

const unsigned int Visca::VISCA_WHITEBALANCE_INDOOR = VISCA_WB_INDOOR
static

Indoor white balance preset.

Definition at line 55 of file visca.h.

Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().

const unsigned int Visca::VISCA_WHITEBALANCE_MANUAL = VISCA_WB_MANUAL
static

Manual white balance.

Definition at line 59 of file visca.h.

Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().

const unsigned int Visca::VISCA_WHITEBALANCE_ONE_PUSH = VISCA_WB_ONE_PUSH
static

One push white balance preset.

Definition at line 57 of file visca.h.

Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().

const unsigned int Visca::VISCA_WHITEBALANCE_OUTDOOR = VISCA_WB_OUTDOOR
static

Outdoor white balance preset.

Definition at line 56 of file visca.h.

Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().

const unsigned int Visca::VISCA_WHITEBLANCE_AUTO = VISCA_WB_AUTO
static

Automatic white balance.

Definition at line 54 of file visca.h.

Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().


The documentation for this class was generated from the following files: