using System; using System.Collections.Generic; using System.Linq; using System.Text; using SuperSocket.SocketBase.Command; using SuperSocket.SocketBase.Protocol; namespace SensorHub.Servers.Commands.CASICCommands { public class ConfigCmd : CommandBase<ThirdpartySession, StringRequestInfo> { public override string Name { get { return "Config"; } } public override void ExecuteCommand(ThirdpartySession session, StringRequestInfo requestInfo) { String messagetype = requestInfo.Parameters[0]; String devcode = requestInfo.Parameters[1]; String concentratorcode = requestInfo.Parameters[2]; String config = requestInfo.Parameters[3]; String eventtime = requestInfo.Parameters[4]; session.Logger.Info("接收下发配置数据如下:"); session.Logger.Info("设备编号:" + devcode); session.Logger.Info("集中器编号:" + concentratorcode); session.Logger.Info("配置参数:" + config); ThirdpartyServer thirdparty = session.AppServer as ThirdpartyServer; //thirdparty.DispatchMessage(devcode, concentratorcode, config); String message = "{\"messagetype\":\"" + messagetype + "\",\"devcode\":\"" + devcode + "\",\"result\":\"success\",\"eventtime\":\"" + eventtime + "\"}"; session.Send(message + "\r\n"); } } }