Loading...

Control Plane

Control Plane

The control plane API uses Protocol Buffers and gRPC, and is defined in the synapse-api repo. It has five core function calls:

  • Info
  • Configure
  • Start
  • Stop
  • Query

When a Synapse device turns on for the first time, it has no configuration and by default, will do nothing when started. The main component of a device's configuration is the signal chain which defines a flow of information through the device, and is the thing best thought of as "running" when the device is started.

Discovering Devices

To begin, you must first request the devices available in the API. The discover command will display a procedurally generated name and the IP address for all Synapse devices on the network.

from synapse.utils.discover import discover

discovered = discover()

Info on Devices

After your device(s) have been discovered, you can use the info command to print info on all peripheral devices available on the network.

import synapse as syn

# Connect to a device
device = syn.Device(uri)

# Get the device's info
info = device.info()
assert info is not None, "Couldn't get device info"
print(f"Device info: {info}")

# {
#  name: "twelve-duckling-stampede";
#  serial: "SFI00001",
#  synapse_version: ""
#  firmware_version: "",
#  status: {...},
#  peripherals: [...],
#  configuration: {...}
# }

Configuring Devices

Synapse uses nodes to collect, process, and stream data to and from Synapse devices. You can configure groups of nodes to operate in series as a signal chain.

import synapse as syn

# Configure the device
e_record = syn.ElectricalBroadband()
stream_out = syn.StreamOut()

config = syn.Config()

## Add your relevant nodes
config.add_node(e_record)
config.add_node(stream_out)

## Connect any outputs to relevant inputs
config.connect(e_record, stream_out)

Devices must be reconfigured if you want to update the signal chain.

Starting/Stopping Devices

You can start or stop signal chains that have been configured on a device using the start and stop commands.

# Start the device
ok = device.start()

# ...

# Stop the device
ok = device.stop()