setpwc_api.h
1 /* The GPL applies to this program.
2  In addition, as a special exception, the copyright holders give
3  permission to link the code of portions of this program with the
4  OpenSSL library under certain conditions as described in each
5  individual source file, and distribute linked combinations
6  including the two.
7  You must obey the GNU General Public License in all respects
8  for all of the code used other than OpenSSL. If you modify
9  file(s) with this exception, you may extend this exception to your
10  version of the file(s), but you are not obligated to do so. If you
11  do not wish to do so, delete this exception statement from your
12  version. If you delete this exception statement from all source
13  files in the program, then also delete it here.
14 */
15 
16 #ifndef SETPWC_FUNCTIONS
17 #define SETPWC_FUNCTIONS
18 
19 #include <errno.h>
20 #include <string.h>
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <sys/ioctl.h>
24 #include <sys/types.h>
25 #include <sys/stat.h>
26 #include <fcntl.h>
27 #include <unistd.h>
28 #define _LINUX_TIME_H 1 /* to get things compile on kernel 2.6.x */
29 #include <linux/videodev.h>
30 
31 #include "pwc-ioctl.h"
32 
33 const int SET_PAN = 0;
34 const int SET_TILT = 1;
35 
36 const int GET_PAN = 0;
37 const int GET_TILT = 1;
38 
39 void error_exit(char *what_ioctl);
40 
41 void check_device(int *fd);
42 
43 void not_supported(char *what);
44 
45 void dump_current_settings(int fd);
46 
47 void query_pan_tilt_status(int fd, int *status);
48 
49 void reset_pan_tilt(int fd, int what);
50 
51 void get_pan_or_tilt_limits(int fd, char what, int *min, int *max);
52 
53 void set_pan_or_tilt(int fd, char what, int value);
54 
55 void set_pan_and_tilt(int fd, int pan, int tilt);
56 
57 void set_framerate(int fd, int framerate);
58 
59 void flash_settings(int fd);
60 
61 void restore_settings(int fd);
62 
63 void restore_factory_settings(int fd);
64 
65 void set_compression_preference(int fd, int pref);
66 
67 void set_automatic_gain_control(int fd, int pref);
68 
69 void set_shutter_speed(int fd, int pref);
70 
71 void set_automatic_white_balance_mode(int fd, char *mode);
72 
73 void set_automatic_white_balance_mode_red(int fd, int val);
74 
75 void set_automatic_white_balance_mode_blue(int fd, int val);
76 
77 void set_automatic_white_balance_speed(int fd, int val);
78 
79 void set_automatic_white_balance_delay(int fd, int val);
80 
81 void set_led_on_time(int fd, int val);
82 
83 void set_led_off_time(int fd, int val);
84 
85 void set_sharpness(int fd, int val);
86 
87 void set_backlight_compensation(int fd, int val);
88 
89 void set_antiflicker_mode(int fd, int val);
90 
91 void set_noise_reduction(int fd, int val);
92 
93 #endif
T min(T a, T b)
Return the minimum of a, b.
Definition: utility.h:109
Request to get an integer property.
Definition: player.h:457
#define PLAYER_DIO_CMD_VALUES
Data: input values (PLAYER_DIO_DATA_VALUES)
Definition: player_interfaces.h:1987
uint32_t data_count
Size of data as stored in buffer (bytes)
Definition: player_interfaces.h:3452
String Property Class.
Definition: property.h:169
#define PLAYER_MSG1(level, msg, a)
Error message macros.
Definition: error.h:105
static bool MatchMessage(player_msghdr_t *hdr, int type, int subtype, player_devaddr_t addr)
Helper for message processing.
Definition: message.h:158
int player_sd_register(player_sd_t *sd, const char *name, player_devaddr_t addr)
Register the named device.
#define PLAYER_SET_STRPROP_REQ
String property set request subtype.
Definition: player.h:439
Generic message header.
Definition: player.h:160
virtual int MainSetup(void)
Sets up the resources needed by the driver thread.
Definition: driver.h:657
virtual void MainQuit(void)
Cleanup method for driver thread (called when main exits)
Definition: driver.h:663
Encapsulates a device (i.e., a driver bound to an interface)
Definition: device.h:73
const char * ReadString(int section, const char *name, const char *value)
Read a string value.
virtual void Main(void)=0
Main method for driver thread.
int ReadInt(int section, const char *name, int value)
Read an integer value.
#define PLAYER_OPAQUE_DATA_STATE
Data subtype: generic state.
Definition: player_interfaces.h:3434
#define PLAYER_MSGTYPE_DATA
A data message.
Definition: player.h:94
#define PLAYER_ERROR2(msg, a, b)
Error message macros.
Definition: error.h:82
uint32_t digout
output bitfield
Definition: player_interfaces.h:2011
int32_t value
The property value.
Definition: player.h:464
#define PLAYER_MSGTYPE_RESP_ACK
A positive response message.
Definition: player.h:111
void player_register_drivers()
Register available drivers.
Definition: playertcp.h:137
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
Message handler.
#define PLAYER_MSGTYPE_REQ
A request message.
Definition: player.h:105
#define PLAYER_MSGTYPE_RESP_NACK
A negative response message.
Definition: player.h:124
Integer property class.
Definition: property.h:113
Command: output values (PLAYER_DIO_CMD_VALUES)
Definition: player_interfaces.h:2006
Data: input values (PLAYER_DIO_DATA_VALUES)
Definition: player_interfaces.h:1994
Class for loading configuration file information.
Definition: configfile.h:195
bool WarnUnused()
Check for unused fields and print warnings.
#define PLAYER_SD_NAME_MAXLEN
A device, represented by its name and address.
Definition: playersd.h:69
An autopointer for the message queue.
Definition: message.h:72
char * key
The property key.
Definition: player.h:484
#define PLAYER_ERROR1(msg, a)
Error message macros.
Definition: error.h:81
uint32_t count
the command
Definition: player_interfaces.h:2009
#define PLAYER_ERROR(msg)
Error message macros.
Definition: error.h:80
Base class for drivers which oeprate with a thread.
Definition: driver.h:551
#define PLAYERTCP_DEFAULT_PORT
Default TCP port.
Definition: playertcp.h:121
char * key
The property key.
Definition: player.h:462
#define PLAYER_WARN(msg)
Warning message macros.
Definition: error.h:88
#define PLAYER_MSGTYPE_CMD
A command message.
Definition: player.h:98
#define PLAYER_OPAQUE_CMD_DATA
Cmd subtype: generic command.
Definition: player_interfaces.h:3437
data
Definition: player_interfaces.h:3449
#define PLAYER_DIO_DATA_VALUES
Data: input values (PLAYER_DIO_DATA_VALUES)
Definition: player_interfaces.h:1984
Base class for all drivers.
Definition: driver.h:107
Request to get a string property.
Definition: player.h:479
#define PLAYER_MSG0(level, msg)
General messages.
Definition: error.h:104
bool Load(const char *filename)
Load config from file.
#define PLAYER_SET_INTPROP_REQ
Integer property set request subtype.
Definition: player.h:431
#define PLAYER_MSGQUEUE_DEFAULT_MAXLEN
Default maximum length for a message queue.
Definition: player.h:75
T max(T a, T b)
Return the maximum of a, b.
Definition: utility.h:122
uint8_t * data
The data we will be sending.
Definition: player_interfaces.h:3454