@@ -81,6 +81,14 @@ class _BeaconAdvertisement(Advertisement):
81
81
path_loss_const : int = 3
82
82
"""The path loss constant, typically between 2-4"""
83
83
84
+ @property
85
+ def uuid (self ) -> bytes :
86
+ raise NotImplementedError ("Must be implemented in beacon subclass" )
87
+
88
+ @uuid .setter
89
+ def uuid (self , id : bytes ) -> None :
90
+ raise NotImplementedError ("Must be implemented in beacon subclass" )
91
+
84
92
@property
85
93
def distance (self ) -> float :
86
94
"""The approximate distance to the beacon"""
@@ -89,7 +97,11 @@ def distance(self) -> float:
89
97
90
98
@property
91
99
def beacon_tx_power (self ) -> int :
92
- raise NotImplementedError ("Must be defined in beacon subclass" )
100
+ raise NotImplementedError ("Must be implemented in beacon subclass" )
101
+
102
+ @beacon_tx_power .setter
103
+ def beacon_txt_power (self , power : int ) -> None :
104
+ raise NotImplementedError ("Must be implemented in beacon subclass" )
93
105
94
106
95
107
class iBeaconAdvertisement (_BeaconAdvertisement ):
@@ -123,7 +135,6 @@ def uuid(self, id: bytes) -> None:
123
135
self ._set_struct_index (3 , uuid_msb )
124
136
self ._set_struct_index (4 , uuid_lsb )
125
137
126
-
127
138
@property
128
139
def major (self ) -> int :
129
140
return self ._get_struct_index (self ._major_index )
@@ -158,4 +169,5 @@ def _get_struct_index(self, index: int) -> int:
158
169
return temp_tuple [index ]
159
170
160
171
def _init_struct (self ) -> None :
161
- self ._beacon_data = (_APPLE_COMPANY_ID_FLIPPED , _IBEACON_TYPE , _IBEACON_LENGTH , 0 , 0 , 0 , 0 , 0 )
172
+ apple_id_flipped = struct .unpack (">H" , struct .pack ("<H" , _APPLE_COMPANY_ID ))
173
+ self ._beacon_data = (apple_id_flipped , _IBEACON_TYPE , _IBEACON_LENGTH , 0 , 0 , 0 , 0 , 0 )
0 commit comments