3rdparty/licenseReport: Add seperate LGPL checks
[haiku.git] / src / add-ons / media / media-add-ons / usb_webcam / CamSensor.cpp
blobc5ceafd34e25c45aad3b4e40570f71c8adfd58c4
1 /*
2 * Copyright 2004-2008, François Revol, <revol@free.fr>.
3 * Distributed under the terms of the MIT License.
4 */
6 #include "CamSensor.h"
7 #include "CamDebug.h"
10 CamSensor::CamSensor(CamDevice *_camera)
11 : fInitStatus(B_NO_INIT),
12 fIsBigEndian(false),
13 fTransferEnabled(false),
14 fVideoFrame(),
15 fLastParameterChanges(0),
16 fCamDevice(_camera)
22 CamSensor::~CamSensor()
28 status_t
29 CamSensor::Probe()
31 // default is to match by USB IDs
32 return B_OK;
36 status_t
37 CamSensor::InitCheck()
39 return fInitStatus;
43 status_t
44 CamSensor::Setup()
46 return fInitStatus;
50 const char *
51 CamSensor::Name()
53 return "<unknown>";
57 status_t
58 CamSensor::StartTransfer()
60 fTransferEnabled = true;
61 return B_OK;
65 status_t
66 CamSensor::StopTransfer()
68 fTransferEnabled = false;
69 return B_OK;
73 status_t
74 CamSensor::AcceptVideoFrame(uint32 &width, uint32 &height)
76 // minimum sanity
77 if (width < 1)
78 width = MaxWidth();
79 if (height < 1)
80 height = MaxHeight();
81 if (width > MaxWidth())
82 width = MaxWidth();
83 if (height > MaxHeight())
84 height = MaxHeight();
85 return B_OK;
89 status_t
90 CamSensor::SetVideoFrame(BRect rect)
92 return ENOSYS;
96 status_t
97 CamSensor::SetVideoParams(float brightness, float contrast, float hue, float red, float green, float blue)
99 return ENOSYS;
103 void
104 CamSensor::AddParameters(BParameterGroup *group, int32 &index)
106 fFirstParameterID = index;
109 status_t
110 CamSensor::GetParameterValue(int32 id, bigtime_t *last_change, void *value, size_t *size)
112 return B_BAD_VALUE;
115 status_t
116 CamSensor::SetParameterValue(int32 id, bigtime_t when, const void *value, size_t size)
118 return B_BAD_VALUE;
122 CamDevice *
123 CamSensor::Device()
125 return fCamDevice;
129 status_t
130 CamSensor::ProbeByIICSignature(const uint8 *regList, const uint8 *matchList,
131 size_t count)
133 for (int i = 0; i < count; i++) {
134 uint8 value = 0;
135 ssize_t len;
136 len = Device()->ReadIIC8(regList[i], &value);
137 PRINT((CH ": ReadIIC8 = %d val = %d" CT, len, value));
138 if (len < 1)
139 return ENODEV;
140 if (value != matchList[i])
141 return ENODEV;
143 return B_OK;