Difference between revisions of "IPC-1002"

From LinuxMCE
Jump to: navigation, search
(Ruby Code)
(Ruby Code)
Line 75: Line 75:
 
   46:auth_a=Array.new;
 
   46:auth_a=Array.new;
 
   47:auth_s.each{|c| auth_a.push(c)}
 
   47:auth_s.each{|c| auth_a.push(c)}
   48:s = "GET /cgi-bin/action?action=cam_mv&diretion=cam_up〈=eng HTTP/1.0\r\n"
+
   48:s = "GET /cgi-bin/action?action=cam_mv&diretion=cam_up HTTP/1.0\r\n"
 
   49:s+= "Accept: */*\r\n"
 
   49:s+= "Accept: */*\r\n"
 
   50:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n"
 
   50:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n"
Line 98: Line 98:
 
   69:auth_a=Array.new;
 
   69:auth_a=Array.new;
 
   70:auth_s.each{|c| auth_a.push(c)}
 
   70:auth_s.each{|c| auth_a.push(c)}
   71:s = "GET /cgi-bin/action?action=cam_mv&diretion=cam_down〈=eng HTTP/1.0\r\n"
+
   71:s = "GET /cgi-bin/action?action=cam_mv&diretion=cam_down HTTP/1.0\r\n"
 
   72:s+= "Accept: */*\r\n"
 
   72:s+= "Accept: */*\r\n"
 
   73:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n"
 
   73:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n"
Line 121: Line 121:
 
   92:auth_a=Array.new;
 
   92:auth_a=Array.new;
 
   93:auth_s.each{|c| auth_a.push(c)}
 
   93:auth_s.each{|c| auth_a.push(c)}
   94:s = "GET /cgi-bin/action?action=cam_mv&diretion=cam_left〈=eng HTTP/1.0\r\n"
+
   94:s = "GET /cgi-bin/action?action=cam_mv&diretion=cam_left HTTP/1.0\r\n"
 
   95:s+= "Accept: */*\r\n"
 
   95:s+= "Accept: */*\r\n"
 
   96:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n"
 
   96:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n"
Line 144: Line 144:
 
  115:auth_a=Array.new;
 
  115:auth_a=Array.new;
 
  116:auth_s.each{|c| auth_a.push(c)}
 
  116:auth_s.each{|c| auth_a.push(c)}
  117:s = "GET /cgi-bin/action?action=cam_mv&diretion=cam_right〈=eng HTTP/1.0\r\n"
+
  117:s = "GET /cgi-bin/action?action=cam_mv&diretion=cam_right HTTP/1.0\r\n"
 
  118:s+= "Accept: */*\r\n"
 
  118:s+= "Accept: */*\r\n"
 
  119:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n"
 
  119:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n"
Line 166: Line 166:
 
  137:return @returnParamArray
 
  137:return @returnParamArray
 
  138:end
 
  138:end
139:#### START SETTERS ####################################################################
 
140:def initialize()
 
141:super
 
142:@returnParamArray=Array.new
 
143:end
 
144:def data_set(value)
 
145:@returnParamArray[19]=value
 
146:end
 
147:def format_set(value)
 
148:@returnParamArray[20]=value
 
149:end
 
150:####  END  SETTERS ####################################################################
 
151:end
 
 
</pre>
 
</pre>

Revision as of 13:12, 2 January 2010

Ipc-1002.small.jpg


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_64 < 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:s = "GET "+device_.devdata_[2]+" HTTP/1.0\r\n"
  13:s+= "Accept: */*\r\n"
  14:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n"
  15:s+= "\r\n"
  16:
  17:conn_.Send(s)
  18:recv=""
  19:while(true)
  20:  buff=conn_.Recv(16384, 5000)
  21:  if(buff.length() == 0)
  22:     break
  23:   end
  24:   recv = recv +  buff
  25:end
  26:if (recv=~ /^HTTP[^\r\n]+200\sOK.+?\r\n\r\n(.+)$/m)
  27:  fileName="/tmp/ip_camera_img"+device_.devid_.to_s
  28:  imageFile=File.new(fileName+".jpg",'w')
  29:  imageFile.print $1
  30:  imageFile.close()
  31:  system("/usr/bin/convert "+fileName+".jpg "+fileName+".png");
  32:  size=File.stat(fileName+".png").size 
  33:  imageFile=File.new(fileName+".png",'r')
  34:  img = imageFile.read(size);
  35:  imageFile.close()
  36:  data_set(img)
  37:  format_set('png')
  38:end
  39:return @returnParamArray
  40:end
  41:#### 200 ####################################################################
  42:def cmd_200(streamid, cmd=nil)
  43:@returnParamArray.clear
  44:conn_.Reconnect()
  45:auth_s=device_.devdata_[114]+":"+device_.devdata_[115]
  46:auth_a=Array.new;
  47:auth_s.each{|c| auth_a.push(c)}
  48:s = "GET /cgi-bin/action?action=cam_mv&diretion=cam_up HTTP/1.0\r\n"
  49:s+= "Accept: */*\r\n"
  50:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n"
  51:s+= "\r\n"
  52:
  53:conn_.Send(s)
  54:recv=""
  55:while(true)
  56:buff=conn_.Recv(256, 5000)
  57:if(buff.length() == 0)
  58:break
  59:end
  60:recv = recv + buff
  61:end
  62:return @returnParamArray
  63:end
  64:#### 201 ####################################################################
  65:def cmd_201(streamid, cmd=nil)
  66:@returnParamArray.clear
  67:conn_.Reconnect()
  68:auth_s=device_.devdata_[114]+":"+device_.devdata_[115]
  69:auth_a=Array.new;
  70:auth_s.each{|c| auth_a.push(c)}
  71:s = "GET /cgi-bin/action?action=cam_mv&diretion=cam_down HTTP/1.0\r\n"
  72:s+= "Accept: */*\r\n"
  73:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n"
  74:s+= "\r\n"
  75:
  76:conn_.Send(s)
  77:recv=""
  78:while(true)
  79:buff=conn_.Recv(256, 5000)
  80:if(buff.length() == 0)
  81:break
  82:end
  83:recv = recv + buff
  84:end
  85:return @returnParamArray
  86:end
  87:#### 202 ####################################################################
  88:def cmd_202(streamid, cmd=nil)
  89:@returnParamArray.clear
  90:conn_.Reconnect()
  91:auth_s=device_.devdata_[114]+":"+device_.devdata_[115]
  92:auth_a=Array.new;
  93:auth_s.each{|c| auth_a.push(c)}
  94:s = "GET /cgi-bin/action?action=cam_mv&diretion=cam_left HTTP/1.0\r\n"
  95:s+= "Accept: */*\r\n"
  96:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n"
  97:s+= "\r\n"
  98:
  99:conn_.Send(s)
 100:recv=""
 101:while(true)
 102:buff=conn_.Recv(256, 5000)
 103:if(buff.length() == 0)
 104:break
 105:end
 106:recv = recv + buff
 107:end
 108:return @returnParamArray
 109:end
 110:#### 203 ####################################################################
 111:def cmd_203(streamid, cmd=nil)
 112:@returnParamArray.clear
 113:conn_.Reconnect()
 114:auth_s=device_.devdata_[114]+":"+device_.devdata_[115]
 115:auth_a=Array.new;
 116:auth_s.each{|c| auth_a.push(c)}
 117:s = "GET /cgi-bin/action?action=cam_mv&diretion=cam_right HTTP/1.0\r\n"
 118:s+= "Accept: */*\r\n"
 119:s+= "Authorization: Basic "+auth_a.pack("m").chop+"\r\n"
 120:s+= "\r\n"
 121:
 122:conn_.Send(s)
 123:recv=""
 124:while(true)
 125:buff=conn_.Recv(256, 5000)
 126:if(buff.length() == 0)
 127:break
 128:end
 129:recv = recv + buff
 130:end
 131:return @returnParamArray
 132:end
 133:#### 350 ####################################################################
 134:def cmd_350(cmd=nil)
 135:@returnParamArray.clear
 136:conn_.Close()
 137:return @returnParamArray
 138:end