예제 #1
0
 public static function proccessMessageEvent($_message)
 {
     switch ($_message->messageSchemeIdentifier()) {
         case 'sensor.basic':
             require_once dirname(__FILE__) . '/schema/sensor.basic.class.php';
             $list_event = basicSensor::parserMessage($_message);
             break;
         default:
             break;
     }
     if (is_array($list_event)) {
         foreach ($list_event as $event) {
             $cmd = xPLCmd::byId($event['cmd_id']);
             if ($cmd->getType() == 'info') {
                 cache::set('xpl' . $cmd->getId(), $event['value']);
             }
             $cmd->event($event['value']);
         }
     }
     return;
 }
예제 #2
0
 public static function proccessMessageEvent($_message = null)
 {
     switch ($_message->messageSchemeIdentifier()) {
         case 'sensor.basic':
             require_once dirname(__FILE__) . '/../schema/sensor.basic.class.php';
             $list_event = sensorBasic::parserMessage($_message);
             break;
         case 'homeeasy.basic':
             require_once dirname(__FILE__) . '/../schema/homeeasy.basic.class.php';
             $list_event = homeeasyBasic::parserMessage($_message);
             break;
         case 'x10.basic':
             require_once dirname(__FILE__) . '/../schema/x10.basic.class.php';
             $list_event = x10Basic::parserMessage($_message);
             break;
         case 'x10.security':
             require_once dirname(__FILE__) . '/../schema/x10.security.class.php';
             $list_event = x10Security::parserMessage($_message);
             break;
         case 'ac.basic':
             require_once dirname(__FILE__) . '/../schema/ac.basic.class.php';
             $list_event = acBasic::parserMessage($_message);
             break;
         case 'remote.basic':
             require_once dirname(__FILE__) . '/../schema/remote.basic.class.php';
             $list_event = remoteBasic::parserMessage($_message);
             break;
         case 'osd.basic':
             require_once dirname(__FILE__) . '/../schema/osd.basic.class.php';
             $list_event = osdBasic::parserMessage($_message);
             break;
         case 'lighting.device':
             require_once dirname(__FILE__) . '/../schema/lighting.device.class.php';
             $list_event = lightingDevice::parserMessage($_message);
             break;
         default:
             break;
     }
     $replace = array('on' => 1, 'off' => 0, 'alert' => 1, 'normal' => 0, 'motion' => 1, 'light' => 1, 'dark' => 0, 'arm-home' => 1, 'arm-away' => 1, 'disarm' => 0, 'panic' => 1, 'lights-on' => 1, 'lights-off' => 0);
     if (is_array($list_event)) {
         foreach ($list_event as $event) {
             $cmd = xPLCmd::byId($event['cmd_id']);
             $event['value'] = str_replace(array_keys($replace), array_values($replace), $event['value']);
             if ($cmd->getType() == 'info') {
                 cache::set('xpl' . $cmd->getId(), $event['value']);
             }
             $cmd->event($event['value']);
         }
     }
     return;
 }