Beispiel #1
0
 internal TcAdsSymbolInfo(AdsParseSymbols symbolParser, TcAdsSymbolInfo parent, int subIndex)
 {
     if (symbolParser == null)
     {
         throw new ArgumentNullException("symbolParser");
     }
     id_counter++;
     this._id          = id_counter;
     this.symbolParser = symbolParser;
     this.parent       = parent;
     this.subIndex     = subIndex;
     this.subSymbols   = null;
 }
Beispiel #2
0
 internal TcAdsSymbolInfo(AdsParseSymbols symbolParser, TcAdsSymbolInfo parent, int subIndex, AdsSymbolEntry symbolEntry, TcAdsDataType typeEntry) : this(symbolParser, parent, subIndex)
 {
     if (symbolEntry == null)
     {
         throw new ArgumentNullException("symbolEntry");
     }
     this.indexGroup  = symbolEntry.indexGroup;
     this.indexOffset = symbolEntry.indexOffset;
     this.size        = symbolEntry.size;
     this.dataTypeId  = (AdsDatatypeId)symbolEntry.dataType;
     if (typeEntry != null)
     {
         this.typeEntryFlags = typeEntry.Flags;
     }
     if (this.typeEntryFlags.HasFlag(AdsDataTypeFlags.None | AdsDataTypeFlags.Static))
     {
         this.indexGroup  = 0xf019;
         this.indexOffset = 0;
     }
     this.flags        = symbolEntry.flags;
     this.instancePath = symbolEntry.name;
     this.shortName    = symbolEntry.name;
     this.typeName     = symbolEntry.type;
     this.comment      = symbolEntry.comment;
     this.dataType     = typeEntry;
     if (((symbolEntry.array != null) || (typeEntry == null)) || !typeEntry.IsArray)
     {
         this.arrayInfo = symbolEntry.array;
     }
     else
     {
         this.arrayInfo = typeEntry.Dimensions.ToArray();
         if (typeEntry.Size != this.size)
         {
             this.size = (uint)typeEntry.Size;
         }
     }
     if (symbolEntry.attributes != null)
     {
         this.attributes = new TypeAttributeCollection(symbolEntry.attributes).AsReadOnly();
     }
     else
     {
         this.attributes = null;
     }
 }
Beispiel #3
0
 internal TcAdsSymbolInfo(AdsParseSymbols symbolParser, TcAdsSymbolInfo parent, int subIndex, TcAdsDataType typeEntry) : this(symbolParser, parent, subIndex)
 {
     if (typeEntry == null)
     {
         throw new ArgumentNullException("typeEntry");
     }
     this.indexGroup     = (uint)parent.IndexGroup;
     this.indexOffset    = (uint)parent.IndexOffset;
     this.size           = (uint)typeEntry.Size;
     this.dataTypeId     = typeEntry.DataTypeId;
     this.typeEntryFlags = typeEntry.Flags;
     this.flags          = DataTypeFlagConverter.Convert(typeEntry.Flags);
     this.instancePath   = parent.Name;
     this.shortName      = parent.ShortName;
     this.typeName       = typeEntry.Name;
     this.comment        = typeEntry.Comment;
     this.dataType       = typeEntry;
     this.arrayInfo      = typeEntry.ArrayInfo;
     this.attributes     = typeEntry.Attributes;
 }
Beispiel #4
0
 private void onUploadSymbols()
 {
     using (new MethodTrace())
     {
         this._symbolParser  = null;
         this._isEnumerating = false;
         try
         {
             int timeout = this._adsClient.Timeout;
             this._adsClient.Timeout = 0x7530;
             try
             {
                 if (this._symbolInfo == null)
                 {
                     this._symbolInfo = this.readUploadInfo();
                 }
                 bool containsBaseTypes = this._symbolInfo.ContainsBaseTypes;
                 Module.Trace.TraceInformation(this._symbolInfo.Dump());
                 AdsStream symbolStream = new AdsStream(this._symbolInfo.SymbolsBlockSize);
                 this.readSymbols(symbolStream, this._symbolInfo, 0x10000);
                 Module.Trace.TraceInformation("Symbols uploaded successfully!");
                 AdsStream datatypeStream = new AdsStream(this._symbolInfo.DataTypesBlockSize);
                 this.readDataTypes(datatypeStream, this._symbolInfo, 0x10000);
                 Module.Trace.TraceInformation("DataTypes uploaded successfully!");
                 this._symbolParser = new AdsParseSymbols(this._symbolInfo.TargetPointerSize, this._symbolInfo.ContainsBaseTypes, this._symbolInfo.StringEncoding);
                 this._symbolParser.TypeResolveError += new EventHandler <DataTypeNameEventArgs>(this._symbolParser_ResolveError);
                 this._symbolParser.TypesGenerated   += new EventHandler <DataTypeEventArgs>(this._symbolParser_TypesGenerated);
                 this._symbolParser.Parse(symbolStream, datatypeStream, this._adsClient);
             }
             finally
             {
                 this._adsClient.Timeout = timeout;
             }
         }
         catch (Exception exception)
         {
             Module.Trace.TraceError(exception);
             throw;
         }
     }
 }
Beispiel #5
0
 internal TcAdsSymbolInfoCollection(TcAdsSymbolInfo owner)
 {
     this._owner        = owner;
     this._symbolParser = owner.symbolParser;
     this._count        = this._symbolParser.GetSubSymbolCount(owner);
 }
Beispiel #6
0
 internal TcAdsSymbolInfoCollection(AdsParseSymbols symbolParser)
 {
     this._owner        = null;
     this._symbolParser = symbolParser;
     this._count        = symbolParser.SymbolCount;
 }