Skip to content

Commit 544c3a5

Browse files
committed
Use stored indices
1 parent 526a0b0 commit 544c3a5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

adafruit_ble_beacon.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ def uuid(self) -> bytes:
131131
@uuid.setter
132132
def uuid(self, uuid: bytes) -> None:
133133
uuid_msb, uuid_lsb = struct.unpack(">QQ", uuid)
134-
self._set_struct_index(3, uuid_msb)
135-
self._set_struct_index(4, uuid_lsb)
134+
self._set_struct_index(self._uuid_msb_index, uuid_msb)
135+
self._set_struct_index(self._uuid_lsb_index, uuid_lsb)
136136

137137
@property
138138
def major(self) -> int:
@@ -141,7 +141,7 @@ def major(self) -> int:
141141

142142
@major.setter
143143
def major(self, number: int) -> None:
144-
self._set_struct_index(5, number)
144+
self._set_struct_index(self._major_index, number)
145145

146146
@property
147147
def minor(self) -> int:
@@ -150,7 +150,7 @@ def minor(self) -> int:
150150

151151
@minor.setter
152152
def minor(self, number: int) -> None:
153-
self._set_struct_index(6, number)
153+
self._set_struct_index(self._minor_index, number)
154154

155155
@property
156156
def beacon_tx_power(self) -> int:
@@ -159,7 +159,7 @@ def beacon_tx_power(self) -> int:
159159

160160
@beacon_tx_power.setter
161161
def beacon_tx_power(self, power: int) -> None:
162-
self._set_struct_index(7, power)
162+
self._set_struct_index(self._beacon_tx_power_index, power)
163163

164164
def _set_struct_index(self, index: int, value: int) -> int:
165165
current_beacon_data = list(self._beacon_data)

0 commit comments

Comments
 (0)