1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types = 1); |
4
|
|
|
|
5
|
|
|
namespace Speicher210\KontaktIO\Model\Device\Update; |
6
|
|
|
|
7
|
|
|
use JMS\Serializer\Annotation as JMS; |
8
|
|
|
|
9
|
|
|
final class Physical |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* Device type. |
13
|
|
|
* |
14
|
|
|
* @var string |
15
|
|
|
* |
16
|
|
|
* @JMS\Type("string") |
17
|
|
|
* @JMS\SerializedName("deviceType") |
18
|
|
|
*/ |
19
|
|
|
private $deviceType; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* The UUID of the device. |
23
|
|
|
* |
24
|
|
|
* @var string |
25
|
|
|
* |
26
|
|
|
* @JMS\Type("string") |
27
|
|
|
* @JMS\SerializedName("proximity") |
28
|
|
|
*/ |
29
|
|
|
private $proximity; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var integer |
33
|
|
|
* |
34
|
|
|
* @JMS\Type("integer") |
35
|
|
|
* @JMS\SerializedName("major") |
36
|
|
|
*/ |
37
|
|
|
private $major; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var integer |
41
|
|
|
* |
42
|
|
|
* @JMS\Type("integer") |
43
|
|
|
* @JMS\SerializedName("minor") |
44
|
|
|
*/ |
45
|
|
|
private $minor; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var string |
49
|
|
|
* |
50
|
|
|
* @JMS\Type("string") |
51
|
|
|
* @JMS\SerializedName("packets") |
52
|
|
|
*/ |
53
|
|
|
private $packets; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @var string |
57
|
|
|
* |
58
|
|
|
* @JMS\Type("string") |
59
|
|
|
* @JMS\SerializedName("url") |
60
|
|
|
*/ |
61
|
|
|
private $url; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @var integer |
65
|
|
|
* |
66
|
|
|
* @JMS\Type("integer") |
67
|
|
|
* @JMS\SerializedName("txPower") |
68
|
|
|
*/ |
69
|
|
|
private $txPower; |
70
|
|
|
|
71
|
|
|
public function __construct( |
72
|
|
|
string $deviceType, |
73
|
|
|
?string $proximity, |
74
|
|
|
?int $major, |
75
|
|
|
?int $minor, |
76
|
|
|
?array $packets, |
77
|
|
|
?string $url, |
78
|
|
|
?int $txPower |
79
|
|
|
) { |
80
|
|
|
$this->deviceType = $deviceType; |
81
|
|
|
$this->proximity = $proximity; |
82
|
|
|
$this->major = $major; |
83
|
|
|
$this->minor = $minor; |
84
|
|
|
if ($packets !== null && \count($packets) > 0) { |
85
|
|
|
$this->packets = \implode(',', $packets); |
86
|
|
|
} |
87
|
|
|
$this->url = $url; |
88
|
|
|
$this->txPower = $txPower; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
public function deviceType(): string |
92
|
|
|
{ |
93
|
|
|
return $this->deviceType; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
public function proximity(): ?string |
97
|
|
|
{ |
98
|
|
|
return $this->proximity; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
public function major(): ?int |
102
|
|
|
{ |
103
|
|
|
return $this->major; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
public function minor(): ?int |
107
|
|
|
{ |
108
|
|
|
return $this->minor; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
public function packets(): ?array |
112
|
|
|
{ |
113
|
|
|
if ($this->packets !== null) { |
114
|
|
|
return \explode(',', $this->packets); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
return null; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
public function url(): ?string |
121
|
|
|
{ |
122
|
|
|
return $this->url; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
public function tyPower(): ?int |
126
|
|
|
{ |
127
|
|
|
return $this->txPower; |
128
|
|
|
} |
129
|
|
|
} |