switch quotes

pull/3038/head
Isaac Connor 2017-01-12 12:54:46 -05:00
parent 42484f7680
commit 82eaacc624
1 changed files with 49 additions and 49 deletions

View File

@ -51,7 +51,7 @@ use bytes;
# #
# ========================================================================== # ==========================================================================
use constant CAUSE_STRING => "X10"; # What gets written as the cause of any events use constant CAUSE_STRING => 'X10'; # What gets written as the cause of any events
# ========================================================================== # ==========================================================================
# #
@ -93,11 +93,11 @@ if ( $version ) {
exit(0); exit(0);
} }
die( "No command given" ) unless( $command ); die( 'No command given' ) unless( $command );
die( "No unit code given" ) die( 'No unit code given' )
unless( $unit_code || ($command =~ /(?:start|status|shutdown)/) ); unless( $unit_code || ($command =~ /(?:start|status|shutdown)/) );
if ( $command eq "start" ) if ( $command eq 'start' )
{ {
X10Server::runServer(); X10Server::runServer();
exit(); exit();
@ -201,7 +201,7 @@ sub runServer
vec( $rin, fileno(SERVER),1) = 1; vec( $rin, fileno(SERVER),1) = 1;
vec( $rin, $x10->select_fds(),1) = 1; vec( $rin, $x10->select_fds(),1) = 1;
my $timeout = 0.2; my $timeout = 0.2;
#print( "F:".fileno(SERVER)."\n" ); #print( 'F:'.fileno(SERVER)."\n" );
my $reload = undef; my $reload = undef;
my $reload_count = 0; my $reload_count = 0;
my $reload_limit = $Config{ZM_X10_DB_RELOAD_INTERVAL} / $timeout; my $reload_limit = $Config{ZM_X10_DB_RELOAD_INTERVAL} / $timeout;
@ -259,14 +259,14 @@ sub runServer
{ {
if ( $device ) if ( $device )
{ {
dPrint( ZoneMinder::Logger::DEBUG, $unit_code." ".$device->{status}."\n" ); dPrint( ZoneMinder::Logger::DEBUG, $unit_code.' '.$device->{status}."\n" );
} }
else else
{ {
foreach my $unit_code ( sort( keys(%device_hash) ) ) foreach my $unit_code ( sort( keys(%device_hash) ) )
{ {
my $device = $device_hash{$unit_code}; my $device = $device_hash{$unit_code};
dPrint( ZoneMinder::Logger::DEBUG, $unit_code." ".$device->{status}."\n" ); dPrint( ZoneMinder::Logger::DEBUG, $unit_code.' '.$device->{status}."\n" );
} }
} }
} }
@ -299,7 +299,7 @@ sub runServer
} }
else else
{ {
Fatal( "Bogus descriptor" ); Fatal( 'Bogus descriptor' );
} }
} }
elsif ( $nfound < 0 ) elsif ( $nfound < 0 )
@ -330,14 +330,14 @@ sub runServer
) # Gone into alarm state ) # Gone into alarm state
{ {
Debug( "Applying ON_list for $monitor_id\n" ); Debug( "Applying ON_list for $monitor_id\n" );
$task_list = $monitor->{"ON_list"}; $task_list = $monitor->{'ON_list'};
} }
elsif ( ($state == STATE_IDLE && $monitor->{LastState} != STATE_IDLE) elsif ( ($state == STATE_IDLE && $monitor->{LastState} != STATE_IDLE)
|| ($state == STATE_TAPE && $monitor->{LastState} != STATE_TAPE) || ($state == STATE_TAPE && $monitor->{LastState} != STATE_TAPE)
) # Come out of alarm state ) # Come out of alarm state
{ {
Debug( "Applying OFF_list for $monitor_id\n" ); Debug( "Applying OFF_list for $monitor_id\n" );
$task_list = $monitor->{"OFF_list"}; $task_list = $monitor->{'OFF_list'};
} }
if ( $task_list ) if ( $task_list )
{ {
@ -394,7 +394,7 @@ sub addToDeviceList
}; };
} }
my $task = { type=>"device", my $task = { type=>'device',
monitor=>$monitor, monitor=>$monitor,
address=>$device->{appliance}->address(), address=>$device->{appliance}->address(),
function=>$function function=>$function
@ -404,10 +404,10 @@ sub addToDeviceList
$task->{limit} = $limit $task->{limit} = $limit
} }
my $task_list = $device->{$event."_list"}; my $task_list = $device->{$event.'_list'};
if ( !$task_list ) if ( !$task_list )
{ {
$task_list = $device->{$event."_list"} = []; $task_list = $device->{$event.'_list'} = [];
} }
push( @$task_list, $task ); push( @$task_list, $task );
} }
@ -431,7 +431,7 @@ sub addToMonitorList
}; };
} }
my $task = { type=>"monitor", my $task = { type=>'monitor',
device=>$device, device=>$device,
id=>$monitor->{Id}, id=>$monitor->{Id},
function=>$function function=>$function
@ -441,10 +441,10 @@ sub addToMonitorList
$task->{limit} = $limit; $task->{limit} = $limit;
} }
my $task_list = $monitor->{$event."_list"}; my $task_list = $monitor->{$event.'_list'};
if ( !$task_list ) if ( !$task_list )
{ {
$task_list = $monitor->{$event."_list"} = []; $task_list = $monitor->{$event.'_list'} = [];
} }
push( @$task_list, $task ); push( @$task_list, $task );
} }
@ -496,20 +496,20 @@ sub loadTasks
if ( !$modifier || $modifier eq '+' ) if ( !$modifier || $modifier eq '+' )
{ {
addToDeviceList( $unit_code, addToDeviceList( $unit_code,
"ON", 'ON',
$monitor, $monitor,
!$invert ? "start_active" !$invert ? 'start_active'
: "stop_active", : 'stop_active',
$limit $limit
); );
} }
if ( !$modifier || $modifier eq '-' ) if ( !$modifier || $modifier eq '-' )
{ {
addToDeviceList( $unit_code, addToDeviceList( $unit_code,
"OFF", 'OFF',
$monitor, $monitor,
!$invert ? "stop_active" !$invert ? 'stop_active'
: "start_active", : 'start_active',
$limit $limit
); );
} }
@ -530,20 +530,20 @@ sub loadTasks
if ( !$modifier || $modifier eq '+' ) if ( !$modifier || $modifier eq '+' )
{ {
addToDeviceList( $unit_code, addToDeviceList( $unit_code,
"ON", 'ON',
$monitor, $monitor,
!$invert ? "start_alarm" !$invert ? 'start_alarm'
: "stop_alarm", : 'stop_alarm',
$limit $limit
); );
} }
if ( !$modifier || $modifier eq '-' ) if ( !$modifier || $modifier eq '-' )
{ {
addToDeviceList( $unit_code, addToDeviceList( $unit_code,
"OFF", 'OFF',
$monitor, $monitor,
!$invert ? "stop_alarm" !$invert ? 'stop_alarm'
: "start_alarm", : 'start_alarm',
$limit $limit
); );
} }
@ -564,20 +564,20 @@ sub loadTasks
if ( !$modifier || $modifier eq '+' ) if ( !$modifier || $modifier eq '+' )
{ {
addToMonitorList( $monitor, addToMonitorList( $monitor,
"ON", 'ON',
$unit_code, $unit_code,
!$invert ? "on" !$invert ? 'on'
: "off", : 'off',
$limit $limit
); );
} }
if ( !$modifier || $modifier eq '-' ) if ( !$modifier || $modifier eq '-' )
{ {
addToMonitorList( $monitor, addToMonitorList( $monitor,
"OFF", 'OFF',
$unit_code, $unit_code,
!$invert ? "off" !$invert ? 'off'
: "on", : 'on',
$limit $limit
); );
} }
@ -604,7 +604,7 @@ sub addPendingTask
{ {
push( @$new_pending_list, $pending_task ) push( @$new_pending_list, $pending_task )
} }
elsif ( $task->{type} eq "device" ) elsif ( $task->{type} eq 'device' )
{ {
if (( $task->{monitor}->{Id} != $pending_task->{monitor}->{Id} ) if (( $task->{monitor}->{Id} != $pending_task->{monitor}->{Id} )
|| ( $task->{function} ne $pending_task->{function} )) || ( $task->{function} ne $pending_task->{function} ))
@ -612,7 +612,7 @@ sub addPendingTask
push( @$new_pending_list, $pending_task ) push( @$new_pending_list, $pending_task )
} }
} }
elsif ( $task->{type} eq "monitor" ) elsif ( $task->{type} eq 'monitor' )
{ {
if (( $task->{device}->{appliance}->unit_code() if (( $task->{device}->{appliance}->unit_code()
!= $pending_task->{device}->{appliance}->unit_code() != $pending_task->{device}->{appliance}->unit_code()
@ -641,7 +641,7 @@ sub addPendingTask
$pending_list = $pending_tasks{$end_time} = []; $pending_list = $pending_tasks{$end_time} = [];
} }
my $pending_task; my $pending_task;
if ( $task->{type} eq "device" ) if ( $task->{type} eq 'device' )
{ {
$pending_task = { type=>$task->{type}, $pending_task = { type=>$task->{type},
monitor=>$task->{monitor}, monitor=>$task->{monitor},
@ -649,7 +649,7 @@ sub addPendingTask
}; };
$pending_task->{function} =~ s/start/stop/; $pending_task->{function} =~ s/start/stop/;
} }
elsif ( $task->{type} eq "monitor" ) elsif ( $task->{type} eq 'monitor' )
{ {
$pending_task = { type=>$task->{type}, $pending_task = { type=>$task->{type},
device=>$task->{device}, device=>$task->{device},
@ -664,13 +664,13 @@ sub processTask
{ {
my $task = shift; my $task = shift;
if ( $task->{type} eq "device" ) if ( $task->{type} eq 'device' )
{ {
my ( $instruction, $class ) = ( $task->{function} =~ /^(.+)_(.+)$/ ); my ( $instruction, $class ) = ( $task->{function} =~ /^(.+)_(.+)$/ );
if ( $class eq "active" ) if ( $class eq 'active' )
{ {
if ( $instruction eq "start" ) if ( $instruction eq 'start' )
{ {
zmMonitorEnable( $task->{monitor} ); zmMonitorEnable( $task->{monitor} );
if ( $task->{limit} ) if ( $task->{limit} )
@ -678,14 +678,14 @@ sub processTask
addPendingTask( $task ); addPendingTask( $task );
} }
} }
elsif( $instruction eq "stop" ) elsif( $instruction eq 'stop' )
{ {
zmMonitorDisable( $task->{monitor} ); zmMonitorDisable( $task->{monitor} );
} }
} }
elsif( $class eq "alarm" ) elsif( $class eq 'alarm' )
{ {
if ( $instruction eq "start" ) if ( $instruction eq 'start' )
{ {
zmTriggerEventOn( $task->{monitor}, zmTriggerEventOn( $task->{monitor},
0, 0,
@ -697,15 +697,15 @@ sub processTask
addPendingTask( $task ); addPendingTask( $task );
} }
} }
elsif( $instruction eq "stop" ) elsif( $instruction eq 'stop' )
{ {
zmTriggerEventCancel( $task->{monitor} ); zmTriggerEventCancel( $task->{monitor} );
} }
} }
} }
elsif( $task->{type} eq "monitor" ) elsif( $task->{type} eq 'monitor' )
{ {
if ( $task->{function} eq "on" ) if ( $task->{function} eq 'on' )
{ {
$task->{device}->{appliance}->on(); $task->{device}->{appliance}->on();
if ( $task->{limit} ) if ( $task->{limit} )
@ -713,7 +713,7 @@ sub processTask
addPendingTask( $task ); addPendingTask( $task );
} }
} }
elsif ( $task->{function} eq "off" ) elsif ( $task->{function} eq 'off' )
{ {
$task->{device}->{appliance}->off(); $task->{device}->{appliance}->off();
} }
@ -766,7 +766,7 @@ sub x10listen
} }
next if ( $event->func() !~ /(?:ON|OFF)/ ); next if ( $event->func() !~ /(?:ON|OFF)/ );
$device->{status} = $event->func(); $device->{status} = $event->func();
my $task_list = $device->{$event->func()."_list"}; my $task_list = $device->{$event->func().'_list'};
if ( $task_list ) if ( $task_list )
{ {
foreach my $task ( @$task_list ) foreach my $task ( @$task_list )