89 lines
2.1 KiB
PHP
89 lines
2.1 KiB
PHP
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
/**
|
|
* This class looks after Ness D8/Clipsal panel events
|
|
*
|
|
* @package HAM
|
|
* @category Helpers
|
|
* @author Deon George
|
|
* @copyright (c) 2010 Deon George
|
|
* @license http://dev.leenooks.net/license.html
|
|
*/
|
|
class Panel_NessD8 extends Panel {
|
|
public function trigger() {
|
|
$return = array();
|
|
|
|
foreach ($this->events as $eo) {
|
|
$i = count($return);
|
|
|
|
$return[$i]['date'] = $eo->datetime;
|
|
$return[$i]['alarm'] = $eo->type;
|
|
|
|
if ($eo->sub != 18) {
|
|
$return[$i]['desc'] = sprintf('Unknown Alarm: %s',$eo->id);
|
|
continue;
|
|
}
|
|
|
|
switch ($eo->type) {
|
|
// Alarm
|
|
case 130:
|
|
switch ($eo->qualifier) {
|
|
case 1: $action = 'Alarm'; break;
|
|
case 3: $action = 'Reset'; break;
|
|
default: $action = 'Unknown';
|
|
}
|
|
|
|
$return[$i]['desc'] = sprintf('Alarm (%s) (Area %s) (%s)',$action,$eo->area,$eo->info);
|
|
break;
|
|
|
|
// Exit Installer Mode
|
|
case 306:
|
|
switch ($eo->qualifier) {
|
|
case 1: $action = 'Exit Installer Mode'; break;
|
|
default: $action = 'Unknown';
|
|
}
|
|
|
|
$return[$i]['desc'] = sprintf('Auto Exclude (%s) (Area %s) (%s)',$action,$eo->area,$eo->info);
|
|
break;
|
|
|
|
// Auto Exclude
|
|
case 380:
|
|
switch ($eo->qualifier) {
|
|
case 1: $action = 'Disarmed'; break;
|
|
case 3: $action = 'Armed'; break;
|
|
default: $action = 'Unknown';
|
|
}
|
|
|
|
$return[$i]['desc'] = sprintf('Auto Exclude (%s) (Area %s) (%s)',$action,$eo->area,$eo->info);
|
|
break;
|
|
|
|
// Arm/Disarm Call
|
|
case 402:
|
|
switch ($eo->qualifier) {
|
|
case 1: $action = 'Disarmed'; break;
|
|
case 3: $action = 'Armed'; break;
|
|
default: $action = 'Unknown';
|
|
}
|
|
|
|
// @todo Change this to include the user name.
|
|
$user = substr($eo->info,1,2)==58 ? 'Short Cut' : substr($eo->info,1,2);
|
|
|
|
// @todo Change this to include the area name.
|
|
$return[$i]['desc'] = sprintf('Panel %s (Area %s) (By %s)',$action,$eo->area,$user);
|
|
break;
|
|
|
|
// Test Call
|
|
case 602:
|
|
$return[$i]['desc'] = 'Test Call';
|
|
break;
|
|
|
|
default:
|
|
$return[$i]['desc'] = sprintf('Unknown Alarm: %s',$eo->id);
|
|
}
|
|
}
|
|
|
|
return $return;
|
|
}
|
|
}
|
|
?>
|