GetBytes

class libpebble2.services.getbytes.GetBytesService(pebble)

Synchronously retrieves data from the watch over GetBytes.

Parameters:pebble (PebbleConnection) – The Pebble to send data to.
get_coredump(require_fresh=False)

Retrieves a coredump, if one exists. Raises GetBytesError on failure.

Parameters:require_fresh (bool) – If true, coredumps that have already been read are considered to not exist.
Returns:The retrieved coredump
Return type:bytes
get_file(filename)

Retrieves a PFS file from the watch. This only works on watches running non-release firmware. Raises GetBytesError on failure.

Returns:The retrieved file
Return type:bytes
get_flash_region(offset, length)

Retrieves the contents of a region of flash from the watch. This only works on watches running non-release firmware. Raises GetBytesError on failure.

Returns:The retrieved data
Return type:bytes
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.

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.