コード例 #1
0
 public bool StackBind(ILayer bottom, ILayer top)
 {
     if (top is IDispatcherLayer)
     {
         DispatcherLayer = top as IDispatcherLayer;
         return(true);
     }
     STrace.Error(GetType().FullName, "Falta IDispatcherLayer!");
     return(false);
 }
コード例 #2
0
ファイル: DeviceCommand.cs プロジェクト: jesumarquez/lt
        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);
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
ファイル: CommanderReader.cs プロジェクト: jesumarquez/lt
        public static void DispatchResetStateMachine(int NodeCode, int TrackingId, String TrackingExtraData, IDispatcherLayer Dispatcher)
        {
            var userMessage = new UserMessage(NodeCode, (ulong)TrackingId);

            userMessage.UserSettings.Add("user_message_code", "FSM_RESET");
            userMessage.UserSettings.Add("trackingId", TrackingId.ToString());
            userMessage.UserSettings.Add("trackingExtraData", TrackingExtraData);
            Dispatcher.Dispatch(userMessage);
        }
コード例 #5
0
ファイル: CommanderReader.cs プロジェクト: jesumarquez/lt
        public static int RejectCommand(int NodeCode, int TrackingId, String TrackingExtraData, IDispatcherLayer Dispatcher, Uri request)
        {
            STrace.Debug(typeof(CommanderReader).FullName, NodeCode, "Comando Rechazado: " + request);
            var userMessage = new UserMessage(NodeCode, (ulong)TrackingId);

            userMessage.UserSettings.Add("user_message_code", "NACK");
            userMessage.UserSettings.Add("nack_reason", "REJECTED");
            userMessage.UserSettings.Add("original_request", request.GetComponents(UriComponents.PathAndQuery, UriFormat.Unescaped));
            userMessage.UserSettings.Add("trackingId", TrackingId.ToString());
            userMessage.UserSettings.Add("trackingExtraData", TrackingExtraData);
            Dispatcher.Dispatch(userMessage);
            return(1);
        }