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

#ifndef mainH
#define mainH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <wclBluetooth.hpp>
#include <ComCtrls.hpp>
//---------------------------------------------------------------------------
typedef enum _TAdvertisementFrame
{
        afAppearance,
        afExtInformation,
        afInformation,
        afRaw,
        afDetails,
        afService16Data,
        afService32Data,
        afService128Data,
        afSol16,
        afSol32,
        afSol128,
        afTxPower,
        afUuid,
        afAltBeacon,
        afEddystoneTlm,
        afEddystoneUid,
        afEddystoneUrl,
        afManufacturerRaw,
        afMicrosoftCdpBeacon,
        afAppleAirdrop,
        afAppleAirplaySource,
        afAppleAirplayTarget,
        afAppleAirprint,
        afAppleHomeKit,
        afAppleiBeacon,
        afAppleNearbyAction,
        afAppleNearbyInfo,
        afAppleProximityPairing,
        afAppleUnknown,
        afAppleFindMy,
        afAppleHandoff,
        afAppleHeySiri,
        afAppleMagicSwitch,
        afAppleTetheringSource,
        afAppleTetheringTarget,
        afDriAsd,
        afUnknown
} TAdvertisementFrame;
//---------------------------------------------------------------------------
class TFrameStorage
{
private:
		__int64 FAddress;
		TAdvertisementFrame FFrame;
		__int64 FTimestamp;
		SByte FRssi;

public:
		__fastcall TFrameStorage(const TAdvertisementFrame Frame,
				const __int64 Address, const __int64 Timestamp,
				const SByte Rssi);
		virtual ~TFrameStorage();

		__property __int64 Address = { read = FAddress };
		__property TAdvertisementFrame Frame = { read = FFrame };
		__property __int64 Timestamp = { read = FTimestamp };
		__property SByte Rssi = { read = FRssi };
};
//---------------------------------------------------------------------------
class TGuidFrameStorage : public TFrameStorage
{
private:
		TGUID FUuid;

public:
		__fastcall TGuidFrameStorage(const TAdvertisementFrame Frame,
				const __int64 Address, const __int64 Timestamp,
				const SByte Rssi, const TGUID& Uuid);

		__property TGUID Uuid = { read = FUuid };
};
//---------------------------------------------------------------------------
class TDataFrameStorage : public TFrameStorage
{
private:
		TwclBluetoothLeAdvertisementFrameRawData FData;

public:
		__fastcall TDataFrameStorage(const TAdvertisementFrame Frame,
				const __int64 Address, const __int64 Timestamp,
				const SByte Rssi,
				const TwclBluetoothLeAdvertisementFrameRawData& Data);

		__property TwclBluetoothLeAdvertisementFrameRawData Data = { read = FData };
};
//---------------------------------------------------------------------------
class TGuidDataFrameStorage : public TDataFrameStorage
{
private:
		TGUID FUuid;

public:
		__fastcall TGuidDataFrameStorage(const TAdvertisementFrame Frame,
				const __int64 Address, const __int64 Timestamp, const SByte Rssi,
				const TGUID& Uuid, const TwclBluetoothLeAdvertisementFrameRawData& Data);

		__property TGUID Uuid = { read = FUuid };
};
//---------------------------------------------------------------------------
class TAppearanceFrame : public TFrameStorage
{
private:
		Word FAppearance;

public:
		__fastcall TAppearanceFrame(const __int64 Address, const __int64 Timestamp,
				const SByte Rssi, const Word Appearance);

        __property Word Appearance = { read = FAppearance };
};
//---------------------------------------------------------------------------
class TExtInformationFrame : public TFrameStorage
{
private:
        TwclBluetoothAddressType FAddressType;
        TwclBluetoothLeExtendedFrameFlags FFlags;
        SByte FTxPower;

public:
        __fastcall TExtInformationFrame(const __int64 Address, const __int64 Timestamp,
                const SByte Rssi, const TwclBluetoothAddressType AddressType,
                const TwclBluetoothLeExtendedFrameFlags& Flags,
                const SByte TxPower);

        __property TwclBluetoothAddressType AddressType = { read = FAddressType };
        __property TwclBluetoothLeExtendedFrameFlags Flags = { read = FFlags };
        __property SByte TxPower = { read = FTxPower };
};
//---------------------------------------------------------------------------
class TInformationFrame : public TFrameStorage
{
private:
        TwclBluetoothLeAdvertisementFlags FFlags;
        String FName;
        TwclBluetoothLeAdvertisementType FPacketType;

public:
        __fastcall TInformationFrame(const __int64 Address, const __int64 Timestamp,
                const SByte Rssi, const TwclBluetoothLeAdvertisementFlags& Flags,
                const String& Name, const TwclBluetoothLeAdvertisementType PacketType);

        __property TwclBluetoothLeAdvertisementFlags Flags = { read = FFlags };
        __property String Name = { read = FName };
        __property TwclBluetoothLeAdvertisementType PacketType = { read = FPacketType };
};
//---------------------------------------------------------------------------
class TRawFrame : public TDataFrameStorage
{
private:
        Byte FDataType;

public:
        __fastcall TRawFrame(const __int64 Address, const __int64 Timestamp, const SByte Rssi,
                const TwclBluetoothLeAdvertisementFrameRawData& Data,
                const Byte DataType);

        __property Byte DataType = { read = FDataType };
};
//---------------------------------------------------------------------------
class TDetailsFrame : public TDataFrameStorage
{
public:
        __fastcall TDetailsFrame(const __int64 Address, const __int64 Timestamp, const SByte Rssi,
                const TwclBluetoothLeAdvertisementFrameRawData& Data);
};
//---------------------------------------------------------------------------
class TService16DataFrame : public TDataFrameStorage
{
private:
        Word FUuid;

public:
        __fastcall TService16DataFrame(const __int64 Address, const __int64 Timestamp,
                const SByte Rssi, const TwclBluetoothLeAdvertisementFrameRawData& Data,
                const Word Uuid);

        __property Word Uuid = { read = FUuid };
};
//---------------------------------------------------------------------------
class TService32DataFrame : public TDataFrameStorage
{
private:
        Cardinal FUuid;

public:
        __fastcall TService32DataFrame(const __int64 Address, const __int64 Timestamp,
                const SByte Rssi, const TwclBluetoothLeAdvertisementFrameRawData& Data,
                const Cardinal Uuid);

        __property Cardinal Uuid = { read = FUuid };
};
//---------------------------------------------------------------------------
class TService128DataFrame : public TGuidDataFrameStorage
{
public:
        __fastcall TService128DataFrame(const __int64 Address, const __int64 Timestamp,
                const SByte Rssi, const TGUID& Uuid,
                const TwclBluetoothLeAdvertisementFrameRawData& Data);
};
//---------------------------------------------------------------------------
class TSol16Frame : public TFrameStorage
{
private:
        Word FUuid;

public:
        __fastcall TSol16Frame(const __int64 Address, const __int64 Timestamp,
                const SByte Rssi, const Word Uuid);

        __property Word Uuid = { read = FUuid };
};
//---------------------------------------------------------------------------
class TSol32Frame : public TFrameStorage
{
private:
        Cardinal FUuid;

public:
        __fastcall TSol32Frame(const __int64 Address, const __int64 Timestamp,
                const SByte Rssi, const Cardinal Uuid);

        __property Cardinal Uuid = { read = FUuid };
};
//---------------------------------------------------------------------------
class TSol128Frame : public TGuidFrameStorage
{
public:
        __fastcall TSol128Frame(const __int64 Address, const __int64 Timestamp,
                const SByte Rssi, const TGUID& Uuid);
};
//---------------------------------------------------------------------------
class TTxPowerFrame : public TFrameStorage
{
private:
        SByte FTxPower;

public:
        __fastcall TTxPowerFrame(const __int64 Address, const __int64 Timestamp,
                const SByte Rssi, const SByte TxPower);

        __property SByte TxPower = { read = FTxPower };
};
//---------------------------------------------------------------------------
class TUuidFrame : public TGuidFrameStorage
{
public:
        __fastcall TUuidFrame(const __int64 Address, const __int64 Timestamp,
                const SByte Rssi, const TGUID& Uuid);
};
//---------------------------------------------------------------------------
class TBeaconFrame : public TGuidDataFrameStorage
{
private:
        Word FCompanyId;
        Word FMajor;
        Word FMinor;
        SByte FTxRssi;

public:
        __fastcall TBeaconFrame(const TAdvertisementFrame Frame, const __int64 Address,
                const __int64 Timestamp, const SByte Rssi,
                const TwclBluetoothLeAdvertisementFrameRawData& Data,
                const TGUID& Uuid, const Word CompanyId, const Word Major,
                const Word Minor, const SByte TxRssi);

        __property Word CompanyId = { read = FCompanyId };
        __property Word Major = { read = FMajor };
        __property Word Minor = { read = FMinor };
        __property SByte TxRssi = { read = FTxRssi };
};
//---------------------------------------------------------------------------
class TAltBeaconFrame : public TBeaconFrame
{
private:
        Byte FReserved;

public:
        __fastcall TAltBeaconFrame(const __int64 Address, const __int64 Timestamp,
                const SByte Rssi, const TwclBluetoothLeAdvertisementFrameRawData& Data,
                const TGUID& Uuid, const Word CompanyId, const Word Major,
                const Word Minor, const SByte TxRssi, const Byte Reserved);

        __property Byte Reserved = { read = FReserved };
};
//---------------------------------------------------------------------------
class TMicrosoftCdpBeaconFrame : public TFrameStorage
{
private:
        bool FAddressAsDeviceId;
        TwclBluetoothLeCdpBeaconDeviceType FDeviceType;
        TwclBluetoothLeCdpBeaconExtendedDeviceStatuses FExtendedDeviceStatus;
        TwclBluetoothLeCdpBeaconHash FHash;
        TwclBluetoothLeCdpBeaconSalt FSalt;
        TwclBluetoothLeCdpBeaconScenarioType FScenarioType;
        bool FShareNearBy;
        Byte FSubVersion;
        Byte FVersion;

public:
        __fastcall TMicrosoftCdpBeaconFrame(const __int64 Address,
                const __int64 Timestamp, const SByte Rssi,
                const bool AddressAsDeviceId,
                const TwclBluetoothLeCdpBeaconDeviceType DeviceType,
                const TwclBluetoothLeCdpBeaconExtendedDeviceStatuses ExtendedDeviceStatus,
                const TwclBluetoothLeCdpBeaconHash& Hash,
                const TwclBluetoothLeCdpBeaconSalt& Salt,
                const TwclBluetoothLeCdpBeaconScenarioType ScenarioType,
                const bool ShareNearBy, const Byte SubVersion,
                const Byte Version);

        __property Boolean AddressAsDeviceId = { read = FAddressAsDeviceId };
        __property TwclBluetoothLeCdpBeaconDeviceType DeviceType =
                { read = FDeviceType };
        __property TwclBluetoothLeCdpBeaconExtendedDeviceStatuses ExtendedDeviceStatus =
                { read = FExtendedDeviceStatus };
        __property TwclBluetoothLeCdpBeaconHash Hash = { read = FHash };
        __property TwclBluetoothLeCdpBeaconSalt Salt = { read = FSalt };
        __property TwclBluetoothLeCdpBeaconScenarioType ScenarioType =
                { read = FScenarioType };
        __property bool ShareNearBy = { read = FShareNearBy };
        __property Byte SubVersion = { read = FSubVersion };
        __property Byte Version = { read = FVersion };
};
//---------------------------------------------------------------------------
class TAppleFrame : public TFrameStorage
{
public:
        __fastcall TAppleFrame(const TAdvertisementFrame Frame,
                const TwclBluetoothLeAdvertisementInfo& Info);
};
//---------------------------------------------------------------------------
class TAppleAirdropFrame : public TAppleFrame
{
private:
        TwclBluetoothLeAppleAirdropFrameData FData;

public:
        __fastcall TAppleAirdropFrame(
                const TwclBluetoothLeAdvertisementInfo& Info,
                const TwclBluetoothLeAppleAirdropFrameData& Data);

        __property TwclBluetoothLeAppleAirdropFrameData Data = { read = FData };
};
//---------------------------------------------------------------------------
class TAppleAirplaySourceFrame : public TAppleFrame
{
private:
        TwclBluetoothLeAppleAirplaySourceFrameData FData;

public:
        __fastcall TAppleAirplaySourceFrame(
                const TwclBluetoothLeAdvertisementInfo& Info,
                const TwclBluetoothLeAppleAirplaySourceFrameData& Data);

        __property TwclBluetoothLeAppleAirplaySourceFrameData Data =
                { read = FData };
};
//---------------------------------------------------------------------------
class TAppleAirplayTargetFrame : public TAppleFrame
{
private:
        TwclBluetoothLeAppleAirplayTargetFrameData FData;

public:
        __fastcall TAppleAirplayTargetFrame(
                const TwclBluetoothLeAdvertisementInfo& Info,
                const TwclBluetoothLeAppleAirplayTargetFrameData& Data);

        __property TwclBluetoothLeAppleAirplayTargetFrameData Data =
                { read = FData };
};
//---------------------------------------------------------------------------
class TAppleAirprintFrame : public TAppleFrame
{
private:
        TwclBluetoothLeAppleAirprintFrameData FData;

public:
        __fastcall TAppleAirprintFrame(
                const TwclBluetoothLeAdvertisementInfo& Info,
                const TwclBluetoothLeAppleAirprintFrameData& Data);

        __property TwclBluetoothLeAppleAirprintFrameData Data =
                { read = FData };
};
//---------------------------------------------------------------------------
class TAppleHomeKitFrame : public TAppleFrame
{
private:
        TwclBluetoothLeAppleHomeKitFrameData FData;

public:
        __fastcall TAppleHomeKitFrame(
                const TwclBluetoothLeAdvertisementInfo& Info,
                const TwclBluetoothLeAppleHomeKitFrameData& Data);

        __property TwclBluetoothLeAppleHomeKitFrameData Data = { read = FData };
};
//---------------------------------------------------------------------------
class TAppleiBeaconFrame : public TAppleFrame
{
private:
        TwclBluetoothLeAppleiBeaconFrameData FData;

public:
        __fastcall TAppleiBeaconFrame(
                const TwclBluetoothLeAdvertisementInfo& Info,
                const TwclBluetoothLeAppleiBeaconFrameData& Data);

        __property TwclBluetoothLeAppleiBeaconFrameData Data = { read = FData };
};
//---------------------------------------------------------------------------
class TAppleNearbyActionFrame : public TAppleFrame
{
private:
        TwclBluetoothLeAppleNearbyActionFrameData FData;

public:
        __fastcall TAppleNearbyActionFrame(
                const TwclBluetoothLeAdvertisementInfo& Info,
                const TwclBluetoothLeAppleNearbyActionFrameData& Data);

        __property TwclBluetoothLeAppleNearbyActionFrameData Data =
                { read = FData };
};
//---------------------------------------------------------------------------
class TAppleNearbyInfoFrame : public TAppleFrame
{
private:
        TwclBluetoothLeAppleNearbyInfoFrameData FData;

public:
        __fastcall TAppleNearbyInfoFrame(
                const TwclBluetoothLeAdvertisementInfo& Info,
                const TwclBluetoothLeAppleNearbyInfoFrameData& Data);

        __property TwclBluetoothLeAppleNearbyInfoFrameData Data =
                { read = FData };
};
//---------------------------------------------------------------------------
class TAppleProximityPairingFrame : public TAppleFrame
{
private:
        TwclBluetoothLeAppleProximityPairingFrameData FData;

public:
        __fastcall TAppleProximityPairingFrame(
                const TwclBluetoothLeAdvertisementInfo& Info,
                const TwclBluetoothLeAppleProximityPairingFrameData& Data);

        __property TwclBluetoothLeAppleProximityPairingFrameData Data =
                { read = FData };
};
//---------------------------------------------------------------------------
class TAppleUnknownFrame : public TAppleFrame
{
private:
        TwclBluetoothLeAppleUnknownFrameData FData;

public:
        __fastcall TAppleUnknownFrame(
                const TwclBluetoothLeAdvertisementInfo& Info,
                const TwclBluetoothLeAppleUnknownFrameData& Data);

        __property TwclBluetoothLeAppleUnknownFrameData Data = { read = FData };
};
//---------------------------------------------------------------------------
class TAppleFindMyFrame : public TAppleFrame
{
private:
        TwclBluetoothLeAppleFindMyFrameData FData;

public:
        __fastcall TAppleFindMyFrame(
                const TwclBluetoothLeAdvertisementInfo& Info,
                const TwclBluetoothLeAppleFindMyFrameData& Data);

        __property TwclBluetoothLeAppleFindMyFrameData Data = { read = FData };
};
//---------------------------------------------------------------------------
class TAppleHandoffFrame : public TAppleFrame
{
private:
        TwclBluetoothLeAppleHandoffFrameData FData;

public:
        __fastcall TAppleHandoffFrame(
                const TwclBluetoothLeAdvertisementInfo& Info,
                const TwclBluetoothLeAppleHandoffFrameData& Data);

        __property TwclBluetoothLeAppleHandoffFrameData Data = { read = FData };
};
//---------------------------------------------------------------------------
class TAppleHeySiriFrame : public TAppleFrame
{
private:
        TwclBluetoothLeAppleHeySiriFrameData FData;

public:
        __fastcall TAppleHeySiriFrame(
                const TwclBluetoothLeAdvertisementInfo& Info,
                const TwclBluetoothLeAppleHeySiriFrameData& Data);

        __property TwclBluetoothLeAppleHeySiriFrameData Data = { read = FData };
};
//---------------------------------------------------------------------------
class TAppleMagicSwitchFrame : public TAppleFrame
{
private:
        TwclBluetoothLeAppleMagicSwitchFrameData FData;

public:
        __fastcall TAppleMagicSwitchFrame(
                const TwclBluetoothLeAdvertisementInfo& Info,
                const TwclBluetoothLeAppleMagicSwitchFrameData& Data);

        __property TwclBluetoothLeAppleMagicSwitchFrameData Data =
                { read = FData };
};
//---------------------------------------------------------------------------
class TAppleTetheringSourceFrame : public TAppleFrame
{
private:
        TwclBluetoothLeAppleTetheringSourceFrameData FData;

public:
        __fastcall TAppleTetheringSourceFrame(
                const TwclBluetoothLeAdvertisementInfo& Info,
                const TwclBluetoothLeAppleTetheringSourceFrameData& Data);

        __property TwclBluetoothLeAppleTetheringSourceFrameData Data =
                { read = FData };
};
//---------------------------------------------------------------------------
class TAppleTetheringTargetFrame : public TAppleFrame
{
private:
        TwclBluetoothLeAppleTetheringTargetFrameData FData;

public:
        __fastcall TAppleTetheringTargetFrame(
                const TwclBluetoothLeAdvertisementInfo& Info,
                const TwclBluetoothLeAppleTetheringTargetFrameData& Data);

        __property TwclBluetoothLeAppleTetheringTargetFrameData Data =
                { read = FData };
};
//---------------------------------------------------------------------------
class TEddystoneTlmFrame : public TDataFrameStorage
{
private:
        Cardinal FAdvCnt;
        Word FBatt;
        Cardinal FSecCnt;
        Double FTemp;

public:
        __fastcall TEddystoneTlmFrame(const __int64 Address, const __int64 Timestamp,
                const SByte Rssi, const TwclBluetoothLeAdvertisementFrameRawData& Data,
                const Cardinal AdvCnt, const Word Batt, const Cardinal SecCnt,
                const Double Temp);

        __property Cardinal AdvCnt = { read = FAdvCnt };
        __property Word Batt = { read = FBatt };
        __property Cardinal SecCnt = { read = FSecCnt };
        __property Double Temp = { read = FTemp };
};
//---------------------------------------------------------------------------
class TEddystoneUidFrame : public TGuidDataFrameStorage
{
private:
        SByte FTxRssi;

public:
        __fastcall TEddystoneUidFrame(const __int64 Address, const __int64 Timestamp,
                const SByte Rssi, const TwclBluetoothLeAdvertisementFrameRawData& Data,
                const TGUID& Uuid, const SByte TxRssi);

        __property SByte TxRssi = { read = FTxRssi };
};
//---------------------------------------------------------------------------
class TEddystoneUrlFrame : public TFrameStorage
{
private:
        SByte FTxRssi;
        String FUrl;

public:
        __fastcall TEddystoneUrlFrame(const __int64 Address, const __int64 Timestamp,
                const SByte Rssi, const SByte TxRssi, const String& Url);

        __property SByte TxRssi = { read = FTxRssi };
        __property String Url = { read = FUrl };
};
//---------------------------------------------------------------------------
class TManufacturerFrame : public TDataFrameStorage
{
private:
        Word FCompanyId;

public:
        __fastcall TManufacturerFrame(const __int64 Address, const __int64 Timestamp,
                const SByte Rssi, const Word CompanyId,
                const TwclBluetoothLeAdvertisementFrameRawData& Data);

        __property Word CompanyId = { read = FCompanyId };
};
//---------------------------------------------------------------------------
class TDriAsdFrame : public TFrameStorage
{
private:
        TwclDriRawData FRaw;

public:
        __fastcall TDriAsdFrame(const __int64 Address, const __int64 Timestamp,
                const SByte Rssi, const TwclDriRawData& Raw);

        __property TwclDriRawData Raw = { read = FRaw };
};
//---------------------------------------------------------------------------
class TfmMain : public TForm
{
__published:	// IDE-managed Components
        TLabel *laWatcherScanInterval;
        TLabel *laWatcherScanWindow;
        TLabel *laAdvertiserInterval;
        TLabel *laWatcherScanMode;
        TLabel *laBeaconWatcher;
        TLabel *laLeAdvertiser;
        TLabel *laLog;
        TButton *btWatcherStart;
        TButton *btWatcherStop;
        TListBox *lbLog;
        TButton *btClearLog;
        TButton *btAdvertiserStart;
        TButton *btAdvertiserStop;
        TEdit *edWatcherScanInterval;
        TEdit *edWatcherScanWindow;
        TEdit *edAdvertiserInterval;
        TCheckBox *cbAdvertiserBeacon;
        TCheckBox *cbAdvertiserProximityBeacon;
        TCheckBox *cbAdvertiserAltBeacon;
        TCheckBox *cbAdvertiserEddystoneUid;
        TCheckBox *cbAdvertiserEddystoneUrl;
        TCheckBox *cbAdvertiser128SolUuid;
        TCheckBox *cbAdvertiserManufacturer;
        TCheckBox *cbAdvertiser16Uuid;
        TCheckBox *cbAdvertiser32Uuid;
        TCheckBox *cbAdvertiser128Uuid;
        TCheckBox *cbAdvertiser16UuidData;
        TCheckBox *cbAdvertiser32UuidData;
        TCheckBox *cbAdvertiser128UuidData;
        TCheckBox *cbAdvertiserCustom;
        TCheckBox *cbAdvertiserExtended;
        TCheckBox *cbAdvertiserAnonymous;
        TCheckBox *cbAdvertiserTxRssi;
        TButton *btWatcherDefault;
        TButton *btAdvertiserDefault;
        TComboBox *cbWatcherScanMode;
        TCheckBox *cbWatcherEnableExtended;
        TListView *lvFrameDetails;
        TCheckBox *cbAutoScroll;
        TListView *lvDevices;
        TwclBluetoothManager *BluetoothManager;
        TwclBluetoothLeBeaconWatcher *BeaconWatcher;
        TwclBluetoothLeAdvertiser *LeAdvertiser;
        void __fastcall lvDevicesSelectItem(TObject *Sender,
          TListItem *Item, bool Selected);
        void __fastcall FormCreate(TObject *Sender);
        void __fastcall FormDestroy(TObject *Sender);
        void __fastcall btClearLogClick(TObject *Sender);
        void __fastcall btWatcherDefaultClick(TObject *Sender);
        void __fastcall btAdvertiserDefaultClick(TObject *Sender);
        void __fastcall cbAdvertiserExtendedClick(TObject *Sender);
        void __fastcall EditKeyPress(TObject *Sender, char &Key);
        void __fastcall BluetoothManagerAfterOpen(TObject *Sender);
        void __fastcall BluetoothManagerBeforeClose(TObject *Sender);
        void __fastcall BluetoothManagerClosed(TObject *Sender);
        void __fastcall btWatcherStartClick(TObject *Sender);
        void __fastcall btWatcherStopClick(TObject *Sender);
        void __fastcall BeaconWatcherStarted(TObject *Sender);
        void __fastcall BeaconWatcherStopped(TObject *Sender);
        void __fastcall BeaconWatcherAdvertisementAppearanceFrame(
          TObject *Sender, const __int64 Address, const __int64 Timestamp,
          const SByte Rssi, const WORD Appearance);
        void __fastcall BeaconWatcherAdvertisementExtFrameInformation(
          TObject *Sender, const __int64 Address, const __int64 Timestamp,
          const SByte Rssi, const TwclBluetoothAddressType AddressType,
          const SByte TxPower,
          const TwclBluetoothLeExtendedFrameFlags Flags);
        void __fastcall BeaconWatcherAdvertisementFrameInformation(
          TObject *Sender, const __int64 Address, const __int64 Timestamp,
          const SByte Rssi, const String Name,
          const TwclBluetoothLeAdvertisementType PacketType,
          const TwclBluetoothLeAdvertisementFlags Flags);
        void __fastcall BeaconWatcherAdvertisementRawFrame(TObject *Sender,
          const __int64 Address, const __int64 Timestamp, const SByte Rssi,
          const BYTE DataType,
          const TwclBluetoothLeAdvertisementFrameRawData Data);
        void __fastcall BeaconWatcherAdvertisementReceived(TObject *Sender,
          const __int64 Address, const __int64 Timestamp, const SByte Rssi,
          const TwclBluetoothLeAdvertisementFrameRawData Data);
        void __fastcall BeaconWatcherAdvertisementService128DataFrame(
          TObject *Sender, const __int64 Address, const __int64 Timestamp,
          const SByte Rssi, const TGUID &Uuid,
          const TwclBluetoothLeAdvertisementFrameRawData Data);
        void __fastcall BeaconWatcherAdvertisementService16DataFrame(
          TObject *Sender, const __int64 Address, const __int64 Timestamp,
          const SByte Rssi, const WORD Uuid,
          const TwclBluetoothLeAdvertisementFrameRawData Data);
        void __fastcall BeaconWatcherAdvertisementService32DataFrame(
          TObject *Sender, const __int64 Address, const __int64 Timestamp,
          const SByte Rssi, const DWORD Uuid,
          const TwclBluetoothLeAdvertisementFrameRawData Data);
        void __fastcall BeaconWatcherAdvertisementServiceSol128Frame(
          TObject *Sender, const __int64 Address, const __int64 Timestamp,
          const SByte Rssi, const TGUID &Uuid);
        void __fastcall BeaconWatcherAdvertisementServiceSol16Frame(
          TObject *Sender, const __int64 Address, const __int64 Timestamp,
          const SByte Rssi, const WORD Uuid);
        void __fastcall BeaconWatcherAdvertisementServiceSol32Frame(
          TObject *Sender, const __int64 Address, const __int64 Timestamp,
          const SByte Rssi, const DWORD Uuid);
        void __fastcall BeaconWatcherAdvertisementTxPowerLevelFrame(
          TObject *Sender, const __int64 Address, const __int64 Timestamp,
          const SByte Rssi, const SByte TxPower);
        void __fastcall BeaconWatcherAdvertisementUuidFrame(
          TObject *Sender, const __int64 Address, const __int64 Timestamp,
          const SByte Rssi, const TGUID &Uuid);
        void __fastcall BeaconWatcherAltBeaconFrame(TObject *Sender,
          const __int64 Address, const __int64 Timestamp, const SByte Rssi,
          const WORD CompanyId, const WORD Major, const WORD Minor,
          const TGUID &Uuid, const SByte TxRssi, const BYTE Reserved,
          const TwclBluetoothLeAdvertisementFrameRawData Data);
        void __fastcall BeaconWatcherEddystoneTlmFrame(TObject *Sender,
          const __int64 Address, const __int64 Timestamp, const SByte Rssi,
          const DWORD AdvCnt, const WORD Batt, const DWORD SecCnt,
          const double Temp,
          const TwclBluetoothLeAdvertisementFrameRawData Data);
        void __fastcall BeaconWatcherEddystoneUidFrame(TObject *Sender,
          const __int64 Address, const __int64 Timestamp, const SByte Rssi,
          const SByte TxRssi, const TGUID &Uuid,
          const TwclBluetoothLeAdvertisementFrameRawData Data);
        void __fastcall BeaconWatcherEddystoneUrlFrame(TObject *Sender,
		  const __int64 Address, const __int64 Timestamp, const SByte Rssi,
		  const SByte TxRssi, const String Url);
        void __fastcall BeaconWatcherManufacturerRawFrame(TObject *Sender,
          const __int64 Address, const __int64 Timestamp, const SByte Rssi,
          const WORD CompanyId,
          const TwclBluetoothLeAdvertisementFrameRawData Data);
        void __fastcall BeaconWatcherMicrosoftCdpBeaconFrame(
          TObject *Sender, const __int64 Address, const __int64 Timestamp,
          const SByte Rssi,
          const TwclBluetoothLeCdpBeaconScenarioType ScenarioType,
          const BYTE Version,
          const TwclBluetoothLeCdpBeaconDeviceType DeviceType,
          const BYTE SubVersion, const bool ShareNearBy,
          const bool AddressAsDeviceId,
          const TwclBluetoothLeCdpBeaconExtendedDeviceStatuses ExtendedDeviceStatus,
          const TwclBluetoothLeCdpBeaconSalt Salt,
          const TwclBluetoothLeCdpBeaconHash Hash);
        void __fastcall BeaconWatcherDriAsdMessage(TObject *Sender,
          const __int64 Address, const __int64 Timestamp, const SByte Rssi,
          const TwclDriRawData Raw);
        void __fastcall btAdvertiserStartClick(TObject *Sender);
        void __fastcall btAdvertiserStopClick(TObject *Sender);
        void __fastcall LeAdvertiserStarted(TObject *Sender);
        void __fastcall LeAdvertiserStopped(TObject *Sender);
        void __fastcall BeaconWatcherAppleiBeaconFrame(TObject *Sender,
          const TwclBluetoothLeAdvertisementInfo &Info,
          const TwclBluetoothLeAppleiBeaconFrameData &Data);
        void __fastcall BeaconWatcherAppleNearbyInfoFrame(TObject *Sender,
          const TwclBluetoothLeAdvertisementInfo &Info,
          const TwclBluetoothLeAppleNearbyInfoFrameData &Data);
        void __fastcall BeaconWatcherAppleNearbyActionFrame(
          TObject *Sender, const TwclBluetoothLeAdvertisementInfo &Info,
          const TwclBluetoothLeAppleNearbyActionFrameData &Data);
        void __fastcall BeaconWatcherAppleHomeKitFrame(TObject *Sender,
          const TwclBluetoothLeAdvertisementInfo &Info,
          const TwclBluetoothLeAppleHomeKitFrameData &Data);
        void __fastcall BeaconWatcherAppleUnknownFrame(TObject *Sender,
          const TwclBluetoothLeAdvertisementInfo &Info,
          const TwclBluetoothLeAppleUnknownFrameData &Data);
        void __fastcall BeaconWatcherAppleAirplaySourceFrame(
          TObject *Sender, const TwclBluetoothLeAdvertisementInfo &Info,
          const TwclBluetoothLeAppleAirplaySourceFrameData Data);
        void __fastcall BeaconWatcherAppleAirplayTargetFrame(
          TObject *Sender, const TwclBluetoothLeAdvertisementInfo &Info,
          const TwclBluetoothLeAppleAirplayTargetFrameData &Data);
        void __fastcall BeaconWatcherAppleAirdropFrame(TObject *Sender,
          const TwclBluetoothLeAdvertisementInfo &Info,
          const TwclBluetoothLeAppleAirdropFrameData &Data);
        void __fastcall BeaconWatcherAppleAirprintFrame(TObject *Sender,
          const TwclBluetoothLeAdvertisementInfo &Info,
          const TwclBluetoothLeAppleAirprintFrameData &Data);
        void __fastcall BeaconWatcherAppleProximityPairingFrame(
          TObject *Sender, const TwclBluetoothLeAdvertisementInfo &Info,
          const TwclBluetoothLeAppleProximityPairingFrameData &Data);
        void __fastcall BeaconWatcherAppleFindMyFrame(TObject *Sender,
          const TwclBluetoothLeAdvertisementInfo &Info,
          const TwclBluetoothLeAppleFindMyFrameData &Data);
        void __fastcall BeaconWatcherAppleHandoffFrame(TObject *Sender,
          const TwclBluetoothLeAdvertisementInfo &Info,
          const TwclBluetoothLeAppleHandoffFrameData &Data);
        void __fastcall BeaconWatcherAppleHeySiriFrame(TObject *Sender,
          const TwclBluetoothLeAdvertisementInfo &Info,
          const TwclBluetoothLeAppleHeySiriFrameData &Data);
        void __fastcall BeaconWatcherAppleMagicSwitchFrame(TObject *Sender,
          const TwclBluetoothLeAdvertisementInfo &Info,
          const TwclBluetoothLeAppleMagicSwitchFrameData Data);
        void __fastcall BeaconWatcherAppleTetheringSourceFrame(
          TObject *Sender, const TwclBluetoothLeAdvertisementInfo &Info,
          const TwclBluetoothLeAppleTetheringSourceFrameData &Data);
        void __fastcall BeaconWatcherAppleTetheringTargetFrame(
          TObject *Sender, const TwclBluetoothLeAdvertisementInfo &Info,
          const TwclBluetoothLeAppleTetheringTargetFrameData Data);

private:	// User declarations
        void __fastcall AdvertiserDefaults();
        void __fastcall WatcherDefaults();

        void __fastcall AdvertiserEnableControls(const bool Stopped);
        void __fastcall WatcherEnableControls(const bool Stopped);

        void __fastcall Trace(const String& Msg);
        void __fastcall Trace(const String& Msg, const int Res);

        TwclBluetoothRadio* __fastcall GetRadio();

        TListItem* __fastcall AddDevice(const __int64 Address);
        void __fastcall AddFrame(TFrameStorage* const Frame);

        TDateTime __fastcall ConvertTime(const __int64 Timestamp);

        void __fastcall ShowData(const String& Name, const String& Value);
        void __fastcall ShowFrameBaseData(TFrameStorage* const Frame);
        void __fastcall ShowFrameRawData(
                const TwclBluetoothLeAdvertisementFrameRawData& Data);
        void __fastcall ShowDriFrameRawData(const TwclDriRawData& Raw);

        void __fastcall ShowAppearanceFrame(TAppearanceFrame* const Frame);
        void __fastcall ShowExtInformationFrame(TExtInformationFrame* const Frame);
        void __fastcall ShowInformationFrame(TInformationFrame* const Frame);
        void __fastcall ShowRawFrame(TRawFrame* const Frame);
        void __fastcall ShowDetailsFrame(TDetailsFrame* const Frame);
        void __fastcall ShowService16DataFrame(TService16DataFrame* const Frame);
        void __fastcall ShowService32DataFrame(TService32DataFrame* const Frame);
        void __fastcall ShowService128DataFrame(TService128DataFrame* const Frame);
        void __fastcall ShowSol16Frame(TSol16Frame* const Frame);
        void __fastcall ShowSol32Frame(TSol32Frame* const Frame);
        void __fastcall ShowSol128Frame(TSol128Frame* const Frame);
        void __fastcall ShowTxPowerFrame(TTxPowerFrame* const Frame);
        void __fastcall ShowUuidFrame(TUuidFrame* const Frame);
        void __fastcall ShowAltBeaconFrame(TAltBeaconFrame* const Frame);
        void __fastcall ShowEddystoneTlmFrame(TEddystoneTlmFrame* const Frame);
        void __fastcall ShowEddystoneUidFrame(TEddystoneUidFrame* const Frame);
        void __fastcall ShowEddystoneUrlFrame(TEddystoneUrlFrame* const Frame);
        void __fastcall ShowManufacturerFrame(TManufacturerFrame* const Frame);
        void __fastcall ShowMicrosoftCdpBeaconFrame(TMicrosoftCdpBeaconFrame* const Frame);
        void __fastcall ShowAppleAirdropFrame(TAppleAirdropFrame* const Frame);
        void __fastcall ShowAppleAirplaySourceFrame(TAppleAirplaySourceFrame* const Frame);
        void __fastcall ShowAppleAirplayTargetFrame(TAppleAirplayTargetFrame* const Frame);
        void __fastcall ShowAppleAirprintFrame(TAppleAirprintFrame* const Frame);
        void __fastcall ShowAppleHomeKitFrame(TAppleHomeKitFrame* const Frame);
        void __fastcall ShowAppleiBeaconFrame(TAppleiBeaconFrame* const Frame);
        void __fastcall ShowAppleNearbyActionFrame(TAppleNearbyActionFrame* const Frame);
        void __fastcall ShowAppleNearbyInfoFrame(TAppleNearbyInfoFrame* const Frame);
        void __fastcall ShowAppleProximityPairingFrame(TAppleProximityPairingFrame* const Frame);
        void __fastcall ShowAppleUnknownFrame(TAppleUnknownFrame* const Frame);
        void __fastcall ShowAppleFindMyFrame(TAppleFindMyFrame* const Frame);
        void __fastcall ShowAppleHandoffFrame(TAppleHandoffFrame* const Frame);
        void __fastcall ShowAppleHeySiriFrame(TAppleHeySiriFrame* const Frame);
        void __fastcall ShowAppleMagicSwitchFrame(TAppleMagicSwitchFrame* const Frame);
        void __fastcall ShowAppleTetheringSourceFrame(TAppleTetheringSourceFrame* const Frame);
        void __fastcall ShowAppleTetheringTargetFrame(TAppleTetheringTargetFrame* const Frame);
        void __fastcall ShowFrameData(TFrameStorage* const Frame);
        void __fastcall ShowDriAsdFrame(TDriAsdFrame* const Frame);

        void __fastcall AddAdvertisement(TwclBluetoothLeAdvertisement* const Adv);

public:		// User declarations
        __fastcall TfmMain(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TfmMain *fmMain;
//---------------------------------------------------------------------------
#endif
