IPC-1002
From LinuxMCE
Status
The IPC-1002 device template can be derived from the Panasonic IP Camera. A template for this Camera has been submitted (Plug and Play doesn't quiet work however). Pan and Tilt support. This camera is a cheap camera and can be found at http://www.dealextreme.com/details.dx/sku.14272
Features
- Browser based
- PAN Range +/- 180°, TILT Range 120°
- 10/100mbit LAN
- LCD display the IP address /Network mask/gateway IP etc
- 6 infrared LED, automatic operate in dark environment
- 30fps max
- External sensor & alarm interface
- MPEG4 compression
- UPnP, DynDNS
More features can be found at the above link.
Ruby Code
RCODE: 0:require 'Ruby_Generic_Serial_Device' 1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper 2:end 3:class Device_95 < Ruby_Generic_Serial_Device::RubySerialIOWrapper 4:#### 84 #################################################################### 5:def cmd_84(data, format, disable_aspect_lock, streamid, width, height, cmd=nil) 6:@returnParamArray.clear 7:conn_.Reconnect() 8:auth_s=device_.devdata_[114]+":"+device_.devdata_[115] 9:auth_a=Array.new; 10:auth_s.each{|c| auth_a.push(c)} 11: 12:fix_path=device_.devdata_[2]; 13:fix_path='/'+fix_path if(fix_path[0]!='/'[0]); 14: 15:s = "GET "+fix_path+" HTTP/1.0\r\n" 16:s+= "Accept: */*\r\n" 17:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n" 18:s+= "\r\n" 19: 20:conn_.Send(s) 21:recv="" 22:while(true) 23: buff=conn_.Recv(16384, 5000) 24: if(buff.length() == 0) 25: break 26: end 27: recv = recv + buff 28:end 29:if (recv=~ /^HTTP\/.*Cache-control:\sno-cache\n.(.*)/m) 30: fileName="/tmp/ip_camera_img"+device_.devid_.to_s 31: imageFile=File.new(fileName+".jpg",'w') 32: imageFile.print $1 33: imageFile.close() 34: system("/usr/bin/convert "+fileName+".jpg "+fileName+".png"); 35: size=File.stat(fileName+".png").size 36: imageFile=File.new(fileName+".png",'r') 37: img = imageFile.read(size); 38: imageFile.close() 39: data_set(img) 40: format_set('png') 41:end 42:return @returnParamArray 43:end 44:#### 200 #################################################################### 45:def cmd_200(cmd=nil) 46:@returnParamArray.clear 47:conn_.Reconnect() 48:auth_s=device_.devdata_[114]+":"+device_.devdata_[115] 49:auth_a=Array.new; 50:auth_s.each{|c| auth_a.push(c)} 51:s = "GET /cgi-bin/camctrl.cgi?move=up HTTP/1.0\r\n" 52:s+= "Accept: */*\r\n" 53:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n" 54:s+= "\r\n" 55: 56:conn_.Send(s) 57:recv="" 58:while(true) 59:buff=conn_.Recv(256, 5000) 60:if(buff.length() == 0) 61:break 62:end 63:recv = recv + buff 64:end 65:return @returnParamArray 66:end 67:#### 201 #################################################################### 68:def cmd_201(cmd=nil) 69:@returnParamArray.clear 70:conn_.Reconnect() 71:auth_s=device_.devdata_[114]+":"+device_.devdata_[115] 72:auth_a=Array.new; 73:auth_s.each{|c| auth_a.push(c)} 74:s = "GET /cgi-bin/camctrl.cgi?move=down HTTP/1.0\r\n" 75:s+= "Accept: */*\r\n" 76:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n" 77:s+= "\r\n" 78: 79:conn_.Send(s) 80:recv="" 81:while(true) 82:buff=conn_.Recv(256, 5000) 83:if(buff.length() == 0) 84:break 85:end 86:recv = recv + buff 87:end 88:return @returnParamArray 89:end 90:#### 202 #################################################################### 91:def cmd_202(cmd=nil) 92:@returnParamArray.clear 93:conn_.Reconnect() 94:auth_s=device_.devdata_[114]+":"+device_.devdata_[115] 95:auth_a=Array.new; 96:auth_s.each{|c| auth_a.push(c)} 97:s = "GET /cgi-bin/camctrl.cgi?move=left HTTP/1.0\r\n" 98:s+= "Accept: */*\r\n" 99:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n" 100:s+= "\r\n" 101: 102:conn_.Send(s) 103:recv="" 104:while(true) 105:buff=conn_.Recv(256, 5000) 106:if(buff.length() == 0) 107:break 108:end 109:recv = recv + buff 110:end 111:return @returnParamArray 112:end 113:#### 203 #################################################################### 114:def cmd_203(cmd=nil) 115:@returnParamArray.clear 116:conn_.Reconnect() 117:auth_s=device_.devdata_[114]+":"+device_.devdata_[115] 118:auth_a=Array.new; 119:auth_s.each{|c| auth_a.push(c)} 120:s = "GET /cgi-bin/camctrl.cgi?move=right HTTP/1.0\r\n" 121:s+= "Accept: */*\r\n" 122:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n" 123:s+= "\r\n" 124: 125:conn_.Send(s) 126:recv="" 127:while(true) 128: buff=conn_.Recv(256, 5000) 129: if(buff.length() == 0) 130: break 131: end 132: recv = recv + buff 133:end 134:return @returnParamArray 135:end 136:#### START SETTERS #################################################################### 137:def initialize() 138:super 139:@returnParamArray=Array.new 140:end 141:def data_set(value) 142:@returnParamArray[19]=value 143:end 144:def format_set(value) 145:@returnParamArray[20]=value 146:end 147:#### END SETTERS #################################################################### 148:end