Beispiel #1
0
        public AnalysisDefs.Measurement Measurement;            // just a virtual pointer, not a frozen snapshot, be careful using this during proessing, the root of all that is good and evil


        // system snapshot only
        public MeasurementStatus()
        {
            // system operational state is already on NC.App.Opstate, this makes a copy
            action  = NC.App.Opstate.Action;
            opstate = NC.App.Opstate.SOH;
            start   = NC.App.Opstate.start;

            switch (NC.App.Opstate.Action)
            {
            case NCCAction.Nothing:
            case NCCAction.Prompt:
            case NCCAction.Maintenance:
            case NCCAction.Analysis:
                // nothing more right now
                break;

            case NCCAction.Discover:
            case NCCAction.HVCalibration:
            case NCCAction.Assay:
                if (NC.App.Opstate is LMDAQ.DAQControl.AssayState)
                {
                    LMDAQ.DAQControl.AssayState a = LMDAQ.DAQControl.CurState;
                    State = a.State;
                }
                CurrentRepetition    = NC.App.Opstate.Measurement.CurrentRepetition;
                RequestedRepetitions = NC.App.Opstate.Measurement.RequestedRepetitions;
                break;
            }
        }
        static public UdpCmdPacket ParsePacket(string jsonStr)
        {
            var          pkt = JsonConvert.DeserializeObject <UdpCmdPacket>(jsonStr);
            UdpCmdPacket ret;

            switch (pkt.DocType)
            {
            case DocTypes.OperatingState:
                ret = OperatingState.Parse(jsonStr);
                return(ret);

            case DocTypes.DirectoryBusGreeting:
                ret = DirectoryBusGreeting.Parse(jsonStr);
                return(ret);

            case DocTypes.RigBusInfo:
                ret = RigBusInfo.Parse(jsonStr);
                return(ret);

            case DocTypes.DataBusInfo:
                ret = DataBusInfo.Parse(jsonStr);
                return(ret);

            case DocTypes.ActiveBuses:
                ret = ActiveBuses.Parse(jsonStr);
                return(ret);
            }
            return(null);
        }
Beispiel #3
0
        public void SetRigOptState(OperatingState state)
        {
            var newState = new RigStatePacket();

            newState.FromOperatingState(state);
            SetRigState(0, newState);
        }
Beispiel #4
0
 public void FromOperatingState(OperatingState optState)
 {
     Freq  = Convert.ToInt32(optState.Freq);
     FreqA = Convert.ToInt32(optState.FreqA);
     FreqB = Convert.ToInt32(optState.FreqB);
     Mode  = optState.Mode;
     Vfo   = optState.Vfo;
     Xit   = optState.Xit;
     Split = optState.Split;
     Rit   = optState.Rit;
 }
 public override void SetEntity(MaintenanceObject entity)
 {
     Id                    = entity.Id;
     GroupId               = entity.Group.Id;
     TechIndex             = entity.TechIndex;
     DepartmentId          = entity.Plant?.Department?.Id;
     PlantId               = entity.Plant?.Id;
     Site                  = entity.Site;
     Period                = entity.Report?.Period?.period;
     CurrentOperatingState = entity.CurrentOperatingState ?? OperatingState.Operating;
     UsageFromStartup      = entity.UsageFromStartup;
 }
Beispiel #6
0
 public MotorDevice(string model, Function function, Bar bar, byte canId, NmtState nmtState,
                    OperatingState operatingState, OperatingMode operatingMode, string error)
 {
     Model          = model;
     Function       = function;
     Bar            = bar;
     CanId          = canId;
     NmtState       = nmtState;
     OperatingState = operatingState;
     OperatingMode  = operatingMode;
     Error          = error;
 }
Beispiel #7
0
 /// <summary>
 /// Изменить рабочее состояние объекта ремонта
 /// </summary>
 /// <param name="state">Рабочее состояние</param>
 /// <param name="startDate">Дата изменения состояния</param>
 public void ChangeOperatingState(OperatingState state, DateTime startDate)
 {
     if (CurrentOperatingState != state)
     {
         CurrentOperatingState = state;
         states.Add(new ObjectOperatingState
         {
             State     = state,
             Object    = this,
             StartDate = startDate
         });
     }
 }
Beispiel #8
0
        protected HttpResponseMessage toListJson <T>(PageList <T> list, OperatingState opstate, string message)
        {
            JsonListResponse response = new JsonListResponse
            {
                Message    = message,
                State      = opstate,
                PageIndex  = list.PageIndex,
                PageSize   = list.PageSize,
                TotalCount = list.TotalCount,
                TotalPages = list.TotalPages,
                DataModel  = list.Data
            };

            return(toJsonbase(response));
        }
Beispiel #9
0
        public AnalysisDefs.Measurement Measurement; // just a virtual pointer, not a frozen snapshot, be careful using this during proessing, the root of all that is good and evil


        // system snapshot only
        public MeasurementStatus()
        {
            // system operational state is already on NC.App.Opstate, this makes a copy
            action = NC.App.Opstate.Action;
            opstate = NC.App.Opstate.SOH;
            start = NC.App.Opstate.start;

            switch (NC.App.Opstate.Action)
            {
                case NCCAction.Nothing:
                case NCCAction.Prompt:
                case NCCAction.Maintenance:
                case NCCAction.Analysis:
                    // nothing more right now
                    break;
                case NCCAction.Discover:
                case NCCAction.HVCalibration:
                case NCCAction.Assay:
                    if (NC.App.Opstate is LMDAQ.DAQControl.AssayState)
                    {
                        LMDAQ.DAQControl.AssayState a = LMDAQ.DAQControl.CurState;
                        State = a.State;
                    }
                    CurrentRepetition = NC.App.Opstate.Measurement.CurrentRepetition;
                    RequestedRepetitions = NC.App.Opstate.Measurement.RequestedRepetitions;
                    break;
            }
        }
 public override void SetEntity(ObjectOperatingState entity)
 {
     Id        = entity.Id;
     StartDate = entity.StartDate;
     State     = entity.State;
 }
Beispiel #11
0
        protected HttpResponseMessage toJson(object data, OperatingState opstate, string message)
        {
            var response = new JsonResponse(opstate, message, data);

            return(toJsonbase(response));
        }
Beispiel #12
0
        private void UpdateUserSetting(bool powerOnFlag, bool powerOffFlag, UserSetting newSetting)
        {
            switch (state)
            {
            case OperatingState.STATE_OFF:
                if (powerOnFlag)
                {
                    state = OperatingState.STATE_POWERING_UP;
                }

                break;

            case OperatingState.STATE_POWERING_UP:
                if (CheckSettingConsistency(newSetting))
                {
                    cmdQueue.Enqueue(POWER_ON_CMD);
                }

                if (receivedSetting.On)
                {
                    state = OperatingState.STATE_ON;
                }

                break;

            case OperatingState.STATE_ON:
                if (powerOffFlag)
                {
                    cmdQueue.Enqueue(POWER_OFF_CMD);
                }

                if (!receivedSetting.On)
                {
                    state = OperatingState.STATE_OFF;
                }

                break;
            }

            if (newSetting.PowerLevel != userSetting.PowerLevel)
            {
                cmdQueue.Enqueue(PowerLevelCmd(newSetting.PowerLevel));
                userSetting.PowerLevel = newSetting.PowerLevel;
            }

            if (newSetting.DutyCycle != userSetting.DutyCycle)
            {
                cmdQueue.Enqueue(DutyCycleCmd(newSetting.DutyCycle));
                userSetting.DutyCycle = newSetting.DutyCycle;
            }

            if (newSetting.PulseTime != userSetting.PulseTime)
            {
                cmdQueue.Enqueue(PulseTimeCmd(newSetting.PulseTime));
                userSetting.PulseTime = newSetting.PulseTime;
            }

            if (newSetting.PulseSpacing != userSetting.PulseSpacing)
            {
                cmdQueue.Enqueue(PulseSpacingCmd(newSetting.PulseSpacing));
                userSetting.PulseSpacing = newSetting.PulseSpacing;
            }
        }