tbf/TBF/Rig/Network/Camera/CJMS11/POJO/CommandMEnum.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

46 lines
1.7 KiB
C#

using System.Collections.Generic;
using System.Linq;
namespace TBF.Rig.Network.Camera.CJMS11
{
public static class CommandMEnum
{
private static readonly Dictionary<CommandM, string> commandToString = new Dictionary<CommandM, string>
{
{ CommandM.noCommand, "noCommand" },
{ CommandM.unknown_, "unknown" },
{ CommandM.connect_, "connect" },
{ CommandM.type_camera_, "type_camera" },
{ CommandM.status_, "status" },
{ CommandM.prepare_camera_, "prepare_camera" },
{ CommandM.grab_image_, "grab_image" },
{ CommandM.send_, "send" },
{ CommandM.start_stream_, "start_stream" },
{ CommandM.stop_stream_, "stop_stream" },
{ CommandM.start_stream_images_, "start_stream_images" },
{ CommandM.stop_stream_images_, "stop_stream_images" },
{ CommandM.get_cfg_, "get_cfg" },
{ CommandM.set_cfg_, "set_cfg" },
{ CommandM.close_, "close" },
{ CommandM.disconnect_, "disconnect" },
{ CommandM.overload_config_, "overload_config" },
{ CommandM.client_count_, "client_count" }
};
private static readonly Dictionary<string, CommandM> stringToCommand = commandToString.ToDictionary(kvp => kvp.Value, kvp => kvp.Key);
public static string GetVal(CommandM cmd)
{
return commandToString.TryGetValue(cmd, out var str) ? str : "unknown";
}
public static CommandM GetCommandM(string token)
{
if (string.IsNullOrEmpty(token))
return CommandM.noCommand;
return stringToCommand.TryGetValue(token, out var cmd) ? cmd : CommandM.noCommand;
}
}
}