Skip to content

pb_client.service.Service

Service(
    peer,
    endpoint,
    notifications=None,
    capabilities=frozenset(),
)

A connected service.

Obtained from connect; not constructed directly, because the connection's tasks must be owned by that context manager.

Wrap an established connection.

Parameters:

Name Type Description Default
peer JsonRpcPeer

The JSON-RPC peer, already handshaken.

required
endpoint Endpoint

Where this service is listening.

required
notifications _Notifications | None

The router the peer was given. Without one the subscription methods have nothing to read, so they refuse rather than waiting forever.

None
capabilities frozenset[str]

What the service said it can do, from the handshake.

frozenset()

Methods

  • attach -- Follow everything a hub says, for the duration of the block.
  • chosen_hub -- Report the chosen hub without changing it.
  • connect_hub -- Connect to a hub and leave it connected.
  • disconnect_hub -- Disconnect a hub.
  • download -- Send a compiled program to a hub without starting it.
  • hub_info -- Describe one hub.
  • info -- Ask the service about itself.
  • list_hubs -- List the hubs the service is holding open.
  • ping -- Check that the service is responsive.
  • run_program -- Download a program and run it.
  • scan -- Look for hubs that are advertising.
  • scanning -- Scan, reporting each hub as it is seen rather than at the end.
  • shutdown -- Ask the service to exit.
  • start_program -- Start a program already stored on the hub.
  • start_repl -- Start the hub's built-in interactive interpreter.
  • stop_program -- Stop the program running on a hub.
  • use_hub -- Choose the hub later commands act on when none is named.
  • watching_adapters -- Follow which Bluetooth adapters cannot be used, while hubs are sought.
  • write_stdin -- Send input to whatever is running on a hub.

Attributes