Visca Class Reference
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. | |
| virtual | ~Visca () |
| Destructor. | |
| void | open () |
| Open serial port. | |
| void | close () |
| Close port. | |
| void | set_address () |
| Set addresses of cameras. | |
| void | clear () |
| Clear command buffers. | |
| void | send () |
| Send outbound queue. | |
| void | recv (unsigned int timeout_ms=0xFFFFFFFF) |
| Receive data. | |
| void | recv_ack (unsigned int *socket=NULL) |
| Receive ACK packet. | |
| void | send_with_reply () |
| Send and wait for reply, blocking. | |
| void | send_nonblocking (unsigned int *socket=NULL) |
| Send non-blocking. | |
| void | cancel_command (unsigned int socket) |
| Cancel a running command. | |
| bool | data_available () |
| Check data availability. | |
| void | process () |
| Process incoming data. | |
| void | reset_pan_tilt () |
| Reset pan/tilt. | |
| 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. | |
| void | set_pan_tilt (int pan, int tilt) |
| Set pan tilt. | |
| void | get_pan_tilt (int &pan, int &tilt) |
| Get pan and tilt values. | |
| void | set_pan_tilt_limit (int pan_left, int pan_right, int tilt_up, int tilt_down) |
| Set pan tilt limit. | |
| void | reset_pan_tilt_limit () |
| Reset pan/tilt limit. | |
| void | set_pan_tilt_speed (unsigned char pan_speed, unsigned char tilt_speed) |
| Set pan/tilt speed. | |
| void | get_pan_tilt_speed (unsigned char &pan_speed, unsigned char &tilt_speed) |
| Get pan/tilt speed. | |
| bool | is_nonblocking_finished (unsigned int item) const |
| Check if a non-blocking operation has been finished. | |
| void | reset_zoom () |
| Reset zoom. | |
| void | set_zoom (unsigned int zoom) |
| Set zoom. | |
| void | get_zoom (unsigned int *zoom) |
| Get zoom. | |
| void | set_zoom_speed_tele (unsigned int speed) |
| Set zoom speed in tele. | |
| void | set_zoom_speed_wide (unsigned int speed) |
| Set zoom speed in wide angle. | |
| void | set_zoom_digital_enabled (bool enabled) |
| Enable or disable digital zoome. | |
| void | reset_effect () |
| Reset effects. | |
| void | apply_effect (unsigned char effect) |
| Apply effect. | |
| void | apply_effect_pastel () |
| Apply pastel effect. | |
| void | apply_effect_neg_art () |
| Apply negative art effect. | |
| void | apply_effect_sepia () |
| Apply sepia effect. | |
| void | apply_effect_bnw () |
| Apply B/W effect. | |
| void | apply_effect_solarize () |
| Apply solarize effect. | |
| void | apply_effect_mosaic () |
| Apply mosaic effect. | |
| void | apply_effect_slim () |
| Apply slim effect. | |
| void | apply_effect_stretch () |
| Apply stretch effect. | |
| unsigned int | get_white_balance_mode () |
| Get white balance mode. | |
Static Public Attributes | |
| static const unsigned int | VISCA_WHITEBLANCE_AUTO = VISCA_WB_AUTO |
| Automatic white balance. | |
| static const unsigned int | VISCA_WHITEBALANCE_INDOOR = VISCA_WB_INDOOR |
| Indoor white balance preset. | |
| static const unsigned int | VISCA_WHITEBALANCE_OUTDOOR = VISCA_WB_OUTDOOR |
| Outdoor white balance preset. | |
| static const unsigned int | VISCA_WHITEBALANCE_ONE_PUSH = VISCA_WB_ONE_PUSH |
| One push white balance preset. | |
| static const unsigned int | VISCA_WHITEBALANCE_ATW = VISCA_WB_ATW |
| ATW white balance preset. | |
| static const unsigned int | VISCA_WHITEBALANCE_MANUAL = VISCA_WB_MANUAL |
| Manual white balance. | |
| static const unsigned int | NONBLOCKING_PANTILT = 0 |
| Non-blocking pan/tilt item. | |
| static const unsigned int | NONBLOCKING_ZOOM = 1 |
| Non-blocking zoom item. | |
| static const unsigned int | NONBLOCKING_NUM = 2 |
| Number of non-blocking items. | |
| static const unsigned int | MAX_PAN_SPEED = 0x18 |
| Number of non-blocking items. | |
| static const unsigned int | MAX_TILT_SPEED = 0x14 |
| Number of non-blocking items. | |
Detailed Description
Visca control protocol implementation over a serial line.
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_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.
Definition at line 107 of file visca.cpp.
References clear(), MAX_PAN_SPEED, MAX_TILT_SPEED, NONBLOCKING_NUM, open(), and set_address().
| Visca::~Visca | ( | ) | [virtual] |
Member Function Documentation
| void Visca::apply_effect | ( | unsigned char | filter | ) |
Apply effect.
- Parameters:
-
filter filter
Definition at line 1045 of file visca.cpp.
References fawkes::Exception::append(), and send_with_reply().
Referenced by apply_effect_bnw(), apply_effect_mosaic(), apply_effect_neg_art(), apply_effect_pastel(), apply_effect_sepia(), apply_effect_slim(), apply_effect_solarize(), apply_effect_stretch(), and reset_effect().
| void Visca::apply_effect_bnw | ( | ) |
Apply B/W effect.
Definition at line 1116 of file visca.cpp.
References fawkes::Exception::append(), and apply_effect().
| void Visca::apply_effect_mosaic | ( | ) |
Apply mosaic effect.
Definition at line 1142 of file visca.cpp.
References fawkes::Exception::append(), and apply_effect().
| void Visca::apply_effect_neg_art | ( | ) |
Apply negative art effect.
Definition at line 1090 of file visca.cpp.
References fawkes::Exception::append(), and apply_effect().
| void Visca::apply_effect_pastel | ( | ) |
Apply pastel effect.
Definition at line 1077 of file visca.cpp.
References fawkes::Exception::append(), and apply_effect().
| void Visca::apply_effect_sepia | ( | ) |
Apply sepia effect.
Definition at line 1103 of file visca.cpp.
References fawkes::Exception::append(), and apply_effect().
| void Visca::apply_effect_slim | ( | ) |
Apply slim effect.
Definition at line 1155 of file visca.cpp.
References fawkes::Exception::append(), and apply_effect().
| void Visca::apply_effect_solarize | ( | ) |
Apply solarize effect.
Definition at line 1129 of file visca.cpp.
References fawkes::Exception::append(), and apply_effect().
| void Visca::apply_effect_stretch | ( | ) |
Apply stretch effect.
Definition at line 1168 of file visca.cpp.
References fawkes::Exception::append(), and apply_effect().
| void Visca::cancel_command | ( | unsigned int | socket | ) |
Cancel a running command.
- Parameters:
-
socket socket that the command was send on
Definition at line 522 of file visca.cpp.
References fawkes::Exception::append(), and send_with_reply().
| void Visca::clear | ( | void | ) |
| void Visca::close | ( | ) |
| bool Visca::data_available | ( | ) |
| 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:
-
pan contains pan upon return tilt contains tilt upon return
Definition at line 684 of file visca.cpp.
References recv(), send(), and send_with_reply().
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_speed upon return contains pan speed index tilt_speed upon return contains tilt speed index
Definition at line 647 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 1183 of file visca.cpp.
References fawkes::Exception::append(), recv(), and send_with_reply().
| void Visca::get_zoom | ( | unsigned int * | zoom | ) |
Get zoom.
- Parameters:
-
zoom contains zoom upon return.
Definition at line 985 of file visca.cpp.
References fawkes::Exception::append(), and send_with_reply().
| bool Visca::is_nonblocking_finished | ( | unsigned int | item | ) | const |
| void Visca::open | ( | ) |
| void Visca::process | ( | ) |
Process incoming data.
Definition at line 548 of file visca.cpp.
References data_available(), and recv().
| void Visca::recv | ( | unsigned int | timeout_ms = 0xFFFFFFFF |
) |
Receive data.
- Parameters:
-
timeout_ms read timeout in miliseconds
Definition at line 311 of file visca.cpp.
References fawkes::Exception::append().
Referenced by clear(), get_pan_tilt(), get_white_balance_mode(), process(), send_with_reply(), and set_address().
| void Visca::recv_ack | ( | unsigned int * | socket = NULL |
) |
Receive ACK packet.
- Parameters:
-
socket contains the socket that the ACK was received on upon return
Definition at line 350 of file visca.cpp.
References fawkes::Exception::append().
Referenced by send_nonblocking().
| void Visca::reset_effect | ( | ) |
Reset effects.
Definition at line 1064 of file visca.cpp.
References fawkes::Exception::append(), and apply_effect().
| void Visca::reset_pan_tilt | ( | ) |
Reset pan/tilt.
Definition at line 874 of file visca.cpp.
References fawkes::Exception::append(), and send_with_reply().
| void Visca::reset_pan_tilt_limit | ( | ) |
Reset pan/tilt limit.
Definition at line 792 of file visca.cpp.
References fawkes::Exception::append(), and send_with_reply().
| void Visca::reset_zoom | ( | ) |
Reset zoom.
Definition at line 892 of file visca.cpp.
References fawkes::Exception::append(), and send_with_reply().
| void Visca::send | ( | ) |
Send outbound queue.
Definition at line 271 of file visca.cpp.
Referenced by clear(), get_pan_tilt(), send_nonblocking(), send_with_reply(), set_address(), and start_get_pan_tilt().
| void Visca::send_nonblocking | ( | unsigned int * | socket = NULL |
) |
Send non-blocking.
Does a non-blocking send.
- Parameters:
-
socket the socket that was used to send the request.
Definition at line 385 of file visca.cpp.
References fawkes::Exception::append(), recv_ack(), and send().
Referenced by set_pan_tilt().
| void Visca::send_with_reply | ( | ) |
Send and wait for reply, blocking.
Definition at line 432 of file visca.cpp.
References fawkes::Exception::append(), recv(), and send().
Referenced by apply_effect(), cancel_command(), get_pan_tilt(), get_white_balance_mode(), get_zoom(), reset_pan_tilt(), reset_pan_tilt_limit(), reset_zoom(), set_pan_tilt(), set_pan_tilt_limit(), set_zoom(), set_zoom_digital_enabled(), set_zoom_speed_tele(), and set_zoom_speed_wide().
| void Visca::set_address | ( | ) |
| void Visca::set_pan_tilt | ( | int | pan, | |
| int | tilt | |||
| ) |
Set pan tilt.
- Parameters:
-
pan pan tilt tilt
Definition at line 570 of file visca.cpp.
References fawkes::Exception::append(), NONBLOCKING_PANTILT, send_nonblocking(), and send_with_reply().
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_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 829 of file visca.cpp.
References fawkes::Exception::append(), and send_with_reply().
| void Visca::set_pan_tilt_speed | ( | unsigned char | pan_speed, | |
| unsigned char | tilt_speed | |||
| ) |
Set pan/tilt speed.
- Parameters:
-
pan_speed a value between 0 and MAX_PAN_SPEED tilt_speed a value between 0 and MAX_TILT_SPEED
- Exceptions:
-
Exception thrown if desired pan or tilt speed is too high
Definition at line 628 of file visca.cpp.
References MAX_PAN_SPEED, and MAX_TILT_SPEED.
Referenced by SonyEviD100PVisca::set_speed_radsec().
| void Visca::set_zoom | ( | unsigned int | zoom | ) |
Set zoom.
- Parameters:
-
zoom zoom value
Definition at line 959 of file visca.cpp.
References fawkes::Exception::append(), and send_with_reply().
| void Visca::set_zoom_digital_enabled | ( | bool | enabled | ) |
Enable or disable digital zoome.
- Parameters:
-
enabled true to enable digital zoom, false to disable
Definition at line 1020 of file visca.cpp.
References fawkes::Exception::append(), and send_with_reply().
| void Visca::set_zoom_speed_tele | ( | unsigned int | speed | ) |
Set zoom speed in tele.
- Parameters:
-
speed speed
Definition at line 913 of file visca.cpp.
References fawkes::Exception::append(), and send_with_reply().
| void Visca::set_zoom_speed_wide | ( | unsigned int | speed | ) |
Set zoom speed in wide angle.
- Parameters:
-
speed speed
Definition at line 936 of file visca.cpp.
References fawkes::Exception::append(), and send_with_reply().
| 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 655 of file visca.cpp.
References fawkes::Exception::append(), and send().
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 set_pan_tilt_speed(), and Visca().
const unsigned int Visca::MAX_TILT_SPEED = 0x14 [static] |
Number of non-blocking items.
Definition at line 66 of file visca.h.
Referenced by set_pan_tilt_speed(), and Visca().
const unsigned int Visca::NONBLOCKING_NUM = 2 [static] |
const unsigned int Visca::NONBLOCKING_PANTILT = 0 [static] |
const unsigned int Visca::NONBLOCKING_ZOOM = 1 [static] |
const unsigned int Visca::VISCA_WHITEBALANCE_ATW = VISCA_WB_ATW [static] |
const unsigned int Visca::VISCA_WHITEBALANCE_INDOOR = VISCA_WB_INDOOR [static] |
const unsigned int Visca::VISCA_WHITEBALANCE_MANUAL = VISCA_WB_MANUAL [static] |
const unsigned int Visca::VISCA_WHITEBALANCE_ONE_PUSH = VISCA_WB_ONE_PUSH [static] |
const unsigned int Visca::VISCA_WHITEBALANCE_OUTDOOR = VISCA_WB_OUTDOOR [static] |
const unsigned int Visca::VISCA_WHITEBLANCE_AUTO = VISCA_WB_AUTO [static] |
The documentation for this class was generated from the following files:

