Difference between revisions of "IPC-1002"

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

Latest revision as of 15:44, 11 July 2016

Version Status Date Updated Updated By
710 Unknown N/A N/A
810 Unknown N/A N/A
1004 Unknown N/A N/A
1204 Unknown N/A N/A
1404 Unknown N/A N/A
Usage Information
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