namespace MassiveKnob.Plugin
{
///
public interface IMassiveKnobDeviceContext : IMassiveKnobContext
{
///
/// Call when an attempt is being made to connect to the device. If the connection is always ready
/// this call can be skipped.
///
void Connecting();
///
/// Call when the device is connected. This method must be called before AnalogChanged or DigitalChanged.
///
/// The specs as reported by the device.
void Connected(DeviceSpecs specs);
///
/// Call when the connection to the device has been lost.
///
void Disconnected();
///
/// Call when an analog input's value has changed.
///
/// The index of the analog input. Must be within bounds of the value reported in Connected.
/// The new value in the range from 0 to 100.
void AnalogChanged(int analogInputIndex, byte value);
///
/// Call when a digital input's state has changed.
///
/// The index of the digital input. Must be within bounds of the value reported in Connected.
/// Whether the input is considered on or off.
void DigitalChanged(int digitalInputIndex, bool on);
}
///
/// Defines the specs as reported by the device.
///
public readonly struct DeviceSpecs
{
///
/// The number of analog input controls supported by the device.
///
public readonly int AnalogInputCount;
///
/// The number of digital input controls supported by the device.
///
public readonly int DigitalInputCount;
///
/// The number of analog output controls supported by the device.
///
public readonly int AnalogOutputCount;
///
/// The number of digital output controls supported by the device.
///
public readonly int DigitalOutputCount;
///
/// Defines the specs as reported by the device.
///
/// The number of analog input controls supported by the device.
/// The number of digital input controls supported by the device.
/// The number of analog output controls supported by the device.
/// The number of digital output controls supported by the device.
public DeviceSpecs(int analogInputCount, int digitalInputCount, int analogOutputCount, int digitalOutputCount)
{
AnalogInputCount = analogInputCount;
DigitalInputCount = digitalInputCount;
AnalogOutputCount = analogOutputCount;
DigitalOutputCount = digitalOutputCount;
}
}
}