终端一体化运控平台
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

TopicDefine.cs 1.6 KiB

2 år sedan
2 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using BPA.Message;
  2. using BPA.Message.Enum;
  3. using BPASmartClient.Device;
  4. using BPASmartClient.Helper;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace BPASmartClient.Business
  11. {
  12. /// <summary>
  13. /// 主题定义
  14. /// </summary>
  15. public class TopicDefine : Singleton<TopicDefine>
  16. {
  17. /// <summary>
  18. /// 获取订阅主题
  19. /// </summary>
  20. public List<string> SubscribTopics { get; private set; }
  21. /// <summary>
  22. /// 获取心跳上报主题
  23. /// </summary>
  24. public Dictionary<DeviceClientType, string> PushHeartbeatTopics { get; set; }
  25. public void Initialize(List<IDevice> devices)
  26. {
  27. SubscribTopics = new List<string>();
  28. PushHeartbeatTopics = new Dictionary<DeviceClientType, string>();
  29. foreach (var device in devices)
  30. {
  31. //SubscribTopics.Add(TOPIC.GetInstance.GetOrderPushTopic(device.DeviceType, Plugin.GetInstance().GetPlugin<ConfigMgr>().ClientId));
  32. //SubscribTopics.Add(TOPIC.GetInstance.GetBusinessTopic(device.DeviceType, Plugin.GetInstance().GetPlugin<ConfigMgr>().ClientId));
  33. SubscribTopics.Add(TOPIC.GetInstance.GetOrderPushTopic(device.DeviceType, device.DeviceId));
  34. SubscribTopics.Add(TOPIC.GetInstance.GetBusinessTopic(device.DeviceType, device.DeviceId));
  35. PushHeartbeatTopics.Add(device.DeviceType, TOPIC.GetInstance.GetHeatbeatTopic(device.DeviceType));
  36. }
  37. }
  38. }
  39. }