How to use Black Box protocol
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
RIsoUserInteraction();
}
private static void PolarityNoInteraction()
{
var serChannel = Channel.Serial.Open("COM4");
var channel = Channel.BlackBox.Create(serChannel, "1111");
var region = new Region(2000, 1);
var measurementInfo = DataDisplayInfos.MeasurementInfoList.Get(147); //Polarity
var measurement = new EmptyMeasurement(measurementInfo.Id, region);
var test = new SingleTest(measurement);
var result = channel.Start(test).Result;
Console.WriteLine($"Status: {result.Status}");
}
private static void RIsoUserInteraction()
{
Channel.BlackBox.Get<Channel.BlackBox.Message.Question>().Subscribe(question =>
{
var response = question.CreateResponse(question.AvailableResponses.Single(_=>_ == BlackBoxMessageButtons.No));
Channel.BlackBox.Publish(response);
});
Channel.BlackBox.Get<Channel.BlackBox.Message.Notification>().Subscribe(question =>
{
var response = question.CreateResponse(BlackBoxMessageButtons.Ok);
Channel.BlackBox.Publish(response);
});
var serChannel = Channel.Serial.Open("COM4");
var channel = Channel.BlackBox.Create(serChannel, "1111");
var region = new Region(2000, 1);
var measurementInfo = DataDisplayInfos.MeasurementInfoList.Get(118); //R-ISO
var measurement = new EmptyMeasurement(measurementInfo.Id, region);
var test = new SingleTest(measurement);
var result = channel.Start(test).Result;
channel.Stop();
Console.WriteLine($"Status: {result.Status}");
}
}
C#