GetAccess() public method

Returns is attribute read only.
public GetAccess ( int index ) : AccessMode
index int Attribute index.
return AccessMode
Ejemplo n.º 1
26
 void UpdateObject(GXDLMSObject it, GXDLMSCategory item)
 {
     item.ShortName = (UInt16)it.ShortName;
     item.LogicalName = it.LogicalName;
     if (it.ShortName != 0)
     {
         item.Name = string.Format("0x{0} {1} {2}", it.ShortName.ToString("X4"), it.LogicalName, it.Description);
     }
     else
     {
         item.Name = it.LogicalName + " " + it.Description;
     }
     //Update description.
     item.Description = it.Description;
     //Update atribute index.
     for (int pos = 2; pos != (it as IGXDLMSBase).GetAttributeCount() + 1; ++pos)
     {
         string name = (it as IGXDLMSBase).GetNames()[pos - 1];
         object value = it.GetValues()[pos - 1];
         GXDLMSProperty prop;
         if (((pos == 2 || pos == 3) && it.ObjectType == ObjectType.DemandRegister) || 
             (pos == 2 && it.ObjectType == ObjectType.ExtendedRegister))
         {
             prop = new GXDLMSRegister();
             prop.ObjectType = it.ObjectType;
             prop.LogicalName = it.LogicalName;
             prop.ShortName = it.ShortName;
             prop.Name = name;
             prop.AttributeOrdinal = pos;
         }
         else
         {
             prop = new GXDLMSProperty(it.ObjectType, it.LogicalName, it.ShortName, name, pos);
         }
         item.Properties.Add(prop);
         prop.DLMSType = it.GetDataType(pos);
         //Update scaler and unit.
         if ((pos == 4 && it.ObjectType == ObjectType.DemandRegister) ||
             (pos == 3 && it.ObjectType == ObjectType.ExtendedRegister))
         {
             prop.ValueType = DataType.String;
         }
         else
         {
             if (value is Enum)
             {
                 prop.ForcePresetValues = true;
                 foreach (object val in Enum.GetValues(value.GetType()))
                 {
                     prop.Values.Add(new GXValueItem(val.ToString(), (int)val));
                 }
             }
             else
             {
                 prop.ValueType = it.GetUIDataType(pos);
                 if (prop.ValueType == DataType.None)
                 {
                     prop.ValueType = it.GetDataType(pos);
                 }
             }
         }
         prop.AccessMode = (Gurux.Device.AccessMode)it.GetAccess(pos);
     }            
 }
Ejemplo n.º 2
0
 public void UpdateValueItems(GXDLMSObject target, int index)
 {
     if (InvokeRequired)
     {
         this.BeginInvoke(new UpdateValueItemsEventHandler(UpdateValueItems), target, index);
     }
     else
     {
         GXDLMSAttributeSettings tmp = GXDLMSClient.GetAttributeInfo(target, index);
         if (tmp != null)
         {
             Items = tmp.Values;
         }
         else
         {
             Items = null;
         }
         if (this.Type == GXValueFieldType.TextBox)
         {
             this.Type = Items == null || Items.Count == 0 ? GXValueFieldType.TextBox : GXValueFieldType.CompoBox;
         }
         comboBox1.Items.Clear();
         if (Items != null)
         {
             foreach (GXObisValueItem it in Items)
             {
                 comboBox1.Items.Add(it.UIValue);
             }
         }
         ReadOnly = (target.GetAccess(index) & Gurux.DLMS.AccessMode.Write) == 0;
     }
 }
Ejemplo n.º 3
0
 void UpdateObject(GXDLMSObject it, GXDLMSProperty item, int index)
 {
     //Update name.
     item.AttributeOrdinal = index;
     item.ShortName = it.ShortName;
     item.LogicalName = it.LogicalName;
     if (it.ShortName != 0)
     {
         item.Name = string.Format("0x{0} {1} {2}", it.ShortName.ToString("X4"), it.LogicalName, it.Description);
     }
     else
     {
         item.Name = it.LogicalName + " " + it.Description;
     }                        
     //Update description.
     item.Description = it.Description;
     //Update access mode.
     item.DLMSType = it.GetDataType(index);
     if (item.DLMSType == DataType.Enum)
     {
         item.ForcePresetValues = true;
         object value = it.GetValues()[index - 1];
         foreach (object val in Enum.GetValues(value.GetType()))
         {
             item.Values.Add(new GXValueItem(val.ToString(), (int)val));
         }
     }
     else
     {
         item.ValueType = it.GetUIDataType(index);                
         if (item.ValueType == DataType.None)
         {
             item.ValueType = it.GetDataType(index);                    
         }
     }
     item.AccessMode = (Gurux.Device.AccessMode)it.GetAccess(index);
 }