You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
namespace JiLinApp.Docking.Ptz;
|
|
|
|
public class PtzControlTypeConfig
|
|
{
|
|
public string Type { get; set; }
|
|
|
|
public string Name { get; set; }
|
|
}
|
|
|
|
public class PtzControlTypeConfigHelper
|
|
{
|
|
private static Dictionary<string, PtzControlTypeConfig> PctConfigDict { get; set; }
|
|
|
|
public static void Init(List<PtzControlTypeConfig> ptzCtrlTypes)
|
|
{
|
|
if (PctConfigDict != null) return;
|
|
Dictionary<string, PtzControlTypeConfig> dict = new();
|
|
foreach (var cfg in ptzCtrlTypes)
|
|
{
|
|
dict.Add(cfg.Name, cfg);
|
|
}
|
|
PctConfigDict ??= dict;
|
|
}
|
|
|
|
public static PtzControlType GetControlType(string ctrlName)
|
|
{
|
|
PctConfigDict.TryGetValue(ctrlName, out var cfg);
|
|
string ctrlType = cfg != null ? cfg.Type : "";
|
|
return ctrlType switch
|
|
{
|
|
"PelcoD" => PtzControlType.PelcoD,
|
|
"PelcoP" => PtzControlType.PelcoP,
|
|
"DCamera" => PtzControlType.DCamera,
|
|
"CameraSdk" => PtzControlType.CameraSdk,
|
|
_ => PtzControlType.None
|
|
};
|
|
}
|
|
}
|