// CodeGear C++Builder
// Copyright (c) 1995, 2014 by Embarcadero Technologies, Inc.
// All rights reserved

// (DO NOT EDIT: machine generated header) 'wclMessaging.pas' rev: 27.00 (Windows)

#ifndef WclmessagingHPP
#define WclmessagingHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member 
#pragma pack(push,8)
#include <System.hpp>	// Pascal unit
#include <SysInit.hpp>	// Pascal unit
#include <System.Classes.hpp>	// Pascal unit
#include <Winapi.Windows.hpp>	// Pascal unit
#include <wclWinAPI.hpp>	// Pascal unit
#include <wclErrors.hpp>	// Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Wclmessaging
{
//-- type declarations -------------------------------------------------------
enum DECLSPEC_DENUM TwclMessageSynchronizationKind : unsigned int { skMessages, skThread, skApc };

class DELPHICLASS TwclMessage;
class PASCALIMPLEMENTATION TwclMessage : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	System::Byte FId;
	System::Byte FCategory;
	int FRefCounter;
	
public:
	__fastcall TwclMessage(const System::Byte Id, const System::Byte Category);
	void __fastcall AddRef(void);
	void __fastcall Release(void);
	__property System::Byte Category = {read=FCategory, nodefault};
	__property System::Byte Id = {read=FId, nodefault};
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TwclMessage(void) { }
	
};


class DELPHICLASS TwclSystemCategoryMessage;
class PASCALIMPLEMENTATION TwclSystemCategoryMessage : public TwclMessage
{
	typedef TwclMessage inherited;
	
public:
	__fastcall TwclSystemCategoryMessage(const System::Byte Id);
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TwclSystemCategoryMessage(void) { }
	
};


class DELPHICLASS TwclHardwareChangeMessage;
class PASCALIMPLEMENTATION TwclHardwareChangeMessage : public TwclSystemCategoryMessage
{
	typedef TwclSystemCategoryMessage inherited;
	
private:
	GUID FInterfaceClass;
	GUID FDeviceClass;
	System::UnicodeString FInstance;
	bool FInserted;
	
public:
	__fastcall TwclHardwareChangeMessage(const GUID &InterfaceClass, const GUID &DeviceClass, const System::UnicodeString Instance, const bool Inserted);
	__property GUID InterfaceClass = {read=FInterfaceClass};
	__property GUID DeviceClass = {read=FDeviceClass};
	__property System::UnicodeString Instance = {read=FInstance};
	__property bool Inserted = {read=FInserted, nodefault};
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TwclHardwareChangeMessage(void) { }
	
};


class DELPHICLASS TwclPowerStateChangeMessage;
class PASCALIMPLEMENTATION TwclPowerStateChangeMessage : public TwclSystemCategoryMessage
{
	typedef TwclSystemCategoryMessage inherited;
	
private:
	unsigned FState;
	
public:
	__fastcall TwclPowerStateChangeMessage(const unsigned State);
	__property unsigned State = {read=FState, nodefault};
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TwclPowerStateChangeMessage(void) { }
	
};


class DELPHICLASS TwclThreadSignalMessage;
class PASCALIMPLEMENTATION TwclThreadSignalMessage : public TwclSystemCategoryMessage
{
	typedef TwclSystemCategoryMessage inherited;
	
private:
	System::Byte FSignal;
	
public:
	__fastcall TwclThreadSignalMessage(const System::Byte Signal);
	__property System::Byte Signal = {read=FSignal, nodefault};
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TwclThreadSignalMessage(void) { }
	
};


class DELPHICLASS TwclThreadSynchronizeMessage;
class PASCALIMPLEMENTATION TwclThreadSynchronizeMessage : public TwclSystemCategoryMessage
{
	typedef TwclSystemCategoryMessage inherited;
	
private:
	NativeUInt FEvent;
	void *FParam;
	
public:
	__fastcall TwclThreadSynchronizeMessage(const NativeUInt Event, const void * Param);
	__fastcall virtual ~TwclThreadSynchronizeMessage(void);
	__property void * Param = {read=FParam};
};


class DELPHICLASS TwclWiFiCategoryMessage;
class PASCALIMPLEMENTATION TwclWiFiCategoryMessage : public TwclMessage
{
	typedef TwclMessage inherited;
	
public:
	__fastcall TwclWiFiCategoryMessage(const System::Byte Id);
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TwclWiFiCategoryMessage(void) { }
	
};


class DELPHICLASS TwclBluetoothCategoryMessage;
class PASCALIMPLEMENTATION TwclBluetoothCategoryMessage : public TwclMessage
{
	typedef TwclMessage inherited;
	
public:
	__fastcall TwclBluetoothCategoryMessage(const System::Byte Id);
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TwclBluetoothCategoryMessage(void) { }
	
};


class DELPHICLASS TwclIrDACategoryMessage;
class PASCALIMPLEMENTATION TwclIrDACategoryMessage : public TwclMessage
{
	typedef TwclMessage inherited;
	
public:
	__fastcall TwclIrDACategoryMessage(const System::Byte Id);
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TwclIrDACategoryMessage(void) { }
	
};


class DELPHICLASS TwclSerialCategoryMessage;
class PASCALIMPLEMENTATION TwclSerialCategoryMessage : public TwclMessage
{
	typedef TwclMessage inherited;
	
public:
	__fastcall TwclSerialCategoryMessage(const System::Byte Id);
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TwclSerialCategoryMessage(void) { }
	
};


class DELPHICLASS TwclUsbCategoryMessage;
class PASCALIMPLEMENTATION TwclUsbCategoryMessage : public TwclMessage
{
	typedef TwclMessage inherited;
	
public:
	__fastcall TwclUsbCategoryMessage(const System::Byte Id);
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TwclUsbCategoryMessage(void) { }
	
};


class DELPHICLASS TwclWiiCategoryMessage;
class PASCALIMPLEMENTATION TwclWiiCategoryMessage : public TwclMessage
{
	typedef TwclMessage inherited;
	
public:
	__fastcall TwclWiiCategoryMessage(const System::Byte Id);
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TwclWiiCategoryMessage(void) { }
	
};


class DELPHICLASS TwclKinectCategoryMessage;
class PASCALIMPLEMENTATION TwclKinectCategoryMessage : public TwclMessage
{
	typedef TwclMessage inherited;
	
public:
	__fastcall TwclKinectCategoryMessage(const System::Byte Id);
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TwclKinectCategoryMessage(void) { }
	
};


class DELPHICLASS TwclConnectionCategoryMessage;
class PASCALIMPLEMENTATION TwclConnectionCategoryMessage : public TwclMessage
{
	typedef TwclMessage inherited;
	
public:
	__fastcall TwclConnectionCategoryMessage(const System::Byte Id);
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TwclConnectionCategoryMessage(void) { }
	
};


class DELPHICLASS TwclAudioCategoryMessage;
class PASCALIMPLEMENTATION TwclAudioCategoryMessage : public TwclMessage
{
	typedef TwclMessage inherited;
	
public:
	__fastcall TwclAudioCategoryMessage(const System::Byte Id);
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TwclAudioCategoryMessage(void) { }
	
};


class DELPHICLASS TwclUserDefinedCategoryMessage;
class PASCALIMPLEMENTATION TwclUserDefinedCategoryMessage : public TwclMessage
{
	typedef TwclMessage inherited;
	
public:
	__fastcall TwclUserDefinedCategoryMessage(const System::Byte Id);
public:
	/* TObject.Destroy */ inline __fastcall virtual ~TwclUserDefinedCategoryMessage(void) { }
	
};


typedef void __fastcall (__closure *TwclMessageEvent)(TwclMessage* const Message);

class DELPHICLASS TwclMessageReceiver;
class PASCALIMPLEMENTATION TwclMessageReceiver : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	TwclMessageSynchronizationKind FKind;
	System::Classes::TList* FMessages;
	_RTL_CRITICAL_SECTION FMessagesCS;
	NativeUInt FThreadHandle;
	unsigned FThreadId;
	unsigned FWndThreadId;
	NativeUInt FWndThread;
	int FWndThreadResult;
	NativeUInt FWndThreadEvent;
	bool FListening;
	TwclMessageEvent FOnMessage;
	unsigned FMsg;
	HWND FWnd;
	bool __fastcall WndProc(unsigned uMsg, NativeUInt wParam, NativeInt lParam);
	void __fastcall WndThread(void);
	int __fastcall CreateSyncObj(void);
	int __fastcall CreateSyncWnd(void);
	int __fastcall DestroySyncObj(void);
	int __fastcall DestroySyncWnd(void);
	int __fastcall Synchronize(void);
	void __fastcall ProcessMessages(void);
	
protected:
	virtual void __fastcall DoMessage(TwclMessage* const Message);
	
public:
	__fastcall virtual TwclMessageReceiver(void);
	__fastcall virtual ~TwclMessageReceiver(void);
	int __fastcall Close(void);
	int __fastcall Open(void);
	int __fastcall Post(TwclMessage* const Message, const bool Sync = false);
	__property bool Listening = {read=FListening, nodefault};
	__property TwclMessageEvent OnMessage = {read=FOnMessage, write=FOnMessage};
};


class DELPHICLASS TwclMessageBroadcaster;
class PASCALIMPLEMENTATION TwclMessageBroadcaster : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	System::Classes::TList* FReceivers;
	_RTL_CRITICAL_SECTION FReceiversCS;
	NativeUInt FPowerDll;
	NativeUInt FPowerReg;
	bool FCfgMgrLoaded;
	void *FDevNotify;
	NativeUInt FThread;
	NativeUInt FThreadEvent;
	HWND FWnd;
	int FError;
	void __fastcall RegisterPowerChanges(void);
	void __fastcall UnregisterPowerChanges(void);
	bool __fastcall GetDevClassSetupApi(const GUID &IntfClass, const System::UnicodeString DevName, /* out */ GUID &DevClass);
	bool __fastcall GetDevClassCfgMgrApi(const System::UnicodeString DevName, /* out */ GUID &DevClass);
	void __fastcall ThreadProc(void);
	void __fastcall ProcessWmDestroy(void);
	void __fastcall ProcessWmDeviceChange(const NativeUInt wParam, const NativeInt lParam);
	void __fastcall ProcessWmPowerBroadcast(const NativeUInt wParam);
	bool __fastcall WndProc(unsigned uMsg, NativeUInt wParam, NativeInt lParam);
	int __fastcall InternalSubscribe(TwclMessageReceiver* const Receiver);
	int __fastcall InternalUnsubscribe(TwclMessageReceiver* const Receiver);
	__classmethod int __fastcall CreateBroadcaster();
	__classmethod void __fastcall DeleteBroadcaster();
	__classmethod int __fastcall Subscribe(TwclMessageReceiver* const Receiver);
	__classmethod int __fastcall Unsubscribe(TwclMessageReceiver* const Receiver);
	void __fastcall InternalBroadcast(TwclMessage* const Message);
	void __fastcall InternalProcessApcMessages(void);
	void __fastcall InternalProcessThreadMessages(void);
	void __fastcall InternalProcessWindowsMessages(void);
	void __fastcall InternalProcessMessages(void);
	int __fastcall InternalWaitWindowsMessages(const unsigned Count, const Winapi::Windows::PWOHandleArray Events, const unsigned Timeout, /* out */ unsigned &Index);
	int __fastcall InternalWaitThread(const unsigned Count, const Winapi::Windows::PWOHandleArray Events, const unsigned Timeout, /* out */ unsigned &Index);
	int __fastcall InternalWaitApcMessages(const unsigned Count, const Winapi::Windows::PWOHandleArray Events, const unsigned Timeout, /* out */ unsigned &Index);
	int __fastcall InternalWait(const unsigned Count, const Winapi::Windows::PWOHandleArray Events, const unsigned Timeout, /* out */ unsigned &Index);
	
public:
	__fastcall virtual TwclMessageBroadcaster(void);
	__fastcall virtual ~TwclMessageBroadcaster(void);
	__classmethod int __fastcall Broadcast(TwclMessage* const Message);
	__classmethod int __fastcall ProcessMessages();
	__classmethod int __fastcall Wait(const unsigned Count, const Winapi::Windows::PWOHandleArray Events, const unsigned Timeout, /* out */ unsigned &Index)/* overload */;
	__classmethod int __fastcall Wait(const unsigned Count, const Winapi::Windows::PWOHandleArray Events, /* out */ unsigned &Index)/* overload */;
	__classmethod int __fastcall Wait(const NativeUInt Event, const unsigned Timeout)/* overload */;
	__classmethod int __fastcall Wait(const NativeUInt Event)/* overload */;
	__classmethod TwclMessageSynchronizationKind __fastcall GetSyncMethod();
	__classmethod int __fastcall SetSyncMethod(const TwclMessageSynchronizationKind Kind);
};


//-- var, const, procedure ---------------------------------------------------
static const System::Int8 WCL_MSG_CATEGORY_SYSTEM = System::Int8(0x1);
static const System::Int8 WCL_MSG_CATEGORY_WIFI = System::Int8(0x2);
static const System::Int8 WCL_MSG_CATEGORY_BLUETOOTH = System::Int8(0x3);
static const System::Int8 WCL_MSG_CATEGORY_IRDA = System::Int8(0x4);
static const System::Int8 WCL_MSG_CATEGORY_SERIAL = System::Int8(0x5);
static const System::Int8 WCL_MSG_CATEGORY_USB = System::Int8(0x6);
static const System::Int8 WCL_MSG_CATEGORY_WII = System::Int8(0x7);
static const System::Int8 WCL_MSG_CATEGORY_KINECT = System::Int8(0x8);
static const System::Int8 WCL_MSG_CATEGORY_CONNECTION = System::Int8(0x9);
static const System::Int8 WCL_MSG_CATEGORY_AUDIO = System::Int8(0xa);
static const System::Byte WCL_MSG_CATEGORY_USER = System::Byte(0xc8);
static const System::Int8 WCL_MSG_ID_SYS_HARDWARE_CHANGED = System::Int8(0x1);
static const System::Int8 WCL_MSG_ID_SYS_POWER_STATE_CHANGED = System::Int8(0x2);
static const System::Int8 WCL_MSG_ID_SYS_THREAD_SIGNAL = System::Int8(0x3);
static const System::Int8 WCL_MSG_ID_SYS_THREAD_SYNCHRONIZE = System::Int8(0x4);
}	/* namespace Wclmessaging */
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_WCLMESSAGING)
using namespace Wclmessaging;
#endif
#pragma pack(pop)
#pragma option pop

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// WclmessagingHPP
