#pragma once

#define ID(value) (value & 0x1F)
#define VCC(value) ((value & 0x1FFF) << 5)
#define TEMP(value) (((unsigned long)value & 0x2FF) << 18)
#define HUMIDITY(value) (((unsigned long)value & 0x2FF) << 18)
#define VALUE(value) (((unsigned long)value & 0x2FF) << 18)
#define STATE(value) ((value & 0x1) << 27)
#define TYPE(value) (((unsigned long)value & 0xF) << 28)

#define GET_TYPE(value) (((unsigned long)value >> 28) & 0xF)
#define GET_STATE(value) ((value >> 27) & 0x1)
#define GET_TEMP(value) (((unsigned long)value >> 18) & 0x2FF)
#define GET_HUMIDITY(value) (((unsigned long)value >> 18) & 0x2FF)
#define GET_VALUE(value) (((unsigned long)value >> 18) & 0x2FF)
#define GET_VCC(value) (((unsigned long)value >> 5) & 0x1FFF)

enum SensorType {
	GENERIC = 4,
	HUMIDITY = 5,
	TEMPERATURE = 6,
	CONTACT = 7
};

enum SensorId : int {
	WINDOW1 = 1,
	WINDOW2 = 2,
	WATER_SENSOR = 3,
	TEMP_SENSOR = 4,
	LIGHT_SENSOR = 5,
	MOVEMENT_SENSOR = 6,
	OIL_SENSOR = 7
};
