Exemplo n.º 1
0
        private void Comm_OnReadMtuData(object sender, MTUComm.ReadMtuDataArgs e)
        {
            ActionProgressArgs args;

            switch (e.Status)
            {
            case LogQueryResult.LogDataType.Bussy:
                args = new ActionProgressArgs(0, 0);
                OnProgress(this, args);
                break;

            case LogQueryResult.LogDataType.NewPacket:
                args = new ActionProgressArgs(e.CurrentEntry, e.TotalEntries);
                OnProgress(this, args);
                break;

            case LogQueryResult.LogDataType.LastPacket:
                Mtu          mtu_type = configuration.GetMtuTypeById((int)e.MtuType.Type);
                ActionResult result   = ReadMTUData(e.Start, e.End, e.Entries, e.MtuType, mtu_type);
                logger.logReadDataResult(this, result, mtu_type);
                ActionFinishArgs f_args = new ActionFinishArgs(null);
                OnFinish(this, f_args);
                break;
            }
        }
Exemplo n.º 2
0
        private void Comm_OnBasicRead(object sender, MTUComm.BasicReadArgs e)
        {
            ActionResult     result = new ActionResult();
            ActionFinishArgs args   = new ActionFinishArgs(result);

            OnFinish(this, args);
        }
Exemplo n.º 3
0
        private void Finish(
            ActionFinishArgs args)
        {
            OnFinish(this, args);

            // Reset current action reference
            Singleton.Remove <Action> ();
        }
Exemplo n.º 4
0
        private void Comm_OnTurnOnMtu(object sender, MTUComm.TurnOnMtuArgs e)
        {
            ActionResult result = getBasciInfoResult();

            logger.logTurnOffResult(this, e.Mtu);
            ActionFinishArgs args = new ActionFinishArgs(result);

            OnFinish(this, args);
        }
Exemplo n.º 5
0
        private void Comm_OnReadMtu(object sender, MTUComm.ReadMtuArgs e)
        {
            currentMtu = e.MtuType;

            ActionResult result = CreateActionResultUsingInterface(e.MemoryMap, e.MtuType);

            logger.logReadResult(this, result, e.MtuType);
            ActionFinishArgs args = new ActionFinishArgs(result);

            OnFinish(this, args);
        }
Exemplo n.º 6
0
        private ActionResult Comm_OnAddMtu(object sender, MTUComm.AddMtuArgs e)
        {
            ActionResult     result = CreateActionResultUsingInterface(e.MemoryMap, e.MtuType, e.Form);
            ActionFinishArgs args   = new ActionFinishArgs(result);

            e.AddMtuLog.LogReadMtu(result);

            // Generate xml log file and save on device
            e.AddMtuLog.Save();

            args.FormLog = e.AddMtuLog;

            OnFinish(this, args);
            return(result);
        }
Exemplo n.º 7
0
        private void Comm_OnTurnOnOffMtu(object sender, MTUComm.TurnOffMtuArgs args)
        {
            try
            {
                ActionResult resultBasic = getBasciInfoResult();
                this.lastLogCreated = logger.TurnOnOff(this, args.Mtu, resultBasic);
                ActionFinishArgs finalArgs = new ActionFinishArgs(resultBasic);

                this.Finish(finalArgs);
            }
            catch (Exception e)
            {
                Errors.LogErrorNowAndContinue(new PuckCantCommWithMtuException());
                this.OnError();
            }
        }
Exemplo n.º 8
0
        private async Task Comm_OnAddMtu(object sender, MTUComm.AddMtuArgs args)
        {
            try
            {
                ActionResult result = await CreateActionResultUsingInterface(args.MemoryMap, args.MtuType, args.Form);

                ActionFinishArgs finalArgs = new ActionFinishArgs(result);
                args.AddMtuLog.LogReadMtu(result);
                this.lastLogCreated = args.AddMtuLog.Save();

                this.Finish(finalArgs);
            }
            catch (Exception e)
            {
                Errors.LogErrorNowAndContinue(new PuckCantCommWithMtuException());
                this.OnError();
            }
        }
Exemplo n.º 9
0
        private async Task Comm_OnReadMtu(object sender, MTUComm.ReadMtuArgs args)
        {
            try
            {
                ActionResult resultAllInterfaces = await CreateActionResultUsingInterface(args.MemoryMap, args.Mtu);

                this.lastLogCreated = logger.ReadMTU(this, resultAllInterfaces, args.Mtu);
                ActionFinishArgs finalArgs = new ActionFinishArgs(resultAllInterfaces);
                finalArgs.Mtu = args.Mtu;

                this.Finish(finalArgs);
            }
            catch (Exception e)
            {
                Errors.LogErrorNowAndContinue(new PuckCantCommWithMtuException());
                this.OnError();
            }
        }