/////////////////////////////////////////////////////////////////////////////
//
// This header file defines hardware monitoring shared memory format
//
/////////////////////////////////////////////////////////////////////////////
#ifndef _RTHM_SHARED_MEMORY_INCLUDED_
#define _RTHM_SHARED_MEMORY_INCLUDED_
/////////////////////////////////////////////////////////////////////////////
// v1.0 header
typedef struct RTHM_SHARED_MEMORY_HEADER_V_1_0
{
	DWORD	dwSignature;
		//signature allows applications to verify status of shared memory

		//The signature can be set to:
		//'RTHM'	- hardware monitoring memory is initialized and contains 
		//			valid data 
		//0xDEAD	- hardware monitoring memory is marked for deallocation and
		//			no longer contain valid data
		//otherwise the memory is not initialized
	DWORD	dwVersion;
		//header version ((major<<16) + minor)
		//must be set to 0x00010000 for v1.0 header
	DWORD	dwNumEntries;
		//number of subsequent RTHM_SHARED_MEMORY_ENTRY_V_1_0 entries
	time_t	time;
		//last polling time
} RTHM_SHARED_MEMORY_HEADER_V_1_0, *LPRTHM_SHARED_MEMORY_HEADER_V_1_0;
/////////////////////////////////////////////////////////////////////////////
// v1.0 entry structure (array of entries follows immediately by the header)
typedef struct RTHM_SHARED_MEMORY_ENTRY_V_1_0
{
	char	czSrc[32];
		//data source name (e.g. "Core temperature")
	char	czDim[8];
		//data source dimansion (e.g. "°C")
	float	data;
		//last polled data (e.g. 50°C)
		//(this field can be set to FLT_MAX if data is not available)
} RTHM_SHARED_MEMORY_ENTRY_V_1_0, *LPRTHM_SHARED_MEMORY_ENTRY_V_1_0;
/////////////////////////////////////////////////////////////////////////////
// v1.1+ header
typedef struct RTHM_SHARED_MEMORY_HEADER
{
	DWORD	dwSignature;
		//signature allows applications to verify status of shared memory

		//The signature can be set to:
		//'RTHM'	- hardware monitoring memory is initialized and contains 
		//			valid data 
		//0xDEAD	- hardware monitoring memory is marked for deallocation and
		//			no longer contain valid data
		//otherwise the memory is not initialized
	DWORD	dwVersion;
		//header version ((major<<16) + minor)
		//must be set to 0x00010001 or greater to use this structure
	DWORD	dwNumEntries;
		//number of subsequent RTHM_SHARED_MEMORY_ENTRY entries
	time_t	time;
		//last polling time
	DWORD	dwEntrySize;
		//size of entries in subsequent RTHM_SHARED_MEMORY_ENTRY entries array
} RTHM_SHARED_MEMORY_HEADER, *LPRTHM_SHARED_MEMORY_HEADER;
/////////////////////////////////////////////////////////////////////////////
#define RTHM_SHARED_MEMORY_ENTRY_FLAG_SHOW_IN_TOOLTIP				0x00000001
#define	RTHM_SHARED_MEMORY_ENTRY_FLAG_SHOW_IN_ICON					0x00000002
#define	RTHM_SHARED_MEMORY_ENTRY_FLAG_SHOW_IN_OSD					0x00000004
/////////////////////////////////////////////////////////////////////////////
// v1.1+ entry structure (array of entries follows immediately by the header)
typedef struct RTHM_SHARED_MEMORY_ENTRY
{
	char	czSrc[32];
		//data source name (e.g. "Core temperature")
	char	czDim[16];
		//data source dimansion (e.g. "°C")
	float	data;
		//last polled data in raw format (e.g. 50°C)
		//(this field can be set to FLT_MAX if data is not available)

		//take a note that the user can enable raw data transforming mode and
		//display different values on the graph (e.g. raw core VID values can
		//be translated to mapped core voltages).
		//In this case you may use dataTransformed field to get transformed value
	float	offset;
		//user specified data offset (e.g. +10°C temerature compensation)

		//take a note that this value is not automatically added to transformed
		//data, it is up to you to add offset to it
	float	dataTransformed;
		//last polled data in transformed format
	DWORD	flags;
		//bitmask, containing combination of RTHM_SHARED_MEMORY_ENTRY_FLAG_... flags
} RTHM_SHARED_MEMORY_ENTRY, *LPRTHM_SHARED_MEMORY_ENTRY;
/////////////////////////////////////////////////////////////////////////////
#endif //_RTHM_SHARED_MEMORY_INCLUDED_