cameraUVC.h
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2006
4  * Raymond Sheh, Luke Gumbley
5  *
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  *
21  */
22 
23 #include <libplayercore/playercore.h>
24 
25 #include "UvcInterface.h"
26 
27 class CameraUvc;
28 
29 #ifndef CAMERAUVC_H_
30 #define CAMERAUVC_H_
31 
32 class CameraUvc : public ThreadedDriver
33 {
34  public:
35  CameraUvc(ConfigFile* cf, int section);
36  ~CameraUvc();
37  int MainSetup();
38  void MainQuit();
39 
40  int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data);
41  private:
42  virtual void Main();
43 
44  UvcInterface *ui;
45 
46  player_camera_data_t data; // Data to send to client (through the server)
47 };
48 
49 #endif /*CAMERAUVC_H_*/
Request to get an integer property.
Definition: player.h:457
#define PLAYER_WARN1(msg, a)
Error message macros.
Definition: error.h:89
String Property Class.
Definition: property.h:169
#define PLAYER_MSG1(level, msg, a)
Error message macros.
Definition: error.h:105
virtual void Publish(player_devaddr_t addr, QueuePointer &queue, uint8_t type, uint8_t subtype, void *src=NULL, size_t deprecated=0, double *timestamp=NULL, bool copy=true)
Publish a message via one of this driver's interfaces.
int MainSetup()
Sets up the resources needed by the driver thread.
Definition: cameraUVC.cc:130
static bool MatchMessage(player_msghdr_t *hdr, int type, int subtype, player_devaddr_t addr)
Helper for message processing.
Definition: message.h:158
double ReadFloat(int section, const char *name, double value)
Read a floating point (double) value.
Definition: cameraUVC.h:32
#define PLAYER_SET_STRPROP_REQ
String property set request subtype.
Definition: player.h:439
Generic message header.
Definition: player.h:160
unsigned int GetDataSize()
Size of message data.
Definition: message.h:189
virtual int MainSetup(void)
Sets up the resources needed by the driver thread.
Definition: driver.h:657
uint32_t compression
Image compression; PLAYER_CAMERA_COMPRESS_RAW indicates no compression.
Definition: player_interfaces.h:2966
#define PLAYER_CAMERA_REQ_GET_IMAGE
Request/reply subtype: get current image frame.
Definition: player_interfaces.h:2931
virtual void MainQuit(void)
Cleanup method for driver thread (called when main exits)
Definition: driver.h:663
uint32_t width
Image dimensions [pixels].
Definition: player_interfaces.h:2953
#define PLAYER_CAMERA_FORMAT_RGB888
Image format : 24-bit color (8 bits R, 8 bits G, 8 bits B).
Definition: player_interfaces.h:2942
uint8_t type
Message type; must be one of PLAYER_MSGTYPE_*.
Definition: player.h:165
#define PLAYER_WARN3(msg, a, b, c)
Error message macros.
Definition: error.h:91
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.
uint32_t fdiv
Some images (such as disparity maps) use scaled pixel values; for these images, fdiv specifies the sc...
Definition: player_interfaces.h:2963
uint8_t subtype
Message subtype; interface specific.
Definition: player.h:167
virtual void Main(void)=0
Main method for driver thread.
uint32_t image_count
Size of image data as stored in image buffer (bytes)
Definition: player_interfaces.h:2968
int ReadInt(int section, const char *name, int value)
Read an integer value.
void * GetPayload()
Get pointer to payload.
Definition: message.h:187
void ProcessMessages(void)
Process pending messages.
#define PLAYER_MSGTYPE_DATA
A data message.
Definition: player.h:94
#define PLAYER_ERROR2(msg, a, b)
Error message macros.
Definition: error.h:82
int32_t value
The property value.
Definition: player.h:464
#define PLAYER_MSGTYPE_RESP_ACK
A positive response message.
Definition: player.h:111
#define PLAYER_CAMERA_DATA_STATE
Data subtype: state.
Definition: player_interfaces.h:2922
uint8_t * image
Compressed image data (byte-aligned, row major order).
Definition: player_interfaces.h:2972
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
Message handler.
static bool MatchDeviceAddress(player_devaddr_t addr1, player_devaddr_t addr2)
Compare two addresses.
Definition: device.h:200
bool ReadBool(int section, const char *name, bool value)
Read a boolean value (one of: yes, no, true, false, 1, 0)
#define PLAYER_MSGTYPE_REQ
A request message.
Definition: player.h:105
int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
Message handler.
Definition: cameraUVC.cc:194
#define PLAYER_MSGTYPE_RESP_NACK
A negative response message.
Definition: player.h:124
Integer property class.
Definition: property.h:113
int ReadDeviceAddr(player_devaddr_t *addr, int section, const char *name, int code, int index, const char *key)
Read a device id.
Data: state (PLAYER_CAMERA_DATA_STATE)
Definition: player_interfaces.h:2950
Class for loading configuration file information.
Definition: configfile.h:195
int ReadTupleInt(int section, const char *name, int index, int value)
Read an integer from a tuple field.
A device address.
Definition: player.h:144
An autopointer for the message queue.
Definition: message.h:72
uint32_t format
Image format (must be compatible with depth).
Definition: player_interfaces.h:2959
char * key
The property key.
Definition: player.h:484
void MainQuit()
Cleanup method for driver thread (called when main exits)
Definition: cameraUVC.cc:150
Definition: UvcInterface.h:32
void SetError(int code)
Set/reset error code.
Definition: driver.h:144
#define PLAYER_ERROR1(msg, a)
Error message macros.
Definition: error.h:81
#define PLAYER_CAMERA_COMPRESS_RAW
Compression method: raw.
Definition: player_interfaces.h:2945
#define PLAYER_ERROR(msg)
Error message macros.
Definition: error.h:80
player_devaddr_t device_addr
Default device address (single-interface drivers)
Definition: driver.h:268
Base class for drivers which oeprate with a thread.
Definition: driver.h:551
#define PLAYER_CAMERA_FORMAT_MONO8
Image format : 8-bit monochrome.
Definition: player_interfaces.h:2936
double timestamp
Time associated with message contents (seconds since epoch)
Definition: player.h:169
uint32_t size
Size in bytes of the payload to follow.
Definition: player.h:173
char * key
The property key.
Definition: player.h:462
Reference-counted message objects.
Definition: message.h:131
#define PLAYER_WARN(msg)
Warning message macros.
Definition: error.h:88
Base class for all drivers.
Definition: driver.h:107
char * value
The property value.
Definition: player.h:488
Request to get a string property.
Definition: player.h:479
virtual void Main()
Main method for driver thread.
Definition: cameraUVC.cc:161
#define PLAYER_MSG2(level, msg, a, b)
Error message macros.
Definition: error.h:106
uint32_t height
Image dimensions [pixels].
Definition: player_interfaces.h:2955
#define PLAYER_SET_INTPROP_REQ
Integer property set request subtype.
Definition: player.h:431
player_msghdr_t * GetHeader()
Get pointer to header.
Definition: message.h:185
player_devaddr_t addr
Device to which this message pertains.
Definition: player.h:163
#define PLAYER_MSGQUEUE_DEFAULT_MAXLEN
Default maximum length for a message queue.
Definition: player.h:75
#define PLAYER_CAMERA_COMPRESS_JPEG
Compression method: jpeg.
Definition: player_interfaces.h:2947
uint32_t bpp
Image bits-per-pixel (8, 16, 24, 32).
Definition: player_interfaces.h:2957