#ifndef TDIDevCapsH #define TDIDevCapsH // ========================================================================== // File: TDIDevCaps.H // Authors: BCB_Code_Generator v1.62, // Darren Dwyer (source code, documentation, demos, website), // Hugh Edwards (documentation, icons, website), // Brian Austin (some source code, documentation) // Description: This file defines the TDIDevCaps Component // // "TDx_Input_Library v1.62" // (c) 2002 BCB-Tools.com Pty. Ltd., Sydney, Australia. // All Rights Reserved. // // Refer to the 'Licence.Txt' file for licencing & copyright information. // ========================================================================== // -------------------------------------------------------------------------- #include "TDx_Library_Defns.H" #include "TDx_Library_Functions.H" // -------------------------------------------------------------------------- #include "TDx_Input_Library_Defns.H" #include "TDx_Input_Library_Functions.H" // ========================================================================== // Set: TDIDevCapsFlags_Set // Description: A set of mangled DirectX flag names that are used to set the // TDIDevCaps::Flags property using the BCB Object Inspector. // For detailed descriptions of each flag, see the Flags // property description below. // ========================================================================== enum TDIDevCaps_Flags_Flags { didc_alias, didc_attached, didc_deadband, didc_emulated, didc_ffattack, didc_fffade, didc_forcefeedback, didc_phantom, didc_polleddataformat, didc_polleddevice, didc_posnegcoefficients, didc_posnegsaturation, didc_saturation, didc_startdelay }; typedef Set< TDIDevCaps_Flags_Flags, didc_alias, didc_startdelay > TDIDevCaps_Flags_Set; // -------------------------------------------------------------------------- // ========================================================================== // Class: TDIDevCaps // Description: The TDIDevCaps component wraps the DirectX DIDEVCAPS // structure, which defines the capabilities of a DirectInput // device. // // To retrieve a device's capabilities, use the // TDx_InputDevice::GetCapabilities() method. // ========================================================================== #if (__BORLANDC__ >= 0x0530) // BCB Version 3 + class PACKAGE TDIDevCaps : public TComponent { // -------------------------------------------------------------------------- #else // BCB Version 1 class TDIDevCaps : public TComponent { #endif // ========================================================================== __published: // ========================================================================== // ---------------------------------------------------------------------- // Property: Flags_ // Description: The Flags property defines flags indicating the force // feedback and reporting capabilities the device has // available. // The described effect applies when the flag is set. // Note: This property is used to set the various DirectX Flags // for the 'Flags' property via the BCB Object Inspector. // For detailed descriptions of each flag, see the Flags // property description below. // ---------------------------------------------------------------------- __property TDIDevCaps_Flags_Set Flags_ = { read=FGetFlags_, write=FSetFlags_, nodefault }; // ---------------------------------------------------------------------- // Property: Axes // Description: The Axes property defines the number of axes available on // the device. // // Any part of a device that is capable of returning a range // of values is regarded to be an axis. // ---------------------------------------------------------------------- __property dword Axes = { read=FGetAxes, write=FSetAxes, default=0 }; // ---------------------------------------------------------------------- // Property: Buttons // Description: The Buttons property defines the number of buttons // available on the device. // // Any part of a device that is basically boolean is // regarded to be a button. // ---------------------------------------------------------------------- __property dword Buttons = { read=FGetButtons, write=FSetButtons, default=0 }; // ---------------------------------------------------------------------- // Property: FFDriverVersion // Description: The FFDriverVersion property defines the version number // of the force feedback device driver. // // There is no standard format for revisions, except that // newer revisions will have a larger value. // ---------------------------------------------------------------------- __property dword FFDriverVersion = { read=FGetFFDriverVersion, write=FSetFFDriverVersion, default=0 }; // ---------------------------------------------------------------------- // Property: FFMinTimeResolution // Description: The FFMinTimeResolution property defines the minimum // amount of time, in microseconds, that the device can // resolve. // // Any times assigned by the application, for force feedback // effects, will be rounded to the nearest increment that is // supported by the device. // ---------------------------------------------------------------------- __property dword FFMinTimeResolution = { read=FGetFFMinTimeResolution, write=FSetFFMinTimeResolution, default=0 }; // ---------------------------------------------------------------------- // Property: FFSamplePeriod // Description: The FFSamplePeriod property defines the minimum time, in // microseconds, that is allowed between the playback of // consecutive force feedback commands. // ---------------------------------------------------------------------- __property dword FFSamplePeriod = { read=FGetFFSamplePeriod, write=FSetFFSamplePeriod, default=0 }; // ---------------------------------------------------------------------- // Property: FirmwareRevision // Description: The FirmwareRevision property defines the firmware // revision of the device. // // There is no standard format for firmware revisions, // except that newer revisions will have a larger value. // ---------------------------------------------------------------------- __property dword FirmwareRevision = { read=FGetFirmwareRevision, write=FSetFirmwareRevision, default=0 }; // ---------------------------------------------------------------------- // Property: HardwareRevision // Description: The HardwareRevision Defines the hardware revision of the // device. // // There is no standard format for hardware revisions, // except that newer revisions will have a larger value. // ---------------------------------------------------------------------- __property dword HardwareRevision = { read=FGetHardwareRevision, write=FSetHardwareRevision, default=0 }; // ---------------------------------------------------------------------- // Property: POVs // Description: The POVs property defines the number of 'point of view' // controls on the device. // ---------------------------------------------------------------------- __property dword POVs = { read=FGetPOVs, write=FSetPOVs, default=0 }; // ---------------------------------------------------------------------- // Property: Size // Description: The Size property defines the size, in bytes, of the // internal structure used by this component. // ---------------------------------------------------------------------- __property dword Size = { read=FGetSize, write=FSetSize, default=sizeof(DIDEVCAPS) }; // ---------------------------------------------------------------------- // Event: OnError() // Description: The OnError event is called when an error occurs in the // TDIDevCaps component. // ---------------------------------------------------------------------- __property TDx_Error OnError = {read=FOnError, write=FOnError, nodefault}; // ========================================================================== public: // ========================================================================== // ---------------------------------------------------------------------- // Property: DevType // Description: The DevType property defines the device type // specification flags. // The described effect applies when the flag is set. // // The device type defines a device as one of four basic // types, those being keyboard, mouse, joystick and unknown. // The four basic types have subtypes that further specify // the device type. All devices can also be defined as using // HID (Human Interface Device) protocol. // // Basic types are defined in the least significant byte, // subtypes in the next byte and further definitions such as // HID are contained in the high order word. // ---------------------------------------------------------------------- __property dword DevType = { read=FGetDevType, write=FSetDevType, default=0 }; // ---------------------------------------------------------------------- // Property: ErrorValue // Description: The ErrorValue property contains the last error value // returned from a call to a TDIDevCaps method or fget/fset. // eg. DI_OK or DDERR_SURFACELOST or TDX_ERROR // ---------------------------------------------------------------------- __property HRESULT ErrorValue = { read=FGetErrorValue, write=FSetErrorValue, default=DI_OK }; // ---------------------------------------------------------------------- // Property: Flags // Description: The Flags property defines flags indicating the force // feedback and reporting capabilities the device has // available. // The described effect applies when the flag is set. // Flags: DIDC_ALIAS - // The device duplicates another input device. // // An alias device will not be enumerated by // TDx_Input::EnumDevices() unless specifically requested. // DIDC_ATTACHED - // The device is physically attached to the system. // // It is possible to have a device installed but not // attached, like if you have a mouse driver installed, // but the mouse is not physically plugged in. // DIDC_DEADBAND - // Support for deadband on at least one force feedback // condition is available. // DIDC_EMULATED - // The device's data is not coming directly from a kernel // mode driver. // // There may be some performance degradation, depending on // the functionality being used. // DIDC_FFATTACK - // Support for force feedback attack envelope parameters // on at least one effect is available. // // TDIEnvelope::AttackLevel and TDIEnvelope::AttackTime // will be ignored if attack is not supported for a given // effect. // After calling TDx_InputDevice::GetEffectInfo(), an // individual effect will set the DIEFT_FFATTACK flag if // attack is supported for that effect. // DIDC_FFFADE - // Support for force feedback fade envelope parameters on // at least one effect is available. // // TDIEnvelope::FadeLevel and TDIEnvelope::FadeTime will // be ignored if fade is not supported for a given effect. // After calling TDx_InputDevice::GetEffectInfo(), an // individual effect will set the DIEFT_FFFADE flag if // fade is supported for that effect. // DIDC_FORCEFEEDBACK - // Support for force feedback effects is available. // DIDC_PHANTOM - // The device does not actually exist, instead being a // placeholder for a possible future device. // // A phantom device will not be enumerated by // TDx_Input::EnumDevices() unless specifically requested. // DIDC_POLLEDDATAFORMAT - // One or more objects in the current data format must be // polled rather than being interrupt driven. // // TDx_InputDevice::Poll() must be explicitly called in // order to obtain data from objects that have to be // polled. // DIDC_POLLEDDEVICE - // One or more parts of the device must be polled rather // than being interrupt driven. // // TDx_InputDevice::Poll() must be explicitly called in // order to obtain data from device objects that have to // be polled. // A HID may have both polled and non-polled objects // present. // DIDC_POSNEGCOEFFICIENTS - // Support for both positive and negative coefficient // values for conditions is available for at least one // condition. // // After calling TDx_InputDevice::GetEffectInfo(), an // individual condition will set DIEFT_POSNEGCOEFFICIENTS // if separate positive and negative coefficients are // supported for that condition. // // If this flag isn't set then the positive coefficient is // used for both the positive and negative values. // DIDC_POSNEGSATURATION - // Support for both positive and negative saturation // values for conditions is available for at least one // condition. // // After calling TDx_InputDevice::GetEffectInfo(), an // individual condition will set DIEFT_POSNEGSATURATION if // separate positive and negative saturations are // supported for that condition. // // If this flag isn't set then the positive saturation is // used for both the positive and negative values. // DIDC_SATURATION - // Support for saturation values on conditions is // available for at least one condition. // // After calling TDx_InputDevice::GetEffectInfo(), an // individual condition will set DIEFT_SATURATION if // saturation is supported for that condition. // // If the device does not support saturation, then the // force generated by a condition is only limited by the // maximum force the device can generate. // DIDC_STARTDELAY - // Support for delaying the playback of an effect by a // specified time is available. // // If support is not available the TDIEffect::StartDelay // property will be ignored. // ---------------------------------------------------------------------- __property dword Flags = { read=FGetFlags, write=FSetFlags, default=0 }; // ---------------------------------------------------------------------- // Method: Clear() // Description: The Clear() method can be used to clear the contents of // the TDIDevCaps's internal DIDEVCAPS structure. // Note: if you have manually linked a structure member to a // chunk of memory, make sure you release this memory before // calling Clear(). // ---------------------------------------------------------------------- virtual void __fastcall Clear(); // ---------------------------------------------------------------------- // Property: Flags_Strings() // Description: This property returns a TStringList containing current // flag values for the Flags property. Note: Any memory // associated with these strings is released on destruction. // ---------------------------------------------------------------------- __property TStringList* Flags_Strings = { read=FGetFlags_Strings }; // ---------------------------------------------------------------------- // Constructor() and Destructor() // ---------------------------------------------------------------------- __fastcall TDIDevCaps(TComponent* Owner); virtual __fastcall ~TDIDevCaps(); // ---------------------------------------------------------------------- // Internal Structure Access // ---------------------------------------------------------------------- __property DIDEVCAPS* Internal_DIDEVCAPS_Ptr = { read=FGetInternal_DIDEVCAPS_Ptr, nodefault }; void __fastcall Internal_DIDEVCAPS_Update(); // ========================================================================== protected: // ========================================================================== // ---------------------------------------------------------------------- // Object Inspector 'Flag' Access Methods // ---------------------------------------------------------------------- TDIDevCaps_Flags_Set __fastcall FGetFlags_(); void __fastcall FSetFlags_( TDIDevCaps_Flags_Set pFlags_ ); // ---------------------------------------------------------------------- // Property Access Methods // ---------------------------------------------------------------------- dword __fastcall FGetAxes(); void __fastcall FSetAxes( dword pAxes ); dword __fastcall FGetButtons(); void __fastcall FSetButtons( dword pButtons ); dword __fastcall FGetDevType(); void __fastcall FSetDevType( dword pDevType ); HRESULT __fastcall FGetErrorValue(); void __fastcall FSetErrorValue( HRESULT pErrorValue ); dword __fastcall FGetFFDriverVersion(); void __fastcall FSetFFDriverVersion( dword pFFDriverVersion ); dword __fastcall FGetFFMinTimeResolution(); void __fastcall FSetFFMinTimeResolution( dword pFFMinTimeResolution ); dword __fastcall FGetFFSamplePeriod(); void __fastcall FSetFFSamplePeriod( dword pFFSamplePeriod ); dword __fastcall FGetFirmwareRevision(); void __fastcall FSetFirmwareRevision( dword pFirmwareRevision ); dword __fastcall FGetFlags(); void __fastcall FSetFlags( dword pFlags ); dword __fastcall FGetHardwareRevision(); void __fastcall FSetHardwareRevision( dword pHardwareRevision ); dword __fastcall FGetPOVs(); void __fastcall FSetPOVs( dword pPOVs ); dword __fastcall FGetSize(); void __fastcall FSetSize( dword pSize ); // ---------------------------------------------------------------------- // Flag_Strings Access Methods // ---------------------------------------------------------------------- TStringList* __fastcall FGetFlags_Strings(); // ========================================================================== private: // ========================================================================== // ---------------------------------------------------------------------- // Internal Structure Access // ---------------------------------------------------------------------- DIDEVCAPS* __fastcall FGetInternal_DIDEVCAPS_Ptr(); void __fastcall FSetInternal_DIDEVCAPS( DIDEVCAPS* pDIDEVCAPS ); // ---------------------------------------------------------------------- // Property Variables // ---------------------------------------------------------------------- HRESULT fErrorValue; // ---------------------------------------------------------------------- // Flags_Strings Variables // ---------------------------------------------------------------------- TStringList* fFlags_Strings; // ---------------------------------------------------------------------- // Structure Variables // ---------------------------------------------------------------------- DIDEVCAPS fDIDEVCAPS; // ---------------------------------------------------------------------- // Event Variables // ---------------------------------------------------------------------- TDx_Error FOnError; }; // -------------------------------------------------------------------------- #endif // --------------------------------------------------------------------------