示例#1
0
        /// <summary>
        /// Gets the received text asynchronous.
        /// </summary>
        /// <returns></returns>
        public async Task GetReceivedText_Async()
        {
            byte[] RxDataRaw, RxData;
            int    xLength;

            RxDataRaw = xSerialDevice.ReceiveData();
            if (RxDataRaw[0] != 0)
            {
                xLength = RxDataRaw.Length - 1;
                RxData  = new byte[RxDataRaw.Length - 1];
                for (int i = 0; i < xLength; i++)
                {
                    RxData[i] = RxDataRaw[i + 1];
                }
                RxText += System.Text.Encoding.ASCII.GetString(RxData);
            }
        }
示例#2
0
        public static void ReceiveWork(object target)
        {
            SerialPortProcessor my = target as SerialPortProcessor;

            my.ReceiveData();
        }