forked from peec/x10php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
X10DeviceRadio.php
57 lines (48 loc) · 1.22 KB
/
X10DeviceRadio.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
<?php
/**
* X10 Radio Device.
* Such devices that has radio recievers instead of power line.
* @author Petter Kjelkenes <[email protected]>
*
*/
class X10DeviceRadio extends X10Device{
/**
* Send ON signal.
*/
public function on(){
$this->chkFlag(X10Device::F_ON);
return $this->rawCommand(__METHOD__, func_get_args(), 'On');
}
/**
* Send OFF signal.
*/
public function off(){
$this->chkFlag(X10Device::F_OFF);
return $this->rawCommand(__METHOD__, func_get_args(), 'Off');
}
/**
* Send DIM signal.
*/
public function dim(){
$this->chkFlag(X10Device::F_DIM);
return $this->rawCommand(__METHOD__, func_get_args(), "Dim");
}
/**
* Send Bright signal.
*/
public function bright(){
$this->chkFlag(X10Device::F_BRIGHT);
return $this->rawCommand(__METHOD__, func_get_args(), "Bright");
}
/**
* Runs a raw command
* See: Radio Frequency Command Reference in Official SDK for X10.
* Example of camera constants: AutoFocus, Zoom
* @param string $query example on, off, etc..
*/
public function rawCommand($method, $arguments, $query){
$com = $this->x10ApiExcecutable . ' sendrf ' . $this->code . ' ' . $query;
$this->log($method, $arguments, $com);
return shell_exec($com);
}
}