//---------------------------------------------------------------------------

#ifndef mainH
#define mainH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include "wclBluetooth.hpp"
//---------------------------------------------------------------------------
class TfmMain : public TForm
{
__published:	// IDE-managed Components
        TLabel *laBattLevelCaption;
        TLabel *laBattLevel;
        TLabel *laButtons;
        TLabel *laAccel;
        TLabel *laXCaption;
        TLabel *laX;
        TLabel *laYCaption;
        TLabel *laY;
        TLabel *laZCaption;
        TLabel *laZ;
        TLabel *laIrCaption;
        TLabel *laIrModeCpation;
        TLabel *laIrMode;
        TLabel *laIrSensitivityCaption;
        TLabel *laIrSensitivity;
        TLabel *laSensor0Caption;
        TLabel *laSensor0PositionCaption;
        TLabel *laSensor0Position;
        TLabel *laSensor0SizeCaption;
        TLabel *laSensor0Size;
        TLabel *laSensor0FoundCaption;
        TLabel *laSensor0Found;
        TLabel *laSensor1Caption;
        TLabel *laSensor1PositionCaption;
        TLabel *laSensor1Position;
        TLabel *laSensor1SizeCaption;
        TLabel *laSensor1Size;
        TLabel *laSensor1FoundCaption;
        TLabel *laSensor1Found;
        TLabel *laSensor2Caption;
        TLabel *laSensor2PositionCaption;
        TLabel *laSensor2Position;
        TLabel *laSensor2SizeCaption;
        TLabel *laSensor2Size;
        TLabel *laSensor2FoundCaption;
        TLabel *laSensor2Found;
        TLabel *laSensor3Caption;
        TLabel *laSensor3PositionCaption;
        TLabel *laSensor3Position;
        TLabel *laSensor3SizeCpation;
        TLabel *laSensor3Size;
        TLabel *laSensor3FoundCaption;
        TLabel *laSensor3Found;
        TLabel *laNunchukCaption;
        TLabel *laNunchukState;
        TLabel *laNunchukXCaption;
        TLabel *laNunchukX;
        TLabel *laNunchukYCaption;
        TLabel *laNunchukY;
        TLabel *laNunchukZCaption;
        TLabel *laNunchukZ;
        TLabel *laNunchukJoyXCaption;
        TLabel *laNunchukJoyYCaption;
        TLabel *laNunchukJoyX;
        TLabel *laNunchukJoyY;
        TLabel *laBalanceBoardCaption;
        TLabel *laBalanceBoardState;
        TLabel *laBbTopRightCaption;
        TLabel *laBbTopLeftCaption;
        TLabel *laBbBottomRightCaption;
        TLabel *laBbBottomLeftCaption;
        TLabel *laBbTopRight;
        TLabel *laBbTopLeft;
        TLabel *laBbBottomRight;
        TLabel *laBbBottomLeft;
        TButton *btDiscover;
        TListView *lvDevices;
        TButton *btConnect;
        TButton *btDisconnect;
        TListBox *lbLog;
        TButton *btClear;
        TButton *btGetStatus;
        TCheckBox *cbLed1;
        TCheckBox *cbLed2;
        TCheckBox *cbLed3;
        TCheckBox *cbLed4;
        TButton *btGetLeds;
        TButton *btSetLeds;
        TCheckBox *cbA;
        TCheckBox *cbB;
        TCheckBox *cbPlus;
        TCheckBox *cbHome;
        TCheckBox *cbMinus;
        TCheckBox *cbOne;
        TCheckBox *cbTwo;
        TCheckBox *cbUp;
        TCheckBox *cbDown;
        TCheckBox *cbLeft;
        TCheckBox *cbRight;
        TButton *btEnableAccel;
        TButton *btDisableAccel;
        TButton *btEnableIr;
        TButton *btDisableIr;
        TButton *btRumbleOn;
        TButton *btRumbleOff;
        TCheckBox *cbNunchukC;
        TCheckBox *cbNunchukZ;
        TwclBluetoothManager *wclBluetoothManager;
        TwclWiiRemoteClient *wclWiiRemoteClient;
        void __fastcall FormCreate(TObject *Sender);
        void __fastcall FormDestroy(TObject *Sender);
        void __fastcall wclBluetoothManagerDiscoveringStarted(
          TObject *Sender, const TwclBluetoothRadio *Radio);
        void __fastcall wclBluetoothManagerDeviceFound(TObject *Sender,
          const TwclBluetoothRadio *Radio, const __int64 Address);
        void __fastcall wclBluetoothManagerDiscoveringCompleted(
          TObject *Sender, const TwclBluetoothRadio *Radio,
          const int Error);
        void __fastcall btDiscoverClick(TObject *Sender);
        void __fastcall btConnectClick(TObject *Sender);
        void __fastcall btDisconnectClick(TObject *Sender);
        void __fastcall wclWiiRemoteClientConnect(TObject *Sender,
          const int Error);
        void __fastcall wclWiiRemoteClientDisconnect(TObject *Sender,
          const int Reason);
        void __fastcall wclWiiRemoteClientStatusChanged(TObject *Sender,
          const double Batt, const TwclWiiRemoteLeds Leds);
        void __fastcall btClearClick(TObject *Sender);
        void __fastcall btGetStatusClick(TObject *Sender);
        void __fastcall btGetLedsClick(TObject *Sender);
        void __fastcall btSetLedsClick(TObject *Sender);
        void __fastcall wclWiiRemoteClientButtonsChanged(TObject *Sender,
          const TwclWiiRemoteButtons &Buttons);
        void __fastcall wclWiiRemoteClientAccelChanged(TObject *Sender,
          const TwclWiiRemoteAccel &Accel);
        void __fastcall btEnableAccelClick(TObject *Sender);
        void __fastcall btDisableAccelClick(TObject *Sender);
        void __fastcall wclWiiRemoteClientIrChanged(TObject *Sender,
          const TwclWiiRemoteIrSensors &Ir);
        void __fastcall btEnableIrClick(TObject *Sender);
        void __fastcall btDisableIrClick(TObject *Sender);
        void __fastcall btRumbleOnClick(TObject *Sender);
        void __fastcall btRumbleOffClick(TObject *Sender);
        void __fastcall wclWiiRemoteClientExtensionAttached(
          TObject *Sender);
        void __fastcall wclWiiRemoteClientExtensionDetached(
          TObject *Sender);
        void __fastcall wclWiiRemoteClientNunchukChanged(TObject *Sender,
          const TwclWiiRemoteNunchuk &Nunchuk);
        void __fastcall wclWiiRemoteClientBalanceBoardChanged(
          TObject *Sender, const TwclWiiRemoteBalanceBoard &Board);
private:	// User declarations
        TwclBluetoothRadio* GetRadio();

        void Trace(String Msg);
        void Trace(String Msg, int Res);

        void SetLeds();

        void ClearAccel();
        void ClearIr();
        void ClearNunchuk();
        void ClearExtensions();
        void ClearBalanceBoard();
public:		// User declarations
        __fastcall TfmMain(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TfmMain *fmMain;
//---------------------------------------------------------------------------
#endif
