终端一体化运控平台
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.
 
 
 

40 regels
1.3 KiB

  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, InternetInfo.ClientId));
  32. SubscribTopics.Add(TOPIC.GetInstance.GetBusinessTopic(device.DeviceType, InternetInfo.ClientId));
  33. PushHeartbeatTopics.Add(device.DeviceType, TOPIC.GetInstance.GetHeatbeatTopic(device.DeviceType));
  34. }
  35. }
  36. }
  37. }