/* ***********************************************************
 * This file was automatically generated on 2016-02-10.      *
 *                                                           *
 * JavaScript Bindings Version 2.0.8                         *
 *                                                           *
 * If you have a bugfix for this file and want to commit it, *
 * please fix the bug in the generator. You can find a link  *
 * to the generators git repository on tinkerforge.com       *
 *************************************************************/

var Device = require('./Device');

BrickIMUV2.DEVICE_IDENTIFIER = 18;
BrickIMUV2.DEVICE_DISPLAY_NAME = 'IMU Brick 2.0';
BrickIMUV2.CALLBACK_ACCELERATION = 32;
BrickIMUV2.CALLBACK_MAGNETIC_FIELD = 33;
BrickIMUV2.CALLBACK_ANGULAR_VELOCITY = 34;
BrickIMUV2.CALLBACK_TEMPERATURE = 35;
BrickIMUV2.CALLBACK_LINEAR_ACCELERATION = 36;
BrickIMUV2.CALLBACK_GRAVITY_VECTOR = 37;
BrickIMUV2.CALLBACK_ORIENTATION = 38;
BrickIMUV2.CALLBACK_QUATERNION = 39;
BrickIMUV2.CALLBACK_ALL_DATA = 40;
BrickIMUV2.FUNCTION_GET_ACCELERATION = 1;
BrickIMUV2.FUNCTION_GET_MAGNETIC_FIELD = 2;
BrickIMUV2.FUNCTION_GET_ANGULAR_VELOCITY = 3;
BrickIMUV2.FUNCTION_GET_TEMPERATURE = 4;
BrickIMUV2.FUNCTION_GET_ORIENTATION = 5;
BrickIMUV2.FUNCTION_GET_LINEAR_ACCELERATION = 6;
BrickIMUV2.FUNCTION_GET_GRAVITY_VECTOR = 7;
BrickIMUV2.FUNCTION_GET_QUATERNION = 8;
BrickIMUV2.FUNCTION_GET_ALL_DATA = 9;
BrickIMUV2.FUNCTION_LEDS_ON = 10;
BrickIMUV2.FUNCTION_LEDS_OFF = 11;
BrickIMUV2.FUNCTION_ARE_LEDS_ON = 12;
BrickIMUV2.FUNCTION_SAVE_CALIBRATION = 13;
BrickIMUV2.FUNCTION_SET_ACCELERATION_PERIOD = 14;
BrickIMUV2.FUNCTION_GET_ACCELERATION_PERIOD = 15;
BrickIMUV2.FUNCTION_SET_MAGNETIC_FIELD_PERIOD = 16;
BrickIMUV2.FUNCTION_GET_MAGNETIC_FIELD_PERIOD = 17;
BrickIMUV2.FUNCTION_SET_ANGULAR_VELOCITY_PERIOD = 18;
BrickIMUV2.FUNCTION_GET_ANGULAR_VELOCITY_PERIOD = 19;
BrickIMUV2.FUNCTION_SET_TEMPERATURE_PERIOD = 20;
BrickIMUV2.FUNCTION_GET_TEMPERATURE_PERIOD = 21;
BrickIMUV2.FUNCTION_SET_ORIENTATION_PERIOD = 22;
BrickIMUV2.FUNCTION_GET_ORIENTATION_PERIOD = 23;
BrickIMUV2.FUNCTION_SET_LINEAR_ACCELERATION_PERIOD = 24;
BrickIMUV2.FUNCTION_GET_LINEAR_ACCELERATION_PERIOD = 25;
BrickIMUV2.FUNCTION_SET_GRAVITY_VECTOR_PERIOD = 26;
BrickIMUV2.FUNCTION_GET_GRAVITY_VECTOR_PERIOD = 27;
BrickIMUV2.FUNCTION_SET_QUATERNION_PERIOD = 28;
BrickIMUV2.FUNCTION_GET_QUATERNION_PERIOD = 29;
BrickIMUV2.FUNCTION_SET_ALL_DATA_PERIOD = 30;
BrickIMUV2.FUNCTION_GET_ALL_DATA_PERIOD = 31;
BrickIMUV2.FUNCTION_ENABLE_STATUS_LED = 238;
BrickIMUV2.FUNCTION_DISABLE_STATUS_LED = 239;
BrickIMUV2.FUNCTION_IS_STATUS_LED_ENABLED = 240;
BrickIMUV2.FUNCTION_GET_PROTOCOL1_BRICKLET_NAME = 241;
BrickIMUV2.FUNCTION_GET_CHIP_TEMPERATURE = 242;
BrickIMUV2.FUNCTION_RESET = 243;
BrickIMUV2.FUNCTION_GET_IDENTITY = 255;

function BrickIMUV2(uid, ipcon) {
	//Full fledged AHRS with 9 degrees of freedom

	/*
	Creates an object with the unique device ID *uid* and adds it to
	the IP Connection *ipcon*.
	*/
	Device.call(this, this, uid, ipcon);
	BrickIMUV2.prototype = Object.create(Device);
	this.responseExpected = {};
	this.callbackFormats = {};
	this.APIVersion = [2, 0, 0];
	this.responseExpected[BrickIMUV2.FUNCTION_GET_ACCELERATION] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_MAGNETIC_FIELD] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_ANGULAR_VELOCITY] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_TEMPERATURE] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_ORIENTATION] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_LINEAR_ACCELERATION] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_GRAVITY_VECTOR] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_QUATERNION] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_ALL_DATA] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_LEDS_ON] = Device.RESPONSE_EXPECTED_FALSE;
	this.responseExpected[BrickIMUV2.FUNCTION_LEDS_OFF] = Device.RESPONSE_EXPECTED_FALSE;
	this.responseExpected[BrickIMUV2.FUNCTION_ARE_LEDS_ON] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_SAVE_CALIBRATION] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_SET_ACCELERATION_PERIOD] = Device.RESPONSE_EXPECTED_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_ACCELERATION_PERIOD] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_SET_MAGNETIC_FIELD_PERIOD] = Device.RESPONSE_EXPECTED_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_MAGNETIC_FIELD_PERIOD] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_SET_ANGULAR_VELOCITY_PERIOD] = Device.RESPONSE_EXPECTED_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_ANGULAR_VELOCITY_PERIOD] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_SET_TEMPERATURE_PERIOD] = Device.RESPONSE_EXPECTED_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_TEMPERATURE_PERIOD] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_SET_ORIENTATION_PERIOD] = Device.RESPONSE_EXPECTED_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_ORIENTATION_PERIOD] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_SET_LINEAR_ACCELERATION_PERIOD] = Device.RESPONSE_EXPECTED_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_LINEAR_ACCELERATION_PERIOD] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_SET_GRAVITY_VECTOR_PERIOD] = Device.RESPONSE_EXPECTED_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_GRAVITY_VECTOR_PERIOD] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_SET_QUATERNION_PERIOD] = Device.RESPONSE_EXPECTED_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_QUATERNION_PERIOD] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_SET_ALL_DATA_PERIOD] = Device.RESPONSE_EXPECTED_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_ALL_DATA_PERIOD] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.CALLBACK_ACCELERATION] = Device.RESPONSE_EXPECTED_ALWAYS_FALSE;
	this.responseExpected[BrickIMUV2.CALLBACK_MAGNETIC_FIELD] = Device.RESPONSE_EXPECTED_ALWAYS_FALSE;
	this.responseExpected[BrickIMUV2.CALLBACK_ANGULAR_VELOCITY] = Device.RESPONSE_EXPECTED_ALWAYS_FALSE;
	this.responseExpected[BrickIMUV2.CALLBACK_TEMPERATURE] = Device.RESPONSE_EXPECTED_ALWAYS_FALSE;
	this.responseExpected[BrickIMUV2.CALLBACK_LINEAR_ACCELERATION] = Device.RESPONSE_EXPECTED_ALWAYS_FALSE;
	this.responseExpected[BrickIMUV2.CALLBACK_GRAVITY_VECTOR] = Device.RESPONSE_EXPECTED_ALWAYS_FALSE;
	this.responseExpected[BrickIMUV2.CALLBACK_ORIENTATION] = Device.RESPONSE_EXPECTED_ALWAYS_FALSE;
	this.responseExpected[BrickIMUV2.CALLBACK_QUATERNION] = Device.RESPONSE_EXPECTED_ALWAYS_FALSE;
	this.responseExpected[BrickIMUV2.CALLBACK_ALL_DATA] = Device.RESPONSE_EXPECTED_ALWAYS_FALSE;
	this.responseExpected[BrickIMUV2.FUNCTION_ENABLE_STATUS_LED] = Device.RESPONSE_EXPECTED_FALSE;
	this.responseExpected[BrickIMUV2.FUNCTION_DISABLE_STATUS_LED] = Device.RESPONSE_EXPECTED_FALSE;
	this.responseExpected[BrickIMUV2.FUNCTION_IS_STATUS_LED_ENABLED] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_PROTOCOL1_BRICKLET_NAME] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_CHIP_TEMPERATURE] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.responseExpected[BrickIMUV2.FUNCTION_RESET] = Device.RESPONSE_EXPECTED_FALSE;
	this.responseExpected[BrickIMUV2.FUNCTION_GET_IDENTITY] = Device.RESPONSE_EXPECTED_ALWAYS_TRUE;
	this.callbackFormats[BrickIMUV2.CALLBACK_ACCELERATION] = 'h h h';
	this.callbackFormats[BrickIMUV2.CALLBACK_MAGNETIC_FIELD] = 'h h h';
	this.callbackFormats[BrickIMUV2.CALLBACK_ANGULAR_VELOCITY] = 'h h h';
	this.callbackFormats[BrickIMUV2.CALLBACK_TEMPERATURE] = 'b';
	this.callbackFormats[BrickIMUV2.CALLBACK_LINEAR_ACCELERATION] = 'h h h';
	this.callbackFormats[BrickIMUV2.CALLBACK_GRAVITY_VECTOR] = 'h h h';
	this.callbackFormats[BrickIMUV2.CALLBACK_ORIENTATION] = 'h h h';
	this.callbackFormats[BrickIMUV2.CALLBACK_QUATERNION] = 'h h h h';
	this.callbackFormats[BrickIMUV2.CALLBACK_ALL_DATA] = 'h3 h3 h3 h3 h4 h3 h3 b B';

	this.getAcceleration = function(returnCallback, errorCallback) {
		/*
		Returns the calibrated acceleration from the accelerometer for the 
		x, y and z axis in 1/100 m/s².
		
		If you want to get the acceleration periodically, it is recommended 
		to use the callback :func:`Acceleration` and set the period with 
		:func:`SetAccelerationPeriod`.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_ACCELERATION, [], '', 'h h h', returnCallback, errorCallback);
	};
	this.getMagneticField = function(returnCallback, errorCallback) {
		/*
		Returns the calibrated magnetic field from the magnetometer for the 
		x, y and z axis in 1/16 µT (Microtesla).
		
		If you want to get the magnetic field periodically, it is recommended 
		to use the callback :func:`MagneticField` and set the period with 
		:func:`SetMagneticFieldPeriod`.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_MAGNETIC_FIELD, [], '', 'h h h', returnCallback, errorCallback);
	};
	this.getAngularVelocity = function(returnCallback, errorCallback) {
		/*
		Returns the calibrated angular velocity from the gyroscope for the 
		x, y and z axis in 1/16 °/s.
		
		If you want to get the angular velocity periodically, it is recommended 
		to use the callback :func:`AngularVelocity` and set the period with 
		:func:`SetAngularVelocityPeriod`.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_ANGULAR_VELOCITY, [], '', 'h h h', returnCallback, errorCallback);
	};
	this.getTemperature = function(returnCallback, errorCallback) {
		/*
		Returns the temperature of the IMU Brick. The temperature is given in 
		°C. The temperature is measured in the core of the BNO055 IC, it is not the
		ambient temperature
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_TEMPERATURE, [], '', 'b', returnCallback, errorCallback);
	};
	this.getOrientation = function(returnCallback, errorCallback) {
		/*
		Returns the current orientation (heading, roll, pitch) of the IMU Brick as
		independent Euler angles in 1/16 degree. Note that Euler angles always
		experience a `gimbal lock <https://en.wikipedia.org/wiki/Gimbal_lock>`__. We
		recommend that you use quaternions instead, if you need the absolute orientation.
		
		The rotation angle has the following ranges:
		
		* heading: 0° to 360°
		* roll: -90° to +90°
		* pitch: -180° to +180°
		
		If you want to get the orientation periodically, it is recommended 
		to use the callback :func:`Orientation` and set the period with 
		:func:`SetOrientationPeriod`.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_ORIENTATION, [], '', 'h h h', returnCallback, errorCallback);
	};
	this.getLinearAcceleration = function(returnCallback, errorCallback) {
		/*
		Returns the linear acceleration of the IMU Brick for the
		x, y and z axis in 1/100 m/s².
		
		The linear acceleration is the acceleration in each of the three
		axis of the IMU Brick with the influences of gravity removed.
		
		It is also possible to get the gravity vector with the influence of linear
		acceleration removed, see :func:`GetGravityVector`.
		
		If you want to get the linear acceleration periodically, it is recommended 
		to use the callback :func:`LinearAcceleration` and set the period with 
		:func:`SetLinearAccelerationPeriod`.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_LINEAR_ACCELERATION, [], '', 'h h h', returnCallback, errorCallback);
	};
	this.getGravityVector = function(returnCallback, errorCallback) {
		/*
		Returns the current gravity vector of the IMU Brick for the
		x, y and z axis in 1/100 m/s².
		
		The gravity vector is the acceleration that occurs due to gravity.
		Influences of additional linear acceleration are removed.
		
		It is also possible to get the linear acceleration with the influence 
		of gravity removed, see :func:`GetLinearAcceleration`.
		
		If you want to get the gravity vector periodically, it is recommended 
		to use the callback :func:`GravityVector` and set the period with 
		:func:`SetGravityVectorPeriod`.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_GRAVITY_VECTOR, [], '', 'h h h', returnCallback, errorCallback);
	};
	this.getQuaternion = function(returnCallback, errorCallback) {
		/*
		Returns the current orientation (w, x, y, z) of the IMU Brick as
		`quaternions <https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation>`__.
		
		You have to divide the returns values by 16383 (14 bit) to get
		the usual range of -1.0 to +1.0 for quaternions.
		
		If you want to get the quaternions periodically, it is recommended 
		to use the callback :func:`Quaternion` and set the period with 
		:func:`SetQuaternionPeriod`.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_QUATERNION, [], '', 'h h h h', returnCallback, errorCallback);
	};
	this.getAllData = function(returnCallback, errorCallback) {
		/*
		Return all of the available data of the IMU Brick.
		
		* acceleration in 1/100 m/s² (see :func:`GetAcceleration`)
		* magnetic field in 1/16 µT (see :func:`GetMagneticField`)
		* angular velocity in 1/16 °/s (see :func:`GetAngularVelocity`)
		* Euler angles in 1/16 ° (see :func:`GetOrientation`)
		* quaternion 1/16383 (see :func:`GetQuaternion`)
		* linear acceleration 1/100 m/s² (see :func:`GetLinearAcceleration`)
		* gravity vector 1/100 m/s² (see :func:`GetGravityVector`)
		* temperature in 1 °C (see :func:`GetTemperature`)
		* calibration status (see below)
		
		The calibration status consists of four pairs of two bits. Each pair
		of bits represents the status of the current calibration.
		
		* bit 0-1: Magnetometer
		* bit 2-3: Accelerometer
		* bit 4-5: Gyroscope
		* bit 6-7: System
		
		A value of 0 means for "not calibrated" and a value of 3 means
		"fully calibrated". In your program you should always be able to
		ignore the calibration status, it is used by the calibration
		window of the Brick Viewer and it can be ignored after the first
		calibration. See the documentation in the calibration window for
		more information regarding the calibration of the IMU Brick.
		
		If you want to get the data periodically, it is recommended 
		to use the callback :func:`AllData` and set the period with 
		:func:`SetAllDataPeriod`.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_ALL_DATA, [], '', 'h3 h3 h3 h3 h4 h3 h3 b B', returnCallback, errorCallback);
	};
	this.ledsOn = function(returnCallback, errorCallback) {
		/*
		Turns the orientation and direction LEDs of the IMU Brick on.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_LEDS_ON, [], '', '', returnCallback, errorCallback);
	};
	this.ledsOff = function(returnCallback, errorCallback) {
		/*
		Turns the orientation and direction LEDs of the IMU Brick off.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_LEDS_OFF, [], '', '', returnCallback, errorCallback);
	};
	this.areLedsOn = function(returnCallback, errorCallback) {
		/*
		Returns *true* if the orientation and direction LEDs of the IMU Brick
		are on, *false* otherwise.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_ARE_LEDS_ON, [], '', '?', returnCallback, errorCallback);
	};
	this.saveCalibration = function(returnCallback, errorCallback) {
		/*
		A call of this function saves the current calibration to be used
		as a starting point for the next restart of continuous calibration
		of the IMU Brick.
		
		A return value of *true* means that the calibration could be used and
		*false* means that it could not be used (this happens if the calibration 
		status is not "fully calibrated").
		
		This function is used by the calibration window of the Brick Viewer, you
		should not need to call it in your program.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_SAVE_CALIBRATION, [], '', '?', returnCallback, errorCallback);
	};
	this.setAccelerationPeriod = function(period, returnCallback, errorCallback) {
		/*
		Sets the period in ms with which the :func:`Acceleration` callback is triggered
		periodically. A value of 0 turns the callback off.
		
		The default value is 0.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_SET_ACCELERATION_PERIOD, [period], 'I', '', returnCallback, errorCallback);
	};
	this.getAccelerationPeriod = function(returnCallback, errorCallback) {
		/*
		Returns the period as set by :func:`SetAccelerationPeriod`.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_ACCELERATION_PERIOD, [], '', 'I', returnCallback, errorCallback);
	};
	this.setMagneticFieldPeriod = function(period, returnCallback, errorCallback) {
		/*
		Sets the period in ms with which the :func:`MagneticField` callback is triggered
		periodically. A value of 0 turns the callback off.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_SET_MAGNETIC_FIELD_PERIOD, [period], 'I', '', returnCallback, errorCallback);
	};
	this.getMagneticFieldPeriod = function(returnCallback, errorCallback) {
		/*
		Returns the period as set by :func:`SetMagneticFieldPeriod`.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_MAGNETIC_FIELD_PERIOD, [], '', 'I', returnCallback, errorCallback);
	};
	this.setAngularVelocityPeriod = function(period, returnCallback, errorCallback) {
		/*
		Sets the period in ms with which the :func:`AngularVelocity` callback is triggered
		periodically. A value of 0 turns the callback off.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_SET_ANGULAR_VELOCITY_PERIOD, [period], 'I', '', returnCallback, errorCallback);
	};
	this.getAngularVelocityPeriod = function(returnCallback, errorCallback) {
		/*
		Returns the period as set by :func:`SetAngularVelocityPeriod`.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_ANGULAR_VELOCITY_PERIOD, [], '', 'I', returnCallback, errorCallback);
	};
	this.setTemperaturePeriod = function(period, returnCallback, errorCallback) {
		/*
		Sets the period in ms with which the :func:`Temperature` callback is triggered
		periodically. A value of 0 turns the callback off.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_SET_TEMPERATURE_PERIOD, [period], 'I', '', returnCallback, errorCallback);
	};
	this.getTemperaturePeriod = function(returnCallback, errorCallback) {
		/*
		Returns the period as set by :func:`SetTemperaturePeriod`.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_TEMPERATURE_PERIOD, [], '', 'I', returnCallback, errorCallback);
	};
	this.setOrientationPeriod = function(period, returnCallback, errorCallback) {
		/*
		Sets the period in ms with which the :func:`Orientation` callback is triggered
		periodically. A value of 0 turns the callback off.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_SET_ORIENTATION_PERIOD, [period], 'I', '', returnCallback, errorCallback);
	};
	this.getOrientationPeriod = function(returnCallback, errorCallback) {
		/*
		Returns the period as set by :func:`SetOrientationPeriod`.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_ORIENTATION_PERIOD, [], '', 'I', returnCallback, errorCallback);
	};
	this.setLinearAccelerationPeriod = function(period, returnCallback, errorCallback) {
		/*
		Sets the period in ms with which the :func:`LinearAcceleration` callback is triggered
		periodically. A value of 0 turns the callback off.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_SET_LINEAR_ACCELERATION_PERIOD, [period], 'I', '', returnCallback, errorCallback);
	};
	this.getLinearAccelerationPeriod = function(returnCallback, errorCallback) {
		/*
		Returns the period as set by :func:`SetLinearAccelerationPeriod`.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_LINEAR_ACCELERATION_PERIOD, [], '', 'I', returnCallback, errorCallback);
	};
	this.setGravityVectorPeriod = function(period, returnCallback, errorCallback) {
		/*
		Sets the period in ms with which the :func:`GravityVector` callback is triggered
		periodically. A value of 0 turns the callback off.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_SET_GRAVITY_VECTOR_PERIOD, [period], 'I', '', returnCallback, errorCallback);
	};
	this.getGravityVectorPeriod = function(returnCallback, errorCallback) {
		/*
		Returns the period as set by :func:`SetGravityVectorPeriod`.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_GRAVITY_VECTOR_PERIOD, [], '', 'I', returnCallback, errorCallback);
	};
	this.setQuaternionPeriod = function(period, returnCallback, errorCallback) {
		/*
		Sets the period in ms with which the :func:`Quaternion` callback is triggered
		periodically. A value of 0 turns the callback off.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_SET_QUATERNION_PERIOD, [period], 'I', '', returnCallback, errorCallback);
	};
	this.getQuaternionPeriod = function(returnCallback, errorCallback) {
		/*
		Returns the period as set by :func:`SetQuaternionPeriod`.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_QUATERNION_PERIOD, [], '', 'I', returnCallback, errorCallback);
	};
	this.setAllDataPeriod = function(period, returnCallback, errorCallback) {
		/*
		Sets the period in ms with which the :func:`AllData` callback is triggered
		periodically. A value of 0 turns the callback off.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_SET_ALL_DATA_PERIOD, [period], 'I', '', returnCallback, errorCallback);
	};
	this.getAllDataPeriod = function(returnCallback, errorCallback) {
		/*
		Returns the period as set by :func:`SetAllDataPeriod`.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_ALL_DATA_PERIOD, [], '', 'I', returnCallback, errorCallback);
	};
	this.enableStatusLED = function(returnCallback, errorCallback) {
		/*
		Enables the status LED.
		
		The status LED is the blue LED next to the USB connector. If enabled is is
		on and it flickers if data is transfered. If disabled it is always off.
		
		The default state is enabled.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_ENABLE_STATUS_LED, [], '', '', returnCallback, errorCallback);
	};
	this.disableStatusLED = function(returnCallback, errorCallback) {
		/*
		Disables the status LED.
		
		The status LED is the blue LED next to the USB connector. If enabled is is
		on and it flickers if data is transfered. If disabled it is always off.
		
		The default state is enabled.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_DISABLE_STATUS_LED, [], '', '', returnCallback, errorCallback);
	};
	this.isStatusLEDEnabled = function(returnCallback, errorCallback) {
		/*
		Returns *true* if the status LED is enabled, *false* otherwise.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_IS_STATUS_LED_ENABLED, [], '', '?', returnCallback, errorCallback);
	};
	this.getProtocol1BrickletName = function(port, returnCallback, errorCallback) {
		/*
		Returns the firmware and protocol version and the name of the Bricklet for a
		given port.
		
		This functions sole purpose is to allow automatic flashing of v1.x.y Bricklet
		plugins.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, [port], 'c', 'B B3 s40', returnCallback, errorCallback);
	};
	this.getChipTemperature = function(returnCallback, errorCallback) {
		/*
		Returns the temperature in °C/10 as measured inside the microcontroller. The
		value returned is not the ambient temperature!
		
		The temperature is only proportional to the real temperature and it has an
		accuracy of +-15%. Practically it is only useful as an indicator for
		temperature changes.
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_CHIP_TEMPERATURE, [], '', 'h', returnCallback, errorCallback);
	};
	this.reset = function(returnCallback, errorCallback) {
		/*
		Calling this function will reset the Brick. Calling this function
		on a Brick inside of a stack will reset the whole stack.
		
		After a reset you have to create new device objects,
		calling functions on the existing ones will result in
		undefined behavior!
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_RESET, [], '', '', returnCallback, errorCallback);
	};
	this.getIdentity = function(returnCallback, errorCallback) {
		/*
		Returns the UID, the UID where the Brick is connected to, 
		the position, the hardware and firmware version as well as the
		device identifier.
		
		The position can be '0'-'8' (stack position).
		
		The device identifier numbers can be found :ref:`here <device_identifier>`.
		|device_identifier_constant|
		*/
		this.ipcon.sendRequest(this, BrickIMUV2.FUNCTION_GET_IDENTITY, [], '', 's8 s8 c B3 B3 H', returnCallback, errorCallback);
	};
}

module.exports = BrickIMUV2;
