Fawkes API
Fawkes Development Version
|
Visca control protocol implementation over a serial line. More...
#include "visca.h"
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 | set_power (bool powered) |
Set power state. More... | |
bool | is_powered () |
Check if camera is powered. 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... | |
bool | get_mirror () |
Get mirror sate. More... | |
void | set_mirror (bool mirror) |
Sett mirror sate. 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... | |
static const unsigned int | VISCA_ZOOM_VALUE_WIDE = 0x0000 |
Zoom value: wide. More... | |
static const unsigned int | VISCA_ZOOM_VALUE_1X = 0x0E6D |
Zoom value: 1x. More... | |
static const unsigned int | VISCA_ZOOM_VALUE_2X = 0x188E |
Zoom value: 2x. More... | |
static const unsigned int | VISCA_ZOOM_VALUE_3X = 0x2507 |
Zoom value: 3x. More... | |
static const unsigned int | VISCA_ZOOM_VALUE_4X = 0x2B82 |
Zoom value: 4x. More... | |
static const unsigned int | VISCA_ZOOM_VALUE_5X = 0x3130 |
Zoom value: 5x. More... | |
static const unsigned int | VISCA_ZOOM_VALUE_6X = 0x352E |
Zoom value: 6x. More... | |
static const unsigned int | VISCA_ZOOM_VALUE_7X = 0x385D |
Zoom value: 7x. More... | |
static const unsigned int | VISCA_ZOOM_VALUE_8X = 0x3B48 |
Zoom value: 8x. More... | |
static const unsigned int | VISCA_ZOOM_VALUE_9X = 0x3E01 |
Zoom value: 9x. More... | |
static const unsigned int | VISCA_ZOOM_VALUE_10X = 0x4000 |
Zoom value: 10x. More... | |
static const unsigned int | VISCA_ZOOM_VALUE_DIG_20X = 0x5000 |
Zoom value: 20x. More... | |
static const unsigned int | VISCA_ZOOM_VALUE_DIG_30X = 0x6000 |
Zoom value: 30x. More... | |
static const unsigned int | VISCA_ZOOM_VALUE_DIG_40X = 0x7000 |
Zoom value: 40x. More... | |
Visca::Visca | ( | const char * | device_file, |
unsigned int | def_timeout_ms = 10 , |
||
bool | blocking = true |
||
) |
Constructor.
device_file | serial device file (e.g. /dev/ttyUSB0) |
def_timeout_ms | default timeout for read operations applied if no explicit timeout is given. |
blocking | if 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. |
void Visca::apply_effect | ( | unsigned char | filter | ) |
Apply effect.
filter | filter |
Definition at line 1119 of file visca.cpp.
References fawkes::Exception::append().
void Visca::apply_effect_bnw | ( | ) |
Apply B/W effect.
Definition at line 1190 of file visca.cpp.
References fawkes::Exception::append().
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
void Visca::apply_effect_mosaic | ( | ) |
Apply mosaic effect.
Definition at line 1216 of file visca.cpp.
References fawkes::Exception::append().
void Visca::apply_effect_neg_art | ( | ) |
Apply negative art effect.
Definition at line 1164 of file visca.cpp.
References fawkes::Exception::append().
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
void Visca::apply_effect_pastel | ( | ) |
Apply pastel effect.
Definition at line 1151 of file visca.cpp.
References fawkes::Exception::append().
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
void Visca::apply_effect_sepia | ( | ) |
Apply sepia effect.
Definition at line 1177 of file visca.cpp.
References fawkes::Exception::append().
void Visca::apply_effect_slim | ( | ) |
Apply slim effect.
Definition at line 1229 of file visca.cpp.
References fawkes::Exception::append().
void Visca::apply_effect_solarize | ( | ) |
Apply solarize effect.
Definition at line 1203 of file visca.cpp.
References fawkes::Exception::append().
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
void Visca::apply_effect_stretch | ( | ) |
Apply stretch effect.
Definition at line 1242 of file visca.cpp.
References fawkes::Exception::append().
void Visca::cancel_command | ( | unsigned int | socket | ) |
Cancel a running command.
socket | socket that the command was send on |
Definition at line 542 of file visca.cpp.
References fawkes::Exception::append(), and ViscaException::ViscaException().
void Visca::clear | ( | void | ) |
Clear command buffers.
Definition at line 249 of file visca.cpp.
References fawkes::Exception::append(), and ViscaException::ViscaException().
bool Visca::data_available | ( | ) |
bool Visca::get_mirror | ( | ) |
Get mirror sate.
Definition at line 1317 of file visca.cpp.
References fawkes::Exception::append(), and ViscaException::ViscaException().
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.
pan | contains pan upon return |
tilt | contains tilt upon return |
Definition at line 752 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.
pan_speed | upon return contains pan speed index |
tilt_speed | upon return contains tilt speed index |
Definition at line 715 of file visca.cpp.
Referenced by SonyEviD100PVisca::get_speed_radsec().
unsigned int Visca::get_white_balance_mode | ( | ) |
Get white balance mode.
Definition at line 1257 of file visca.cpp.
References fawkes::Exception::append(), and ViscaException::ViscaException().
void Visca::get_zoom | ( | unsigned int & | zoom | ) |
Get zoom.
zoom | contains zoom upon return. |
Definition at line 1059 of file visca.cpp.
References fawkes::Exception::append(), and ViscaException::ViscaException().
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
bool Visca::is_nonblocking_finished | ( | unsigned int | item | ) | const |
Check if a non-blocking operation has been finished.
item | the non-blocking item to check |
Definition at line 419 of file visca.cpp.
References ViscaException::ViscaException().
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
bool Visca::is_powered | ( | ) |
Check if camera is powered.
Definition at line 610 of file visca.cpp.
References fawkes::Exception::append(), and ViscaException::ViscaException().
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received(), and PanTiltSonyEviD100PThread::init().
void Visca::open | ( | ) |
Open serial port.
Definition at line 138 of file visca.cpp.
References ViscaException::ViscaException().
void Visca::process | ( | ) |
Process incoming data.
Definition at line 568 of file visca.cpp.
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
void Visca::recv | ( | unsigned int | timeout_ms = 0xFFFFFFFF | ) |
Receive data.
timeout_ms | read timeout in miliseconds |
Definition at line 310 of file visca.cpp.
References fawkes::Exception::append().
void Visca::recv_ack | ( | unsigned int * | socket = NULL | ) |
Receive ACK packet.
socket | contains the socket that the ACK was received on upon return |
Definition at line 349 of file visca.cpp.
References fawkes::Exception::append(), and ViscaException::ViscaException().
void Visca::reset_effect | ( | ) |
Reset effects.
Definition at line 1138 of file visca.cpp.
References fawkes::Exception::append().
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
void Visca::reset_pan_tilt | ( | ) |
void Visca::reset_pan_tilt_limit | ( | ) |
Reset pan/tilt limit.
Definition at line 861 of file visca.cpp.
References fawkes::Exception::append().
void Visca::reset_zoom | ( | ) |
void Visca::send | ( | ) |
Send outbound queue.
Definition at line 270 of file visca.cpp.
References ViscaException::ViscaException().
void Visca::send_nonblocking | ( | unsigned int * | socket = NULL | ) |
Send non-blocking.
Does a non-blocking send.
socket | the socket that was used to send the request. |
Definition at line 384 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 430 of file visca.cpp.
References fawkes::Exception::append().
void Visca::set_mirror | ( | bool | mirror | ) |
Sett mirror sate.
mirror | true to enable mirroring, false to disable |
Definition at line 1297 of file visca.cpp.
References fawkes::Exception::append().
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received(), and PanTiltSonyEviD100PThread::init().
void Visca::set_pan_tilt | ( | int | pan, |
int | tilt | ||
) |
Set pan tilt.
pan | pan |
tilt | tilt |
Definition at line 638 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.
pan_left | most left pan value |
pan_right | most right pan value |
tilt_up | most up tilt value |
tilt_down | most down tilt value |
Definition at line 898 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.
pan_speed | a value between 0 and MAX_PAN_SPEED |
tilt_speed | a value between 0 and MAX_TILT_SPEED |
Exception | thrown if desired pan or tilt speed is too high |
Definition at line 696 of file visca.cpp.
Referenced by SonyEviD100PVisca::set_speed_radsec().
void Visca::set_power | ( | bool | powered | ) |
Set power state.
powered | true to power on, false to power off |
Definition at line 589 of file visca.cpp.
References fawkes::Exception::append().
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received(), PanTiltSonyEviD100PThread::finalize(), and PanTiltSonyEviD100PThread::init().
void Visca::set_zoom | ( | unsigned int | zoom | ) |
Set zoom.
zoom | zoom value |
Definition at line 1028 of file visca.cpp.
References fawkes::Exception::append().
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
void Visca::set_zoom_digital_enabled | ( | bool | enabled | ) |
Enable or disable digital zoome.
enabled | true to enable digital zoom, false to disable |
Definition at line 1094 of file visca.cpp.
References fawkes::Exception::append().
void Visca::set_zoom_speed_tele | ( | unsigned int | speed | ) |
Set zoom speed in tele.
speed | speed |
Definition at line 982 of file visca.cpp.
References fawkes::Exception::append().
void Visca::set_zoom_speed_wide | ( | unsigned int | speed | ) |
Set zoom speed in wide angle.
speed | speed |
Definition at line 1005 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 723 of file visca.cpp.
References fawkes::Exception::append(), and ViscaInquiryRunningException::ViscaInquiryRunningException().
|
static |
Number of non-blocking items.
Definition at line 64 of file visca.h.
Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().
|
static |
Number of non-blocking items.
Definition at line 65 of file visca.h.
Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().
|
static |
Number of non-blocking items.
Definition at line 62 of file visca.h.
Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().
|
static |
Non-blocking pan/tilt item.
Definition at line 60 of file visca.h.
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received(), and ViscaInquiryRunningException::ViscaInquiryRunningException().
|
static |
Non-blocking zoom item.
Definition at line 61 of file visca.h.
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received(), and ViscaInquiryRunningException::ViscaInquiryRunningException().
|
static |
ATW white balance preset.
Definition at line 57 of file visca.h.
Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().
|
static |
Indoor white balance preset.
Definition at line 54 of file visca.h.
Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().
|
static |
Manual white balance.
Definition at line 58 of file visca.h.
Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().
|
static |
One push white balance preset.
Definition at line 56 of file visca.h.
Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().
|
static |
Outdoor white balance preset.
Definition at line 55 of file visca.h.
Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().
|
static |
Automatic white balance.
Definition at line 53 of file visca.h.
Referenced by ViscaInquiryRunningException::ViscaInquiryRunningException().
|
static |
Zoom value: 10x.
Definition at line 88 of file visca.h.
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
|
static |
Zoom value: 1x.
Definition at line 70 of file visca.h.
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
|
static |
Zoom value: 2x.
Definition at line 72 of file visca.h.
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
|
static |
Zoom value: 3x.
Definition at line 74 of file visca.h.
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
|
static |
Zoom value: 4x.
Definition at line 76 of file visca.h.
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
|
static |
Zoom value: 5x.
Definition at line 78 of file visca.h.
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
|
static |
Zoom value: 6x.
Definition at line 80 of file visca.h.
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
|
static |
Zoom value: 7x.
Definition at line 82 of file visca.h.
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
|
static |
Zoom value: 8x.
Definition at line 84 of file visca.h.
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
|
static |
Zoom value: 9x.
Definition at line 86 of file visca.h.
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
|
static |
Zoom value: 20x.
Definition at line 90 of file visca.h.
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
|
static |
Zoom value: 30x.
Definition at line 92 of file visca.h.
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
|
static |
Zoom value: 40x.
Definition at line 94 of file visca.h.
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().
|
static |
Zoom value: wide.
Definition at line 68 of file visca.h.
Referenced by PanTiltSonyEviD100PThread::bb_interface_message_received().