Esempio n. 1
0
        /// <summary>
        /// Read the value from the handle returned by GetSymhandleByNameAsync
        /// </summary>
        /// <param name="varHandle">The handle returned by GetSymhandleByNameAsync</param>
        /// <returns>A byte[] with the value of the twincat variable</returns>
        public async Task <byte[]> ReadBytesAsync(uint varHandle, uint readLength)
        {
            AdsReadCommand adsCommand = new AdsReadCommand(0x0000F005, varHandle, readLength);
            var            result     = await adsCommand.RunAsync(this.ams);

            return(result.Data);
        }
Esempio n. 2
0
        public async Task <byte[]> ReadBytesQ_Async(uint offset, uint readLength)
        {
            AdsReadCommand adsCommand = new AdsReadCommand(0x0000F030, offset, readLength);
            var            result     = await adsCommand.RunAsync(this.ams);

            return(result.Data);
        }
Esempio n. 3
0
        public async Task <IList <IAdsSymhandle> > GetSymbolsAsync()
        {
            AdsReadCommand adsCommand = new AdsReadCommand(0x0000f00f, 0x000000, 0x30);
            var            result     = await adsCommand.RunAsync(ams);

            uint readLength = (uint)BitConverter.ToInt32(result.Data, 4);

            adsCommand = new AdsReadCommand(0x0000f00b, 0x000000, readLength);
            result     = await adsCommand.RunAsync(ams);

            var symbols = GetSymbolsFromBytes(result.Data);

            return(symbols);
        }