namespace Tinkerforge
{
    public static class ECan
    {
        public static (bool Success, byte FrameType, long Identifier, byte[] Data, byte Length) ReadFrame(
            this BrickletCAN can)
        {
            can.ReadFrame(out bool success, out byte frameType, out long identifier, out byte[] data, out byte length);
            return (success, frameType, identifier, data, length);
        }

        public static (byte Mode, long Mask, long Filter1, long Filter2) GetReadFilter(this BrickletCAN can)
        {
            can.GetReadFilter(out byte mode, out long mask, out long filter1, out long filter2);
            return (mode, mask, filter1, filter2);
        }

        public static (byte WriteErrorLevel, byte ReadErrorLevel, bool TransceiverDisabled, long WriteTimeoutCount, long
            ReadRegisterOverflowCount, long ReadBufferOverflowCount) GetErrorLog(this BrickletCAN can)
        {
            can.GetErrorLog(out byte writeErrorLevel, out byte readErrorLevel, out bool transceiverDisabled,
                out long writeTimeoutCount, out long readRegisterOverflowCount, out long readBufferOverflowCount);
            return (writeErrorLevel, readErrorLevel, transceiverDisabled, writeTimeoutCount, readRegisterOverflowCount,
                readBufferOverflowCount);
        }
    }
}
