Exemplo n.º 1
0
        /// <summary>
        /// 发送指令
        /// </summary>
        /// <param name="message">指令消息</param>
        public void SendCommand(CommandMessage message)
        {
            TcpClientManager device;

            lock (_clientSockets)
            {
                device = _clientSockets.FirstOrDefault(client => client.DeviceGuid == message.DeviceGuid);
            }

            if (device == null)
            {
                return;
            }

            var command = ProtocolInfoManager.GetCommand(message.CommandGuid);

            if (command == null)
            {
                return;
            }

            device.Send(command, message.Params);
        }
 static CommunicationServices()
 {
     Manager = new ActiveClientManager();
     ProtocolInfoManager.InitManager();
 }