#ifndef _new_can_protocol_ID_struct
#define _new_can_protocol_ID_struct

//Route mode
#define ROUTE_MASTER 0
#define ROUTE_SLAVE 1

//Data Types
#define DATA_TYPE_BROADCAST 0b0000
#define DATA_TYPE_DISCRETE 0b0001
#define DATA_TYPE_ANALOG 0b0010
#define DATA_TYPE_MODBUS_COIL 0b0011
#define DATA_TYPE_MODBUS_DISCRETE 0b0100
#define DATA_TYPE_MODBUS_HOLDING 0b0101
#define DATA_TYPE_MODBUS_INPUT 0b0110
#define DATA_TYPE_ERROR 0b0111
#define DATA_TYPE_PULSE 0b1111

//Sensor Types for DATA_TYPE_BROADCAST
#define SENSOR_TYPE_BROADCAST_STATUS 0b00000
#define SENSOR_TYPE_BROADCAST_ONOFF 0b00001
#define SENSOR_TYPE_BROADCAST_RESTARTDEVICE 0b00010
#define SENSOR_TYPE_BROADCAST_RTCSETUP 0b00011

//Sensor Types for DATA_TYPE_DISCRETE
#define SENSOR_TYPE_DISCRETE_ACCIDENT 0b00000
#define SENSOR_TYPE_DISCRETE_WARNING 0b00001
#define SENSOR_TYPE_DISCRETE_CONTROL_SIGNALS 0b00010
#define SENSOR_TYPE_DISCRETE_FLAGS 0b00011
#define SENSOR_TYPE_DISCRETE_RESET 0b00100
#define SENSOR_TYPE_DISCRETE_CHANGE_MODE 0b00101
#define SENSOR_TYPE_DISCRETE_REQUEST_LIST_OF_PARAMETERS 0b00110

//Sensor Types for DATA_TYPE_ANALOG
#define SENSOR_TYPE_ANALOG_UNIVERSAL 0b00000
#define SENSOR_TYPE_ANALOG_USTAVKI 0b00001
#define SENSOR_TYPE_ANALOG_U 0b00010
#define SENSOR_TYPE_ANALOG_I 0b00011
#define SENSOR_TYPE_ANALOG_T 0b00100

//Error Code
#define NONEXISTENT_ELEMENT 0x01

typedef union _extID{
	struct extID_Standard_Fields{
		unsigned DeviceID:8;
		unsigned SensorID:11;
		unsigned SensorType:5;
		unsigned DataType:4;
		unsigned Route:1;
	}StandardFields;
	struct extID_Modbus_Fields{
		unsigned DeviceID:8;
		unsigned CountReg:8;
		unsigned StrAdr:8;
		unsigned DataType:4;
		unsigned Route:1;
	}ModbusFields;
	unsigned int BitAll:29;	
}extID;

#endif