Table of Contents

Class Device

Namespace
Bonsai.Harp
Assembly
Bonsai.Harp.dll

Represents an observable source of messages from the Harp device connected at the specified serial port.

public class Device : Source<HarpMessage>, INamedElement
Inheritance
Device
Implements
Derived
Inherited Members

Constructors

Device()

Initializes a new instance of the Device class.

public Device()

Device(int)

Initializes a new instance of the Device class accepting connections only from Harp devices with the specified identifier.

public Device(int whoAmI)

Parameters

whoAmI int

The device identifier to match against serial connections.

Device(int, FirmwareMetadata)

Initializes a new instance of the Device class accepting connections only from Harp devices with the specified identifier and firmware version.

public Device(int whoAmI, FirmwareMetadata firmware)

Parameters

whoAmI int

The device identifier to match against serial connections.

firmware FirmwareMetadata

Provides information about the expected device firmware version.

Properties

DumpRegisters

Gets or sets a value indicating whether the device should send the content of all registers during initialization.

public bool DumpRegisters { get; set; }

Property Value

bool

Heartbeat

Gets or sets a value indicating whether the Device sends the Timestamp event each second.

public EnableFlag Heartbeat { get; set; }

Property Value

EnableFlag

IgnoreErrors

Gets or sets a value indicating whether error messages parsed during acquisition should be ignored or raise an exception.

public bool IgnoreErrors { get; set; }

Property Value

bool

OperationLed

Gets or sets a value specifying the state of the LED reporting device operation.

public LedState OperationLed { get; set; }

Property Value

LedState

OperationMode

Gets or sets a value specifying the operation mode of the device at initialization.

public OperationMode OperationMode { get; set; }

Property Value

OperationMode

PortName

Gets or sets the name of the serial port used to communicate with the Harp device.

[TypeConverter(typeof(PortNameConverter))]
public string PortName { get; set; }

Property Value

string

RegisterMap

Gets a read-only mapping from address to register type.

public static IReadOnlyDictionary<int, Type> RegisterMap { get; }

Property Value

IReadOnlyDictionary<int, Type>

VisualIndicators

Gets or sets a value specifying the state of all the visual indicators in the device.

public LedState VisualIndicators { get; set; }

Property Value

LedState

Methods

Generate()

Connects to the specified serial port and returns an observable sequence of Harp messages coming from the device.

public override IObservable<HarpMessage> Generate()

Returns

IObservable<HarpMessage>

The observable sequence of Harp messages produced by the device.

Generate(IObservable<HarpMessage>)

Connects to the specified serial port and sends the observable sequence of Harp messages. The return value is an observable sequence of Harp messages coming from the device.

public IObservable<HarpMessage> Generate(IObservable<HarpMessage> source)

Parameters

source IObservable<HarpMessage>

An observable sequence of Harp messages to send to the device.

Returns

IObservable<HarpMessage>

The observable sequence of Harp messages produced by the device.