示例#1
0
        private async Task <string> GetObjectName(TmAddr tmAddr)
        {
            if (tmAddr == null || tmAddr.Type == TmType.Unknown)
            {
                return("");
            }
            const int bufSize = 1024;
            var       buf     = new byte[bufSize];

            await Task.Run(() => _native.TmcDntGetObjectName(_cid,
                                                             (ushort)tmAddr.Type.ToNativeType(),
                                                             (short)tmAddr.Ch,
                                                             (short)tmAddr.Rtu,
                                                             (short)tmAddr.Point,
                                                             ref buf,
                                                             bufSize))
            .ConfigureAwait(false);

            return(EncodingUtil.Win1251BytesToUtf8(buf));
        }