forked from peec/x10php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
X10Action.php
75 lines (64 loc) · 1.19 KB
/
X10Action.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* X10 Actions happens when any method is ran on a specific device.
* @author SOPPEN
*
*/
class X10Action{
/**
*
* @var \X10Device
*/
private $device;
private $action;
private $args;
private $command;
public function __construct($device, $action, $args, $command){
$this->device = $device;
$this->action = $action;
$this->args = $args;
$this->command = $command;
}
/**
* @return \X10DevicePower
*/
public function getDevice(){
return $this->device;
}
/**
* Returns the exact command runned.
*/
public function getCommand(){
return $this->command;
}
/**
* @return string The action performed such as on, off etc.
*/
public function getAction(){
return $this->action;
}
/**
* Gets the device code.
*/
public function getDevCode(){
return $this->device->getCode();
}
/**
* Gets the device type, returns constants of X10Device values.
*/
public function getDevType(){
$type = 0;
if ($this->device instanceof X10DevicePower){
$type = X10Device::TYPE_POWER;
}else{
$type = X10Device::TYPE_RADIO;
}
return $type;
}
/**
* Gets the arguments as array.
*/
public function getArgs(){
return $this->args;
}
}