Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera Settings #3

Open
shadowbgd opened this issue Aug 23, 2019 · 2 comments
Open

Camera Settings #3

shadowbgd opened this issue Aug 23, 2019 · 2 comments

Comments

@shadowbgd
Copy link

Hi,
Can you add capability to change settings of camera?

I have the communication between XMeye and Camera recorded, and this is how it goes:

..... ...........I...{ "Camera.Param.[0]" : { "AeSensitivity" : 7, "ApertureMode" : "0x00000001", "BLCMode" : "0x00000001", "DayNightColor" : "0x00000000", "Day_nfLevel" : 3, "DncThr" : 30, "ElecLevel" : 50, "EsShutter" : "0x00000006", "ExposureParam" : { "LeastTime" : "0x00000064", "Level" : 0, "MostTime" : "0x00010000" }, "GainParam" : { "AutoGain" : 0, "Gain" : 50 }, "IRCUTMode" : 1, "IrcutSwap" : 0, "Night_nfLevel" : 3, "PictureFlip" : "0x00000001", "PictureMirror" : "0x00000001", "RejectFlicker" : "0x00000000", "WhiteBalance" : "0x00000000" }, "Name" : "Camera.Param.[0]", "SessionID" : "0x9" }

Binary:
ff000000060000001800000000001004490200007b202243616d6572612e506172616d2e5b305d22203a207b2022416553656e736974697669747922203a20372c202241706572747572654d6f646522203a202230783030303030303031222c2022424c434d6f646522203a202230783030303030303031222c20224461794e69676874436f6c6f7222203a202230783030303030303030222c20224461795f6e664c6576656c22203a20332c2022446e6354687222203a2033302c2022456c65634c6576656c22203a2035302c202245735368757474657222203a202230783030303030303036222c20224578706f73757265506172616d22203a207b20224c6561737454696d6522203a202230783030303030303634222c20224c6576656c22203a20302c20224d6f737454696d6522203a20223078303030313030303022207d2c20224761696e506172616d22203a207b20224175746f4761696e22203a20302c20224761696e22203a203530207d2c202249524355544d6f646522203a20312c202249726375745377617022203a20302c20224e696768745f6e664c6576656c22203a20332c202250696374757265466c697022203a202230783030303030303031222c2022506963747572654d6972726f7222203a202230783030303030303031222c202252656a656374466c69636b657222203a202230783030303030303030222c2022576869746542616c616e636522203a20223078303030303030303022207d2c20224e616d6522203a202243616d6572612e506172616d2e5b305d222c202253657373696f6e494422203a202230783622207d0a

Receive after

.... ...........:...{ "Name" : "", "Ret" : 100, "SessionID" : "0x00000009" }

@alexshpilkin
Copy link
Owner

Hello and thanks for your interest in the project.

I agree that support for device configuration is both important and desirable. It’s more or less the only substantial thing currently missing compared both to the protocol description and to the vendor-provided utilities.

I am at a loss, however, as to how and where to start working on it. From what I can see (device configuration dumps), the configuration is enormous. Seriously, it is mind-bogglingly huge. Yes, simply providing a means to set a user-provided configuration key to the given object would be straightforward; but so far in this project I’ve tried to give precise and strongly-typed interfaces to everything. And a precise description of every configuration option would be several times as big as what I’ve done so far. The supporting framework is in place, but... I simply can’t bring myself to do this much menial work figuring out and transcribing every possible option.

That said, everything—even this—is better in company, so if you want to start chipping away at this task, please be welcome and ask if you need some pointers. Maybe this will help me get excited about the remainder of the project as well.

@shadowbgd
Copy link
Author

Hello, I have managed to solve the issue of settings, but it is quick and dirty, because I needed only to set AGC and BW modes. I also added support for Zoom and Focus, because my camera have optical 18x zoom lens.

This is the code I have written, I'm not experienced python developer, but maybe you can use this to upgrade your project, since I have finished this part of my project. Maybe somebody will need this.

def agc(self,kod):
if kod==1:
self.send(1040,{ "Camera.Param.[0]" : { "AeSensitivity" : 7, "ApertureMode" : "0x00000001", "BLCMode" : "0x00000001", "DayNightColor" : "0x00000000", "Day_nfLevel" : 3, "DncThr" : 30, "ElecLevel" : 50, "EsShutter" : "0x00000006", "ExposureParam" : { "LeastTime" : "0x00000064", "Level" : 0, "MostTime" : "0x00010000" }, "GainParam" : { "AutoGain" : 1, "Gain" : 50 }, "IRCUTMode" : 1, "IrcutSwap" : 0, "Night_nfLevel" : 3, "PictureFlip" : "0x00000001", "PictureMirror" : "0x00000001", "RejectFlicker" : "0x00000000", "WhiteBalance" : "0x00000000" }, "Name" : "Camera.Param.[0]","SessionID":"0x%08X"%self.session })
else:
self.send(1040,{ "Camera.Param.[0]" : { "AeSensitivity" : 7, "ApertureMode" : "0x00000001", "BLCMode" : "0x00000001", "DayNightColor" : "0x00000000", "Day_nfLevel" : 3, "DncThr" : 30, "ElecLevel" : 50, "EsShutter" : "0x00000006", "ExposureParam" : { "LeastTime" : "0x00000064", "Level" : 0, "MostTime" : "0x00010000" }, "GainParam" : { "AutoGain" : 0, "Gain" : 50 }, "IRCUTMode" : 1, "IrcutSwap" : 0, "Night_nfLevel" : 3, "PictureFlip" : "0x00000001", "PictureMirror" : "0x00000001", "RejectFlicker" : "0x00000000", "WhiteBalance" : "0x00000000" }, "Name" : "Camera.Param.[0]","SessionID":"0x%08X"%self.session })

def bw(self,kod):
if kod==1:
self.send(1040,{ "Camera.Param.[0]" : { "AeSensitivity" : 7, "ApertureMode" : "0x00000001", "BLCMode" : "0x00000001", "DayNightColor" : "0x00000002", "Day_nfLevel" : 3, "DncThr" : 30, "ElecLevel" : 50, "EsShutter" : "0x00000006", "ExposureParam" : { "LeastTime" : "0x00000064", "Level" : 0, "MostTime" : "0x00010000" }, "GainParam" : { "AutoGain" : 1, "Gain" : 50 }, "IRCUTMode" : 1, "IrcutSwap" : 0, "Night_nfLevel" : 3, "PictureFlip" : "0x00000001", "PictureMirror" : "0x00000001", "RejectFlicker" : "0x00000000", "WhiteBalance" : "0x00000000" }, "Name" : "Camera.Param.[0]","SessionID":"0x%08X"%self.session })
else:
self.send(1040,{ "Camera.Param.[0]" : { "AeSensitivity" : 7, "ApertureMode" : "0x00000001", "BLCMode" : "0x00000001", "DayNightColor" : "0x00000000", "Day_nfLevel" : 3, "DncThr" : 30, "ElecLevel" : 50, "EsShutter" : "0x00000006", "ExposureParam" : { "LeastTime" : "0x00000064", "Level" : 0, "MostTime" : "0x00010000" }, "GainParam" : { "AutoGain" : 0, "Gain" : 50 }, "IRCUTMode" : 1, "IrcutSwap" : 0, "Night_nfLevel" : 3, "PictureFlip" : "0x00000001", "PictureMirror" : "0x00000001", "RejectFlicker" : "0x00000000", "WhiteBalance" : "0x00000000" }, "Name" : "Camera.Param.[0]","SessionID":"0x%08X"%self.session })

def zoomin(self):
self.ptz('ZoomTile')
def zoomout(self):
self.ptz('ZoomWide')
def focusnear(self):
self.ptz('FocusNear')
def focusfar(self):
self.ptz('FocusFar')

def ptz(self, cmd, ch = 0):
#ptz_param = { "AUX" : { "Number" : 0, "Status" : "On" }, "Channel" : ch, "MenuOpts" : "Enter", "POINT" : { "bottom" : 0, "left" : 0, "right" : 0, "top" : 0 }, "Pattern" : "SetBegin", "Preset" : -1, "Step" : 5, "Tour" : 0 }
#self.set(self.QCODES["OPPTZControl"], "OPPTZControl", { "Command" : cmd, "Parameter" : ptz_param })
self.send(1400,{ "Name" : "OPPTZControl", "OPPTZControl" : { "Command" : cmd, "Parameter" : { "AUX" : { "Number" : 0, "Status" : "On" }, "Channel" : 0, "MenuOpts" : "Enter", "POINT" : { "bottom" : 0, "left" : 0, "right" : 0, "top" : 0 }, "Pattern" : "SetBegin", "Preset" : 65535, "Step" : 5, "Tour" : 0 } },"SessionID":"0x%08X"%self.session })

I had to comment out your ptz function, and replace with my code to work, but I didn't notice what is difference betwen your and mine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants