public Device(XElement device, XElement scales)
        {
            try
            {
                XElement limitXElmnt = device.Descendants("tumbler").FirstOrDefault(el => el.Attribute("name")?.Value == "limit");
                XElement typeXElmnt  = device.Descendants("tumbler").FirstOrDefault(el => el.Attribute("name")?.Value == "type");

                DeviceType = device.Attribute("type").Value;

                TLimit = new TLimit(limitXElmnt);
                TType  = new TType(typeXElmnt);

                Scales = new List <Scale>();
                var ss = scales.Descendants("scale");
                foreach (XElement item in ss)
                {
                    XElement sc = device.Descendants("scale").FirstOrDefault(el => el.Attribute("type")?.Value == item.Attribute("type")?.Value);
                    Scales.Add(new Scale(sc, item));
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Device type: {0}.", DeviceType);
            }
        }
 public string SetLimit(string msg)
 {
     try
     {
         Group = TLimit.GetGroup(msg);
         Limit = TLimit.GetValue(msg);
         return(TLimit.GetAngle(msg));
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Set limit: {0}.", msg);
         return(string.Empty);
     }
 }