@@ -244,3 +244,59 @@ def waiting(self):
244244 def clear (self ):
245245 """Empties the buffer."""
246246 pass
247+
248+
249+ class LWP3Device :
250+ """
251+ Connects to a remote hub running official LEGO firmware using the the
252+ `LEGO Wireless Protocol v3`_
253+
254+ .. _`LEGO Wireless Protocol v3`:
255+ https://lego.github.io/lego-ble-wireless-protocol-docs/
256+ """
257+
258+ def __init__ (self , hub_kind , name = None , timeout = 10000 ):
259+ """
260+
261+ Arguments:
262+ hub_kind (int):
263+ The `hub type identifier`_ of the hub to connect to.
264+ name (str):
265+ The name of the hub to connect to or ``None`` to connect to any
266+ hub.
267+ timeout (int):
268+ The time, in milliseconds, to wait for a connection before
269+ raising an exception.
270+
271+
272+ .. _`hub type identifier`:
273+ https://github.com/pybricks/technical-info/blob/master/assigned-numbers.md#hub-type-ids
274+ """
275+
276+ def name (self , name = None ):
277+ """Gets or sets the Bluetooth name of the remote.
278+
279+ If no name is given, this method returns the current name.
280+
281+ Arguments:
282+ name (str): New Bluetooth name of the remote.
283+ """
284+
285+ def write (self , buf ):
286+ """
287+ Sends a message to the remote hub.
288+
289+ Arguments:
290+ buf (bytes): The raw binary message to send.
291+ """
292+
293+ def read (self ):
294+ """
295+ Retrieves the most recent message received from the remote hub.
296+
297+ If a message has not been received since the last read, the method will
298+ block until a message is received.
299+
300+ Returns:
301+ bytes: The raw binary message.
302+ """
0 commit comments