BlobDB

The BlobDB service provides a mechanism for interacting with the Pebble BlobDB service. The service handles multiple messages in flight, retries, and provides callbacks for completion and failure. A SyncWrapper is provided that can be passed any blobdb method and will block until it completes.

class libpebble2.services.blobdb.BlobDBClient(pebble, timeout=5)

Provides a mechanism for interacting with the Pebble’s BlobDB service. All methods are asynchronous. Messages will be retried automatically if they time out, but all error responses from the watch are considered final and will be reported.

If you want to interact synchronously with BlobDB, see SyncWrapper.

Parameters:
  • pebble (PebbleConnection) – The pebble to connect to.
  • timeout (int) – The timeout before resending a BlobDB command.
clear(database, callback=None)

Wipe the given database. This only affects items inserted remotely; items inserted on the watch (e.g. alarm clock timeline pins) are not removed.

Parameters:
  • database (BlobDatabaseID) – The database to wipe.
  • callback – A callback to be called on success or failure.
delete(database, key, callback=None)

Delete an item from the given database.

Parameters:
  • database (BlobDatabaseID) – The database from which to delete the value.
  • key (uuid.UUID) – The key to delete.
  • callback – A callback to be called on success or failure.
insert(database, key, value, callback=None)

Insert an item into the given database.

Parameters:
  • database (BlobDatabaseID) – The database into which to insert the value.
  • key (uuid.UUID) – The key to insert.
  • value (bytes) – The value to insert.
  • callback – A callback to be called on success or failure.
class libpebble2.services.blobdb.SyncWrapper(method, *args, **kwargs)

Wraps a BlobDBClient call and returns when it completes.

Use it like this:

SyncWrapper(blobdb_client.insert, some_key, some_value).wait()
Parameters:
  • method – The method to call.
  • args – Arguments to pass to the method.