line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#-------------------------------------------------------------- |
2
|
|
|
|
|
|
|
# IC1500.pm |
3
|
|
|
|
|
|
|
# Perl module to control Edimax IC1500-series network cameras |
4
|
|
|
|
|
|
|
# (c) 2008, 2009 Andy Smith |
5
|
|
|
|
|
|
|
#-------------------------------------------------------------- |
6
|
|
|
|
|
|
|
# $Id: IC1500.pm 8 2009-04-24 18:34:18Z andys $ |
7
|
|
|
|
|
|
|
#-------------------------------------------------------------- |
8
|
|
|
|
|
|
|
# See 'perldoc IC1500.pm' for documentation |
9
|
|
|
|
|
|
|
#-------------------------------------------------------------- |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
package Net::Camera::Edimax::IC1500; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
20068
|
use 5.008008; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
14
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
15
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
34
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
require Exporter; |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
1013
|
use LWP::UserAgent; |
|
1
|
|
|
|
|
50353
|
|
|
1
|
|
|
|
|
3038
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
24
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
25
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# This allows declaration use Edimax ':all'; |
28
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
29
|
|
|
|
|
|
|
# will save memory. |
30
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
) ] ); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
our @EXPORT = qw( |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
our $VERSION = sprintf "1.%03d", q$Id: IC1500.pm 8 2009-04-24 18:34:18Z andys $ =~ /: .+ (\d+) \d+-/; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Preloaded methods go here. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub new { |
45
|
0
|
|
|
0
|
1
|
|
my $package = shift; |
46
|
0
|
|
|
|
|
|
my $self = {}; |
47
|
0
|
|
|
|
|
|
my %options = @_; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
$self->{hostname} = $options{hostname}; |
50
|
0
|
0
|
|
|
|
|
if ($options{port}) { $self->{port} = $options{port}; } else { $self->{port} = "80"; } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
$self->{username} = $options{username}; |
52
|
0
|
|
|
|
|
|
$self->{password} = $options{password}; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
$self->{_ua} = undef; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Image settings |
57
|
0
|
|
|
|
|
|
$self->{imageSettingsResolution} = undef; |
58
|
0
|
|
|
|
|
|
$self->{imageSettingsQuality} = 15; # camera_left.asp appears to set set anything as 'selected' by default |
59
|
0
|
|
|
|
|
|
$self->{imageSettingsFrameRate} = undef; |
60
|
0
|
|
|
|
|
|
$self->{imageSettingsFrequency} = undef; |
61
|
0
|
|
|
|
|
|
$self->{imageSettingsBrightness} = undef; |
62
|
0
|
|
|
|
|
|
$self->{imageSettingsContrast} = undef; |
63
|
0
|
|
|
|
|
|
$self->{imageSettingsSaturation} = undef; |
64
|
0
|
|
|
|
|
|
$self->{imageSettingsHue} = undef; |
65
|
0
|
|
|
|
|
|
$self->{imageSettingsWhiteness} = undef; |
66
|
0
|
|
|
|
|
|
$self->{imageSettingsAutoExp} = undef; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# System settings |
69
|
0
|
|
|
|
|
|
$self->{systemSettingsLED} = undef; |
70
|
0
|
|
|
|
|
|
$self->{systemSettingsCameraName} = undef; |
71
|
0
|
|
|
|
|
|
$self->{systemSettingsPassword} = undef; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# Status settings |
74
|
0
|
|
|
|
|
|
$self->{statusFirmware} = undef; |
75
|
0
|
|
|
|
|
|
$self->{statusUptime} = undef; |
76
|
0
|
|
|
|
|
|
$self->{statusTime} = undef; |
77
|
0
|
|
|
|
|
|
$self->{statusIPAddress} = undef; |
78
|
0
|
|
|
|
|
|
$self->{statusNetmask} = undef; |
79
|
0
|
|
|
|
|
|
$self->{statusGateway} = undef; |
80
|
0
|
|
|
|
|
|
$self->{statusDNSServer} = undef; |
81
|
0
|
|
|
|
|
|
$self->{statusMACAddress} = undef; |
82
|
0
|
|
|
|
|
|
$self->{statusVideoPort} = undef; |
83
|
0
|
|
|
|
|
|
$self->{statusHTTPPort} = undef; |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
$self = bless($self, $package); |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
$self->{_ua} = $self->_createLWP(); |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
return $self; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub _createLWP { |
93
|
0
|
|
|
0
|
|
|
my $self = shift; |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
my $ua = LWP::UserAgent->new; |
96
|
0
|
|
|
|
|
|
$ua->agent("Net::Camera::Edimax::IC1500/$VERSION"); |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
$ua->credentials( |
99
|
|
|
|
|
|
|
$self->{hostname} . ':' . $self->{port}, |
100
|
|
|
|
|
|
|
'Internet Camera', |
101
|
|
|
|
|
|
|
$self->{username} => $self->{password} |
102
|
|
|
|
|
|
|
); |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
return $ua; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub _buildImageSettingsRequest { |
108
|
0
|
|
|
0
|
|
|
my $self = shift; |
109
|
0
|
|
|
|
|
|
my ($query) = @_; |
110
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
my $request = HTTP::Request->new(GET => 'http://' . $self->{hostname} . ':' . $self->{port} . '/form/camera?' . $query); |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
return $request; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# Accessor methods |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub imageSettingsResolution { |
119
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
120
|
0
|
|
|
|
|
|
my ($value) = @_; |
121
|
|
|
|
|
|
|
|
122
|
0
|
0
|
|
|
|
|
$self->{imageSettingsResolution} = $value if defined($value); |
123
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
return $self->{imageSettingsResolution}; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub imageSettingsQuality { |
128
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
129
|
0
|
|
|
|
|
|
my ($value) = @_; |
130
|
|
|
|
|
|
|
|
131
|
0
|
0
|
|
|
|
|
$self->{imageSettingsQuality} = $value if defined($value); |
132
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
return $self->{imageSettingsQuality}; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub imageSettingsFrameRate { |
137
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
138
|
0
|
|
|
|
|
|
my ($value) = @_; |
139
|
|
|
|
|
|
|
|
140
|
0
|
0
|
|
|
|
|
$self->{imageSettingsFrameRate} = $value if defined($value); |
141
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
|
return $self->{imageSettingsFrameRate}; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub imageSettingsFrequency { |
146
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
147
|
0
|
|
|
|
|
|
my ($value) = @_; |
148
|
|
|
|
|
|
|
|
149
|
0
|
0
|
|
|
|
|
$self->{imageSettingsFrequency} = $value if defined($value); |
150
|
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
|
return $self->{imageSettingsFrequency}; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub imageSettingsBrightness { |
155
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
156
|
0
|
|
|
|
|
|
my ($value) = @_; |
157
|
|
|
|
|
|
|
|
158
|
0
|
0
|
|
|
|
|
$self->{imageSettingsBrightness} = $value if defined($value); |
159
|
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
|
return $self->{imageSettingsBrightness}; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
sub imageSettingsContrast { |
164
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
165
|
0
|
|
|
|
|
|
my ($value) = @_; |
166
|
|
|
|
|
|
|
|
167
|
0
|
0
|
|
|
|
|
$self->{imageSettingsContrast} = $value if defined($value); |
168
|
|
|
|
|
|
|
|
169
|
0
|
|
|
|
|
|
return $self->{imageSettingsContrast}; |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub imageSettingsSaturation { |
173
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
174
|
0
|
|
|
|
|
|
my ($value) = @_; |
175
|
|
|
|
|
|
|
|
176
|
0
|
0
|
|
|
|
|
$self->{imageSettingsSaturation} = $value if defined($value); |
177
|
|
|
|
|
|
|
|
178
|
0
|
|
|
|
|
|
return $self->{imageSettingsSaturation}; |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
sub imageSettingsHue { |
182
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
183
|
0
|
|
|
|
|
|
my ($value) = @_; |
184
|
|
|
|
|
|
|
|
185
|
0
|
0
|
|
|
|
|
$self->{imageSettingsHue} = $value if defined($value); |
186
|
|
|
|
|
|
|
|
187
|
0
|
|
|
|
|
|
return $self->{imageSettingsHue}; |
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
sub imageSettingsWhiteness { |
191
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
192
|
0
|
|
|
|
|
|
my ($value) = @_; |
193
|
|
|
|
|
|
|
|
194
|
0
|
0
|
|
|
|
|
$self->{imageSettingsWhiteness} = $value if defined($value); |
195
|
|
|
|
|
|
|
|
196
|
0
|
|
|
|
|
|
return $self->{imageSettingsWhiteness}; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub imageSettingsAutoExp { |
200
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
201
|
0
|
|
|
|
|
|
my ($value) = @_; |
202
|
|
|
|
|
|
|
|
203
|
0
|
0
|
|
|
|
|
if(defined($value)) |
204
|
|
|
|
|
|
|
{ |
205
|
0
|
0
|
|
|
|
|
if($value eq "ON") |
206
|
|
|
|
|
|
|
{ |
207
|
0
|
|
|
|
|
|
$self->{imageSettingsAutoExp} = $value; |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
else |
210
|
|
|
|
|
|
|
{ |
211
|
0
|
|
|
|
|
|
$self->{imageSettingsAutoExp} = ""; |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
0
|
|
|
|
|
|
return $self->{imageSettingsAutoExp}; |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sub systemSettingsCameraName { |
219
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
220
|
0
|
|
|
|
|
|
my ($value) = @_; |
221
|
|
|
|
|
|
|
|
222
|
0
|
0
|
|
|
|
|
$self->{systemSettingsCameraName} = $value if defined($value); |
223
|
|
|
|
|
|
|
|
224
|
0
|
|
|
|
|
|
return $self->{systemSettingsCameraName}; |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
sub systemSettingsPassword { |
228
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
229
|
0
|
|
|
|
|
|
my ($value) = @_; |
230
|
|
|
|
|
|
|
|
231
|
0
|
0
|
|
|
|
|
$self->{systemSettingsPassword} = $value if defined($value); |
232
|
|
|
|
|
|
|
|
233
|
0
|
|
|
|
|
|
return $self->{systemSettingsPassword}; |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
sub systemSettingsLED { |
237
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
238
|
0
|
|
|
|
|
|
my ($value) = @_; |
239
|
|
|
|
|
|
|
|
240
|
0
|
0
|
|
|
|
|
$self->{systemSettingsLED} = $value if defined($value); |
241
|
|
|
|
|
|
|
|
242
|
0
|
|
|
|
|
|
return $self->{systemSettingsLED}; |
243
|
|
|
|
|
|
|
} |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
sub statusFirmware { |
246
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
247
|
0
|
|
|
|
|
|
my ($value) = @_; |
248
|
|
|
|
|
|
|
|
249
|
0
|
0
|
|
|
|
|
$self->{statusFirmware} = $value if defined($value); |
250
|
|
|
|
|
|
|
|
251
|
0
|
|
|
|
|
|
return $self->{statusFirmware}; |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
sub statusUptime { |
255
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
256
|
0
|
|
|
|
|
|
my ($value) = @_; |
257
|
|
|
|
|
|
|
|
258
|
0
|
0
|
|
|
|
|
$self->{statusUptime} = $value if defined($value); |
259
|
|
|
|
|
|
|
|
260
|
0
|
|
|
|
|
|
return $self->{statusUptime}; |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
sub statusTime { |
264
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
265
|
0
|
|
|
|
|
|
my ($value) = @_; |
266
|
|
|
|
|
|
|
|
267
|
0
|
0
|
|
|
|
|
$self->{statusTime} = $value if defined($value); |
268
|
|
|
|
|
|
|
|
269
|
0
|
|
|
|
|
|
return $self->{statusTime}; |
270
|
|
|
|
|
|
|
} |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
sub statusIPAddress { |
273
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
274
|
0
|
|
|
|
|
|
my ($value) = @_; |
275
|
|
|
|
|
|
|
|
276
|
0
|
0
|
|
|
|
|
$self->{statusIPAddress} = $value if defined($value); |
277
|
|
|
|
|
|
|
|
278
|
0
|
|
|
|
|
|
return $self->{statusIPAddress}; |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
sub statusNetmask { |
282
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
283
|
0
|
|
|
|
|
|
my ($value) = @_; |
284
|
|
|
|
|
|
|
|
285
|
0
|
0
|
|
|
|
|
$self->{statusNetmask} = $value if defined($value); |
286
|
|
|
|
|
|
|
|
287
|
0
|
|
|
|
|
|
return $self->{statusNetmask}; |
288
|
|
|
|
|
|
|
} |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
sub statusGateway { |
291
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
292
|
0
|
|
|
|
|
|
my ($value) = @_; |
293
|
|
|
|
|
|
|
|
294
|
0
|
0
|
|
|
|
|
$self->{statusGateway} = $value if defined($value); |
295
|
|
|
|
|
|
|
|
296
|
0
|
|
|
|
|
|
return $self->{statusGateway}; |
297
|
|
|
|
|
|
|
} |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
sub statusDNSServer { |
300
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
301
|
0
|
|
|
|
|
|
my ($value) = @_; |
302
|
|
|
|
|
|
|
|
303
|
0
|
0
|
|
|
|
|
$self->{statusDNSServer} = $value if defined($value); |
304
|
|
|
|
|
|
|
|
305
|
0
|
|
|
|
|
|
return $self->{statusDNSServer}; |
306
|
|
|
|
|
|
|
} |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
sub statusMACAddress { |
309
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
310
|
0
|
|
|
|
|
|
my ($value) = @_; |
311
|
|
|
|
|
|
|
|
312
|
0
|
0
|
|
|
|
|
$self->{statusMACAddress} = $value if defined($value); |
313
|
|
|
|
|
|
|
|
314
|
0
|
|
|
|
|
|
return $self->{statusMACAddress}; |
315
|
|
|
|
|
|
|
} |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
sub statusVideoPort { |
318
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
319
|
0
|
|
|
|
|
|
my ($value) = @_; |
320
|
|
|
|
|
|
|
|
321
|
0
|
0
|
|
|
|
|
$self->{statusVideoPort} = $value if defined($value); |
322
|
|
|
|
|
|
|
|
323
|
0
|
|
|
|
|
|
return $self->{statusVideoPort}; |
324
|
|
|
|
|
|
|
} |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
sub statusHTTPPort { |
327
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
328
|
0
|
|
|
|
|
|
my ($value) = @_; |
329
|
|
|
|
|
|
|
|
330
|
0
|
0
|
|
|
|
|
$self->{statusHTTPPort} = $value if defined($value); |
331
|
|
|
|
|
|
|
|
332
|
0
|
|
|
|
|
|
return $self->{statusHTTPPort}; |
333
|
|
|
|
|
|
|
} |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
sub setImageSettings { |
336
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
# Start with a blank query |
339
|
0
|
|
|
|
|
|
my $query = undef; |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
# Build up our query as needed |
342
|
0
|
|
|
|
|
|
$query = "resolution=".$self->imageSettingsResolution; |
343
|
0
|
|
|
|
|
|
$query .= "&quality=".$self->imageSettingsQuality; |
344
|
0
|
|
|
|
|
|
$query .= "&framerate=".$self->imageSettingsFrameRate; |
345
|
0
|
|
|
|
|
|
$query .= "&frequency=".$self->imageSettingsFrequency; |
346
|
|
|
|
|
|
|
|
347
|
0
|
0
|
|
|
|
|
if($self->imageSettingsAutoExp eq "ON") |
348
|
|
|
|
|
|
|
{ |
349
|
0
|
|
|
|
|
|
$query .= "&autoexposure=".$self->imageSettingsAutoExp; |
350
|
|
|
|
|
|
|
} |
351
|
|
|
|
|
|
|
|
352
|
0
|
|
|
|
|
|
$query .= "&b_value=".$self->imageSettingsBrightness; |
353
|
0
|
|
|
|
|
|
$query .= "&c_value=".$self->imageSettingsContrast; |
354
|
0
|
|
|
|
|
|
$query .= "&s_value=".$self->imageSettingsSaturation; |
355
|
0
|
|
|
|
|
|
$query .= "&h_value=".$self->imageSettingsHue; |
356
|
0
|
|
|
|
|
|
$query .= "&w_value=".$self->imageSettingsWhiteness; |
357
|
|
|
|
|
|
|
|
358
|
0
|
|
|
|
|
|
my $request = $self->_buildImageSettingsRequest($query); |
359
|
0
|
|
|
|
|
|
$self->{_ua}->request($request); |
360
|
|
|
|
|
|
|
} |
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
sub getSnapshot { |
363
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
364
|
|
|
|
|
|
|
|
365
|
0
|
|
|
|
|
|
my $request = HTTP::Request->new(GET => 'http://' . $self->{hostname} . ':' . $self->{port} . '/snapshot.jpg'); |
366
|
|
|
|
|
|
|
|
367
|
0
|
|
|
|
|
|
my $response = $self->{_ua}->request($request); |
368
|
|
|
|
|
|
|
|
369
|
0
|
|
|
|
|
|
return $response->{_content}; |
370
|
|
|
|
|
|
|
} |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
sub cycleSystemLED { |
373
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
374
|
|
|
|
|
|
|
|
375
|
0
|
|
|
|
|
|
my $request = HTTP::Request->new(GET => 'http://' . $self->{hostname} . ':' . $self->{port} . '/form/enet?enet_source=system.asp&enet_avs_disable_leds='); |
376
|
|
|
|
|
|
|
|
377
|
0
|
|
|
|
|
|
my $response = $self->{_ua}->request($request); |
378
|
|
|
|
|
|
|
} |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
sub reboot { |
381
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
382
|
|
|
|
|
|
|
|
383
|
0
|
|
|
|
|
|
my $request = HTTP::Request->new(GET => 'http://' . $self->{hostname} . ':' . $self->{port} . '/form/reboot?enet_source=reboot.htm'); |
384
|
|
|
|
|
|
|
|
385
|
0
|
|
|
|
|
|
my $response = $self->{_ua}->request($request); |
386
|
|
|
|
|
|
|
} |
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
sub getSystemSettings { |
389
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
390
|
|
|
|
|
|
|
|
391
|
0
|
|
|
|
|
|
my $request = HTTP::Request->new(GET => 'http://' . $self->{hostname} . ':' . $self->{port} . '/system.asp'); |
392
|
|
|
|
|
|
|
|
393
|
0
|
|
|
|
|
|
my $response = $self->{_ua}->request($request); |
394
|
|
|
|
|
|
|
|
395
|
0
|
|
|
|
|
|
my $settingsPage = $response->{_content}; |
396
|
|
|
|
|
|
|
|
397
|
0
|
|
|
|
|
|
my $led; |
398
|
|
|
|
|
|
|
my $camera_name; |
399
|
0
|
|
|
|
|
|
my $password; |
400
|
|
|
|
|
|
|
|
401
|
0
|
0
|
|
|
|
|
if($settingsPage =~ /Turn (\w+) LED light/im) |
402
|
|
|
|
|
|
|
{ |
403
|
0
|
0
|
|
|
|
|
if($1 eq "on") |
404
|
|
|
|
|
|
|
{ |
405
|
0
|
|
|
|
|
|
$led = 0; |
406
|
|
|
|
|
|
|
} |
407
|
|
|
|
|
|
|
else |
408
|
|
|
|
|
|
|
{ |
409
|
0
|
|
|
|
|
|
$led = 1; |
410
|
|
|
|
|
|
|
} |
411
|
|
|
|
|
|
|
} |
412
|
0
|
0
|
|
|
|
|
if($settingsPage =~ /enet_camera_name" value="(\w+)" size/im) |
413
|
|
|
|
|
|
|
{ |
414
|
0
|
|
|
|
|
|
$camera_name = $1; |
415
|
|
|
|
|
|
|
} |
416
|
0
|
0
|
|
|
|
|
if($settingsPage =~ /enet_passwd" value="(\w+)" size/im) |
417
|
|
|
|
|
|
|
{ |
418
|
0
|
|
|
|
|
|
$password = $1; |
419
|
|
|
|
|
|
|
} |
420
|
|
|
|
|
|
|
|
421
|
0
|
|
|
|
|
|
$self->systemSettingsLED($led); |
422
|
0
|
|
|
|
|
|
$self->systemSettingsCameraName($camera_name); |
423
|
0
|
|
|
|
|
|
$self->systemSettingsPassword($password); |
424
|
|
|
|
|
|
|
} |
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
sub getLog { |
427
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
428
|
|
|
|
|
|
|
|
429
|
0
|
|
|
|
|
|
my $request = HTTP::Request->new(GET => 'http://' . $self->{hostname} . ':' . $self->{port} . '/log_show.asp'); |
430
|
|
|
|
|
|
|
|
431
|
0
|
|
|
|
|
|
my $response = $self->{_ua}->request($request); |
432
|
|
|
|
|
|
|
|
433
|
0
|
|
|
|
|
|
my $logPage = $response->{_content}; |
434
|
|
|
|
|
|
|
|
435
|
0
|
|
|
|
|
|
my $logFile; |
436
|
0
|
0
|
|
|
|
|
if($logPage =~ / |
437
|
|
|
|
|
|
|
{ |
438
|
0
|
|
|
|
|
|
$logFile = $1; |
439
|
|
|
|
|
|
|
} |
440
|
|
|
|
|
|
|
|
441
|
0
|
|
|
|
|
|
return $logFile; |
442
|
|
|
|
|
|
|
} |
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
sub getStatus { |
445
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
446
|
|
|
|
|
|
|
|
447
|
0
|
|
|
|
|
|
my $request = HTTP::Request->new(GET => 'http://' . $self->{hostname} . ':' . $self->{port} . '/status.asp'); |
448
|
|
|
|
|
|
|
|
449
|
0
|
|
|
|
|
|
my $response = $self->{_ua}->request($request); |
450
|
|
|
|
|
|
|
|
451
|
0
|
|
|
|
|
|
my $statusPage = $response->{_content}; |
452
|
|
|
|
|
|
|
|
453
|
0
|
|
|
|
|
|
my $firmware; |
454
|
|
|
|
|
|
|
my $uptime; |
455
|
0
|
|
|
|
|
|
my $time; |
456
|
0
|
|
|
|
|
|
my $ipaddress; |
457
|
0
|
|
|
|
|
|
my $netmask; |
458
|
0
|
|
|
|
|
|
my $gateway; |
459
|
0
|
|
|
|
|
|
my $dnsserver; |
460
|
0
|
|
|
|
|
|
my $macaddress; |
461
|
0
|
|
|
|
|
|
my $videoport; |
462
|
0
|
|
|
|
|
|
my $httpport; |
463
|
|
|
|
|
|
|
|
464
|
0
|
0
|
|
|
|
|
if($statusPage =~ /Firmware Version :<\/font>.+?9pt">(.+?)<\/font/ms) |
465
|
|
|
|
|
|
|
{ |
466
|
0
|
|
|
|
|
|
$firmware = $1; |
467
|
|
|
|
|
|
|
} |
468
|
0
|
0
|
|
|
|
|
if($statusPage =~ /Device Uptime :<\/font>.+?9pt">(.+?)<\/font/ms) |
469
|
|
|
|
|
|
|
{ |
470
|
0
|
|
|
|
|
|
$uptime = $1; |
471
|
|
|
|
|
|
|
} |
472
|
0
|
0
|
|
|
|
|
if($statusPage =~ /System Time :<\/font>.+?9pt">(.+?)<\/font/ms) |
473
|
|
|
|
|
|
|
{ |
474
|
0
|
|
|
|
|
|
$time = $1; |
475
|
|
|
|
|
|
|
} |
476
|
0
|
0
|
|
|
|
|
if($statusPage =~ /IP Address :<\/font>.+?9pt">(.+?)<\/font/ms) |
477
|
|
|
|
|
|
|
{ |
478
|
0
|
|
|
|
|
|
$ipaddress = $1; |
479
|
|
|
|
|
|
|
} |
480
|
0
|
0
|
|
|
|
|
if($statusPage =~ /Subnet Mask :<\/font>.+?9pt">(.+?)<\/font/ms) |
481
|
|
|
|
|
|
|
{ |
482
|
0
|
|
|
|
|
|
$netmask = $1; |
483
|
|
|
|
|
|
|
} |
484
|
0
|
0
|
|
|
|
|
if($statusPage =~ /Gateway :<\/font>.+?9pt">(.+?)<\/font/ms) |
485
|
|
|
|
|
|
|
{ |
486
|
0
|
|
|
|
|
|
$gateway = $1; |
487
|
|
|
|
|
|
|
} |
488
|
0
|
0
|
|
|
|
|
if($statusPage =~ /DNS Server :<\/font>.+?9pt">(.+?)<\/font/ms) |
489
|
|
|
|
|
|
|
{ |
490
|
0
|
|
|
|
|
|
$dnsserver = $1; |
491
|
|
|
|
|
|
|
} |
492
|
0
|
0
|
|
|
|
|
if($statusPage =~ /MAC Address :<\/font>.+?9pt">(.+?)<\/font/ms) |
493
|
|
|
|
|
|
|
{ |
494
|
0
|
|
|
|
|
|
$macaddress = $1; |
495
|
|
|
|
|
|
|
} |
496
|
0
|
0
|
|
|
|
|
if($statusPage =~ /Video Port :<\/font>.+?9pt">(.+?)<\/font/ms) |
497
|
|
|
|
|
|
|
{ |
498
|
0
|
|
|
|
|
|
$videoport = $1; |
499
|
|
|
|
|
|
|
} |
500
|
0
|
0
|
|
|
|
|
if($statusPage =~ /HTTP Port :<\/font>.+?9pt">(.+?)<\/font/ms) |
501
|
|
|
|
|
|
|
{ |
502
|
0
|
|
|
|
|
|
$httpport = $1; |
503
|
|
|
|
|
|
|
} |
504
|
|
|
|
|
|
|
|
505
|
0
|
|
|
|
|
|
$self->statusFirmware($firmware); |
506
|
0
|
|
|
|
|
|
$self->statusUptime($uptime); |
507
|
0
|
|
|
|
|
|
$self->statusTime($time); |
508
|
0
|
|
|
|
|
|
$self->statusIPAddress($ipaddress); |
509
|
0
|
|
|
|
|
|
$self->statusNetmask($netmask); |
510
|
0
|
|
|
|
|
|
$self->statusGateway($gateway); |
511
|
0
|
|
|
|
|
|
$self->statusDNSServer($dnsserver); |
512
|
0
|
|
|
|
|
|
$self->statusMACAddress($macaddress); |
513
|
0
|
|
|
|
|
|
$self->statusVideoPort($videoport); |
514
|
0
|
|
|
|
|
|
$self->statusHTTPPort($httpport); |
515
|
|
|
|
|
|
|
} |
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
sub getImageSettings { |
519
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
520
|
|
|
|
|
|
|
|
521
|
0
|
|
|
|
|
|
my $request = HTTP::Request->new(GET => 'http://' . $self->{hostname} . ':' . $self->{port} . '/camera_left.asp'); |
522
|
|
|
|
|
|
|
|
523
|
0
|
|
|
|
|
|
my $response = $self->{_ua}->request($request); |
524
|
|
|
|
|
|
|
|
525
|
0
|
|
|
|
|
|
my $settingsPage = $response->{_content}; |
526
|
|
|
|
|
|
|
|
527
|
0
|
|
|
|
|
|
my $b_value; |
528
|
|
|
|
|
|
|
my $c_value; |
529
|
0
|
|
|
|
|
|
my $s_value; |
530
|
0
|
|
|
|
|
|
my $h_value; |
531
|
0
|
|
|
|
|
|
my $w_value; |
532
|
0
|
|
|
|
|
|
my $resolution; |
533
|
0
|
|
|
|
|
|
my $quality; |
534
|
0
|
|
|
|
|
|
my $framerate; |
535
|
0
|
|
|
|
|
|
my $frequency; |
536
|
0
|
|
|
|
|
|
my $autoexposure; |
537
|
|
|
|
|
|
|
|
538
|
0
|
0
|
|
|
|
|
if($settingsPage =~ /id="b_value" value="(\d+)"/im) |
539
|
|
|
|
|
|
|
{ |
540
|
0
|
|
|
|
|
|
$b_value = $1; |
541
|
|
|
|
|
|
|
} |
542
|
0
|
0
|
|
|
|
|
if($settingsPage =~ /id="c_value" value="(\d+)"/im) |
543
|
|
|
|
|
|
|
{ |
544
|
0
|
|
|
|
|
|
$c_value = $1; |
545
|
|
|
|
|
|
|
} |
546
|
0
|
0
|
|
|
|
|
if($settingsPage =~ /id="s_value" value="(\d+)"/im) |
547
|
|
|
|
|
|
|
{ |
548
|
0
|
|
|
|
|
|
$s_value = $1; |
549
|
|
|
|
|
|
|
} |
550
|
0
|
0
|
|
|
|
|
if($settingsPage =~ /id="h_value" value="(\d+)"/im) |
551
|
|
|
|
|
|
|
{ |
552
|
0
|
|
|
|
|
|
$h_value = $1; |
553
|
|
|
|
|
|
|
} |
554
|
0
|
0
|
|
|
|
|
if($settingsPage =~ /id="w_value" value="(\d+)"/im) |
555
|
|
|
|
|
|
|
{ |
556
|
0
|
|
|
|
|
|
$w_value = $1; |
557
|
|
|
|
|
|
|
} |
558
|
0
|
0
|
|
|
|
|
if($settingsPage =~ /"(\d+)" selected>(\d+)X(\d+)/im) |
559
|
|
|
|
|
|
|
{ |
560
|
0
|
|
|
|
|
|
$resolution = $1; |
561
|
|
|
|
|
|
|
} |
562
|
0
|
0
|
|
|
|
|
if($settingsPage =~ /"(\d+)" selected>(\s+)
|
563
|
|
|
|
|
|
|
{ |
564
|
0
|
|
|
|
|
|
$quality = $1; |
565
|
|
|
|
|
|
|
} |
566
|
0
|
0
|
|
|
|
|
if($settingsPage =~ /"(\d+)" selected>(\d+)
|
567
|
|
|
|
|
|
|
{ |
568
|
0
|
|
|
|
|
|
$framerate = $1; |
569
|
|
|
|
|
|
|
} |
570
|
0
|
0
|
|
|
|
|
if($settingsPage =~ /"(\d+)" selected>(50 Hz|60 Hz|Outdoor)
|
571
|
|
|
|
|
|
|
{ |
572
|
0
|
|
|
|
|
|
$frequency = $1; |
573
|
|
|
|
|
|
|
} |
574
|
0
|
0
|
|
|
|
|
if($settingsPage =~ /NAME="autoexposure" checked value/im) |
575
|
|
|
|
|
|
|
{ |
576
|
0
|
|
|
|
|
|
$autoexposure = "ON"; |
577
|
|
|
|
|
|
|
} |
578
|
0
|
0
|
|
|
|
|
if($settingsPage =~ /NAME="autoexposure" value/im) |
579
|
|
|
|
|
|
|
{ |
580
|
0
|
|
|
|
|
|
$autoexposure = "OFF"; |
581
|
|
|
|
|
|
|
} |
582
|
|
|
|
|
|
|
|
583
|
0
|
|
|
|
|
|
$self->imageSettingsBrightness($b_value); |
584
|
0
|
|
|
|
|
|
$self->imageSettingsContrast($c_value); |
585
|
0
|
|
|
|
|
|
$self->imageSettingsSaturation($s_value); |
586
|
0
|
|
|
|
|
|
$self->imageSettingsHue($h_value); |
587
|
0
|
|
|
|
|
|
$self->imageSettingsWhiteness($w_value); |
588
|
0
|
|
|
|
|
|
$self->imageSettingsResolution($resolution); |
589
|
0
|
|
|
|
|
|
$self->imageSettingsQuality($quality); |
590
|
0
|
|
|
|
|
|
$self->imageSettingsFrameRate($framerate); |
591
|
0
|
|
|
|
|
|
$self->imageSettingsFrequency($frequency); |
592
|
0
|
|
|
|
|
|
$self->imageSettingsAutoExp($autoexposure); |
593
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
} |
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
1; |
597
|
|
|
|
|
|
|
__END__ |