Putbytes¶
-
class
libpebble2.services.putbytes.
PutBytes
(pebble, object_type, object, bank=None, filename='', app_install_id=None)¶ Synchronously sends data to the watch over PutBytes.
Parameters: - pebble (PebbleConnection) – The Pebble to send data to.
- object_type (PutBytesType) – The type of data being sent.
- object (bytes) – The data to send.
- bank (int) – The bank to install the data to, if applicable.
- filename (str) – The filename of the data, if applicable
- app_install_id (int) – This is used during app installations on 3.x. It is mutually exclusive with
bank
andfilename
.
-
register_handler
(event, handler)¶ Registers a handler to be triggered by an event
Parameters: - event – The event to handle
- handler – The handler callable.
Returns: A handle that can be used to unregister the handler.
-
send
()¶ Sends the object to the watch. Block until completion, or raises
PutBytesError
on failure.During transmission, a “progress” event will be periodically emitted with the following signature:
(sent_this_interval, sent_so_far, total_object_size)
-
unregister_handler
(handle)¶ Unregisters an event handler.
Parameters: handle – The handle returned from register_handler()
-
wait_for_event
(event, timeout=10)¶ Block waiting for the given event. Returns the event params.
Parameters: - event – The event to handle.
- timeout – The maximum time to wait before raising
TimeoutError
.
Returns: The event params.