Exemple #1
0
        public override Enums.Response ProcessPacket(LightingConsole console, int type)
        {
            //Apply to SK
            SK sk = console.Stromkreise[Fixture];

            if (sk == null)
            {
                return(Enums.Response.BadCmd);
            }

            if (type == 160 /* SKMON_MLPAR_REMOVE */)
            {
                sk.Parameters.Clear();
                return(Enums.Response.OK);
            }

            // load MLCParams
            foreach (SelParData par in Parameters)
            {
                MlcParameter mlcParameter = console.MLCParameters.Find(x => x.Number == par.Parno);
                if (mlcParameter == null)
                {
                    MlcParameter parameter = new MlcParameter(par.Parno, Enums.SelRangeDisp.Normal, par.Parname);
                    console.MLCParameters.Add(parameter);

                    //get info (not loaded yet)
                    console.QueryAsync(new ParSelect(par.Parno)).ConfigureAwait(false);
                }
                else
                {
                    mlcParameter.Name = par.Parname;
                }
                MlParameter param = sk.Parameters.Find(inc => inc.ParNo == par.Parno);
                if (param != null)
                {
                    param.Value   = (par.Val16 & 0xff00) >> 8;
                    param.Display = par.Parval;
                    param.PalName = par.Palname;
                    param.Sk      = sk;
                }
                else
                {
                    param = new MlParameter(par.Parname, par.Parno, (par.Val16 & 0xff00) >> 8)
                    {
                        PalName = par.Palname,
                        Display = par.Parname,
                        Sk      = sk
                    };
                    sk.Parameters.Add(param);
                }
            }
            return(Enums.Response.OK);
        }
Exemple #2
0
        public override Enums.Response ProcessPacket(LightingConsole console, int type)
        {
            SK          sk    = console.Stromkreise[Fixture];
            MlParameter param = sk?.Parameters.Find(x => x.ParNo == Fixpar);

            if (param is null)
            {
                return(Enums.Response.BadCmd);
            }

            MlcParameter mlc = console.MLCParameters.Find(x => x.Number == Fixpar);

            //TODO remove?
#if DEBUG
            console.Logger?.Log(Count);
#endif

            // TODO inspection
            int i = 0;
            foreach (SelRangeData data in Arr)
            {
                param.Range      = (Start : data.Start, End : data.End);
                param.DefaultVal = data.DefaultVal;
                param.Flags      = data.Flags;
                param.Name       = data.Name;

                mlc.Range   = (start : data.Start, end : data.End);
                mlc.Default = data.DefaultVal;
                mlc.Flags   = data.Flags;
                mlc.Name    = data.Name;

                //increment par-pointer?
                i++;
                param = sk.Parameters.Find(x => x.ParNo == Fixpar + i);
            }
            return(Enums.Response.OK);
        }