This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* For uvcdynctrl 0.2.4 | |
* Logitech c615 https://www.logitech.com/en-us/product/hd-webcam-c615 | |
*/ | |
class Api | |
{ | |
private function setCmd($cmd, $value) | |
{ | |
exec("uvcdynctrl -v -d video0 --set '".$cmd."' '$value' 2>&1",$output); | |
return $output[0]; | |
} | |
public function getCmd($cmd) | |
{ | |
exec("uvcdynctrl -v -d video0 --get '".$cmd."' 2>&1",$output); | |
return $output[0]; | |
} | |
public function disableAutoExposure() | |
{ | |
$command = "'Exposure, Auto'"; | |
$options = 1; | |
return SELF::setCmd($command,$options); | |
} | |
public function setExposure($expo) | |
{ | |
/* | |
* Values : [ 3 .. 2047, step size: 1 ], | |
* Default : 166 | |
*/ | |
$command = "'Exposure (Absolute)''"; | |
return SELF::setCmd($command,$expo); | |
} | |
public function killLED() | |
{ | |
$command = "LED1 Mode"; | |
return SELF::setCmd($command, 0); | |
} | |
public function setZoom($zoom) | |
{ | |
/* | |
* Values : [ 1 .. 5, step size: 1 ], | |
* Default : 1 | |
*/ | |
$command = "Zoom, Absolute"; | |
return SELF::setCmd($command,$zoom); | |
} | |
public function setPan($pan) | |
{ | |
/* | |
* Values : [ -36000 .. 36000, step size: 3600 ], | |
* Default : 0 | |
*/ | |
$command = "Pan (Absolute)"; | |
return SELF::setCmd($command,$pan); | |
} | |
public function setFocus($steps) | |
{ | |
/* | |
* Values : [ 0 .. 255, step size: 17 ], | |
* Default : 51 | |
*/ | |
if(count($steps) == 0) | |
{ | |
$size = 51; | |
} | |
else | |
{ | |
$size = ($steps * 17); | |
} | |
$command = "Focus (absolute)"; | |
return SELF::setCmd($command,$size); | |
} | |
/* | |
Exposure, Auto | |
ID : 0x0000000f, | |
Type : Choice, | |
Flags : { CAN_READ, CAN_WRITE }, | |
Values : { 'Manual Mode'[1], 'Aperture Priority Mode'[3] }, | |
Default : 3 | |
Exposure (Absolute) | |
ID : 0x00000011, | |
Type : Dword, | |
Flags : { CAN_READ, CAN_WRITE }, | |
Values : [ 3 .. 2047, step size: 1 ], | |
Default : 166 | |
Exposure, Auto Priority | |
ID : 0x00000010, | |
Type : Boolean, | |
Flags : { CAN_READ, CAN_WRITE }, | |
Values : [ 0 .. 1, step size: 1 ], | |
Default : 0 | |
Pan (Absolute) | |
ID : 0x0000001c, | |
Type : Dword, | |
Flags : { CAN_READ, CAN_WRITE }, | |
Values : [ -36000 .. 36000, step size: 3600 ], | |
Default : 0 | |
Tilt (Absolute) | |
ID : 0x0000001e, | |
Type : Dword, | |
Flags : { CAN_READ, CAN_WRITE }, | |
Values : [ -36000 .. 36000, step size: 3600 ], | |
Default : 0 | |
Focus (absolute) | |
ID : 0x00000015, | |
Type : Dword, | |
Flags : { CAN_READ, CAN_WRITE }, | |
Values : [ 0 .. 255, step size: 17 ], | |
Default : 51 | |
Focus, Auto | |
ID : 0x00000014, | |
Type : Boolean, | |
Flags : { CAN_READ, CAN_WRITE }, | |
Values : [ 0 .. 1, step size: 1 ], | |
Default : 1 | |
Zoom, Absolute | |
ID : 0x00000019, | |
Type : Dword, | |
Flags : { CAN_READ, CAN_WRITE }, | |
Values : [ 1 .. 5, step size: 1 ], | |
Default : 1 | |
LED1 Mode | |
ID : 0x046d0003, | |
Type : Choice, | |
Flags : { CAN_READ, CAN_WRITE, IS_CUSTOM }, | |
Values : { 'Off'[0], 'On'[1], 'Auto'[2] }, | |
Default : 0 | |
uvcdynctrl -v -d video0 -c | |
*/ | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment