Skip to content

Commit e740a59

Browse files
committed
Wording
1 parent b77e69b commit e740a59

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

hid_services.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ def save_service_characteristics(self, handles):
690690
self.characteristics[h_d1] = ("HID reference", struct.pack("<BB", 1, 1)) # HID reference: id=1, type=input.
691691
self.characteristics[h_proto] = ("HID protocol mode", b"\x01") # HID protocol mode: report.
692692

693-
# Overwrite super to notify central of a hid report.
693+
# Overwrite super to notify client of a hid report.
694694
def notify_hid_report(self):
695695
if self.is_connected():
696696
b = self.button1 + self.button2 * 2 + self.button3 * 4 + self.button4 * 8 + self.button5 * 16 + self.button6 * 32 + self.button7 * 64 + self.button8 * 128
@@ -817,13 +817,13 @@ def save_service_characteristics(self, handles):
817817
self.characteristics[h_d1] = ("HID reference", struct.pack("<BB", 1, 1)) # HID reference: id=1, type=input.
818818
self.characteristics[h_proto] = ("HID protocol mode", b"\x01") # HID protocol mode: report.
819819

820-
# Overwrite super to notify central of a hid report
820+
# Overwrite super to notify client of a hid report
821821
def notify_hid_report(self):
822822
if self.is_connected():
823823
b = self.button1 + self.button2 * 2 + self.button3
824824
state = struct.pack("Bbbb", b, self.x, self.y, self.w) # Pack the mouse state as described by the input report.
825825
self.characteristics[self.h_rep] = ("HID report", state)
826-
self._ble.gatts_notify(self.conn_handle, self.h_rep, state) # Notify central by writing to the report handle.
826+
self._ble.gatts_notify(self.conn_handle, self.h_rep, state) # Notify client by writing to the report handle.
827827
print("Notify with report: ", struct.unpack("Bbbb", state))
828828

829829
# Set the mouse axes values.
@@ -925,12 +925,12 @@ def __init__(self, name="Bluetooth Keyboard"):
925925
self.services.append(self.HIDS) # Append to list of service descriptions.
926926

927927
# Interrupt request callback function
928-
# Overwrite super to catch keyboard report write events by the central.
928+
# Overwrite super to catch keyboard report write events by the client.
929929
def ble_irq(self, event, data):
930930
if event == _IRQ_GATTS_WRITE: # If a client has written to a characteristic or descriptor.
931931
conn_handle, attr_handle = data # Get the handle to the characteristic that was written.
932932
if attr_handle == self.h_repout:
933-
print("Keyboard changed by Central")
933+
print("Keyboard changed by client")
934934
report = self._ble.gatts_read(attr_handle) # Read the report.
935935
bytes = struct.unpack("B", report) # Unpack the report.
936936
if self.kb_callback is not None: # Call the callback function.
@@ -968,20 +968,20 @@ def save_service_characteristics(self, handles):
968968
self.characteristics[h_d2] = ("HID output reference", struct.pack("<BB", 1, 2)) # HID reference: id=1, type=output.
969969
self.characteristics[h_proto] = ("HID protocol mode", b"\x01") # HID protocol mode: report.
970970

971-
# Overwrite super to notify central of a hid report.
971+
# Overwrite super to notify client of a hid report.
972972
def notify_hid_report(self):
973973
if self.is_connected():
974974
# Pack the Keyboard state as described by the input report.
975975
state = struct.pack("8B", self.modifiers, 0, self.keypresses[0], self.keypresses[1], self.keypresses[2], self.keypresses[3], self.keypresses[4], self.keypresses[5])
976976
self.characteristics[self.h_rep] = ("HID input report", state)
977-
self._ble.gatts_notify(self.conn_handle, self.h_rep, state) # Notify central by writing to the report handle.
977+
self._ble.gatts_notify(self.conn_handle, self.h_rep, state) # Notify client by writing to the report handle.
978978
print("Notify with report: ", struct.unpack("8B", state))
979979

980-
# Set the modifier bits, notify to send the modifiers to central.
980+
# Set the modifier bits, notify to send the modifiers to client.
981981
def set_modifiers(self, right_gui=0, right_alt=0, right_shift=0, right_control=0, left_gui=0, left_alt=0, left_shift=0, left_control=0):
982982
self.modifiers = (right_gui << 7) + (right_alt << 6) + (right_shift << 5) + (right_control << 4) + (left_gui << 3) + (left_alt << 2) + (left_shift << 1) + left_control
983983

984-
# Press keys, notify to send the keys to central.
984+
# Press keys, notify to send the keys to client.
985985
# This will hold down the keys, call set_keys() without arguments and notify again to release.
986986
def set_keys(self, k0=0x00, k1=0x00, k2=0x00, k3=0x00, k4=0x00, k5=0x00):
987987
self.keypresses = [k0, k1, k2, k3, k4, k5]

readme.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ The library consists of five classes with the following functions:
145145
* `start_advertising()` (Starts Bluetooth advertisement)
146146
* `stop_advertising()` (Stops Bluetooth advertisement)
147147
* `is_running()` (Returns `True` if services are running, otherwise `False`)
148-
* `is_connected()` (Returns `True` if a central is connected, otherwise `False`)
148+
* `is_connected()` (Returns `True` if a client is connected, otherwise `False`)
149149
* `is_advertising()` (Returns `True` if advertising, otherwise `False`)
150150
* `set_state(state)` (Sets one of the `HumanInterfaceDevice` constants `DEVICE_STOPPED`, `DEVICE_IDLE`, `DEVICE_ADVERTISING`, or `DEVICE_CONNECTED`. Doesn't change the actual function. Used internally)
151151
* `get_state()` (Returns one of the `HumanInterfaceDevice` constants `DEVICE_STOPPED`, `DEVICE_IDLE`, `DEVICE_ADVERTISING`, or `DEVICE_CONNECTED`)
@@ -164,22 +164,22 @@ The library consists of five classes with the following functions:
164164
* `set_passkey(passkey)` (Set the passkey to use for pairing)
165165
* `set_keystore(keystore)` (Sets the key store to use from `hid_keystores.py`. Default `JSONKeyStore`)
166166
* `set_battery_level(level)` (Sets the battery level internally)
167-
* `notify_battery_level()` (Notifies the central of the current battery level. Call after setting battery level)
167+
* `notify_battery_level()` (Notifies the client of the current battery level. Call after setting battery level)
168168
* `notify_hid_report()` (Function for subclasses to override)
169169

170170
* `Joystick` (subclass of `HumanInterfaceDevice`, implements joystick service)
171171
* `__init__(name)` (Initialize the joystick)
172172
* `start()` (Starts the HID service using joystick characteristics. Calls `HumanInterfaceDevice.start()`)
173173
* `write_service_characteristics(handles)` (Writes the joystick HID service characteristics. Calls `HumanInterfaceDevice.write_service_characteristics(handles)`)
174-
* `notify_hid_report()` (Notifies the central of the internal HID joystick status)
174+
* `notify_hid_report()` (Notifies the client of the internal HID joystick status)
175175
* `set_axes(x, y)` (Sets the joystick axes internally)
176176
* `set_buttons(b1, b2, b3, b4, b5, b6, b7, b8)` (Sets the joystick buttons internally)
177177

178178
* `Mouse` (subclass of `HumanInterfaceDevice`, implements mouse service)
179179
* `__init__(name)` (Initialize the mouse)
180180
* `start()` (Starts the HID service using mouse characteristics. Calls `HumanInterfaceDevice.start()`)
181181
* `write_service_characteristics(handles)` (Writes the mouse HID service characteristics. Calls `HumanInterfaceDevice.write_service_characteristics(handles)`)
182-
* `notify_hid_report()` (Notifies the central of the internal HID mouse status)
182+
* `notify_hid_report()` (Notifies the client of the internal HID mouse status)
183183
* `set_axes(x, y)` (Sets the mouse axes movement internally)
184184
* `set_wheel(w)` (Sets the mouse wheel movement internally)
185185
* `set_buttons(b1, b2, b3)` (Sets the mouse buttons internally)
@@ -188,7 +188,7 @@ The library consists of five classes with the following functions:
188188
* `__init__(name)` (Initialize the keyboard)
189189
* `start()` (Starts the HID service using keyboard characteristics. Calls `HumanInterfaceDevice.start()`)
190190
* `write_service_characteristics(handles)` (Writes the keyboard HID service characteristics. Calls `HumanInterfaceDevice.write_service_characteristics(handles)`)
191-
* `notify_hid_report()` (Notifies the central of the internal HID keyboard status)
191+
* `notify_hid_report()` (Notifies the client of the internal HID keyboard status)
192192
* `set_modifiers(right_gui, right_alt, right_shift, right_control, left_gui, left_alt, left_shift, left_control)` (Sets the keyboard modifier keys internally)
193193
* `set_keys(k0, k1, k2, k3, k4, k5)` (Sets a list of key codes to press internally. Call without keys to release.)
194194
* `ble_irq(event, data)` (Internal callback function that catches BLE keyboard interrupt requests)

0 commit comments

Comments
 (0)