using CFX.Structures; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Sln.Iot.CFX.CFXBusiness { /// /// 设备支持能力列表 /// public class CFXSupportedTopicList { public static List SupportedTopics = new List() { new SupportedTopic() { TopicName = "CFX", TopicSupportType = TopicSupportType.Publisher, SupportedMessages = new List { "EndpointConnected", "EndpointShuttingDown", "GetEndpointInformationRequest/Response", "AreYouThereRequest/Response", "WhoIsThereRequest/Response", "NotSupportedResponse", "Heartbeat" } }, new SupportedTopic() { TopicName = "CFX.Production", TopicSupportType = TopicSupportType.Publisher, SupportedMessages = new List { "UnitsArrived", "WorkStarted", "WorkStageStarted", "WorkStageCompleted", "WorkStagePaused", "WorkStageResumed", "WorkCompleted", "UnitsDeparted", "RecipeActivated", "RecipeModified", "GetActiveRecipeRequest/Response", } }, new SupportedTopic() { TopicName = "CFX.Production.Processing", TopicSupportType = TopicSupportType.Publisher, SupportedMessages = new List { "UnitsProcessed", } }, new SupportedTopic() { TopicName = "CFX.InformationSystem.UnitValidation", TopicSupportType = TopicSupportType.Publisher, SupportedMessages = new List { "ValidateUnitsRequest/Response", } }, new SupportedTopic() { TopicName = "CFX.ResourcePerformance", TopicSupportType = TopicSupportType.Publisher, SupportedMessages = new List { "FaultOccurred", "FaultAcknowledged", "FaultCleared", "HandleFaultRequest/Response", "GetActiveFaultRequest/Response", "LogEntryRecorded", "StationOffline", "StationOnline", "StationStateChanged", "StationParametersModified", "ModifyStationParametersRequest/Response", } }, }; /// /// 是否支持该能力列表 /// /// 查询的能力列表 /// public static bool IsSupportJudge(List topics) { foreach (SupportedTopic topic in topics) { foreach (string message in topic.SupportedMessages) { var supportedTopic = SupportedTopics.FirstOrDefault(t => t.TopicName == topic.TopicName); if (supportedTopic == null || !supportedTopic.SupportedMessages.Contains(message)) { return false; } } } return true; } } }