D-Link DCS-5300G
| Version | Status | Date Updated | Updated By |
|---|---|---|---|
| 710 | Unknown | N/A | N/A |
| 810 | Working | 28 February 2012 | gadgetlmce |
| 1004 | Unknown | N/A | N/A |
| 1204 | Unknown | N/A | N/A |
| 1404 | Unknown | N/A | N/A |
| Usage Information | |||


Status
The D-Link DCS-5300G device template can be derived from the Panasonic IP Camera. A initial version can be found in the testing sqlCVS repository. It is fully plug and play and supports pan and tilt.
Features
- Browser based
- PAN Range +/- 135°, TILT Range +90°/ -45°
- 802.11g WLAN (2 antennas with RP-SMA connector)
- 10/100mbit LAN
- 2x I/O Port, 1x Sensor Input, 1x Relay Output
- 1x mic input, 1x A/V Connector
- 30fps max
- active motion detector
- MPEG4 compression
- UPnP, DynDNS
- Real-Time Live Video & Audio Streaming
- compatible with DCS-70 outdoor mount
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:loop do
23: buff=conn_.Recv(16384, 5000)
24: if buff.empty?
25: break
26: end
27: recv += buff
28:end
29:if recv=~ /^HTTP[^\r\n]+200\sOK.+?\r\n\r\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:loop do
59:buff=conn_.Recv(256, 5000)
60:if buff.empty?
61:break
62:end
63: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:loop do
82:buff=conn_.Recv(256, 5000)
83:if buff.empty?
84:break
85:end
86: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:loop do
105:buff=conn_.Recv(256, 5000)
106:if buff.empty?
107:break
108:end
109: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:loop do
128: buff=conn_.Recv(256, 5000)
129: if buff.empty?
130: break
131: end
132: 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
8.10 Template Fixes
I have managed to get a DCS-5300 camera to work on 8.10 but have had to manually fix the template (#1919 for the DCS5300G which is the wireless version). These are the steps that I had to do.
1. Add "Core" under "Device is controlled via category"
2. Add "Ruby Internal Commands" under section 'Commands' and make sure 'Commands' and 'Pan/Tilt/Zoom' are checked.
3. Click on Edit Ruby commands and hit update button. This will add the missing ruby commands.
4. In #350 process incoming Data put the following ruby code.
conn_.Close()
6. Do a reload router and everything should be OK.