line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Rovio;
|
2
|
1
|
|
|
1
|
|
22953
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
960
|
use LWP::Simple;
|
|
1
|
|
|
|
|
138730
|
|
|
1
|
|
|
|
|
8
|
|
5
|
1
|
|
|
1
|
|
646
|
use vars qw($VERSION);
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6928
|
|
6
|
|
|
|
|
|
|
$VERSION = "1.5";
|
7
|
|
|
|
|
|
|
my $answer ="";
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new {
|
10
|
0
|
|
|
0
|
1
|
|
my $package = shift;
|
11
|
0
|
|
|
|
|
|
my $self;
|
12
|
0
|
|
|
|
|
|
$self->{'opened'} = 1;
|
13
|
0
|
|
|
|
|
|
$self->{'host'} = $_[0];
|
14
|
0
|
0
|
0
|
|
|
|
if ((($_[1]) && ($_[2])) && (($_[1] ne "") && ($_[2] ne ""))) {
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
15
|
|
|
|
|
|
|
# $self->{'auth'} = 1;
|
16
|
|
|
|
|
|
|
# $self->{'username'} = $_[1];
|
17
|
|
|
|
|
|
|
# $self->{'password'} = $_[2];
|
18
|
0
|
|
|
|
|
|
$self->{'host'} = $_[1].':'.$_[2].'@'.$self->{'host'};
|
19
|
|
|
|
|
|
|
}
|
20
|
0
|
|
|
|
|
|
return bless($self, $package);
|
21
|
|
|
|
|
|
|
}
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub send
|
24
|
|
|
|
|
|
|
{
|
25
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
26
|
0
|
0
|
|
|
|
|
if ($self->{'opened'})
|
27
|
|
|
|
|
|
|
{
|
28
|
0
|
0
|
|
|
|
|
if ($_[0] ne "")
|
29
|
|
|
|
|
|
|
{
|
30
|
|
|
|
|
|
|
#my $request = WWW::Mechanize->new();
|
31
|
|
|
|
|
|
|
#my $auth;
|
32
|
|
|
|
|
|
|
#if ($self->{'auth'}) {
|
33
|
|
|
|
|
|
|
#$request->credentials($self->{'username'}, $self->{'password'});
|
34
|
|
|
|
|
|
|
#}
|
35
|
0
|
|
|
|
|
|
my $file = $_[0];
|
36
|
0
|
|
|
|
|
|
my $GET = $_[1];
|
37
|
0
|
0
|
0
|
|
|
|
if ((!$GET) or ($GET eq ""))
|
38
|
|
|
|
|
|
|
{
|
39
|
0
|
|
|
|
|
|
$GET = " ";
|
40
|
|
|
|
|
|
|
}
|
41
|
|
|
|
|
|
|
#$request->get('http://'.$self->{'host'}.'/'.$file.'?'.$GET);
|
42
|
0
|
|
|
|
|
|
get('http://'.$self->{'host'}.'/'.$file.'?'.$GET);
|
43
|
|
|
|
|
|
|
}
|
44
|
|
|
|
|
|
|
else
|
45
|
|
|
|
|
|
|
{
|
46
|
0
|
|
|
|
|
|
warn "Host not specified\n";
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
}
|
49
|
|
|
|
|
|
|
}
|
50
|
|
|
|
|
|
|
else
|
51
|
|
|
|
|
|
|
{
|
52
|
0
|
|
|
|
|
|
warn "No connection to $self->{'host'}\n";
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
}
|
55
|
|
|
|
|
|
|
}
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub camera_head
|
58
|
|
|
|
|
|
|
{
|
59
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
60
|
0
|
0
|
|
|
|
|
if ($_[0] =~ /down/i)
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
61
|
|
|
|
|
|
|
{
|
62
|
0
|
|
|
|
|
|
$answer = $self->send('rev.cgi', 'Cmd=nav&action=18&drive=12');
|
63
|
|
|
|
|
|
|
}
|
64
|
|
|
|
|
|
|
elsif ($_[0] =~ /mid/i)
|
65
|
|
|
|
|
|
|
{
|
66
|
0
|
|
|
|
|
|
$answer = $self->send('rev.cgi', 'Cmd=nav&action=18&drive=13');
|
67
|
|
|
|
|
|
|
}
|
68
|
|
|
|
|
|
|
elsif ($_[0] =~ /up/i)
|
69
|
|
|
|
|
|
|
{
|
70
|
0
|
|
|
|
|
|
$answer = $self->send('rev.cgi', 'Cmd=nav&action=18&drive=11');
|
71
|
|
|
|
|
|
|
}
|
72
|
|
|
|
|
|
|
else
|
73
|
|
|
|
|
|
|
{
|
74
|
0
|
|
|
|
|
|
warn "Invalid argument for camera_head()\n";
|
75
|
|
|
|
|
|
|
}
|
76
|
0
|
|
|
|
|
|
return processanswer();
|
77
|
|
|
|
|
|
|
}
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# The lights_blue function was submitted to me by kyncl on the Robocommunity.com forum. Thanks!
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub lights_blue {
|
82
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
83
|
0
|
0
|
|
|
|
|
if ($_[0] =~ /off/i) {
|
84
|
0
|
|
|
|
|
|
$self->send("/mcu", "parameters=114D4D00010053485254000100011A000000");
|
85
|
|
|
|
|
|
|
}
|
86
|
0
|
0
|
|
|
|
|
if ($_[0] =~ /on/i) {
|
87
|
0
|
|
|
|
|
|
$self->send("/mcu", "parameters=114D4D00010053485254000100011AFF0000");
|
88
|
|
|
|
|
|
|
}
|
89
|
|
|
|
|
|
|
|
90
|
0
|
0
|
0
|
|
|
|
if (($_[0] =~ /1/i) or ($_[0] =~ /0/i)) {
|
91
|
0
|
|
|
|
|
|
my $line = $_[0];
|
92
|
0
|
|
|
|
|
|
my $hex = unpack("H*", pack ("B*", $line));
|
93
|
0
|
|
|
|
|
|
$self->send("/mcu",'parameters=114D4D00010053485254000100011A'.$hex.'0000');
|
94
|
|
|
|
|
|
|
}
|
95
|
|
|
|
|
|
|
}
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub halt
|
98
|
|
|
|
|
|
|
{
|
99
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
100
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=17");
|
101
|
0
|
|
|
|
|
|
return processanswer();
|
102
|
|
|
|
|
|
|
}
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub startrecording
|
105
|
|
|
|
|
|
|
{
|
106
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
107
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=2");
|
108
|
0
|
|
|
|
|
|
return processanswer();
|
109
|
|
|
|
|
|
|
};
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub abortrecording
|
112
|
|
|
|
|
|
|
{
|
113
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
114
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=3");
|
115
|
0
|
|
|
|
|
|
return processanswer();
|
116
|
|
|
|
|
|
|
};
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub stoprecording
|
119
|
|
|
|
|
|
|
{
|
120
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
121
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=4&name=$_[0]");
|
122
|
0
|
|
|
|
|
|
return processanswer();
|
123
|
|
|
|
|
|
|
};
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub deletepath
|
126
|
|
|
|
|
|
|
{
|
127
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
128
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=5&name=$_[0]");
|
129
|
0
|
|
|
|
|
|
return processanswer();
|
130
|
|
|
|
|
|
|
};
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub changeresolution
|
133
|
|
|
|
|
|
|
{
|
134
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
135
|
0
|
0
|
|
|
|
|
if (defined $_[0])
|
136
|
|
|
|
|
|
|
{
|
137
|
0
|
0
|
|
|
|
|
if ($_[0] =~ m/[0|1|2|3]/g)
|
138
|
|
|
|
|
|
|
{
|
139
|
0
|
|
|
|
|
|
$answer = $self->send("/ChangeResolution.cgi", "ResType=$_[0]");
|
140
|
|
|
|
|
|
|
}
|
141
|
|
|
|
|
|
|
else
|
142
|
|
|
|
|
|
|
{
|
143
|
0
|
|
|
|
|
|
return "Value must be 0,1,2, or 3";
|
144
|
|
|
|
|
|
|
}
|
145
|
|
|
|
|
|
|
}
|
146
|
|
|
|
|
|
|
else
|
147
|
|
|
|
|
|
|
{
|
148
|
0
|
|
|
|
|
|
return "Value must be 0,1,2, or 3";
|
149
|
|
|
|
|
|
|
}
|
150
|
0
|
|
|
|
|
|
return "OK";
|
151
|
|
|
|
|
|
|
};
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
# Input Parameter
|
154
|
|
|
|
|
|
|
# Camera supports 4 types of resolution:
|
155
|
|
|
|
|
|
|
# 0 - {176, 144}
|
156
|
|
|
|
|
|
|
# 1 - {352, 288}
|
157
|
|
|
|
|
|
|
# 2 - {320, 240} (Default)
|
158
|
|
|
|
|
|
|
# 3 - {640, 480}
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub changecompressratio
|
161
|
|
|
|
|
|
|
{
|
162
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
163
|
0
|
0
|
|
|
|
|
if (defined $_[0])
|
164
|
|
|
|
|
|
|
{
|
165
|
0
|
0
|
|
|
|
|
if ($_[0] =~ m/[0|1|2]/g)
|
166
|
|
|
|
|
|
|
{
|
167
|
0
|
|
|
|
|
|
$answer = $self->send("/ChangeCompressRatio.cgi", "Ratio=$_[0]");
|
168
|
|
|
|
|
|
|
}
|
169
|
|
|
|
|
|
|
else
|
170
|
|
|
|
|
|
|
{
|
171
|
0
|
|
|
|
|
|
return "Value must be 0,1, or 2";
|
172
|
|
|
|
|
|
|
}
|
173
|
|
|
|
|
|
|
}
|
174
|
|
|
|
|
|
|
else
|
175
|
|
|
|
|
|
|
{
|
176
|
0
|
|
|
|
|
|
return "Value must be 0,1, or 2";
|
177
|
|
|
|
|
|
|
}
|
178
|
0
|
|
|
|
|
|
return "OK";
|
179
|
|
|
|
|
|
|
};
|
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
# Compression Ratios (MPEG mode only)
|
182
|
|
|
|
|
|
|
#
|
183
|
|
|
|
|
|
|
# 0 - Low
|
184
|
|
|
|
|
|
|
# 1 - Medium
|
185
|
|
|
|
|
|
|
# 2 - High
|
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
sub changeframerate
|
188
|
|
|
|
|
|
|
{
|
189
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
190
|
0
|
0
|
|
|
|
|
if (defined $_[0])
|
191
|
|
|
|
|
|
|
{
|
192
|
0
|
0
|
0
|
|
|
|
if (($_[0] >= 2) && ($_[0] <= 32))
|
193
|
|
|
|
|
|
|
{
|
194
|
0
|
|
|
|
|
|
$answer = $self->send("/ChangeFramerate.cgi", "Framerate=$_[0]");
|
195
|
|
|
|
|
|
|
}
|
196
|
|
|
|
|
|
|
else
|
197
|
|
|
|
|
|
|
{
|
198
|
0
|
|
|
|
|
|
return "Value must be 2 - 32.";
|
199
|
|
|
|
|
|
|
}
|
200
|
|
|
|
|
|
|
}
|
201
|
|
|
|
|
|
|
else
|
202
|
|
|
|
|
|
|
{
|
203
|
0
|
|
|
|
|
|
return "Value must be 2 - 32";
|
204
|
|
|
|
|
|
|
}
|
205
|
0
|
|
|
|
|
|
return "OK";
|
206
|
|
|
|
|
|
|
};
|
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
# Supports 2-32 Frames per sec as input values
|
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
sub changebrightness
|
211
|
|
|
|
|
|
|
{
|
212
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
213
|
0
|
0
|
|
|
|
|
if (defined $_[0])
|
214
|
|
|
|
|
|
|
{
|
215
|
0
|
0
|
0
|
|
|
|
if (($_[0] >= 0) && ($_[0] <= 6))
|
216
|
|
|
|
|
|
|
{
|
217
|
0
|
|
|
|
|
|
$answer = $self->send("/ChangeBrightness.cgi", "Brightness=$_[0]");
|
218
|
|
|
|
|
|
|
}
|
219
|
|
|
|
|
|
|
else
|
220
|
|
|
|
|
|
|
{
|
221
|
0
|
|
|
|
|
|
return "Value must be 0 - 6.";
|
222
|
|
|
|
|
|
|
}
|
223
|
|
|
|
|
|
|
}
|
224
|
|
|
|
|
|
|
else
|
225
|
|
|
|
|
|
|
{
|
226
|
0
|
|
|
|
|
|
return "Value must be 0 - 6";
|
227
|
|
|
|
|
|
|
}
|
228
|
0
|
|
|
|
|
|
return "OK";
|
229
|
|
|
|
|
|
|
};
|
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
# Brightness from 0 - 6. 6 = Brightest setting.
|
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
sub changespeakervolume
|
234
|
|
|
|
|
|
|
{
|
235
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
236
|
0
|
0
|
|
|
|
|
if (defined $_[0])
|
237
|
|
|
|
|
|
|
{
|
238
|
0
|
0
|
0
|
|
|
|
if (($_[0] >= 0) && ($_[0] <= 31))
|
239
|
|
|
|
|
|
|
{
|
240
|
0
|
|
|
|
|
|
$answer = $self->send("/ChangeSpeakerVolume.cgi", "SpeakerVolume=$_[0]");
|
241
|
|
|
|
|
|
|
}
|
242
|
|
|
|
|
|
|
else
|
243
|
|
|
|
|
|
|
{
|
244
|
0
|
|
|
|
|
|
return "Value must be 0 - 31.";
|
245
|
|
|
|
|
|
|
}
|
246
|
|
|
|
|
|
|
}
|
247
|
|
|
|
|
|
|
else
|
248
|
|
|
|
|
|
|
{
|
249
|
0
|
|
|
|
|
|
return "Value must be 0 - 31";
|
250
|
|
|
|
|
|
|
}
|
251
|
0
|
|
|
|
|
|
return "OK";
|
252
|
|
|
|
|
|
|
};
|
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
# Speaker Volume from 0 - 31, 31 = Loudest.
|
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
sub changemicvolume
|
257
|
|
|
|
|
|
|
{
|
258
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
259
|
0
|
0
|
|
|
|
|
if (defined $_[0])
|
260
|
|
|
|
|
|
|
{
|
261
|
0
|
0
|
0
|
|
|
|
if (($_[0] >= 0) && ($_[0] <= 31))
|
262
|
|
|
|
|
|
|
{
|
263
|
0
|
|
|
|
|
|
$answer = $self->send("/ChangeMicVolume.cgi", "MicVolume=$_[0]");
|
264
|
|
|
|
|
|
|
}
|
265
|
|
|
|
|
|
|
else
|
266
|
|
|
|
|
|
|
{
|
267
|
0
|
|
|
|
|
|
return "Value must be 0 - 31.";
|
268
|
|
|
|
|
|
|
}
|
269
|
|
|
|
|
|
|
}
|
270
|
|
|
|
|
|
|
else
|
271
|
|
|
|
|
|
|
{
|
272
|
0
|
|
|
|
|
|
return "Value must be 0 - 31";
|
273
|
|
|
|
|
|
|
}
|
274
|
0
|
|
|
|
|
|
return "OK";
|
275
|
|
|
|
|
|
|
};
|
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
# Mic Volume from 0 - 31, 31 = Loudest.
|
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
sub getreport
|
280
|
|
|
|
|
|
|
{
|
281
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
282
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=1");
|
283
|
0
|
|
|
|
|
|
my ($config, %config, $var, $value) = "";
|
284
|
0
|
|
|
|
|
|
my @settings = split(/\|/,$answer);
|
285
|
0
|
|
|
|
|
|
foreach (@settings)
|
286
|
|
|
|
|
|
|
{
|
287
|
0
|
|
|
|
|
|
chomp;
|
288
|
0
|
|
|
|
|
|
s/#.*//;
|
289
|
0
|
|
|
|
|
|
s/^\s+//;
|
290
|
0
|
|
|
|
|
|
s/\s+$//;
|
291
|
0
|
0
|
|
|
|
|
next unless length;
|
292
|
|
|
|
|
|
|
#print $_ . "\n";
|
293
|
0
|
|
|
|
|
|
($var, $value) = split(/\s*=\s*/, $_, 2);
|
294
|
0
|
|
|
|
|
|
$config{$var} = $value
|
295
|
|
|
|
|
|
|
};
|
296
|
0
|
|
|
|
|
|
return (\%config);
|
297
|
|
|
|
|
|
|
}
|
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
# 'wifi_ss' => '205',
|
300
|
|
|
|
|
|
|
# 'show_time' => '0',
|
301
|
|
|
|
|
|
|
# 'theta' => '-2.497',
|
302
|
|
|
|
|
|
|
# 'frame_rate' => '25',
|
303
|
|
|
|
|
|
|
# 'state' => '0',
|
304
|
|
|
|
|
|
|
# 'y' => '1041',
|
305
|
|
|
|
|
|
|
# 'ss' => '17326',
|
306
|
|
|
|
|
|
|
# 'speaker_volume' => '27',
|
307
|
|
|
|
|
|
|
# 'next_room_ss' => '55',
|
308
|
|
|
|
|
|
|
# 'video_compression' => '1',
|
309
|
|
|
|
|
|
|
# 'mic_volume' => '29',
|
310
|
|
|
|
|
|
|
# 'ui_status' => '0',
|
311
|
|
|
|
|
|
|
# 'brightness' => '6',
|
312
|
|
|
|
|
|
|
# 'email_state' => '0',
|
313
|
|
|
|
|
|
|
# 'resolution' => '2',
|
314
|
|
|
|
|
|
|
# 'privilege' => '0',
|
315
|
|
|
|
|
|
|
# 'beacon' => '0',
|
316
|
|
|
|
|
|
|
# 'x' => '3575',
|
317
|
|
|
|
|
|
|
# 'room' => '0',
|
318
|
|
|
|
|
|
|
# 'battery' => '118',
|
319
|
|
|
|
|
|
|
# 'Cmd' => 'nav responses = 0',
|
320
|
|
|
|
|
|
|
# 'beacon_x' => '0',
|
321
|
|
|
|
|
|
|
# 'user_check' => '1',
|
322
|
|
|
|
|
|
|
# 'flags' => '0005',
|
323
|
|
|
|
|
|
|
# 'next_room' => '9',
|
324
|
|
|
|
|
|
|
# 'pp' => '0',
|
325
|
|
|
|
|
|
|
# 'sm' => '15',
|
326
|
|
|
|
|
|
|
# 'charging' => '72',
|
327
|
|
|
|
|
|
|
# 'head_position' => '204',
|
328
|
|
|
|
|
|
|
# 'ac_freq' => '2',
|
329
|
|
|
|
|
|
|
# 'resistance' => '0',
|
330
|
|
|
|
|
|
|
# 'ddns_state' => '0'
|
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
sub getlog
|
333
|
|
|
|
|
|
|
{
|
334
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
335
|
0
|
|
|
|
|
|
$answer = $self->send("/GetLog.cgi", "");
|
336
|
0
|
|
|
|
|
|
my ($log, %log, $var, $value, $line, $timeinsecs, $lognum, @lognum) = "";
|
337
|
0
|
0
|
|
|
|
|
if ($answer =~ m/Time = ([0-9].*)/g) { $timeinsecs = $1; };
|
|
0
|
|
|
|
|
|
|
338
|
0
|
|
|
|
|
|
while ( $answer =~ /Log = ([0-9].*)/g )
|
339
|
|
|
|
|
|
|
{
|
340
|
0
|
|
|
|
|
|
push @lognum, $1;
|
341
|
|
|
|
|
|
|
};
|
342
|
0
|
|
|
|
|
|
$log{'Time'} = $timeinsecs;
|
343
|
0
|
|
|
|
|
|
$log{'LogLines'} = \@lognum;
|
344
|
0
|
|
|
|
|
|
return (\%log);
|
345
|
|
|
|
|
|
|
}
|
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
# 0 Information
|
348
|
|
|
|
|
|
|
# 1 Error
|
349
|
|
|
|
|
|
|
# 11 Set user
|
350
|
|
|
|
|
|
|
# 12 Del user
|
351
|
|
|
|
|
|
|
# 13 Set user check
|
352
|
|
|
|
|
|
|
# 14 Open camera
|
353
|
|
|
|
|
|
|
# 15 Close camera
|
354
|
|
|
|
|
|
|
# 16 Change resolution
|
355
|
|
|
|
|
|
|
# 17 Change quality
|
356
|
|
|
|
|
|
|
# 18 Change brightness
|
357
|
|
|
|
|
|
|
# 19 Change contrast
|
358
|
|
|
|
|
|
|
# 20 Change saturation
|
359
|
|
|
|
|
|
|
# 21 Change hue
|
360
|
|
|
|
|
|
|
# 22 Change Sharpness
|
361
|
|
|
|
|
|
|
# 23 Set email
|
362
|
|
|
|
|
|
|
# 24 Set ftp server
|
363
|
|
|
|
|
|
|
# 25 Dial (pppoe)
|
364
|
|
|
|
|
|
|
# 26 Dial (modem)
|
365
|
|
|
|
|
|
|
# 27 New client
|
366
|
|
|
|
|
|
|
# 28 Set Motion Detect
|
367
|
|
|
|
|
|
|
# 29 Set Monite Area
|
368
|
|
|
|
|
|
|
# 30 Set Server Time
|
369
|
|
|
|
|
|
|
# 31 Set Server IP
|
370
|
|
|
|
|
|
|
# 32 Set Http Port
|
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
sub getmcureport
|
374
|
|
|
|
|
|
|
{
|
375
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
376
|
0
|
|
|
|
|
|
my ($report) = "";
|
377
|
0
|
|
|
|
|
|
my %report;
|
378
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=20");
|
379
|
0
|
0
|
|
|
|
|
if ($answer)
|
380
|
|
|
|
|
|
|
{
|
381
|
0
|
|
|
|
|
|
chomp $answer;
|
382
|
0
|
|
|
|
|
|
$answer =~ m/responses = 0(.*?)$/g;
|
383
|
0
|
|
|
|
|
|
$report{packet_length} = hex(substr($1, 0, 1));
|
384
|
0
|
|
|
|
|
|
$report{left_wheel_dir} = substr($1, 2, 1);
|
385
|
0
|
|
|
|
|
|
$report{left_encoder_ticks} = substr($1, 3, 2);
|
386
|
0
|
|
|
|
|
|
$report{right_wheel_dir} = substr($1, 5, 1);
|
387
|
0
|
|
|
|
|
|
$report{right_encoder_ticks} = substr($1, 6, 2);
|
388
|
0
|
|
|
|
|
|
$report{rear_wheel_dir} = substr($1, 8, 1);
|
389
|
0
|
|
|
|
|
|
$report{rear_encoder_ticks} = substr($1, 9, 2);
|
390
|
0
|
|
|
|
|
|
$report{head_position} = substr($1, 12, 1);
|
391
|
0
|
|
|
|
|
|
$report{picture_index} = substr($1, 13, 1);
|
392
|
|
|
|
|
|
|
#print "\n Getstatus: " . $answer . "\n";
|
393
|
|
|
|
|
|
|
#print "\nAnswer: " . length($1) . " - $1\n";
|
394
|
0
|
|
|
|
|
|
return \%report;
|
395
|
|
|
|
|
|
|
}
|
396
|
|
|
|
|
|
|
else
|
397
|
|
|
|
|
|
|
{
|
398
|
0
|
|
|
|
|
|
return "FAIL";
|
399
|
|
|
|
|
|
|
};
|
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
}
|
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
# TODO: Finish setups for bit compare
|
404
|
|
|
|
|
|
|
# Offset Length Description
|
405
|
|
|
|
|
|
|
# 0 1B Length of the packet
|
406
|
|
|
|
|
|
|
# 1 1B NOT IN USE
|
407
|
|
|
|
|
|
|
# 2 1B Direction of rotation of left wheel since last read (bit 2)
|
408
|
|
|
|
|
|
|
# 3 2B Number of left wheel encoder ticks since last read
|
409
|
|
|
|
|
|
|
# 5 1B Direction of rotation of right wheel since last read (bit 2)
|
410
|
|
|
|
|
|
|
# 6 2B Number of right wheel encoder ticks since last read
|
411
|
|
|
|
|
|
|
# 8 1B Direction of rotation of rear wheel since last read (bit 2)
|
412
|
|
|
|
|
|
|
# 9 2B Number of rear wheel encoder ticks since last read
|
413
|
|
|
|
|
|
|
# 11 1B NOT IN USE
|
414
|
|
|
|
|
|
|
# 12 1B Head position
|
415
|
|
|
|
|
|
|
# 13 1B 0x7F: Battery Full (0x7F or higher for new battery) 0x??: Orange light in Rovio head.
|
416
|
|
|
|
|
|
|
# ( to be define) 0x6A: Very low battery (Hungry, danger, very low battery level) libNS need take
|
417
|
|
|
|
|
|
|
# control to go home and charging 0x64: Shutdown level (MCU will cut off power for protecting the battery)
|
418
|
|
|
|
|
|
|
# 14 1B bit 0 : Light LED (head) status, 0: OFF, 1: ON bit 1 : IR-Radar power status. 0: OFF, 1: ON
|
419
|
|
|
|
|
|
|
# bit 2 : IR-Radar detector status: 0: fine, 1: barrier detected. bit 3-5: Charger staus 0x00 : nothing
|
420
|
|
|
|
|
|
|
# happen 0x01 : charging completed. 0x02 : in charging 0x04 : something wrong, error occur.
|
421
|
|
|
|
|
|
|
# bit 6,7: undefined, do not use.
|
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
sub getpathlist
|
425
|
|
|
|
|
|
|
{
|
426
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
427
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=6");
|
428
|
0
|
|
|
|
|
|
$answer =~ m/= (.*?)$/g;
|
429
|
0
|
|
|
|
|
|
$answer ="";
|
430
|
0
|
|
|
|
|
|
return split(/\|/,$1);
|
431
|
|
|
|
|
|
|
}
|
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
sub gettime
|
434
|
|
|
|
|
|
|
{
|
435
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
436
|
0
|
|
|
|
|
|
$answer = $self->send("/GetTime.cgi", "");
|
437
|
0
|
|
|
|
|
|
my ($config, %config, $var, $value) = "";
|
438
|
0
|
|
|
|
|
|
my @settings = split(/\n/,$answer);
|
439
|
0
|
|
|
|
|
|
foreach (@settings)
|
440
|
|
|
|
|
|
|
{
|
441
|
0
|
|
|
|
|
|
chomp;
|
442
|
0
|
|
|
|
|
|
s/#.*//;
|
443
|
0
|
|
|
|
|
|
s/^\s+//;
|
444
|
0
|
|
|
|
|
|
s/\s+$//;
|
445
|
0
|
0
|
|
|
|
|
next unless length;
|
446
|
|
|
|
|
|
|
#print $_ . "\n";
|
447
|
0
|
|
|
|
|
|
($var, $value) = split(/\s*=\s*/, $_, 2);
|
448
|
0
|
|
|
|
|
|
$config{$var} = $value
|
449
|
|
|
|
|
|
|
};
|
450
|
0
|
|
|
|
|
|
return (\%config);
|
451
|
|
|
|
|
|
|
}
|
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
sub getmediaformat
|
455
|
|
|
|
|
|
|
{
|
456
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
457
|
0
|
|
|
|
|
|
$answer =$self->send("/GetMediaFormat.cgi", "");
|
458
|
|
|
|
|
|
|
#print "\n Media answer: $answer \n";
|
459
|
0
|
|
|
|
|
|
my ($config, %config, $var, $value) = "";
|
460
|
0
|
|
|
|
|
|
my @settings = split(/\n/,$answer);
|
461
|
0
|
|
|
|
|
|
foreach (@settings)
|
462
|
|
|
|
|
|
|
{
|
463
|
0
|
|
|
|
|
|
chomp;
|
464
|
0
|
|
|
|
|
|
s/#.*//;
|
465
|
0
|
|
|
|
|
|
s/^\s+//;
|
466
|
0
|
|
|
|
|
|
s/\s+$//;
|
467
|
0
|
0
|
|
|
|
|
next unless length;
|
468
|
|
|
|
|
|
|
#print $_ . "\n";
|
469
|
0
|
|
|
|
|
|
($var, $value) = split(/\s*=\s*/, $_, 2);
|
470
|
0
|
|
|
|
|
|
$config{$var} = $value
|
471
|
|
|
|
|
|
|
};
|
472
|
0
|
|
|
|
|
|
return (\%config);
|
473
|
|
|
|
|
|
|
}
|
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
#Formats returned:
|
476
|
|
|
|
|
|
|
# Audio
|
477
|
|
|
|
|
|
|
# 0 - AMR
|
478
|
|
|
|
|
|
|
# 1 - PCM
|
479
|
|
|
|
|
|
|
# 2 - IMAADPCM
|
480
|
|
|
|
|
|
|
# 3 - ULAW
|
481
|
|
|
|
|
|
|
# 4 - ALAW
|
482
|
|
|
|
|
|
|
#
|
483
|
|
|
|
|
|
|
# Video
|
484
|
|
|
|
|
|
|
# 1 - H263
|
485
|
|
|
|
|
|
|
# 2 - MPEG4
|
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
sub setmediaformat
|
488
|
|
|
|
|
|
|
{
|
489
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
490
|
0
|
|
|
|
|
|
my ($command,$params) = "";
|
491
|
0
|
|
|
|
|
|
my %params;
|
492
|
0
|
|
|
|
|
|
($params) = @_;
|
493
|
0
|
0
|
|
|
|
|
if ($params->{Video}) { if ($params->{Video} =~ m/[1|2]/g){} else { return "Video must be 1 or 2"; }; $command .= "&Video=" . $params->{Video}; };
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
494
|
0
|
0
|
|
|
|
|
if ($params->{Audio}) { if ($params->{Audio} =~ m/[0|1|2|3|4]/g){} else { return "Audio must be 1, 2, 3, or 4"; }; $command .= "&Audio=" . $params->{Audio}; };
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
495
|
0
|
|
|
|
|
|
$answer = $self->send("/SetMediaFormat.cgi", "$command");
|
496
|
0
|
|
|
|
|
|
return "OK";
|
497
|
|
|
|
|
|
|
}
|
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
sub getcamera
|
500
|
|
|
|
|
|
|
{
|
501
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
502
|
0
|
|
|
|
|
|
$answer =$self->send("/GetCamera.cgi", "");
|
503
|
0
|
|
|
|
|
|
my ($config, %config, $var, $value) = "";
|
504
|
0
|
|
|
|
|
|
my @settings = split(/\|/,$answer);
|
505
|
0
|
|
|
|
|
|
foreach (@settings)
|
506
|
|
|
|
|
|
|
{
|
507
|
0
|
|
|
|
|
|
chomp;
|
508
|
0
|
|
|
|
|
|
s/#.*//;
|
509
|
0
|
|
|
|
|
|
s/^\s+//;
|
510
|
0
|
|
|
|
|
|
s/\s+$//;
|
511
|
0
|
0
|
|
|
|
|
next unless length;
|
512
|
|
|
|
|
|
|
#print $_ . "\n";
|
513
|
0
|
|
|
|
|
|
($var, $value) = split(/\s*=\s*/, $_, 2);
|
514
|
0
|
|
|
|
|
|
$config{$var} = $value
|
515
|
|
|
|
|
|
|
};
|
516
|
0
|
|
|
|
|
|
return (\%config);
|
517
|
|
|
|
|
|
|
}
|
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
sub gethttp
|
520
|
|
|
|
|
|
|
{
|
521
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
522
|
0
|
|
|
|
|
|
$answer =$self->send("/GetHttp.cgi", "");
|
523
|
|
|
|
|
|
|
#print "\n Http answer: $answer \n";
|
524
|
0
|
|
|
|
|
|
my ($config, %config, $var, $value) = "";
|
525
|
0
|
|
|
|
|
|
my @settings = split(/\n/,$answer);
|
526
|
0
|
|
|
|
|
|
foreach (@settings)
|
527
|
|
|
|
|
|
|
{
|
528
|
0
|
|
|
|
|
|
chomp;
|
529
|
0
|
|
|
|
|
|
s/#.*//;
|
530
|
0
|
|
|
|
|
|
s/^\s+//;
|
531
|
0
|
|
|
|
|
|
s/\s+$//;
|
532
|
0
|
0
|
|
|
|
|
next unless length;
|
533
|
|
|
|
|
|
|
#print $_ . "\n";
|
534
|
0
|
|
|
|
|
|
($var, $value) = split(/\s*=\s*/, $_, 2);
|
535
|
0
|
|
|
|
|
|
$config{$var} = $value
|
536
|
|
|
|
|
|
|
};
|
537
|
0
|
|
|
|
|
|
return (\%config);
|
538
|
|
|
|
|
|
|
}
|
539
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
sub sethttp
|
541
|
|
|
|
|
|
|
{
|
542
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
543
|
0
|
|
|
|
|
|
my ($command,$params) = "";
|
544
|
0
|
|
|
|
|
|
my %params;
|
545
|
0
|
|
|
|
|
|
($params) = @_;
|
546
|
0
|
0
|
|
|
|
|
if ($params->{Port1}) { if ($params->{Port1}) { $command .= "&Port1=" . $params->{Port1}; }; };
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
547
|
0
|
0
|
|
|
|
|
if ($params->{Port0}) { if ($params->{Port0}) { $command .= "&Port0=" . $params->{Port0}; }; };
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
548
|
0
|
|
|
|
|
|
$answer = $self->send("/SetHttp.cgi", "$command");
|
549
|
0
|
|
|
|
|
|
return "OK";
|
550
|
|
|
|
|
|
|
}
|
551
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
# This command will cause the http server to reset, briefly making it inaccessable - prepare for this to prevent errors.
|
553
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
sub getmail
|
555
|
|
|
|
|
|
|
{
|
556
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
557
|
0
|
|
|
|
|
|
$answer =$self->send("/GetMail.cgi", "");
|
558
|
|
|
|
|
|
|
#print "\n Getmail answer: $answer \n";
|
559
|
0
|
|
|
|
|
|
my ($config, %config, $var, $value) = "";
|
560
|
0
|
|
|
|
|
|
my @settings = split(/\n/,$answer);
|
561
|
0
|
|
|
|
|
|
foreach (@settings)
|
562
|
|
|
|
|
|
|
{
|
563
|
0
|
|
|
|
|
|
chomp;
|
564
|
0
|
|
|
|
|
|
s/#.*//;
|
565
|
0
|
|
|
|
|
|
s/^\s+//;
|
566
|
0
|
|
|
|
|
|
s/\s+$//;
|
567
|
0
|
0
|
|
|
|
|
next unless length;
|
568
|
|
|
|
|
|
|
#print $_ . "\n";
|
569
|
0
|
|
|
|
|
|
($var, $value) = split(/\s*=\s*/, $_, 2);
|
570
|
0
|
|
|
|
|
|
$config{$var} = $value
|
571
|
|
|
|
|
|
|
};
|
572
|
0
|
|
|
|
|
|
return (\%config);
|
573
|
|
|
|
|
|
|
}
|
574
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
# GetMail Returns:
|
576
|
|
|
|
|
|
|
#
|
577
|
|
|
|
|
|
|
# 'Subject' => 'Rovio Snapshot',
|
578
|
|
|
|
|
|
|
# 'User' => '',
|
579
|
|
|
|
|
|
|
# 'MailServer' => '',
|
580
|
|
|
|
|
|
|
# 'Port' => '25',
|
581
|
|
|
|
|
|
|
# 'Sender' => '',
|
582
|
|
|
|
|
|
|
# 'CheckFlag' => '0',
|
583
|
|
|
|
|
|
|
# 'Enable' => '0',
|
584
|
|
|
|
|
|
|
# 'Receiver' => '',
|
585
|
|
|
|
|
|
|
# 'PassWord' => '',
|
586
|
|
|
|
|
|
|
# 'Body' => 'Check out this photo from my Rovio.'
|
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
sub setmail
|
589
|
|
|
|
|
|
|
{
|
590
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
591
|
0
|
|
|
|
|
|
my ($command,$params) = "";
|
592
|
0
|
|
|
|
|
|
my %params;
|
593
|
0
|
|
|
|
|
|
($params) = @_;
|
594
|
0
|
0
|
|
|
|
|
if ($params->{Mailserver}) { if ($params->{Mailserver}) { $command .= "&Mailserver=" . $params->{Mailserver}; }; };
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
595
|
0
|
0
|
|
|
|
|
if ($params->{Sender}) { if ($params->{Sender}) { $command .= "&Sender=" . $params->{Sender}; }; };
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
596
|
0
|
0
|
|
|
|
|
if ($params->{Receiver}) { if ($params->{Receiver}) { $command .= "&Receiver=" . $params->{Receiver}; }; };
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
597
|
0
|
0
|
|
|
|
|
if ($params->{Subject}) { if ($params->{Subject}) { $command .= "&Subject=" . $params->{Subject}; }; };
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
598
|
0
|
0
|
|
|
|
|
if ($params->{User}) { if ($params->{User}) { $command .= "&User=" . $params->{User}; }; };
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
599
|
0
|
0
|
|
|
|
|
if ($params->{PassWord}) { if ($params->{PassWord}) { $command .= "&PassWord=" . $params->{PassWord}; }; };
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
600
|
0
|
0
|
|
|
|
|
if ($params->{CheckFlag}) { if ($params->{CheckFlag}) { $command .= "&CheckFlag=" . $params->{CheckFlag}; }; };
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
601
|
0
|
|
|
|
|
|
$answer = $self->send("/SetMail.cgi", "$command");
|
602
|
0
|
|
|
|
|
|
return "OK";
|
603
|
|
|
|
|
|
|
}
|
604
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
# SetMail.cgi
|
606
|
|
|
|
|
|
|
# Input Parameters
|
607
|
|
|
|
|
|
|
#
|
608
|
|
|
|
|
|
|
# Enable - Ignored
|
609
|
|
|
|
|
|
|
# MailServer - mail server address
|
610
|
|
|
|
|
|
|
# Sender - sender’s email address
|
611
|
|
|
|
|
|
|
# Receiver - receiver’s email address, multi-receivers separated by ‘;’
|
612
|
|
|
|
|
|
|
# Subject - subject of email
|
613
|
|
|
|
|
|
|
# User - user name for logging into the MailServer
|
614
|
|
|
|
|
|
|
# PassWord - password for logging into the MailServer
|
615
|
|
|
|
|
|
|
# CheckFlag - whether the MailServer needs to check password
|
616
|
|
|
|
|
|
|
# Interval - Ignored
|
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
sub getver
|
619
|
|
|
|
|
|
|
{
|
620
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
621
|
0
|
|
|
|
|
|
$answer = $self->send("/GetVer.cgi", "");
|
622
|
0
|
0
|
|
|
|
|
if ($answer)
|
623
|
|
|
|
|
|
|
{
|
624
|
0
|
|
|
|
|
|
chomp $answer;
|
625
|
0
|
|
|
|
|
|
$answer =~ m/Version = (.*?)$/g;
|
626
|
0
|
|
|
|
|
|
return $1;
|
627
|
|
|
|
|
|
|
}
|
628
|
|
|
|
|
|
|
else
|
629
|
|
|
|
|
|
|
{
|
630
|
0
|
|
|
|
|
|
return 0;
|
631
|
|
|
|
|
|
|
}
|
632
|
|
|
|
|
|
|
}
|
633
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
sub getstatus
|
635
|
|
|
|
|
|
|
{
|
636
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
637
|
0
|
|
|
|
|
|
my($status) = "";
|
638
|
0
|
|
|
|
|
|
my %status;
|
639
|
0
|
|
|
|
|
|
$answer = $self->send("/GetStatus.cgi", "");
|
640
|
0
|
|
|
|
|
|
chomp $answer;
|
641
|
0
|
|
|
|
|
|
$answer =~ m/= (.*?)$/g;
|
642
|
0
|
|
|
|
|
|
$status{camera_state} = substr($1, 0, 2);
|
643
|
0
|
|
|
|
|
|
$status{modem_state} = substr($1, 2, 2);
|
644
|
0
|
|
|
|
|
|
$status{pppoe_state} = substr($1, 4, 2);
|
645
|
0
|
|
|
|
|
|
$status{x_direction} = substr($1, 6, 3);
|
646
|
0
|
|
|
|
|
|
$status{y_direction} = substr($1, 9, 3);
|
647
|
0
|
|
|
|
|
|
$status{focus} = substr($1, 12, 3);
|
648
|
0
|
|
|
|
|
|
$status{bright} = substr($1, 15, 3);
|
649
|
0
|
|
|
|
|
|
$status{contrast} = substr($1, 18, 3);
|
650
|
0
|
|
|
|
|
|
$status{resolution} = substr($1, 21, 1);
|
651
|
0
|
|
|
|
|
|
$status{compression_ratio} = substr($1, 22, 1);
|
652
|
0
|
|
|
|
|
|
$status{privilege} = substr($1, 23, 1);
|
653
|
0
|
|
|
|
|
|
$status{picture_index} = substr($1, 24, 6);
|
654
|
0
|
|
|
|
|
|
$status{email_state} = substr($1, 30, 1);
|
655
|
0
|
|
|
|
|
|
$status{user_check} = substr($1, 31, 1);
|
656
|
0
|
|
|
|
|
|
$status{image_file_length} = substr($1, 32, 8);
|
657
|
0
|
|
|
|
|
|
$status{monitor_rect} = substr($1, 40, 16);
|
658
|
0
|
|
|
|
|
|
$status{ftp_state} = substr($1, 56, 1);
|
659
|
0
|
|
|
|
|
|
$status{saturation} = substr($1, 57, 3);
|
660
|
0
|
|
|
|
|
|
$status{motion_detected_index} = substr($1, 60, 6);
|
661
|
0
|
|
|
|
|
|
$status{hue} = substr($1, 66, 3);
|
662
|
0
|
|
|
|
|
|
$status{sharpness} = substr($1, 69, 3);
|
663
|
0
|
|
|
|
|
|
$status{motion_detect_way} = substr($1, 72, 1);
|
664
|
0
|
|
|
|
|
|
$status{sensors_frequency} = substr($1, 73, 1);
|
665
|
0
|
|
|
|
|
|
$status{channel_mode} = substr($1, 74, 1);
|
666
|
0
|
|
|
|
|
|
$status{channel_value} = substr($1, 75, 2);
|
667
|
0
|
|
|
|
|
|
$status{audio_volume} = substr($1, 77, 3);
|
668
|
0
|
|
|
|
|
|
$status{dynamic_dns_state} = substr($1, 80, 1);
|
669
|
0
|
|
|
|
|
|
$status{audio_state} = substr($1, 81, 1);
|
670
|
0
|
|
|
|
|
|
$status{frame_rate} = substr($1, 82, 3);
|
671
|
0
|
|
|
|
|
|
$status{speaker_volume} = substr($1, 85, 3);
|
672
|
0
|
|
|
|
|
|
$status{mic_volume} = substr($1, 88, 3);
|
673
|
0
|
|
|
|
|
|
$status{show_time} = substr($1, 91, 1);
|
674
|
0
|
|
|
|
|
|
$status{wifi_strength} = hex(substr($1, 93, 1));
|
675
|
0
|
|
|
|
|
|
$status{battery_level} = hex(substr($1, 94, 2));
|
676
|
|
|
|
|
|
|
#print "\n Getstatus: " . $answer . "\n";
|
677
|
0
|
|
|
|
|
|
$answer ="";
|
678
|
0
|
|
|
|
|
|
return \%status;
|
679
|
|
|
|
|
|
|
}
|
680
|
|
|
|
|
|
|
#
|
681
|
|
|
|
|
|
|
# GetStatus: 01000000000000000600021099999901000000000000000000000000000099999900000000000000000250270290c575 -96
|
682
|
|
|
|
|
|
|
#
|
683
|
|
|
|
|
|
|
# Byte Description Value
|
684
|
|
|
|
|
|
|
# 0, 1 Camera State 00 - off 01 – on
|
685
|
|
|
|
|
|
|
# 2, 3 Modem State 00 - off 01 - on line(common mode) 02 - connecting(common mode)
|
686
|
|
|
|
|
|
|
# 4, 5 PPPoE State same as Modem state
|
687
|
|
|
|
|
|
|
# 6, 7, 8 x-direction Reserved
|
688
|
|
|
|
|
|
|
# 9, 10, 11 y-direction Reserved
|
689
|
|
|
|
|
|
|
# 12, 13, 14 Focus Reserved
|
690
|
|
|
|
|
|
|
# 15, 16, 17 Bright 0 – 255
|
691
|
|
|
|
|
|
|
# 18, 19, 20 contrast 0 – 255
|
692
|
|
|
|
|
|
|
# 21 resolution 00 - {176, 144} 01 - {320, 240} 02 - {352, 288} 03 - {640, 480}
|
693
|
|
|
|
|
|
|
# 22 compression ratio Reserved
|
694
|
|
|
|
|
|
|
# 23 privilege 0 - super user(administrator) 1 - common user
|
695
|
|
|
|
|
|
|
# 24, 25, .., 29 picture index (999999 - invalid picture)
|
696
|
|
|
|
|
|
|
# 30 email state 0 - do not send motion-detected pictures 1 - send motion-detected pictures, success 2 - send motion-detected pictures, fail (wrong IP, user or password?)
|
697
|
|
|
|
|
|
|
# 31 user check 0 - do not check user, any user can connect and act as a super user 1 - username and password required, only username is "administrator" has the super privilege.
|
698
|
|
|
|
|
|
|
# 32, 34, .., 39 image file length length in bytes
|
699
|
|
|
|
|
|
|
# 40, 42, .., 55 monitor rect 4 - left(0-9999) 4 - top(0-9999) 4 - right(0-9999) 4 - bottom(0-9999)
|
700
|
|
|
|
|
|
|
# 56 ftp state 0 - disable ftp upload 1 - enable ftp upload, and upload success 2 - enable ftp upload, but fail(wrong IP, user or password?)
|
701
|
|
|
|
|
|
|
# 57, 58, 59 saturation 0 - 255
|
702
|
|
|
|
|
|
|
# 60, 61, ..., 65 motion detected index (999999 - init value)
|
703
|
|
|
|
|
|
|
# 66, 67, 68 Hue 0 - 255
|
704
|
|
|
|
|
|
|
# 69, 70, 71 sharpness 0 - 255
|
705
|
|
|
|
|
|
|
# 72 motion detect way 0 - no motion detect non-zero - motion detect
|
706
|
|
|
|
|
|
|
# 73 sensor's frequency 0 - outdoor 1 - 50Hz 2 - 60Hz
|
707
|
|
|
|
|
|
|
# 74 channel mode 0 - fixed mode 1 - round robin mode
|
708
|
|
|
|
|
|
|
# 75, 76 channel value In fixed mode, the value may be from 0 to 3 In round robin mode, the value may be from 1 to 15
|
709
|
|
|
|
|
|
|
# 77, 78, 79 audio volume
|
710
|
|
|
|
|
|
|
# 80 dynamic DNS state 0 - no update 1 - updating 2 - update successfully 3 - update failed
|
711
|
|
|
|
|
|
|
# 81 audio state 0 - audio disabled 1 - audio enabled
|
712
|
|
|
|
|
|
|
# 82, 83, 84 frame rate
|
713
|
|
|
|
|
|
|
# 85,86, 87 Speaker volume
|
714
|
|
|
|
|
|
|
# 88, 89, 90 Mic volume
|
715
|
|
|
|
|
|
|
# 91 Show Time 0 - do not show time in image 1 – show time in image
|
716
|
|
|
|
|
|
|
# 92 WiFi Strength 0-15, 0 is Max.
|
717
|
|
|
|
|
|
|
# 93, 94 BatteryLevel 0-0xFF, 255 is Max.
|
718
|
|
|
|
|
|
|
|
719
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
sub state
|
721
|
|
|
|
|
|
|
{
|
722
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
723
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=22");
|
724
|
0
|
|
|
|
|
|
$answer =~ m/state=(.*?)$/g;
|
725
|
0
|
0
|
|
|
|
|
if ($1 == "0") { return "idle"; };
|
|
0
|
|
|
|
|
|
|
726
|
0
|
0
|
|
|
|
|
if ($1 == "1") { return "driving home"; };
|
|
0
|
|
|
|
|
|
|
727
|
0
|
0
|
|
|
|
|
if ($1 == "2") { return "docking"; };
|
|
0
|
|
|
|
|
|
|
728
|
0
|
0
|
|
|
|
|
if ($1 == "3") { return "executing path"; };
|
|
0
|
|
|
|
|
|
|
729
|
0
|
0
|
|
|
|
|
if ($1 == "4") { return "recording path"; };
|
|
0
|
|
|
|
|
|
|
730
|
0
|
|
|
|
|
|
return 0;
|
731
|
|
|
|
|
|
|
}
|
732
|
|
|
|
|
|
|
|
733
|
|
|
|
|
|
|
sub gohomeanddock
|
734
|
|
|
|
|
|
|
{
|
735
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
736
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=13");
|
737
|
0
|
|
|
|
|
|
return processanswer();
|
738
|
|
|
|
|
|
|
}
|
739
|
|
|
|
|
|
|
|
740
|
|
|
|
|
|
|
sub dock
|
741
|
|
|
|
|
|
|
{
|
742
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
743
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=13");
|
744
|
0
|
|
|
|
|
|
return processanswer();
|
745
|
|
|
|
|
|
|
}
|
746
|
|
|
|
|
|
|
|
747
|
|
|
|
|
|
|
sub resetnavstatemachine
|
748
|
|
|
|
|
|
|
{
|
749
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
750
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=17");
|
751
|
0
|
|
|
|
|
|
return processanswer();
|
752
|
|
|
|
|
|
|
}
|
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
sub updatehomeposition
|
755
|
|
|
|
|
|
|
{
|
756
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
757
|
0
|
|
|
|
|
|
$answer =$self->send("/rev.cgi", "Cmd=nav&action=14");
|
758
|
0
|
|
|
|
|
|
return processanswer();
|
759
|
|
|
|
|
|
|
}
|
760
|
|
|
|
|
|
|
|
761
|
|
|
|
|
|
|
sub gettuningparameters
|
762
|
|
|
|
|
|
|
{
|
763
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
764
|
0
|
|
|
|
|
|
$answer =$self->send("/rev.cgi", "Cmd=nav&action=16");
|
765
|
0
|
|
|
|
|
|
my ($config, %config, $var, $value) = "";
|
766
|
0
|
|
|
|
|
|
my @settings = split(/\|/,$answer);
|
767
|
0
|
|
|
|
|
|
foreach (@settings)
|
768
|
|
|
|
|
|
|
{
|
769
|
0
|
|
|
|
|
|
chomp;
|
770
|
0
|
|
|
|
|
|
s/#.*//;
|
771
|
0
|
|
|
|
|
|
s/^\s+//;
|
772
|
0
|
|
|
|
|
|
s/\s+$//;
|
773
|
0
|
0
|
|
|
|
|
next unless length;
|
774
|
|
|
|
|
|
|
#print $_ . "\n";
|
775
|
0
|
|
|
|
|
|
($var, $value) = split(/\s*=\s*/, $_, 2);
|
776
|
0
|
|
|
|
|
|
$config{$var} = $value
|
777
|
|
|
|
|
|
|
};
|
778
|
0
|
|
|
|
|
|
return (\%config);
|
779
|
|
|
|
|
|
|
}
|
780
|
|
|
|
|
|
|
|
781
|
|
|
|
|
|
|
# 'ManTurn' => '8',
|
782
|
|
|
|
|
|
|
# 'ManDrive' => '7',
|
783
|
|
|
|
|
|
|
# 'DockTimeout' => '72',
|
784
|
|
|
|
|
|
|
# 'Reverse' => '6',
|
785
|
|
|
|
|
|
|
# 'LeftRight' => '6',
|
786
|
|
|
|
|
|
|
# 'Cmd' => 'nav responses = 0',
|
787
|
|
|
|
|
|
|
# 'Forward' => '5',
|
788
|
|
|
|
|
|
|
# 'DriveTurn' => '8',
|
789
|
|
|
|
|
|
|
# 'HomingTurn' => '9'
|
790
|
|
|
|
|
|
|
|
791
|
|
|
|
|
|
|
sub settuningparameters
|
792
|
|
|
|
|
|
|
{
|
793
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
794
|
0
|
|
|
|
|
|
my ($command,$params) = "";
|
795
|
0
|
|
|
|
|
|
my %params;
|
796
|
0
|
|
|
|
|
|
($params) = @_;
|
797
|
0
|
0
|
|
|
|
|
if ($params->{ManTurn}) { $command .= "&ManTurn=" . $params->{ManTurn}; };
|
|
0
|
|
|
|
|
|
|
798
|
0
|
0
|
|
|
|
|
if ($params->{ManDrive}) { $command .= "&ManDrive=" . $params->{ManDrive}; };
|
|
0
|
|
|
|
|
|
|
799
|
0
|
0
|
|
|
|
|
if ($params->{DockTimeout}) { $command .= "&DockTimeout=" . $params->{DockTimeout}; };
|
|
0
|
|
|
|
|
|
|
800
|
0
|
0
|
|
|
|
|
if ($params->{Reverse}) { $command .= "&Reverse=" . $params->{Reverse}; };
|
|
0
|
|
|
|
|
|
|
801
|
0
|
0
|
|
|
|
|
if ($params->{LeftRight}) { $command .= "&LeftRight=" . $params->{LeftRight}; };
|
|
0
|
|
|
|
|
|
|
802
|
0
|
0
|
|
|
|
|
if ($params->{Forward}) { $command .= "&Forward=" . $params->{Forward}; };
|
|
0
|
|
|
|
|
|
|
803
|
0
|
0
|
|
|
|
|
if ($params->{DriveTurn}) { $command .= "&DriveTurn=" . $params->{DriveTurn}; };
|
|
0
|
|
|
|
|
|
|
804
|
0
|
0
|
|
|
|
|
if ($params->{HomingTurn}) { $command .= "&HomingTurn=" . $params->{HomingTurn}; };
|
|
0
|
|
|
|
|
|
|
805
|
0
|
|
|
|
|
|
$answer =$self->send("/rev.cgi", "Cmd=nav&action=15$command");
|
806
|
0
|
|
|
|
|
|
return processanswer();
|
807
|
|
|
|
|
|
|
}
|
808
|
|
|
|
|
|
|
|
809
|
|
|
|
|
|
|
sub getlogo
|
810
|
|
|
|
|
|
|
{
|
811
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
812
|
0
|
|
|
|
|
|
$answer =$self->send("/GetLogo.cgi", "");
|
813
|
|
|
|
|
|
|
#print "\n" , $answer . "\n";
|
814
|
0
|
|
|
|
|
|
my ($config, %config, $var, $value) = "";
|
815
|
0
|
|
|
|
|
|
my ($lastvar) = " ";
|
816
|
0
|
|
|
|
|
|
my @settings = split(/\n/,$answer);
|
817
|
0
|
|
|
|
|
|
foreach (@settings)
|
818
|
|
|
|
|
|
|
{
|
819
|
0
|
|
|
|
|
|
chomp;
|
820
|
0
|
|
|
|
|
|
s/#.*//;
|
821
|
0
|
|
|
|
|
|
s/^\s+//;
|
822
|
0
|
|
|
|
|
|
s/\s+$//;
|
823
|
0
|
0
|
|
|
|
|
next unless length;
|
824
|
|
|
|
|
|
|
#print $_ . "\n";
|
825
|
0
|
|
|
|
|
|
($var, $value) = split(/\s*=\s*/, $_, 2);
|
826
|
0
|
0
|
|
|
|
|
if ($var eq $lastvar)
|
827
|
|
|
|
|
|
|
{
|
828
|
0
|
|
|
|
|
|
$var .= "2";
|
829
|
0
|
|
|
|
|
|
$config{$var} = $value
|
830
|
|
|
|
|
|
|
}
|
831
|
|
|
|
|
|
|
else
|
832
|
|
|
|
|
|
|
{
|
833
|
0
|
|
|
|
|
|
$config{$var} = $value
|
834
|
|
|
|
|
|
|
}
|
835
|
0
|
|
|
|
|
|
$lastvar = $var;
|
836
|
|
|
|
|
|
|
};
|
837
|
0
|
|
|
|
|
|
return (\%config);
|
838
|
|
|
|
|
|
|
}
|
839
|
|
|
|
|
|
|
|
840
|
|
|
|
|
|
|
sub getip
|
841
|
|
|
|
|
|
|
{
|
842
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
843
|
0
|
0
|
0
|
|
|
|
if (($_[0] ne "wlan0") && ($_[0] ne "eth1")) { return "Value must be wlan0 or eth1"; };
|
|
0
|
|
|
|
|
|
|
844
|
0
|
|
|
|
|
|
$answer =$self->send("/GetIP.cgi", "Interface=$_[0]");
|
845
|
|
|
|
|
|
|
#print "\n" , $answer . "\n";
|
846
|
0
|
|
|
|
|
|
my ($config, %config, $var, $value) = "";
|
847
|
0
|
|
|
|
|
|
my ($lastvar) = " ";
|
848
|
0
|
|
|
|
|
|
my @settings = split(/\n/,$answer);
|
849
|
0
|
|
|
|
|
|
foreach (@settings)
|
850
|
|
|
|
|
|
|
{
|
851
|
0
|
|
|
|
|
|
chomp;
|
852
|
0
|
|
|
|
|
|
s/#.*//;
|
853
|
0
|
|
|
|
|
|
s/^\s+//;
|
854
|
0
|
|
|
|
|
|
s/\s+$//;
|
855
|
0
|
0
|
|
|
|
|
next unless length;
|
856
|
|
|
|
|
|
|
#print $_ . "\n";
|
857
|
0
|
|
|
|
|
|
($var, $value) = split(/\s*=\s*/, $_, 2);
|
858
|
0
|
0
|
|
|
|
|
if ($var eq $lastvar)
|
859
|
|
|
|
|
|
|
{
|
860
|
0
|
|
|
|
|
|
$var .= "2";
|
861
|
0
|
|
|
|
|
|
$config{$var} = $value
|
862
|
|
|
|
|
|
|
}
|
863
|
|
|
|
|
|
|
else
|
864
|
|
|
|
|
|
|
{
|
865
|
0
|
|
|
|
|
|
$config{$var} = $value
|
866
|
|
|
|
|
|
|
}
|
867
|
0
|
|
|
|
|
|
$lastvar = $var;
|
868
|
|
|
|
|
|
|
};
|
869
|
0
|
|
|
|
|
|
return (\%config);
|
870
|
|
|
|
|
|
|
}
|
871
|
|
|
|
|
|
|
|
872
|
|
|
|
|
|
|
#GetIP Returns:
|
873
|
|
|
|
|
|
|
#
|
874
|
|
|
|
|
|
|
# 'CurrentDNS0' => '4.2.2.3',
|
875
|
|
|
|
|
|
|
# 'DNS2' => '0.0.0.0',
|
876
|
|
|
|
|
|
|
# 'IPWay' => 'manually',
|
877
|
|
|
|
|
|
|
# 'CurrentNetmask' => '255.255.255.0',
|
878
|
|
|
|
|
|
|
# 'Netmask' => '255.255.255.0',
|
879
|
|
|
|
|
|
|
# 'DNS1' => '0.0.0.0',
|
880
|
|
|
|
|
|
|
# 'Gateway' => '192.168.1.1',
|
881
|
|
|
|
|
|
|
# 'DNS0' => '4.2.2.3',
|
882
|
|
|
|
|
|
|
# 'CurrentGateway' => '192.168.1.1',
|
883
|
|
|
|
|
|
|
# 'CurrentDNS1' => '0.0.0.0',
|
884
|
|
|
|
|
|
|
# 'CameraName' => 'RovioCam',
|
885
|
|
|
|
|
|
|
# 'CurrentIP' => '192.168.1.200',
|
886
|
|
|
|
|
|
|
# 'Enable' => '1',
|
887
|
|
|
|
|
|
|
# 'CurrentDNS2' => '0.0.0.0',
|
888
|
|
|
|
|
|
|
# 'IP' => '192.168.1.200',
|
889
|
|
|
|
|
|
|
# 'CurrentIPState' => 'STATIC_IP_OK'
|
890
|
|
|
|
|
|
|
|
891
|
|
|
|
|
|
|
sub getwlan
|
892
|
|
|
|
|
|
|
{
|
893
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
894
|
0
|
|
|
|
|
|
$answer =$self->send("/GetWlan.cgi", "");
|
895
|
|
|
|
|
|
|
#print "\n" , $answer . "\n";
|
896
|
0
|
|
|
|
|
|
my ($config, %config, $var, $value) = "";
|
897
|
0
|
|
|
|
|
|
my ($lastvar) = " ";
|
898
|
0
|
|
|
|
|
|
my @settings = split(/\n/,$answer);
|
899
|
0
|
|
|
|
|
|
foreach (@settings)
|
900
|
|
|
|
|
|
|
{
|
901
|
0
|
|
|
|
|
|
chomp;
|
902
|
0
|
|
|
|
|
|
s/#.*//;
|
903
|
0
|
|
|
|
|
|
s/^\s+//;
|
904
|
0
|
|
|
|
|
|
s/\s+$//;
|
905
|
0
|
0
|
|
|
|
|
next unless length;
|
906
|
|
|
|
|
|
|
#print $_ . "\n";
|
907
|
0
|
|
|
|
|
|
($var, $value) = split(/\s*=\s*/, $_, 2);
|
908
|
0
|
0
|
|
|
|
|
if ($var eq $lastvar)
|
909
|
|
|
|
|
|
|
{
|
910
|
0
|
|
|
|
|
|
$var .= "2";
|
911
|
0
|
|
|
|
|
|
$config{$var} = $value
|
912
|
|
|
|
|
|
|
}
|
913
|
|
|
|
|
|
|
else
|
914
|
|
|
|
|
|
|
{
|
915
|
0
|
|
|
|
|
|
$config{$var} = $value
|
916
|
|
|
|
|
|
|
}
|
917
|
0
|
|
|
|
|
|
$lastvar = $var;
|
918
|
|
|
|
|
|
|
};
|
919
|
0
|
|
|
|
|
|
return (\%config);
|
920
|
|
|
|
|
|
|
}
|
921
|
|
|
|
|
|
|
|
922
|
|
|
|
|
|
|
#GetWlan Returns:
|
923
|
|
|
|
|
|
|
#
|
924
|
|
|
|
|
|
|
# 'Wep128type' => 'Wep128HEX',
|
925
|
|
|
|
|
|
|
# 'Wep64type' => 'Wep64HEX',
|
926
|
|
|
|
|
|
|
# 'Channel' => '5',
|
927
|
|
|
|
|
|
|
# 'ESSID' => 'YourRouterSSID',
|
928
|
|
|
|
|
|
|
# 'WepSet' => 'Asc',
|
929
|
|
|
|
|
|
|
# 'CurrentWiFiState' => 'OK',
|
930
|
|
|
|
|
|
|
# 'Mode' => 'Managed',
|
931
|
|
|
|
|
|
|
# 'Key' => '',
|
932
|
|
|
|
|
|
|
# 'WepGroup' => '0',
|
933
|
|
|
|
|
|
|
# 'WepAsc' => ''
|
934
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
sub getddns
|
936
|
|
|
|
|
|
|
{
|
937
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
938
|
0
|
|
|
|
|
|
my($status) = "";
|
939
|
0
|
|
|
|
|
|
my %status;
|
940
|
0
|
|
|
|
|
|
$answer = $self->send("/GetDDNS.cgi", "");
|
941
|
|
|
|
|
|
|
#print "(" . $answer . ")\n";
|
942
|
0
|
|
|
|
|
|
my ($config, %config, $var, $value) = "";
|
943
|
0
|
|
|
|
|
|
my ($lastvar) = " ";
|
944
|
0
|
|
|
|
|
|
my @settings = split(/\n/,$answer);
|
945
|
0
|
|
|
|
|
|
foreach (@settings)
|
946
|
|
|
|
|
|
|
{
|
947
|
0
|
|
|
|
|
|
chomp;
|
948
|
0
|
|
|
|
|
|
s/#.*//;
|
949
|
0
|
|
|
|
|
|
s/^\s+//;
|
950
|
0
|
|
|
|
|
|
s/\s+$//;
|
951
|
0
|
0
|
|
|
|
|
next unless length;
|
952
|
0
|
|
|
|
|
|
($var, $value) = split(/\s*=\s*/, $_, 2);
|
953
|
0
|
0
|
|
|
|
|
if ($var eq $lastvar)
|
954
|
|
|
|
|
|
|
{
|
955
|
0
|
|
|
|
|
|
$var .= "2";
|
956
|
0
|
|
|
|
|
|
$config{$var} = $value
|
957
|
|
|
|
|
|
|
}
|
958
|
|
|
|
|
|
|
else
|
959
|
|
|
|
|
|
|
{
|
960
|
0
|
|
|
|
|
|
$config{$var} = $value
|
961
|
|
|
|
|
|
|
}
|
962
|
0
|
|
|
|
|
|
$lastvar = $var;
|
963
|
|
|
|
|
|
|
};
|
964
|
0
|
|
|
|
|
|
return (\%config);
|
965
|
|
|
|
|
|
|
}
|
966
|
|
|
|
|
|
|
|
967
|
|
|
|
|
|
|
#GetDDNS Returns:
|
968
|
|
|
|
|
|
|
|
969
|
|
|
|
|
|
|
# 'User' => '',
|
970
|
|
|
|
|
|
|
# 'Pass' => '',
|
971
|
|
|
|
|
|
|
# 'Service' => '',
|
972
|
|
|
|
|
|
|
# 'ProxyPass' => '',
|
973
|
|
|
|
|
|
|
# 'Proxy' => '',
|
974
|
|
|
|
|
|
|
# 'ProxyPort' => '0',
|
975
|
|
|
|
|
|
|
# 'Info' => 'Not Update',
|
976
|
|
|
|
|
|
|
# 'ProxyUser' => '',
|
977
|
|
|
|
|
|
|
# 'Enable' => '0',
|
978
|
|
|
|
|
|
|
# 'IP' => '0.0.0.0',
|
979
|
|
|
|
|
|
|
# 'DomainName' => ''
|
980
|
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
#Info can return:
|
982
|
|
|
|
|
|
|
# Updated
|
983
|
|
|
|
|
|
|
# Updating
|
984
|
|
|
|
|
|
|
# Failed
|
985
|
|
|
|
|
|
|
# Updating IP
|
986
|
|
|
|
|
|
|
# Checked
|
987
|
|
|
|
|
|
|
# Not Update
|
988
|
|
|
|
|
|
|
|
989
|
|
|
|
|
|
|
# TODO: Write a handler for the streamed video from GetData
|
990
|
|
|
|
|
|
|
sub getdata
|
991
|
|
|
|
|
|
|
{
|
992
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
993
|
0
|
|
|
|
|
|
$answer = $self->send("/GetData.cgi", "");
|
994
|
0
|
|
|
|
|
|
return $answer;
|
995
|
|
|
|
|
|
|
};
|
996
|
|
|
|
|
|
|
|
997
|
|
|
|
|
|
|
sub gohome
|
998
|
|
|
|
|
|
|
{
|
999
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
1000
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=12");
|
1001
|
0
|
|
|
|
|
|
return processanswer();
|
1002
|
|
|
|
|
|
|
}
|
1003
|
|
|
|
|
|
|
|
1004
|
|
|
|
|
|
|
sub getname
|
1005
|
|
|
|
|
|
|
{
|
1006
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
1007
|
0
|
|
|
|
|
|
$answer = $self->send("/GetName.cgi", "");
|
1008
|
0
|
|
|
|
|
|
$answer =~ m/CameraName = (.*?)$/g;
|
1009
|
0
|
|
|
|
|
|
return $1;
|
1010
|
|
|
|
|
|
|
}
|
1011
|
|
|
|
|
|
|
|
1012
|
|
|
|
|
|
|
sub setname
|
1013
|
|
|
|
|
|
|
{
|
1014
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
1015
|
0
|
|
|
|
|
|
$answer = $self->send("/SetName.cgi", "&CameraName=$_[0]");
|
1016
|
0
|
0
|
|
|
|
|
if (getname($self) eq $_[0]) { return "OK" } else { return 0; };
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
1017
|
|
|
|
|
|
|
}
|
1018
|
|
|
|
|
|
|
|
1019
|
|
|
|
|
|
|
sub playpathforward
|
1020
|
|
|
|
|
|
|
{
|
1021
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
1022
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=7&name=$_[0]");
|
1023
|
0
|
|
|
|
|
|
return processanswer();
|
1024
|
|
|
|
|
|
|
}
|
1025
|
|
|
|
|
|
|
|
1026
|
|
|
|
|
|
|
sub playpathbackward
|
1027
|
|
|
|
|
|
|
{
|
1028
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
1029
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=8&name=$_[0]");
|
1030
|
0
|
|
|
|
|
|
return processanswer();
|
1031
|
|
|
|
|
|
|
}
|
1032
|
|
|
|
|
|
|
|
1033
|
|
|
|
|
|
|
sub renamepath
|
1034
|
|
|
|
|
|
|
{
|
1035
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
1036
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=11&name=$_[0]&newname=$_[1]");
|
1037
|
0
|
|
|
|
|
|
return processanswer();
|
1038
|
|
|
|
|
|
|
}
|
1039
|
|
|
|
|
|
|
|
1040
|
|
|
|
|
|
|
sub stopplaying
|
1041
|
|
|
|
|
|
|
{
|
1042
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
1043
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=9");
|
1044
|
0
|
|
|
|
|
|
return processanswer();
|
1045
|
|
|
|
|
|
|
}
|
1046
|
|
|
|
|
|
|
|
1047
|
|
|
|
|
|
|
sub clearallpaths
|
1048
|
|
|
|
|
|
|
{
|
1049
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
1050
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=21");
|
1051
|
0
|
|
|
|
|
|
return processanswer();
|
1052
|
|
|
|
|
|
|
}
|
1053
|
|
|
|
|
|
|
|
1054
|
|
|
|
|
|
|
sub pauseplaying
|
1055
|
|
|
|
|
|
|
{
|
1056
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
1057
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=10");
|
1058
|
0
|
|
|
|
|
|
return processanswer();
|
1059
|
|
|
|
|
|
|
}
|
1060
|
|
|
|
|
|
|
|
1061
|
|
|
|
|
|
|
sub manualdrive
|
1062
|
|
|
|
|
|
|
{
|
1063
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
1064
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=18&drive=$_[0]&speed=$_[1]");
|
1065
|
0
|
|
|
|
|
|
return processanswer();
|
1066
|
|
|
|
|
|
|
}
|
1067
|
|
|
|
|
|
|
|
1068
|
|
|
|
|
|
|
sub light
|
1069
|
|
|
|
|
|
|
{
|
1070
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
1071
|
0
|
0
|
0
|
|
|
|
if ((!$_[0]) or ($_[0] =~ /off/i))
|
1072
|
|
|
|
|
|
|
{
|
1073
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=19&LIGHT=0");
|
1074
|
|
|
|
|
|
|
}
|
1075
|
|
|
|
|
|
|
else
|
1076
|
|
|
|
|
|
|
{
|
1077
|
0
|
|
|
|
|
|
$answer = $self->send("/rev.cgi", "Cmd=nav&action=19&LIGHT=1");
|
1078
|
|
|
|
|
|
|
}
|
1079
|
0
|
|
|
|
|
|
return processanswer();
|
1080
|
|
|
|
|
|
|
}
|
1081
|
|
|
|
|
|
|
|
1082
|
|
|
|
|
|
|
sub camimg
|
1083
|
|
|
|
|
|
|
{
|
1084
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
1085
|
0
|
|
|
|
|
|
$answer = get('http://'.$self->{'host'}.'/'.'Jpeg/CamImg0002.jpg');
|
1086
|
0
|
0
|
|
|
|
|
if ($answer)
|
1087
|
|
|
|
|
|
|
{
|
1088
|
0
|
|
|
|
|
|
return $answer;
|
1089
|
|
|
|
|
|
|
}
|
1090
|
|
|
|
|
|
|
else
|
1091
|
|
|
|
|
|
|
{
|
1092
|
0
|
|
|
|
|
|
return 0;
|
1093
|
|
|
|
|
|
|
};
|
1094
|
|
|
|
|
|
|
}
|
1095
|
|
|
|
|
|
|
|
1096
|
|
|
|
|
|
|
sub send_photo
|
1097
|
|
|
|
|
|
|
{
|
1098
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
1099
|
0
|
|
|
|
|
|
$self->send("/SendMail.cgi");
|
1100
|
0
|
|
|
|
|
|
return "OK";
|
1101
|
|
|
|
|
|
|
}
|
1102
|
|
|
|
|
|
|
|
1103
|
|
|
|
|
|
|
sub sendmail
|
1104
|
|
|
|
|
|
|
{
|
1105
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
1106
|
0
|
|
|
|
|
|
$self->send("/SendMail.cgi");
|
1107
|
0
|
|
|
|
|
|
return "OK";
|
1108
|
|
|
|
|
|
|
}
|
1109
|
|
|
|
|
|
|
|
1110
|
|
|
|
|
|
|
sub reboot
|
1111
|
|
|
|
|
|
|
{
|
1112
|
0
|
|
|
0
|
1
|
|
my $self = shift;
|
1113
|
0
|
|
|
|
|
|
$answer = $self->send("/Reboot.cgi", "");
|
1114
|
0
|
|
|
|
|
|
return processanswer();
|
1115
|
|
|
|
|
|
|
|
1116
|
|
|
|
|
|
|
}
|
1117
|
|
|
|
|
|
|
|
1118
|
|
|
|
|
|
|
sub processanswer
|
1119
|
|
|
|
|
|
|
{
|
1120
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
1121
|
0
|
0
|
|
|
|
|
if ($answer)
|
1122
|
|
|
|
|
|
|
{
|
1123
|
0
|
|
|
|
|
|
chomp $answer;
|
1124
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 0/ig) { return "OK"; };
|
|
0
|
|
|
|
|
|
|
1125
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 9/ig) { return "PATH_NOT_FOUND"; };
|
|
0
|
|
|
|
|
|
|
1126
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 8/ig) { return "PATH_BASEADDRESS_NOT_INITIALIZED"; };
|
|
0
|
|
|
|
|
|
|
1127
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 7/ig) { return "FAILED_TO_READ_PATH"; };
|
|
0
|
|
|
|
|
|
|
1128
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 6/ig) { return "NO_EMPTY_PATH_AVAILABLE"; };
|
|
0
|
|
|
|
|
|
|
1129
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 5/ig) { return "NO_NS_SIGNAL"; };
|
|
0
|
|
|
|
|
|
|
1130
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 4/ig) { return "UNKNOWN_CGI_ACTION"; };
|
|
0
|
|
|
|
|
|
|
1131
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 3/ig) { return "FEATURE_NOT_IMPLEMENTED"; };
|
|
0
|
|
|
|
|
|
|
1132
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 23/ig) { return "NO_PARAMETER"; };
|
|
0
|
|
|
|
|
|
|
1133
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 22/ig) { return "PARAMETER_OUTOFRANGE"; };
|
|
0
|
|
|
|
|
|
|
1134
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 21/ig) { return "NS_UART_READ_ERROR"; };
|
|
0
|
|
|
|
|
|
|
1135
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 20/ig) { return "NS_PACKET_CHECKSUM_ERROR"; };
|
|
0
|
|
|
|
|
|
|
1136
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 2/ig) { return "ROBOT_BUSY"; };
|
|
0
|
|
|
|
|
|
|
1137
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 19/ig) { return "NO_NS_PORT_AVAILABLE"; };
|
|
0
|
|
|
|
|
|
|
1138
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 18/ig) { return "NO_MCU_PORT_AVAILABLE"; };
|
|
0
|
|
|
|
|
|
|
1139
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 17/ig) { return "NO_MEMORY_AVAILABLE"; };
|
|
0
|
|
|
|
|
|
|
1140
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 16/ig) { return "FLASH_NOT_READY"; };
|
|
0
|
|
|
|
|
|
|
1141
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 15/ig) { return "FAILED_TO_WRITE_TO_FLASH"; };
|
|
0
|
|
|
|
|
|
|
1142
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 14/ig) { return "FAILED_TO_READ_FROM_FLASH"; };
|
|
0
|
|
|
|
|
|
|
1143
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 13/ig) { return "FAILED_TO_DELETE_PATH"; };
|
|
0
|
|
|
|
|
|
|
1144
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 12/ig) { return "FLASH_NOT_INITIALIZED"; };
|
|
0
|
|
|
|
|
|
|
1145
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 11/ig) { return "NOT_RECORDING_PATH"; };
|
|
0
|
|
|
|
|
|
|
1146
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 10/ig) { return "PATH_NAME_NOT_SPECIFIED"; };
|
|
0
|
|
|
|
|
|
|
1147
|
0
|
0
|
|
|
|
|
if ($answer =~ m/responses = 1/ig) { return "FAIL"; };
|
|
0
|
|
|
|
|
|
|
1148
|
0
|
|
|
|
|
|
return 0;
|
1149
|
|
|
|
|
|
|
};
|
1150
|
|
|
|
|
|
|
};
|
1151
|
|
|
|
|
|
|
|
1152
|
|
|
|
|
|
|
1;
|
1153
|
|
|
|
|
|
|
__END__
|