equal
deleted
inserted
replaced
159 my $quancom = new Quancom "172.16.0.22"; |
159 my $quancom = new Quancom "172.16.0.22"; |
160 my $result = $q->cmd("xxxxxx"); |
160 my $result = $q->cmd("xxxxxx"); |
161 if ($result->error) { die $result->error_message } |
161 if ($result->error) { die $result->error_message } |
162 else { print $result->data } |
162 else { print $result->data } |
163 |
163 |
|
164 $q->set(1 .. 64 => 1); # switch on all the lights |
|
165 |
164 |
166 |
165 =head1 METHODS |
167 =head1 METHODS |
166 |
168 |
167 =over |
169 =over |
168 |
170 |
185 |
187 |
186 The only tested I<string> is currently "WB0101FF", which should set |
188 The only tested I<string> is currently "WB0101FF", which should set |
187 all bits on the first relais. Some other (untested) string for setting |
189 all bits on the first relais. Some other (untested) string for setting |
188 just the lowest bit on the first relais should be "WB010001". |
190 just the lowest bit on the first relais should be "WB010001". |
189 |
191 |
|
192 B<Note:> This function is provided for functionality not covered by the |
|
193 above L<set()> function. Whenever possible, you should avoid using this |
|
194 L<cmd()>, since it binds you tightly to the specific hardware. |
|
195 |
190 =item B<reset>( ) |
196 =item B<reset>( ) |
191 |
197 |
192 This resets the device by setting the reset control flag. |
198 This resets the device by setting the reset control flag. |
193 B<Note:> It doesn't reset timeouts etc. To reset these, use |
199 B<Note:> It doesn't reset timeouts etc. To reset these, use |
194 L<full_reset()>. |
200 L<full_reset()>. |
196 =item B<full_reset>( ) |
202 =item B<full_reset>( ) |
197 |
203 |
198 This clears the outputs AND resets timeouts by writing zero |
204 This clears the outputs AND resets timeouts by writing zero |
199 to all control bits. |
205 to all control bits. |
200 |
206 |
201 |
|
202 =item B<last_result>( ) |
207 =item B<last_result>( ) |
203 |
208 |
204 This returns an object containing the last result. |
209 This returns an object containing the last result. |
205 See L<Quancom::Result> for more information. |
210 See L<Quancom::Result> for more information. |
206 |
211 |
207 =back |
212 =back |
208 |
213 |
209 =head1 MORE EXAMPLES |
214 =head1 EXAMPLES |
210 |
215 |
211 use Quancom; |
216 use Quancom; |
212 my $quancom = new Quancom("172.20.20.1"); |
217 my $quancom = new Quancom("172.20.20.1"); |
213 die "Sorry" if $quancom->cmd("xxxx")->error; |
218 |
|
219 my $result; |
|
220 |
|
221 $result = $quancom->set(1, 7 => 1); |
|
222 die $quancom->error_message if $quancom->error; |
|
223 |
|
224 $result = $quancom->set(23 => 0); |
|
225 die $quancom->error_message if not $quancom->ok; |
|
226 |
|
227 $quancom->set(12 => 1); |
|
228 $result = $quancom->last_result; |
|
229 die $quancom->error_message if not $quancom->ok; |
|
230 |
|
231 $quancom->set(1..63 => 1)->ok |
|
232 or die $quancom->last_result->error_message; |
214 |
233 |
215 =head1 SEE ALSO |
234 =head1 SEE ALSO |
216 |
235 |
217 L<Quancom::Result> |
236 L<Quancom::Result> |
218 |
237 |
219 =head1 AUTHOR |
238 =head1 AUTHOR |
220 |
239 |
221 Maik Schueller |
240 Maik Schueller <maik.schueller@o3si.de> |
222 Heiko Schlittermann |
241 Heiko Schlittermann <hs@schlittermann.de> |
223 |
242 |
224 =head1 THANKS |
243 =head1 THANKS |
225 |
244 |
226 Thanks to Mr. van den Berg from Quancom for his support. |
245 Thanks to Mr. van den Berg from Quancom for his support. |
227 |
246 |