Introduced the CJMS11 camera component and its factory in TbfComponents. Added implementation for the CJMS11 camera class, along with unit tests to validate its functionality and integration. This enhances existing camera support in the system.
31 lines
1.0 KiB
C#
31 lines
1.0 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace TBF.Rig.Network.Camera.CJMS11.POJO
|
|
{
|
|
public class MessageStatusEnum
|
|
{
|
|
private static readonly Dictionary<MessageStatus, string> commandToString = new Dictionary<MessageStatus, string>
|
|
{
|
|
{ MessageStatus.UNDEFINED, "" },
|
|
{ MessageStatus.ACK, "ACK" },
|
|
{ MessageStatus.NACK, "NACK" },
|
|
{ MessageStatus.ERROR, "ERROR" }
|
|
};
|
|
|
|
private static readonly Dictionary<string, MessageStatus> stringToCommand = commandToString.ToDictionary(kvp => kvp.Value, kvp => kvp.Key);
|
|
|
|
public static string GetVal(MessageStatus cmd)
|
|
{
|
|
return commandToString.TryGetValue(cmd, out var str) ? str : "undefined";
|
|
}
|
|
|
|
public static MessageStatus GetCommandM(string token)
|
|
{
|
|
if (string.IsNullOrEmpty(token))
|
|
return MessageStatus.UNDEFINED;
|
|
|
|
return stringToCommand.TryGetValue(token, out var cmd) ? cmd : MessageStatus.UNDEFINED;
|
|
}
|
|
}
|
|
} |