namespace Tinkerforge
{
    public static class EIMU
    {
        public static (short Roll, short Pitch, short Yaw) GetOrientation(this BrickIMU imu)
        {
            imu.GetOrientation(out short roll, out short pitch, out short yaw);
            return (roll, pitch, yaw);           
        }

        public static (float X, float Y, float Z, float W) GetQuaternion(this BrickIMU imu)
        {
            imu.GetQuaternion(out float x, out float y, out float z, out float w);
            return (x, y, z, w);
        }

        public static (short X, short Y, short Z) GetAcceleration(this BrickIMU imu)
        {
            imu.GetAcceleration(out short x, out short y, out short z);
            return (x, y, z);
        }

        public static (short X, short Y, short Z) GetMagneticField(this BrickIMU imu)
        {
            imu.GetMagneticField(out short x, out short y, out short z);
            return (x, y, z);
        }

        public static (short X, short Y, short Z) GetAngularVelocity(this BrickIMU imu)
        {
            imu.GetAngularVelocity(out short x, out short y, out short z);
            return (x, y, z);
        }

        public static (short AccelerationX, short AccelerationY, short AccelerationZ, short MagneticX, short MagneticY,
            short MagneticZ, short AngularX, short AngularY, short AngularZ, short Temperature) GetAllData(
                this BrickIMU imu)
        {
            imu.GetAllData(out short accX, out short accY, out short accZ, out short magX, out short magY,
                out short magZ, out short angX, out short angY, out short angZ, out short temperature);
            return (accX, accY, accZ, magX, magY, magZ, angX, angY, angZ, temperature);
        }

        public static (char Port, byte ProtocolVersion, byte[] FirmwareVersion, string Name) GetProtocol1BrickletName(
            this BrickIMU imu, char port)
        {
            imu.GetProtocol1BrickletName(port, out byte protocolVersion, out byte[] firmwareVersion, out string name);
            return (port, protocolVersion, firmwareVersion, name);
        }


    }
}
