/// <summary>
 /// Class constructor. Instantiates a new <see cref="XBeeSettingNumber"/> object with the
 /// provided parameters.
 /// </summary>
 /// <param name="name">Name of the setting.</param>
 /// <param name="description">Description of the setting.</param>
 /// <param name="defaultValue">Default value of the setting.</param>
 /// <param name="category">Parent category of the setting.</param>
 /// <param name="ownerFirmware">XBee firmware the setting belongs to.</param>
 /// <param name="numNetworks">The number of networks the setting can be configured for.</param>
 /// <seealso cref="XBeeCategory"/>
 /// <seealso cref="XBeeFirmware"/>
 public XBeeSettingNumber(string name, string description, string defaultValue,
                          XBeeCategory category, XBeeFirmware ownerFirmware, int numNetworks)
     : base(name, description, defaultValue, category, ownerFirmware, numNetworks)
 {
     Type = TYPE_NUMBER;
     ReFormatDefaultValue();
 }
Exemple #2
0
        /// <summary>
        /// Clones and returns the XBee firmware object.
        /// </summary>
        /// <returns>The cloned XBee firmware object.</returns>
        public XBeeFirmware CloneFirmware()
        {
            // Verify if the firmware needs to fill its contents.
            if (!Initialized)
            {
                try
                {
                    FillContents();
                }
                catch (ParsingException e)
                {
                    logger.Error(e.Message, e);
                }
            }

            XBeeFirmware clonedFirmware = (XBeeFirmware)Clone();

            // Clone the categories and set them to the cloned firmware.
            List <XBeeCategory> clonedCategories = new List <XBeeCategory>();

            foreach (XBeeCategory category in Categories)
            {
                clonedCategories.Add(category.CloneCategory(null, clonedFirmware));
            }
            clonedFirmware.Categories = clonedCategories;

            return(clonedFirmware);
        }
Exemple #3
0
 /// <summary>
 /// Class constructor. Instantiates a new <see cref="XBeeCategory"/> with the provided parameters.
 /// </summary>
 /// <param name="name">Name of the category.</param>
 /// <param name="description">Description of the category.</param>
 /// <param name="parentCategory">Parent category.</param>
 /// <param name="ownerFirmware">XBee firmware the category belongs to.</param>
 /// <seealso cref="XBeeFirmware"/>
 public XBeeCategory(string name, string description, XBeeCategory parentCategory, XBeeFirmware ownerFirmware)
 {
     Name           = name;
     Description    = description;
     ParentCategory = parentCategory;
     OwnerFirmware  = ownerFirmware;
 }
Exemple #4
0
        /// <summary>
        /// Clones and returns the XBee category object.
        /// </summary>
        /// <param name="parentCategory">The parent category where the cloned category should be placed.</param>
        /// <param name="ownerFirmware">The owner firmware of the cloned category.</param>
        /// <returns>The cloned XBee category object.</returns>
        public XBeeCategory CloneCategory(XBeeCategory parentCategory, XBeeFirmware ownerFirmware)
        {
            XBeeCategory clonedCategory = (XBeeCategory)Clone();

            clonedCategory.ParentCategory = parentCategory;
            clonedCategory.OwnerFirmware  = ownerFirmware;

            // Clone the settings and add them to the cloned category.
            List <AbstractXBeeSetting> clonedSettings = new List <AbstractXBeeSetting>();

            foreach (AbstractXBeeSetting setting in Settings)
            {
                clonedSettings.Add(setting.CloneSetting(clonedCategory, ownerFirmware));
            }
            clonedCategory.Settings = clonedSettings;

            // Clone the categories and add them to the cloned category.
            List <XBeeCategory> clonedCategories = new List <XBeeCategory>();

            foreach (XBeeCategory category in Categories)
            {
                clonedCategories.Add(category.CloneCategory(clonedCategory, ownerFirmware));
            }
            clonedCategory.Categories = clonedCategories;

            return(clonedCategory);
        }
 /// <summary>
 /// Class constructor. Instantiates a new <see cref="XBeeSettingCombo"/> object with the
 /// provided parameters.
 /// </summary>
 /// <param name="atCommand">The AT command corresponding to the setting.</param>
 /// <param name="name">Name of the setting.</param>
 /// <param name="description">Description of the setting.</param>
 /// <param name="defaultValue">Default value of the setting.</param>
 /// <param name="category">Parent category of the setting.</param>
 /// <param name="ownerFirmware">XBee firmware the setting belongs to.</param>
 /// <param name="numNetworks">The number of networks the setting can be configured for.</param>
 /// <seealso cref="XBeeCategory"/>
 /// <seealso cref="XBeeFirmware"/>
 public XBeeSettingCombo(string atCommand, string name, string description,
                         string defaultValue, XBeeCategory category, XBeeFirmware ownerFirmware, int numNetworks)
     : base(atCommand, name, description, defaultValue, category, ownerFirmware, numNetworks)
 {
     Type = TYPE_COMBO;
     if (DefaultValue.ToLower().StartsWith("0x"))
     {
         DefaultValue = DefaultValue.Substring(2);
     }
 }
        /// <summary>
        /// Clones and returns the setting object.
        /// </summary>
        /// <param name="parentCategory">The parent category where the cloned setting should be placed.</param>
        /// <param name="ownerFirmware">The owner firmware of the cloned setting.</param>
        /// <returns>The cloned setting object.</returns>
        /// <seealso cref="AbstractXBeeDevice"/>
        public new AbstractXBeeSetting CloneSetting(XBeeCategory parentCategory, XBeeFirmware ownerFirmware)
        {
            XBeeSettingText clonedSetting = (XBeeSettingText)base.CloneSetting(parentCategory, ownerFirmware);

            // Clone the attributes of this object.
            clonedSetting.MinChars       = MinChars;
            clonedSetting.MaxChars       = MaxChars;
            clonedSetting.Format         = Format;
            clonedSetting.ExceptionValue = ExceptionValue;

            return(clonedSetting);
        }
        /// <summary>
        /// Clones and returns the setting object.
        /// </summary>
        /// <param name="parentCategory">The parent category where the cloned setting should be placed.</param>
        /// <param name="ownerFirmware">The owner firmware of the cloned setting.</param>
        /// <returns>The cloned setting object.</returns>
        /// <seealso cref="AbstractXBeeSetting"/>
        public new AbstractXBeeSetting CloneSetting(XBeeCategory parentCategory, XBeeFirmware ownerFirmware)
        {
            XBeeSettingNumber clonedSetting = (XBeeSettingNumber)base.CloneSetting(parentCategory, ownerFirmware);

            // Clone the list of items and set it to the cloned setting.
            List <string> clonedAdditionalValues = new List <string>();

            clonedAdditionalValues.AddRange(AdditionalValues);
            clonedSetting.AdditionalValues = clonedAdditionalValues;

            return(clonedSetting);
        }
        /// <summary>
        /// Clones and returns the setting object.
        /// </summary>
        /// <param name="parentCategory">The parent category where the cloned setting should be placed.</param>
        /// <param name="ownerFirmware">The owner firmware of the cloned setting.</param>
        /// <returns>The cloned setting object.</returns>
        /// <seealso cref="AbstractXBeeSetting"/>
        public new AbstractXBeeSetting CloneSetting(XBeeCategory parentCategory, XBeeFirmware ownerFirmware)
        {
            XBeeSettingCombo clonedSetting = (XBeeSettingCombo)base.CloneSetting(parentCategory, ownerFirmware);

            // Clone the list of items and set it to the cloned setting.
            List <string> clonedItems = new List <string>();

            clonedItems.AddRange(Items);
            clonedSetting.Items = clonedItems;

            return(clonedSetting);
        }
        /// <summary>
        /// Clones and returns the setting object.
        /// </summary>
        /// <param name="parentCategory">The parent category where the cloned setting should be placed.</param>
        /// <param name="ownerFirmware">The owner firmware of the cloned setting.</param>
        /// <returns>The cloned setting object.</returns>
        public AbstractXBeeSetting CloneSetting(XBeeCategory parentCategory, XBeeFirmware ownerFirmware)
        {
            AbstractXBeeSetting clonedSetting = (AbstractXBeeSetting)Clone();

            clonedSetting.ParentCategory = parentCategory;
            clonedSetting.OwnerFirmware  = ownerFirmware;

            // Clone the list of current values.
            List <string> clonedCurrentValues = new List <string>();

            clonedCurrentValues.AddRange(CurrentValues);
            clonedSetting.CurrentValues = clonedCurrentValues;

            // Clone the list of XBee values.
            List <string> clonedXBeeValues = new List <string>();

            clonedXBeeValues.AddRange(XBeeValues);
            clonedSetting.XBeeValues = clonedXBeeValues;

            return(clonedSetting);
        }
        /// <summary>
        /// Class constructor. Instantiates a new <see cref="AbstractXBeeSetting"/> object with the
        /// provided parameters.
        /// </summary>
        /// <param name="atCommand">The AT command corresponding to the setting.</param>
        /// <param name="name">Name of the setting.</param>
        /// <param name="description">Description of the setting.</param>
        /// <param name="defaultValue">Default value of the setting.</param>
        /// <param name="parentCategory">Parent category of the setting.</param>
        /// <param name="ownerFirmware">XBee firmware the setting belongs to.</param>
        /// <param name="numNetworks">The number of networks the setting can be configured for.</param>
        protected AbstractXBeeSetting(string atCommand, string name, string description, string defaultValue,
                                      XBeeCategory parentCategory, XBeeFirmware ownerFirmware, int numNetworks)
        {
            AtCommand      = atCommand;
            Name           = name;
            Description    = description;
            DefaultValue   = defaultValue;
            ParentCategory = parentCategory;
            OwnerFirmware  = ownerFirmware;
            NumNetworks    = numNetworks;

            // Fill values with default value.
            for (int i = 0; i < numNetworks; i++)
            {
                CurrentValues.Add(defaultValue);
            }

            // Fill XBee values with default value.
            for (int i = 0; i < numNetworks; i++)
            {
                XBeeValues.Add(defaultValue);
            }
        }
 /// <summary>
 /// Class constructor. Instantiates a new <see cref="XBeeSettingText"/> object with the
 /// provided parameters.
 /// </summary>
 /// <param name="atCommand">The AT command corresponding to the setting.</param>
 /// <param name="name">Name of the setting.</param>
 /// <param name="description">Description of the setting.</param>
 /// <param name="defaultValue">Default value of the setting.</param>
 /// <param name="category">Parent category of the setting.</param>
 /// <param name="ownerFirmware">XBee firmware the setting belongs to.</param>
 /// <seealso cref="XBeeCategory"/>
 /// <seealso cref="XBeeFirmware"/>
 public XBeeSettingText(string atCommand, string name, string description,
                        string defaultValue, XBeeCategory category, XBeeFirmware ownerFirmware)
     : base(atCommand, name, description, defaultValue, category, ownerFirmware, 1)
 {
 }
 /// <summary>
 /// Class constructor. Instantiates a new <see cref="XBeeSettingText"/> object with the
 /// provided parameters.
 /// </summary>
 /// <param name="name">Name of the setting.</param>
 /// <param name="description">Description of the setting.</param>
 /// <param name="defaultValue">Default value of the setting.</param>
 /// <param name="category">Parent category of the setting.</param>
 /// <param name="ownerFirmware">XBee firmware the setting belongs to.</param>
 /// <param name="numNetworks">The number of networks the setting can be configured for.</param>
 /// <seealso cref="XBeeCategory"/>
 /// <seealso cref="XBeeFirmware"/>
 public XBeeSettingText(string name, string description, string defaultValue,
                        XBeeCategory category, XBeeFirmware ownerFirmware, int numNetworks)
     : base(name, description, defaultValue, category, ownerFirmware, numNetworks)
 {
     Type = TYPE_TEXT;
 }
 /// <summary>
 /// Class constructor. Instantiates a new <see cref="XBeeSettingText"/> object with the
 /// provided parameters.
 /// </summary>
 /// <param name="name">Name of the setting.</param>
 /// <param name="description">Description of the setting.</param>
 /// <param name="defaultValue">Default value of the setting.</param>
 /// <param name="category">Parent category of the setting.</param>
 /// <param name="ownerFirmware">XBee firmware the setting belongs to.</param>
 /// <seealso cref="XBeeCategory"/>
 /// <seealso cref="XBeeFirmware"/>
 public XBeeSettingText(string name, string description, string defaultValue,
                        XBeeCategory category, XBeeFirmware ownerFirmware)
     : this(name, description, defaultValue, category, ownerFirmware, 1)
 {
 }
 /// <summary>
 /// Class constructor. Instantiates a new <see cref="AbstractXBeeSetting"/> object with the
 /// provided parameters.
 /// </summary>
 /// <param name="atCommand">The AT command corresponding to the setting.</param>
 /// <param name="name">Name of the setting.</param>
 /// <param name="description">Description of the setting.</param>
 /// <param name="defaultValue">Default value of the setting.</param>
 /// <param name="parentCategory">Parent category of the setting.</param>
 /// <param name="ownerFirmware">XBee firmware the setting belongs to.</param>
 protected AbstractXBeeSetting(string atCommand, string name, string description,
                               string defaultValue, XBeeCategory parentCategory, XBeeFirmware ownerFirmware)
     : this(atCommand, name, description, defaultValue, parentCategory, ownerFirmware, 1)
 {
 }
 /// <summary>
 /// Class constructor. Instantiates a new <see cref="AbstractXBeeSetting"/> object with the
 /// provided parameters.
 /// </summary>
 /// <param name="name">Name of the setting.</param>
 /// <param name="description">Description of the setting.</param>
 /// <param name="defaultValue">Default value of the setting.</param>
 /// <param name="parentCategory">Parent category of the setting.</param>
 /// <param name="ownerFirmware">XBee firmware the setting belongs to.</param>
 /// <param name="numNetworks">The number of networks the setting can be configured for.</param>
 protected AbstractXBeeSetting(string name, string description, string defaultValue,
                               XBeeCategory parentCategory, XBeeFirmware ownerFirmware, int numNetworks)
     : this(null, name, description, defaultValue, parentCategory, ownerFirmware, numNetworks)
 {
 }