tbf/TBF/Rig/Network/Camera/RoiForFixedStartCJMS11/RoiCfg.cs
Michal Buzik 0daefb93bb Add CJMS11 enhancements, logging, and resolution support
- Extended CJMS11 camera handling with new functionalities, including image grabbing, resolution configuration, and improved ROI support.
- Added new `ToString` method implementations for enhanced debugging and logging in key classes like `JmsMessage`, `JmsPacket`, and `RoiCfg`.
- Introduced additional commands (`start_stream_images`, `stop_stream_images`) in `CommandM` and its enum.
- Implemented new resolution handling in `RoiCfg` with support for configurable image frames.
- Refactored resolution-related UI elements in `RoiCfgCtrl` to add a dropdown for selecting resolution.
- Made minor UX improvements by replacing inconsistent string formats with verbatim strings in console messages.
- Updated project dependencies with new resolution-related utilities (`Frame` and `ResolutionFrames`).
- Resolved camera-specific symbolic issues by transitioning to `CJMS11.Camera` over prior naming inconsistencies.
2025-07-18 08:50:22 +02:00

79 lines
2.1 KiB
C#

///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System.Collections.Generic;
using System.Xml.Serialization;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
using TBF.Rig.Network.Camera.RoiForFixedStartCJMS11.common;
namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
{
public class RoiCfg : ComponentCfgBase, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RoiCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new RoiCfgCtrl(); }
///
/// Serialized parameters
///
public bool BlackAndWhite;
public bool LowResolution;
public ImageRotation ImageRotation;
[XmlIgnore]
private Frame _imageFrame;
[XmlElement(IsNullable = true)]
public Frame ImageFrame
{
get
{
if (_imageFrame == null)
{
_imageFrame = new Frame(); // Ensure non-null when accessed
}
return _imageFrame;
}
set
{
_imageFrame = value;
}
}
/// <summary> Procedure parameters </summary>
[XmlIgnore]
public ProcedureParams ProcParams;
public override IParamsProvider GetRuntimeProcParamsProvider() { return ProcParams; }
public override IParamsProvider CreateProcParamsProvider() { return new ProcedureParams(true); }
/// Private parameterless constructor invoked by all other (public) constructors
RoiCfg()
{
ProcParams = new ProcedureParams(true);
}
public RoiCfg(string name, IComponentFactory factory)
: this()
{
Name = name;
Factory = factory;
ParentName = "Camera";
BlackAndWhite = false;
LowResolution = true;
ImageRotation = ImageRotation.None;
ImageFrame = Frame.StandardFrame();
DebugLevel = DebugMode.Inherit;
}
public string ToString(int i)
{
return string.Format("{0} Camera={1} B&W={2}, LowRes={3}, Rotation={4}, Frame={5}",
Name, ParentName, BlackAndWhite, LowResolution, ImageRotation, ImageFrame);
}
}
}