Пример #1
0
        private bool StatusChecker(CRTPStatus status)
        {
            if (StatusEvent != null)
                StatusEvent(this, new EventArgs<CRTPStatus>(status));

            if (status.AcknowledgeRecieved) return false;

            if (ErrorEvent != null)
                ErrorEvent(this, new EventArgs<CrazyError>(CrazyError.AcknowledgeError));

            return true;
        }
Пример #2
0
        public CRTPResponse(byte[] data)
        {
            //First byte is status part
            Status = new CRTPStatus(data[0]);

            if(data.Length < 2)
            {
                Header = new CRTPHeader(0,15);
                Data = new byte[0];
                return;
            }

            //Second byte is an CRTPHeader
            Header = new CRTPHeader(data[1]);

            //data is rest of the array
            Data = new byte[data.Length - 2];

            Array.Copy(data, 2, Data, 0, Data.Length);
        }