2 * Copyright 2004-2008, François Revol, <revol@free.fr>.
3 * Distributed under the terms of the MIT License.
11 // This class represents the camera's (cmos or whatever) sensor chip
14 CamSensor(CamDevice
*_camera
);
17 virtual status_t
Probe(); // returns B_OK if found.
19 virtual status_t
InitCheck();
21 virtual status_t
Setup();
23 virtual const char* Name();
25 virtual status_t
StartTransfer();
26 virtual status_t
StopTransfer();
27 virtual bool TransferEnabled() const { return fTransferEnabled
; };
29 virtual bool IsBigEndian() const { return fIsBigEndian
; };
30 virtual bool Use400kHz() const { return false; };
31 virtual bool UseRealIIC() const { return true; };
32 virtual uint8
IICReadAddress() const { return 0; };
33 virtual uint8
IICWriteAddress() const { return 0; };
35 virtual int MaxWidth() const { return -1; };
36 virtual int MaxHeight() const { return -1; };
38 virtual status_t
AcceptVideoFrame(uint32
&width
, uint32
&height
);
39 virtual status_t
SetVideoFrame(BRect rect
);
40 virtual BRect
VideoFrame() const { return fVideoFrame
; };
41 virtual status_t
SetVideoParams(float brightness
, float contrast
, float hue
, float red
, float green
, float blue
);
43 virtual void AddParameters(BParameterGroup
*group
, int32
&index
);
44 virtual status_t
GetParameterValue(int32 id
, bigtime_t
*last_change
, void *value
, size_t *size
);
45 virtual status_t
SetParameterValue(int32 id
, bigtime_t when
, const void *value
, size_t size
);
50 // generic register-like access
51 virtual status_t
WriteReg(uint16 address
, uint8
*data
, size_t count
=1);
52 virtual status_t
WriteReg8(uint16 address
, uint8 data
);
53 virtual status_t
WriteReg16(uint16 address
, uint16 data
);
54 virtual status_t
ReadReg(uint16 address
, uint8
*data
, size_t count
=1, bool cached
=false);
57 virtual status_t
WriteIIC(uint8 address
, uint8
*data
, size_t count
=1);
58 virtual status_t
ReadIIC(uint8 address
, uint8
*data
);
62 status_t
ProbeByIICSignature(const uint8
*regList
,
63 const uint8
*matchList
,
68 bool fTransferEnabled
;
70 int32 fFirstParameterID
;
71 bigtime_t fLastParameterChanges
;
73 CamDevice
*fCamDevice
;
77 #define B_WEBCAM_DECLARE_SENSOR(sensorclass,sensorname) \
78 extern "C" CamSensor *Instantiate##sensorclass(CamDevice *cam); \
79 CamSensor *Instantiate##sensorclass(CamDevice *cam) \
80 { return new sensorclass(cam); };
83 #endif /* _CAM_SENSOR_H */