| 1 | package VoiceXML::Client::DeviceHandle; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use VoiceXML::Client; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use VoiceXML::Client::Util; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use VoiceXML::Client::Vars; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | # just need to define an interface for device handles... | ||||||||||||||||||||||||||||
| 10 | # this really only tells you where to look for the API | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 3 | ▶ | use vars qw { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | $DeviceDefined | ||||||||||||||||||||||||||||
| 14 | %InputMode | ||||||||||||||||||||||||||||
| 15 | %ReadnumGlobals | ||||||||||||||||||||||||||||
| 16 | $VERSION | ||||||||||||||||||||||||||||
| 17 | 3 | }; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 3 | $DeviceDefined = 1; | |||||||||||||||||||||||||||
| 20 | 3 | %InputMode = ( | |||||||||||||||||||||||||||
| 21 | 'FIXEDDIGIT' => 1, | ||||||||||||||||||||||||||||
| 22 | 'MULTIDIGIT' => 2, | ||||||||||||||||||||||||||||
| 23 | ); | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 3 | $VERSION = $VoiceXML::Client::VERSION; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | =head1 VoiceXML::Client::DeviceHandle | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | =head1 NAME | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | VoiceXML::Client::DeviceHandle - Encapsulates the communications device (eg Voice Modem) | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | The VoiceXML::Client::DeviceHandle module is meant to serve as an abstract base | ||||||||||||||||||||||||||||
| 37 | class for voice communication devices. | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | It provides the interface VoiceXML::Client::DeviceHandle::XXX modules are expected | ||||||||||||||||||||||||||||
| 40 | to implement. | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | LICENSE | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | VoiceXML::Client::DeviceHandle module, device handle api based on the VOCP voice messaging system package | ||||||||||||||||||||||||||||
| 47 | VOCP::Device. | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | Copyright (C) 2002,2008 Patrick Deegan | ||||||||||||||||||||||||||||
| 50 | All rights reserved | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | This file is part of VoiceXML::Client. | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | VoiceXML::Client is free software: you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 56 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 57 | the Free Software Foundation, either version 3 of the License, or | ||||||||||||||||||||||||||||
| 58 | (at your option) any later version. | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | VoiceXML::Client is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||
| 61 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||
| 62 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||||||||||||||||||||
| 63 | GNU General Public License for more details. | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | You should have received a copy of the GNU General Public License | ||||||||||||||||||||||||||||
| 66 | along with VoiceXML::Client. If not, see <http://www.gnu.org/licenses/>. | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | =head2 new [PARAMHREF] | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | Creates a new instance, calling init() with PARAMHREF if passed. | ||||||||||||||||||||||||||||
| 73 | Returns a new blessed object. | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | =cut | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=8 SCAR=22.6
Pod
documented
| |||||||||||||||||||||||||||||
| 78 | 3 | my $class = shift; | |||||||||||||||||||||||||||
| 79 | 3 | my $params = shift; | |||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 3 | my $self = {}; | |||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 3 | ▶ | bless $self, ref $class || $class; | ||||||||||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 3 | ▶ | $self->{'autostop'} = (defined $params->{'autostop'}) ? $params->{'autostop'} : $VoiceXML::Client::Vars::Defaults{'autostop'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 3 | ▶ | $self->{'timeout'} = (defined $params->{'timeout'}) ? $params->{'timeout'} : $VoiceXML::Client::Vars::Defaults{'timeout'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | 3 | ▶ | $self->{'numrepeat'} = (defined $params->{'numrepeat'}) ? $params->{'numrepeat'} : $VoiceXML::Client::Vars::Defaults{'numrepeat'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 3 | ▶ | $self->{'device'} = (defined $params->{'device'}) ? $params->{'device'} : $VoiceXML::Client::Vars::Defaults{'device'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 3 | ▶ | $self->{'inputmode'} = (defined $params->{'inputmode'}) ? $params->{'inputmode'} : $InputMode{'FIXEDDIGIT'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 3 | ▶ | while (my ($key, $val) = each %{$params}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | { | ||||||||||||||||||||||||||||
| 98 | 0 | $self->{$key} = $val; | |||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 3 | $ReadnumGlobals{$$}{'device_obj'} = $self; | |||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 3 | $ReadnumGlobals{$$}{'inputReceivedCallbacks'} = {}; | |||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 3 | $self->init($params); | |||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 3 | return $self; | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | =head2 init PARAMHREF | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | Called by new(). This method is used in derived classes to perform startup initialisation. | ||||||||||||||||||||||||||||
| 118 | Override this method if required. | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | =cut | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | 3 | ▶ | sub init { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 123 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 124 | 3 | my $params = shift; | |||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 3 | return 1; | |||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | =head1 Subclass method stubs | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | The following methods are in this parent class (but only implemented as stubs) in order to define a | ||||||||||||||||||||||||||||
| 136 | common interface for all VoiceXML::Client::DeviceHandle subclasses. | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | These methods are actually heavily based on the Modem::Vgetty package methods and the interface should | ||||||||||||||||||||||||||||
| 139 | be considered tentative and expected to change as new devices are added (eg a SIP voice over IP interface | ||||||||||||||||||||||||||||
| 140 | would be nice). | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | =cut | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 0 | ▶ | sub connect { | ||||||||||||||||||||||||||
|
Subroutine
connect: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 146 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 147 | 0 | my $params = shift; | |||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 0 | ▶ | print STDERR "VoiceXML::Client::DeviceHandle::connect() Call to parent class stub - please implement in subclass.\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 150 | if ($VoiceXML::Client::Debug); | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 0 | return 1; | |||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 0 | ▶ | sub disconnect { | ||||||||||||||||||||||||||
|
Subroutine
disconnect: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 157 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 158 | 0 | my $params = shift; | |||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | 0 | ▶ | print STDERR "VoiceXML::Client::DeviceHandle::disconnect() Call to parent class stub - please implement in subclass.\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 161 | if ($VoiceXML::Client::Debug); | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 0 | return 1; | |||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | =head2 beep FREQUENCY LENGTH | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | Sends a beep through the chosen device using given frequency (HZ) and length (in miliseconds). Returns a defined | ||||||||||||||||||||||||||||
| 171 | and true value on success. | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | =cut | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 0 | ▶ | sub beep { | ||||||||||||||||||||||||||
|
Subroutine
beep: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 176 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 177 | 0 | my $frequency = shift; | |||||||||||||||||||||||||||
| 178 | 0 | my $length = shift; | |||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | 0 | print STDERR "VoiceXML::Client::DeviceHandle::beep($frequency, $length) Call to parent class stub - please implement in subclass.\n"; | |||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 0 | return 1; | |||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | =head2 dial DESTINATION | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | Connects to destination. Returns defined & true on success. | ||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | =cut | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | 0 | ▶ | sub dial { | ||||||||||||||||||||||||||
|
Subroutine
dial: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 194 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 195 | 0 | my $destination = shift; | |||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | 0 | print STDERR "VoiceXML::Client::DeviceHandle::dial($destination) Call to parent class stub - please implement in subclass.\n"; | |||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | 0 | return 1; | |||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | =head2 play PLAYPARAM | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | plays a sound (file, text-to-speech, whatever is appropriate) base on PLAYPARAM. May or may not block during | ||||||||||||||||||||||||||||
| 206 | play depending on device implementation. Returns true on success. | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | =cut | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | 0 | ▶ | sub play { | ||||||||||||||||||||||||||
|
Subroutine
play: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 211 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 212 | 0 | my $playthis = shift; | |||||||||||||||||||||||||||
| 213 | 0 | my $type = shift; | |||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | 0 | print STDERR "VoiceXML::Client::DeviceHandle::play($playthis) Call to parent class stub - please implement in subclass.\n"; | |||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 0 | return 1; | |||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | =head2 record TOFILE | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | Records input from user to device to file TOFILE. Returns true on success. | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | =cut | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 0 | ▶ | sub record { | ||||||||||||||||||||||||||
|
Subroutine
record: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 229 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 230 | 0 | my $tofile = shift; | |||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | 0 | print STDERR "VoiceXML::Client::DeviceHandle::record($tofile) Call to parent class stub - please implement in subclass.\n"; | |||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | 0 | return 1; | |||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | =head2 wait TIME | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | Simply waits for TIME seconds. Device should accept/queue user input | ||||||||||||||||||||||||||||
| 242 | during interval. | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | =cut | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | 0 | ▶ | sub wait { | ||||||||||||||||||||||||||
|
Subroutine
wait: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 247 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 248 | 0 | my $time = shift; | |||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | 0 | print STDERR "VoiceXML::Client::DeviceHandle::wait($time) Call to parent class stub - please implement in subclass.\n"; | |||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | 0 | return 1; | |||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | =head2 waitFor STATE | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | Waits until STATE is reached/returned by device. Device should accept/queue user input | ||||||||||||||||||||||||||||
| 260 | during interval. | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | =cut | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | 0 | ▶ | sub waitFor { | ||||||||||||||||||||||||||
|
Subroutine
waitFor: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 265 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 266 | 0 | my $state = shift; | |||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | 0 | print STDERR "VoiceXML::Client::DeviceHandle::waitFor($state) Call to parent class stub - please implement in subclass.\n"; | |||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | 0 | return 1; | |||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | =head2 stop | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | Immediately stop any current activity (wait, play, record, etc.). | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | =cut | ||||||||||||||||||||||||||||
| 278 | 0 | ▶ | sub stop { | ||||||||||||||||||||||||||
|
Subroutine
stop: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 279 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | 0 | print STDERR "VoiceXML::Client::DeviceHandle::stop() Call to parent class stub - please implement in subclass.\n"; | |||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | 0 | return 1; | |||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | =head2 blocking_play PLAYTHIS | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | play PLAYTHIS and return only when done. | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | =cut | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | 0 | ▶ | sub blockingPlay { | ||||||||||||||||||||||||||
|
Subroutine
blockingPlay: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 294 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 295 | 0 | my $playthis = shift; | |||||||||||||||||||||||||||
| 296 | 0 | my $type = shift; | |||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | 0 | print STDERR "VoiceXML::Client::DeviceHandle::blocking_play($playthis) Call to parent class stub - please implement in subclass.\n"; | |||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | 0 | return 1; | |||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | =head2 inputMode [MODE] | ||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | Returns the current input mode (single- or multi- digit currently supported), optionally setting to | ||||||||||||||||||||||||||||
| 308 | MODE, if passed - use the %VoiceXML::Client::DeviceHandle::InputMode hash for valid MODE values. | ||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | =cut | ||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | 0 | ▶ | sub inputMode { | ||||||||||||||||||||||||||
|
Subroutine
inputMode: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 313 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 314 | 0 | my $setTo = shift; | |||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||
| 316 | 0 | ▶ | if (defined $setTo) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 317 | { | ||||||||||||||||||||||||||||
| 318 | 0 | $self->{'inputmode'} = $setTo; | |||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | 0 | return $self->{'inputmode'}; | |||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | =head2 readnum PLAYTHIS TIMEOUT [REPEATTIMES] | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | Plays the PLAYTHIS and then waits for the sequence of the digit input finished. If no are entered within TIMEOUT | ||||||||||||||||||||||||||||
| 327 | seconds, it re-plays the message again. It returns failure (undefined value) if no digits are entered after the message | ||||||||||||||||||||||||||||
| 328 | has been played REPEATTIMES (defaults to 3) times. | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | It returns a string (a sequence of DTMF tones 0-9,A-D and `*') without the final stop key (normally '#'). | ||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | =cut | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | 0 | ▶ | sub readnum { | ||||||||||||||||||||||||||
|
Subroutine
readnum: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 338 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 339 | 0 | my $playthis = shift; | |||||||||||||||||||||||||||
| 340 | 0 | my $timeout = shift; | |||||||||||||||||||||||||||
| 341 | 0 | ▶ | my $repeatTimes = shift || 3; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 3
MC/DC0%0/1
shift() || 3
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | 0 | print STDERR "VoiceXML::Client::DeviceHandle::beep() Call to parent class stub - please implement in subclass.\n"; | |||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | 0 | return 1; | |||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | =head2 validDataFormats | ||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | Returns an array ref of valid data formats (eg 'rmd', 'wav', 'au') the device will accept. | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | =cut | ||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | 0 | ▶ | sub validDataFormats { | ||||||||||||||||||||||||||
|
Subroutine
validDataFormats: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 359 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | 0 | print STDERR "VoiceXML::Client::DeviceHandle::validDataFormats() Call to parent class stub - please implement in subclass.\n"; | |||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | 0 | return undef; | |||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | 0 | ▶ | sub receiveImage { | ||||||||||||||||||||||||||
|
Subroutine
receiveImage: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 369 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | 0 | print STDERR "VoiceXML::Client::DeviceHandle::receiveImage() Call to parent class stub - please implement in subclass.\n"; | |||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | 0 | return 1; | |||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | # Not sure what to do with this method... how do you support faxes while abstracting the modem voice device?? | ||||||||||||||||||||||||||||
| 378 | 0 | ▶ | sub sendImage { | ||||||||||||||||||||||||||
|
Subroutine
sendImage: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 379 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 380 | 0 | my $file = shift; | |||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||
| 382 | 0 | print STDERR "VoiceXML::Client::DeviceHandle::sendImage() Call to parent class stub - please implement in subclass.\n"; | |||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | 0 | return 1; | |||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | 0 | ▶ | sub notifyCallbacksOfInputReceived { | ||||||||||||||||||||||||||
|
Subroutine
notifyCallbacksOfInputReceived: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 389 | 0 | my $input = shift; | |||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | 0 | ▶ | while (my ($name, $dets) = each %{$ReadnumGlobals{$$}{'inputReceivedCallbacks'}}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 392 | { | ||||||||||||||||||||||||||||
| 393 | 0 | ▶ | VoiceXML::Client::Util::log_msg("Notifying $name of input received") if ($VoiceXML::Client::Debug); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 394 | 0 | my $obj = $dets->{'object'}; | |||||||||||||||||||||||||||
| 395 | 0 | my $meth = $dets->{'method'}; | |||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||
| 397 | 0 | $obj->$meth($ReadnumGlobals{$$}{'device_obj'}, $input); | |||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||
| 400 | 0 | return; | |||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||
| 403 | 0 | ▶ | sub registerInputReceivedCallback { | ||||||||||||||||||||||||||
|
Subroutine
registerInputReceivedCallback: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 404 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 405 | 0 | ▶ | my $name = shift || return; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 406 | 0 | my $object = shift; | |||||||||||||||||||||||||||
| 407 | 0 | my $method = shift; | |||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||
| 409 | 0 | ▶ | unless ($object && $object->can($method)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$object and $object->can($method)
MC/DC0%0/2
$object and $object->can($method)
$object
$object->can($method)
Truth table0%0/3
A and B
A= $objectB= $object->can($method)
| |||||||||||||||||||||||||||||
| 410 | { | ||||||||||||||||||||||||||||
| 411 | 0 | VoiceXML::Client::Util::log_msg("Trying to register $method on $object but object can't do that"); | |||||||||||||||||||||||||||
| 412 | 0 | return; | |||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||
| 415 | 0 | ▶ | VoiceXML::Client::Util::log_msg("Registering $method on $object for input received callback") if ($VoiceXML::Client::Debug); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||
| 417 | 0 | $ReadnumGlobals{$$}{'inputReceivedCallbacks'}->{$name} = { | |||||||||||||||||||||||||||
| 418 | 'object' => $object, | ||||||||||||||||||||||||||||
| 419 | 'method' => $method | ||||||||||||||||||||||||||||
| 420 | }; | ||||||||||||||||||||||||||||
| 421 | 0 | return 1; | |||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||
| 424 | 0 | ▶ | sub deleteInputReceivedCallback { | ||||||||||||||||||||||||||
|
Subroutine
deleteInputReceivedCallback: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 425 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 426 | 0 | ▶ | my $name = shift || return; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||
| 428 | 0 | ▶ | delete $ReadnumGlobals{$$}{'inputReceivedCallbacks'}->{$name} if (exists $ReadnumGlobals{$$}{'inputReceivedCallbacks'}->{$name}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||
| 430 | 0 | return; | |||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||
| 435 | 0 | ▶ | sub resetReadnumGlobalNumberCache { | ||||||||||||||||||||||||||
|
Subroutine
resetReadnumGlobalNumberCache: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 436 | 0 | ▶ | my $cacheID = shift || return; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||
| 438 | 0 | $ReadnumGlobals{$cacheID}{'readnum_number'} = ''; | |||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | 0 | return; | |||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||
| 443 | 0 | ▶ | sub appendPendingInput { | ||||||||||||||||||||||||||
|
Subroutine
appendPendingInput: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 444 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 445 | 0 | my $input = shift; | |||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||
| 447 | 0 | ▶ | return unless defined ($input); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||
| 449 | 0 | ▶ | $ReadnumGlobals{$$}{'readnum_number'} = '' unless (defined $ReadnumGlobals{$$}{'readnum_number'}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 450 | 0 | $ReadnumGlobals{$$}{'readnum_number'} .= $input; | |||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||
| 452 | 0 | return $input; | |||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||
| 456 | 0 | ▶ | sub pendingInputLength { | ||||||||||||||||||||||||||
|
Subroutine
pendingInputLength: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 457 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | 0 | my $readnumid = $$; # So it's safe to have multiple devices... | |||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||
| 462 | my $retnum = defined $ReadnumGlobals{$readnumid}{'readnum_number'} ? | ||||||||||||||||||||||||||||
| 463 | 0 | ▶ | $ReadnumGlobals{$readnumid}{'readnum_number'} : ''; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||
| 465 | 0 | ▶ | VoiceXML::Client::Util::log_msg("pendingInputLength() called returning length of '$retnum'") if ($VoiceXML::Client::Debug > 1); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||
| 467 | 0 | return length($retnum); | |||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||
| 471 | 0 | ▶ | sub fetchPendingInput { | ||||||||||||||||||||||||||
|
Subroutine
fetchPendingInput: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 472 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||
| 475 | 0 | my $readnumid = $$; # So it's safe to have multiple devices... | |||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||
| 477 | my $retnum = defined $ReadnumGlobals{$readnumid}{'readnum_number'} ? | ||||||||||||||||||||||||||||
| 478 | 0 | ▶ | $ReadnumGlobals{$readnumid}{'readnum_number'} : ''; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||
| 480 | 0 | resetReadnumGlobalNumberCache($readnumid); | |||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||
| 482 | 0 | return $retnum; | |||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||
| 486 | 3 | 1; | |||||||||||||||||||||||||||