To work with the frame configuration from the client side, request the IFrameClient microservice from a device instance.
var frameClient = device.GetMicroservice<IFrameClient>()
?? throw new Exception("No frame client found");
Usage
First, load the list of available frame configurations from the connected device:
// Load available frames from the device
await frameClient.LoadAvailableFrames();
// Access the available frames through the Frames property
foreach (var frame in frameClient.Frames.Values)
{
Console.WriteLine($"Frame: {frame.Id}");
}
Get the current frame configuration:
// Load available frames first
await frameClient.LoadAvailableFrames();
await frameClient.LoadCurrentFrame();
var subscription = frameClient.CurrentFrame.Subscribe(currentFrame =>
{
if (currentFrame is null)
{
return;
}
Console.WriteLine($"Current frame: {currentFrame}");
});
Update the frame configuration:
// Load available frames first
await frameClient.LoadAvailableFrames();
// Select a frame from the Frames collection
var selectedFrame = frameClient.Frames.Values.First();
// Apply the new frame configuration
await frameClient.SetFrame(selectedFrame);