Exemplo n.º 1
0
        void ParseProfile(string profile)
        {
            IPAddress          ip;
            AN6UControlChannel cc;
            XElement           xdata = XElement.Parse(profile);

            //int baseChCount;
            //int additionalChCount;

            foreach (XElement xel in xdata.Elements())
            {
                if (xel.Name == "IPAddress")
                {
                    IPAddress.TryParse(xel.Attribute("Value").Value, out ip);
                    _ipAddress = ip;
                    //baseChCount = int.Parse(xel.Attribute("ChCount").Value);
                    continue;
                }

                if (xel.Name == "VirtualIP")
                {
                    IPAddress.TryParse(xel.Attribute("Value").Value, out ip);
                    _virtualIP = ip;
                    //additionalChCount = int.Parse(xel.Attribute("ChCount").Value);
                }
            }
            if (Id == 0)
            {
                for (int i = 0; i < 4; i++)
                {
                    cc = new AN6UControlChannel();
                    //cc.Profile = "<Params IP = \"2.0.0.2\" ChNum = \"2\" Port = \"0\"/>";
                    cc.IPAddress = IPAddress;
                    //string s = cc.Profile;
                    cc.PortNo       = i;
                    cc.ChannelNo    = i;
                    cc.ControlSpace = ControlSpace;
                    cc.Partition    = Partition;
                    ControlChannels.Add(cc);
                }
                for (int i = 4; i < 6; i++)
                {
                    cc              = new AN6UControlChannel();
                    cc.IPAddress    = VirtualIP;
                    cc.PortNo       = i;
                    cc.ChannelNo    = i;
                    cc.ControlSpace = ControlSpace;
                    cc.Partition    = Partition;
                    ControlChannels.Add(cc);
                }
            }
        }
Exemplo n.º 2
0
 void CalculateAndSendMoveControl(ControlChannels channel, int distance, bool isRelative)
 {
     if (distance != 0)
     {
         long duration = 0;
         bool positive = true;
         if (isRelative)
         {
             duration = CalculateRunDuration(channel, Math.Abs(distance));
             positive = distance > 0;
         }
         else
         {
             System.Diagnostics.Debug.Assert(false, "Only relative positioning currently supported");
         }
         var commands = _channelCommands[channel];
         SendMoveControl(positive ? commands.PositiveStartCommand : commands.NegativeStartCommand, commands.StopCommand, duration);
     }
 }
Exemplo n.º 3
0
        void ParseProfile(string profile)
        {
            PointTypeEnum pt    = PointTypeEnum.W;
            XElement      xdata = XElement.Parse(profile);

            if (xdata.Attribute("Model") != null)
            {
                Model = xdata.Attribute("Model").Value;
            }
            HaveDimmer = bool.Parse(xdata.Attribute("HaveDimmer").Value);
            if (xdata.Attribute("Name") != null)
            {
                Name = xdata.Attribute("Name").Value;
            }
            Enum.TryParse(xdata.Attribute("PointType").Value, out pt);
            PointType = pt;
            if (Id == 0)
            {
                ControlChannels.Add(new NLPowerChannel()
                {
                    HaveDimmer = HaveDimmer, PointType = PointType
                });
            }
        }
Exemplo n.º 4
0
 protected long CalculateRunDuration(ControlChannels channel, int distance)
 {
     return((long)(distance * StandardSpeed * _channelFactors[channel]));
 }