public DeviceCommand(int trackingId, int gatewayMessageId, int NodeCode, IDispatcherLayer ResponseDispatcher, int SecondsTimeout, String TrackingExtraData, CommanderReader CommanderReader) { State = CommandStates.JustWaitingForBegin; this.TrackingExtraData = TrackingExtraData; this.NodeCode = NodeCode; this.CommanderReader = CommanderReader; this.trackingId = trackingId; this.gatewayMessageId = gatewayMessageId; this.SecondsTimeout = SecondsTimeout; this.ResponseDispatcher = ResponseDispatcher; Timer = new Timer(OnTimeout, this, Timeout.Infinite, Timeout.Infinite); }
public CommanderReaderTask(CommanderReader tree) : base("Commander Reader Background Task") { Tree = tree; }
public static void CreateCommand(INode node, IDispatcherLayer disp, int trackingId, int gatewayMessageId, int timeout, Action action, String trackingExtraData, CommanderReader commanderReader) { var command = new DeviceCommand(trackingId, gatewayMessageId, node.DeviceId, disp, timeout, trackingExtraData, commanderReader); GetDeviceList(node.DeviceId).Add(command); try { action.Invoke(); command.Begin(); } catch (Exception e) { STrace.Exception(typeof(DevicesCommandStatus).FullName, e); command.Rollback(); GetDeviceList(node.DeviceId).Remove(command); } }