コード例 #1
0
        public static int DSGetNextData(ref DtuDataStruct pDataStruct, ushort waitseconds)
        {
            if (IsRunning)
            {
                if (DataQueue.Count == 0)
                {
                    return(0);
                }

                //解析协议
                var frame = new byte[0];
                lock (m_lock)
                {
                    frame = DataQueue[0];
                    DataQueue.RemoveAt(0);
                }

                var result = ExtractFrame(ref frame);

                if (!result)
                {
                    return(0);
                }

                pDataStruct.m_data_buf = frame;
                pDataStruct.m_data_len = BitConverter.GetBytes(frame.Length);
                pDataStruct.m_phoneno  = BitConverter.GetBytes(13300000000);
                pDataStruct.m_dtuId    = BitConverter.GetBytes(1953719668);
                return(1);
            }
            return(1);
        }
コード例 #2
0
        public int GetNextData(ref IDataStruct pDataStruct, ushort waitseconds)
        {
            var datastruct = new DtuDataStruct();
            var result     = DTUSimWrapper.DSGetNextData(ref datastruct, waitseconds);

            if (pDataStruct == null)
            {
                pDataStruct = new DataStruct();
            }

            pDataStruct.Id          = datastruct.m_dtuId;
            pDataStruct.DataBuff    = datastruct.m_data_buf;
            pDataStruct.DataLength  = datastruct.m_data_len;
            pDataStruct.DataType    = datastruct.m_data_type;
            pDataStruct.ReceiveTime = datastruct.m_recv_time;

            return(result);
        }