Channels

An Adderlink channel is composed of one or more transmitter sources, and can be connected to by one or more receivers. See Adder Devices for details on how to query transmitters and receivers.

In adderlib, an Adderlink channel is represented by adderlib.channels.AdderChannel.

Getting Channels

A list of channels available to the user can be retrieved with adderlib.adder.AdderAPI.getChannels().

# Print all the known channels
for ch in api.getChannels():
        print(ch.id, ch.name)

If the ID or the name of an existing channel is known, either of these can be passed to the method as a named argument, and that channel will be the only result returned.

# Get the channel named "Workstation 01"
try:
        ch = next(api.getChannels(name="Workstation 01"))
except StopIteration:
        print("No channel found with name \"Workstation 01\"", sys.stderr)

Connecting to a Channel

A channel can be connected to a receiver with adderlib.adder.AdderAPI.connectToChannel() by passing the desired AdderChannel and AdderReceiver as arguments.

# Irresponsibly connect a bunch of receivers to channels
for rx, ch in zip(api.getReceivers(), api.getChannels()):
        print(f"Connecting {ch.name} to {rx.name}")
        api.connectToChannel(channel=ch, receiver=rx)

An optional named argument mode can be given a named value from the adderlib.channels.AdderChannel.ConnectionMode enum.

Note

For more information on working with Adder receivers, see Adder Devices.

Disconnecting from a Channel

A channel can be disconnected from a receiver with adderlib.adder.AdderAPI.disconnectFromChannel() by passing the desired AdderReceiver as an argument.

# Disconnect all receivers
for rx in api.getReceivers():
        if rx.is_connected:
                print(f"Disconnecting {rx.name} from {rx.channel_name}")
                api.disconnectFromChannel(rx)

An optional named argument force can be set to True, to attempt to force the receiver to disconnect even if the user logged in to that receiver is different than the one issuing the API command to disconnect. This will only be successsful if the user logged in to the API is an administrator.

Creating a Channel

A new channel can be created with adderlib.adder.AdderAPI.createChannel() by passing at least a channel name as a string. If succesful, the new channel will be returned as an AdderChannel object.

There are many optional named arguments that can be given:

While this method allows for a very granular configuration, in practice this is usually simpler:

# Create a channel from one transmitter
tx = next(api.getTransmitters())
ch = api.createChannel(
        name="Darkweb Station 1",
        location="Bunker 12",
        video1=tx,
        group_name="Top Secret Operations"
)
print(f"The channel {ch.name} has been created with ID {ch.id} using sources from {tx.name}")

In this example, the same transmitter is used for all video, audio, USB, and serial sources. Since no ConnectionMode list was given, the allowed connection modes for this channel will be inherited based on Adder’s permissions system.

Note

For more information on working with Adder transmitters, see Adder Devices.

Deleting a Channel

A channel can be deleted with adderlib.adder.AdderAPI.deleteChannel() by passing the desired AdderChannel as an argument.

# Delete all channels for fun
for ch in api.getChannels():
        print(f"Deleting channel {ch.name}")
        api.deleteChannel(ch)

Note

This method must be called by an administrator.