Client

class buttplug.client.ButtplugClient(name: str)

Used to connect to Buttplug Servers.

name

name of the client, which the server can use to show with connection status.

Type

string

devices

dict of devices currently connected to the Buttplug Server, indexed by their server-provisioned numerical index.

Type

Dict[int, ButtplugClientDevice]

device_added_handler

Takes functions of the format f(a: ButtplugClientDevice) -> void. Calls handlers whenever a new device is found by the Buttplug Server.

Type

buttplug.utils.EventHandler

device_removed_handler

Takes functions of the format f(a: ButtplugClientDevice) -> void. Calls handlers whenever a device has disconnected from the Buttplug server.

Type

buttplug.utils.EventHandler

scanning_finished_handler

Takes functions of the format f() -> void. Calls handlers whenever the server has finished scanning for devices.

Type

buttplug.utils.EventHandler

log_handler

Takes functions of the format f(a: Log) -> void. Calls handlers whenever a new log message is received.

Type

buttplug.utils.EventHandler

async connect(connector)

Connects to a Buttplug Server, using the connector passed to it.

Asynchronous function that connects to a Buttplug Server.

Parameters

connector (ButtplugConnector) – Connector to use to contact the server.

Returns

Should just return on successful connect.

Return type

void

Raises

buttplug.client.ButtplugClientConnectorError – On failed connect. Check message for context.

async disconnect()

Disconnect from the remote server.

async request_log(log_level: str)

Request that the server sends logs at the requested level or higher to the client.

To stop logs from being sent, call request_log again with the “Off” level.

Parameters

log_level (string) – Log level to receive. Send “Off” to stop logs from being sent.

async start_scanning()

Request that the server starts scanning for devices.

async stop_scanning()

Request that the server stops scanning for devices.