示例#1
0
        string print_general_status(uint status)
        {
            string status_string = " ";

            Console.Write(" ");

            // General status codes
            if (status == BeagleApi.BG_READ_OK)
            {
                status_string += ("OK");
            }

            if (status != 0)
            {
                buffer_available = BeagleApi.bg_host_buffer_used(handle);
                status_string   += "(" + buffer_available + ":" + BeagleApi.bg_host_buffer_size(handle, 0) + ")";
            }
            if ((status & BeagleApi.BG_READ_TIMEOUT) != 0)
            {
                status_string += ("TIMEOUT ");
            }

            if ((status & BeagleApi.BG_READ_ERR_MIDDLE_OF_PACKET) != 0)
            {
                status_string += ("MIDDLE ");
            }

            if ((status & BeagleApi.BG_READ_ERR_SHORT_BUFFER) != 0)
            {
                status_string += ("SHORT BUFFER ");
            }

            if ((status & BeagleApi.BG_READ_ERR_PARTIAL_LAST_BYTE) != 0)
            {
                status_string += string.Format("PARTIAL_BYTE(bit {0:d}) ", status & 0xff);
            }

            return(status_string);
        }