Controller APIs

Connection

Base class for AES70 connections.

class Connection(options)

Connection base class. It extends Events() and defines two events:

  • close is emitted when this connection has been closed. This event has no parameters.

  • error is emitted when this connection has been closed with an error. This event emits the error object as a single parameter.

Arguments
  • options (object) – The options.

  • options.batch (number) – AES70 messages are batched into single write calls up until this limit. This can improve network performance and reduce packet overhead when many small commands are send at the same time. This often happens e.g. after initially connecting to a device and the device tree is enumerated. Defaults to 64 kilobytes by default but is overwritten e.g. by UDPConnection().

Connection.close()

Closes the connection. Overloaded by connection subclasses.

Connection.set_keepalive_interval(seconds)

Set the keepalive interval.

Arguments
  • seconds (number) – Keepalive interval in seconds.

ClientConnection

Base class for client connections.

class ClientConnection(options)

Connection base class for clients (aka controllers).

Arguments
  • options (object) – Additional options are passed to Connection().

TCPConnection

Client connection using TCP. Only available when using this library under NodeJS.

class TCPConnection(socket, options)

ClientConnection() subclass which implements OCP.1 with TCP transport.

Arguments
  • socket (net.Socket) – The established tcp socket.

  • options (object) – Additional options are passed to ClientConnection().

TCPConnection.connect(options)

Connect to the given endpoint.

Arguments
  • options.host (String) – Hostname or ip address.

  • options.port (number) – Port number.

Returns

Promise.<TCPConnection> – The connection.

TCPConnection.close()

Close the TCP connection.

UDPConnection

Client connection using UDP. Only available when using this library under NodeJS.

class UDPConnection(socket, options)

ClientConnection() subclass which implements OCP.1 with UDP transport.

UDPConnection.connect(options)

Connect to the given endpoint.

Arguments
  • options.host (String) – hostname or ip

  • options.port (number) – port number

  • options.delay (number) – Delay in ms between individual packets. This can be a useful strategy when communicating with devices which cannot handle high packet rates.

  • options.retry_interval (number) – Delay in ms after which a command should be automatically re-sent if no response has been received, yet.

  • options.retry_count (number) – Number of times to retry sending commands. If no response has been received after all retries, the command will fail with an error.

  • options.batch (number) – Maximum number of bytes to send in an individual UDP packet. Note that AES70 messages which are larger than this limit are sent anyway. This only limits how many seperate messages are batched into a single packet.

Returns

Promise.<UDPConnection> – The connection.

UDPConnection.close()

Closes the udp port.

WebSocketConnection

Client connection using WebSockets. Available when using this library in the browser and under NodeJS with the ws npm package being installed.

class WebSocketConnection(ws, options)

ClientConnection() subclass which implements OCP.1 with WebSocket transport.

WebSocketConnection.connect(options)

Connect to the given endpoint.

Arguments
  • options (object) –

  • options.url (String) – Endpoint WebSocket url.

Returns

Promise.<WebSocketConnection> – The connection.

WebSocketConnection.close()

Close the WebSocket connection.

RemoteDevice

This class represents remote AES70 devices. It is created using an established AES70 connection. It extends the Events() class and defines two events:

  • close is emitted when the connection has been closed.

  • error is emitted when the connection closed with an error.

class RemoteDevice(connection)

Controller class for a remote OCA device.

This is the entry point for any interaction with a remote device. Can be used to query the available object tree, or interact with the manager classes.

Arguments
RemoteDevice.on(name, cb)

Register for an event.

Arguments
  • name (String) – Name of the event.

  • cb (function) – Callback function.

RemoteDevice.removeEventListener(name, cb)

Removes an event handler.

Arguments
  • name (String) – Name of the event.

  • cb (function) – Callback function.

RemoteDevice.RemoteDevice
RemoteDevice.AudioProcessingManager

The AudioProcessing manager object. An instance of OcaAudioProcessingManager()

RemoteDevice.CodingManager

The Coding manager object. An instance of OcaCodingManager()

RemoteDevice.DeviceManager

The device manager object. An instance of OcaDeviceManager().

RemoteDevice.DeviceTimeManager

The DeviceTime manager object. An instance of OcaDeviceTimeManager()

RemoteDevice.DiagnosticManager

The Diagnostic manager object. An instance of OcaDiagnosticManager()

RemoteDevice.FirmwareManager

The Firmware manager object. An instance of OcaFirmwareManager()

RemoteDevice.LibraryManager

The Library manager object. An instance of OcaLibraryManager()

RemoteDevice.MediaClockManager

The MediaClock manager object. An instance of OcaMediaClockManager()

RemoteDevice.NetworkManager

The Network manager object. An instance of OcaNetworkManager()

RemoteDevice.PowerManager

The Power manager object. An instance of OcaPowerManager()

RemoteDevice.Root

The Root object. An instance of OcaBlock()

RemoteDevice.SecurityManager

The Security manager object. An instance of OcaSecurityManager()

RemoteDevice.SubscriptionManager

The Subscription manager object. An instance of OcaSubscriptionManager()

RemoteDevice.TaskManager

The Task manager object. An instance of OcaTaskManager()

RemoteDevice.add_control_classes(module)

Add a set of control classes. When communicating with a device the objects created for remote control objects will be picked from the ones added. The standard control classes are always added by default.

Arguments
  • module (Object|Array) – The set of classes to add. Either an object contains the control classes with the classid as key, or an array of control classes.

RemoteDevice.close()

Close the associated connection.

RemoteDevice.discover_all()

Note

Deprecated: Use get_device_tree() instead.

Discovers the complete object tree of this device starting from the root block. The root block itself will not be part of the resulting list.

Returns

Promise – The object list.

RemoteDevice.get_device_tree()

Discovers the device object tree. This are all objects starting at the Root block.

Returns

Promise – The object tree. A recursive tree structure consisting of arrays of objects. Each block is followed by an array of it’s children.

RemoteDevice.get_role_map(separator='/')

Returns a map of role paths to objects. This is a convenience function which internally calls get_device_tree and then tree_to_rolemap. If more than one object has the same role name on the same tree level, their role names will be appended with numbers starting at 1.

Arguments
  • separator (String) – Optional argument used as a separator for levels in the tree.

Returns

Promise.<Map.<string, Object>> – The map of role paths to control objects.

RemoteDevice.set_keepalive_interval(seconds)

Set the keepalive interval.

Arguments
  • seconds (number) – Keepalive interval in seconds.

ObjectBase

This class is the common base class for all remote AES70 objects.

class ObjectBase()

Base class for all client-side control classes.

ObjectBase.ObjectBase
ObjectBase.ClassID

The ClassVersion of this object. This is a local property.

ObjectBase.ClassName

The name of the class of this object. This is a local property.

ObjectBase.ClassVersion

The ClassVersion of this object. This is a local property.

ObjectBase.ObjectNumber

The ObjectNumber of this object.

ObjectBase.GetPropertyID(name)

Get the OcaPropertyID for a given name.

Arguments
  • name (String) –

Returns

OcaPropertyID

ObjectBase.GetPropertyName(id)

Get the name of a given OcaPropertyID.

Arguments
  • id (Types/OcaPropertyID) –

Returns

string

ObjectBase.GetPropertySync()

Returns an instance of PropertySync() for this remote object.

ObjectBase.get_properties()

Returns an instance of Properties() for this remote object.

Arguments

Instances of this class are returned by remote method calls which return more than one output parameter.

class Arguments()

Class used to represent multiple return values.

Arguments.Arguments
Arguments.length

The number of elements.

Arguments.item(n)

Returns an item.

Arguments
  • n (integer) – Index of the item.

RemoteError

Errors of this class are raised by remote method calls which return with a return status of not OK.

class RemoteError(statuc, command)

Error class raised by remote function calls.

Arguments
  • cmd (Command) – The command object.

  • status (OcaStatus) – The error code.

RemoteError.RemoteError

Event

class Event()

Class used to represent all events specified by the OCA standard.

Event.Event
Event.Dipose()

Unsubscribe all event handlers.

Event.subscribe(callback)

Subscribe to this event.

Arguments
  • callback (function) –

Event.unsubscribe(callback)

Unsubscribe from this event.

Arguments
  • callback (function) –

PropertyEvent

class PropertyEvent()

Class used to represent property changes. When this event fires, event handlers will be called with the new value, the OcaPropertyChangeType() and the OcaPropertyID() of the property.

PropertyEvent.PropertyEvent
PropertyEvent.Dipose()

Unsubscribe all event handlers.

PropertyEvent.subscribe(callback)

Subscribe to this event.

Arguments
  • callback (function) –

PropertyEvent.unsubscribe(callback)

Unsubscribe from this event.

Arguments
  • callback (function) –

Events

A simple event handling base class similar to Events in NodeJS.

class Events()

Basic event handling class.

Events.Events
Events.emit(name, ...args)

Emit an event.

Arguments
  • name (String) – Name of the event.

  • args (*) – Extra arguments.

Events.on(name, cb)

Register for an event.

Arguments
  • name (String) – Name of the event.

  • cb (function) – Callback function.

Events.removeEventListener(name, cb)

Removes an event handler.

Arguments
  • name (String) – Name of the event.

  • cb (function) – Callback function.

Enum

class Enum()

An interface implemented by all AES70 enum types. Each AES70 enum is implemented by a class which implements this interface. Enum values are implemented using singletons of this corresponding class.

Enum.toString()
Returns

string – The enum entry name.

Enum.valueOf()
Returns

number – The numeric enum value.