|
123456789101112131415161718192021222324252627282930313233343536373839 |
- using BPA.Message;
- using BPA.Message.Enum;
- using BPASmartClient.Device;
- using BPASmartClient.Helper;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace BPASmartClient.Business
- {
- /// <summary>
- /// 主题定义
- /// </summary>
- public class TopicDefine : Singleton<TopicDefine>
- {
- /// <summary>
- /// 获取订阅主题
- /// </summary>
- public List<string> SubscribTopics { get; private set; }
- /// <summary>
- /// 获取心跳上报主题
- /// </summary>
- public Dictionary<DeviceClientType, string> PushHeartbeatTopics { get; set; }
- public void Initialize(List<IDevice> devices)
- {
- SubscribTopics = new List<string>();
- PushHeartbeatTopics = new Dictionary<DeviceClientType, string>();
- foreach (var device in devices)
- {
- SubscribTopics.Add(TOPIC.GetInstance.GetOrderPushTopic(device.DeviceType, InternetInfo.ClientId));
- SubscribTopics.Add(TOPIC.GetInstance.GetBusinessTopic(device.DeviceType, InternetInfo.ClientId));
-
- PushHeartbeatTopics.Add(device.DeviceType, TOPIC.GetInstance.GetHeatbeatTopic(device.DeviceType));
- }
- }
- }
- }
|