终端一体化运控平台
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

43 lignes
1.5 KiB

  1. using BPA.Message;
  2. using BPA.Message.Enum;
  3. using BPASmartClient.Device;
  4. using BPA.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. }