add missing sg device wrappers in layer 4 of the api and also more documentation
This commit is contained in:
@@ -426,12 +426,12 @@ int32 USGDevice::GetDeviceIndex() const
|
|||||||
return SGCoreImpl_FSGDeviceImpl_GetDeviceIndex(&InstanceContainer);
|
return SGCoreImpl_FSGDeviceImpl_GetDeviceIndex(&InstanceContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void USGDevice::SetDeviceIndex(const int32 Index)
|
void USGDevice::SetDeviceIndex(const int32 NewIndex)
|
||||||
{
|
{
|
||||||
SyncImplObject();
|
SyncImplObject();
|
||||||
|
|
||||||
FSGIC_TSharedPtr_FSGDeviceImpl InstanceContainer{ToSGDeviceImpl()};
|
FSGIC_TSharedPtr_FSGDeviceImpl InstanceContainer{ToSGDeviceImpl()};
|
||||||
SGCoreImpl_FSGDeviceImpl_SetDeviceIndex(&InstanceContainer, Index);
|
SGCoreImpl_FSGDeviceImpl_SetDeviceIndex(&InstanceContainer, NewIndex);
|
||||||
|
|
||||||
SyncUProperties();
|
SyncUProperties();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,9 @@
|
|||||||
*
|
*
|
||||||
* @section DESCRIPTION
|
* @section DESCRIPTION
|
||||||
*
|
*
|
||||||
*
|
* Represents a Device built by the Sense Glove company that is compatible with
|
||||||
|
* our Communications Protocol. All such devices derive from this abstract
|
||||||
|
* class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -49,14 +51,23 @@ class FSGHapticGloveImpl;
|
|||||||
class FSGNovaGloveImpl;
|
class FSGNovaGloveImpl;
|
||||||
class FSGSenseGloveImpl;
|
class FSGSenseGloveImpl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
UCLASS(Abstract, BlueprintType)
|
UCLASS(Abstract, BlueprintType)
|
||||||
class SENSEGLOVECORE_API USGDevice : public UObject
|
class SENSEGLOVECORE_API USGDevice : public UObject
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Parse a main and sub firmware version from its raw (v4.12) notation
|
||||||
|
*/
|
||||||
static void ParseFirmware(const FString& RawFirmware, int32& OutMainVersion, int32& OutSubVersion);
|
static void ParseFirmware(const FString& RawFirmware, int32& OutMainVersion, int32& OutSubVersion);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
static FString ToString(ESGDeviceType DeviceType);
|
static FString ToString(ESGDeviceType DeviceType);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -71,6 +82,9 @@ private:
|
|||||||
FImplDeleter PimplDeleter;
|
FImplDeleter PimplDeleter;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/**
|
||||||
|
* The basic constructor.
|
||||||
|
*/
|
||||||
USGDevice();
|
USGDevice();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -200,39 +214,93 @@ protected:
|
|||||||
virtual void SyncUProperties();
|
virtual void SyncUProperties();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Check which DeviceType this class belongs to.
|
||||||
|
*/
|
||||||
virtual ESGDeviceType GetDeviceType() const;
|
virtual ESGDeviceType GetDeviceType() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve this device's unique identifier.
|
||||||
|
*/
|
||||||
virtual FString GetDeviceId() const PURE_VIRTUAL(FSGDevice::GetDeviceId, return FString(););
|
virtual FString GetDeviceId() const PURE_VIRTUAL(FSGDevice::GetDeviceId, return FString(););
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve this device's hardware version.
|
||||||
|
*/
|
||||||
virtual FString GetHardwareVersion() const PURE_VIRTUAL(FSGDevice::GetHardwareVersion, return FString(););
|
virtual FString GetHardwareVersion() const PURE_VIRTUAL(FSGDevice::GetHardwareVersion, return FString(););
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve this device's main firmware version. v4.12 returns 4.
|
||||||
|
*/
|
||||||
virtual int32 GetFirmwareVersion() const PURE_VIRTUAL(FSGDevice::FirmwareVersion, return -1;);
|
virtual int32 GetFirmwareVersion() const PURE_VIRTUAL(FSGDevice::FirmwareVersion, return -1;);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve this device's sub firmware version. v4.12 returns 12.
|
||||||
|
*/
|
||||||
virtual int32 GetSubFirmwareVersion() const;
|
virtual int32 GetSubFirmwareVersion() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
virtual FString GetFirmwareString() const;
|
virtual FString GetFirmwareString() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve this Device's Serial/Bluetooth address.
|
||||||
|
*/
|
||||||
FString GetAddress() const;
|
FString GetAddress() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this device is currently connected to the system.
|
||||||
|
*/
|
||||||
bool IsConnected() const;
|
bool IsConnected() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the connection type of this Sense Glove.
|
||||||
|
*/
|
||||||
ESGConnectionType GetConnectionType() const;
|
ESGConnectionType GetConnectionType() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the device's Packets per Second Variable.
|
||||||
|
*/
|
||||||
int32 PacketsPerSecondReceived() const;
|
int32 PacketsPerSecondReceived() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the device's Packets per Second Variable.
|
||||||
|
*/
|
||||||
int32 PacketsPerSecondSent() const;
|
int32 PacketsPerSecondSent() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the index of this device within SenseCom.
|
||||||
|
*/
|
||||||
int32 GetDeviceIndex() const;
|
int32 GetDeviceIndex() const;
|
||||||
|
|
||||||
void SetDeviceIndex(const int32 Index);
|
/**
|
||||||
|
* Change this device's index within the SenseCom. Warning: Can cause errors.
|
||||||
|
*/
|
||||||
|
void SetDeviceIndex(int32 NewIndex);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this device is connected over a connection other than usb cable.
|
||||||
|
*/
|
||||||
virtual bool IsWireless() const;
|
virtual bool IsWireless() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this device operates on a battery.
|
||||||
|
*/
|
||||||
virtual bool HasBattery() const;
|
virtual bool HasBattery() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this device is currently charging.
|
||||||
|
*/
|
||||||
virtual bool IsCharging();
|
virtual bool IsCharging();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the device's battery level, as a value between 0 (empty) and 1 (full).
|
||||||
|
*/
|
||||||
virtual bool GetBatteryLevel(float& OutLevel);
|
virtual bool GetBatteryLevel(float& OutLevel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a string representation of this SGDevice, used for debugging.
|
||||||
|
*/
|
||||||
virtual FString ToString() const;
|
virtual FString ToString() const;
|
||||||
};
|
};
|
||||||
@@ -242,9 +242,9 @@ int32 FSGDeviceImpl::GetDeviceIndex() const
|
|||||||
return ToSGDevicePtrChecked()->GetDeviceIndex();
|
return ToSGDevicePtrChecked()->GetDeviceIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSGDeviceImpl::SetDeviceIndex(const int32 Index)
|
void FSGDeviceImpl::SetDeviceIndex(const int32 NewIndex)
|
||||||
{
|
{
|
||||||
ToSGDevicePtrChecked()->SetDeviceIndex(Index);
|
ToSGDevicePtrChecked()->SetDeviceIndex(NewIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FSGDeviceImpl::IsWireless() const
|
bool FSGDeviceImpl::IsWireless() const
|
||||||
|
|||||||
@@ -1089,9 +1089,9 @@ int32 SGCoreImpl_FSGDeviceImpl_GetDeviceIndex(
|
|||||||
|
|
||||||
void SGCoreImpl_FSGDeviceImpl_SetDeviceIndex(
|
void SGCoreImpl_FSGDeviceImpl_SetDeviceIndex(
|
||||||
void* Instance,
|
void* Instance,
|
||||||
const int32 Index)
|
const int32 NewIndex)
|
||||||
{
|
{
|
||||||
return StaticCast<FSGIC_TSharedPtr_FSGDeviceImpl*>(Instance)->Ptr->SetDeviceIndex(Index);
|
return StaticCast<FSGIC_TSharedPtr_FSGDeviceImpl*>(Instance)->Ptr->SetDeviceIndex(NewIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SGCoreImpl_FSGDeviceImpl_IsWireless(
|
bool SGCoreImpl_FSGDeviceImpl_IsWireless(
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ public:
|
|||||||
int32 PacketsPerSecondSent() const;
|
int32 PacketsPerSecondSent() const;
|
||||||
|
|
||||||
int32 GetDeviceIndex() const;
|
int32 GetDeviceIndex() const;
|
||||||
void SetDeviceIndex(int32 Index);
|
void SetDeviceIndex(int32 NewIndex);
|
||||||
|
|
||||||
virtual bool IsWireless() const;
|
virtual bool IsWireless() const;
|
||||||
|
|
||||||
|
|||||||
@@ -556,7 +556,7 @@ SENSEGLOVECOREIMPL_PUBLIC_API int32 SGCoreImpl_FSGDeviceImpl_GetDeviceIndex(
|
|||||||
|
|
||||||
SENSEGLOVECOREIMPL_PUBLIC_API void SGCoreImpl_FSGDeviceImpl_SetDeviceIndex(
|
SENSEGLOVECOREIMPL_PUBLIC_API void SGCoreImpl_FSGDeviceImpl_SetDeviceIndex(
|
||||||
void* Instance,
|
void* Instance,
|
||||||
int32 Index);
|
int32 NewIndex);
|
||||||
|
|
||||||
SENSEGLOVECOREIMPL_PUBLIC_API bool SGCoreImpl_FSGDeviceImpl_IsWireless(
|
SENSEGLOVECOREIMPL_PUBLIC_API bool SGCoreImpl_FSGDeviceImpl_IsWireless(
|
||||||
void* Instance);
|
void* Instance);
|
||||||
|
|||||||
@@ -102,6 +102,16 @@ int32 USGDeviceKismetLibrary::PacketsPerSecondSent(const USGDevice* SGDevice)
|
|||||||
return SGDevice->PacketsPerSecondSent();
|
return SGDevice->PacketsPerSecondSent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32 USGDeviceKismetLibrary::GetDeviceIndex(const USGDevice* SGDevice)
|
||||||
|
{
|
||||||
|
return SGDevice->GetDeviceIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
void USGDeviceKismetLibrary::SetDeviceIndex(USGDevice* SGDevice, const int32 NewIndex)
|
||||||
|
{
|
||||||
|
SGDevice->SetDeviceIndex(NewIndex);
|
||||||
|
}
|
||||||
|
|
||||||
bool USGDeviceKismetLibrary::IsWireless(const USGDevice* SGDevice)
|
bool USGDeviceKismetLibrary::IsWireless(const USGDevice* SGDevice)
|
||||||
{
|
{
|
||||||
return SGDevice->IsWireless();
|
return SGDevice->IsWireless();
|
||||||
|
|||||||
@@ -29,7 +29,9 @@
|
|||||||
*
|
*
|
||||||
* @section DESCRIPTION
|
* @section DESCRIPTION
|
||||||
*
|
*
|
||||||
*
|
* Represents a Device built by the Sense Glove company that is compatible with
|
||||||
|
* our Communications Protocol. All such devices derive from this abstract
|
||||||
|
* class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -48,57 +50,123 @@ class SENSEGLOVECOREKISMET_API USGDeviceKismetLibrary : public USGBlueprintFunct
|
|||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Parse a main and sub firmware version from its raw (v4.12) notation
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SGDevice")
|
||||||
static void ParseFirmware(const FString& RawFirmware, int32& OutMainVersion, int32& OutSubVersion);
|
static void ParseFirmware(const FString& RawFirmware, int32& OutMainVersion, int32& OutSubVersion);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable, DisplayName="To String", Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintCallable, DisplayName="To String", Category="SenseGlove | Core | SGDevice")
|
||||||
static FString ToString_DT(ESGDeviceType DeviceType);
|
static FString ToString_DT(ESGDeviceType DeviceType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check which DeviceType this class belongs to.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
||||||
static ESGDeviceType GetDeviceType(const USGDevice* SGDevice);
|
static ESGDeviceType GetDeviceType(const USGDevice* SGDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve this device's unique identifier.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
||||||
static FString GetDeviceId(const USGDevice* SGDevice);
|
static FString GetDeviceId(const USGDevice* SGDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve this device's hardware version.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
||||||
static FString GetHardwareVersion(const USGDevice* SGDevice);
|
static FString GetHardwareVersion(const USGDevice* SGDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve this device's main firmware version. v4.12 returns 4.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
||||||
static int32 GetFirmwareVersion(const USGDevice* SGDevice);
|
static int32 GetFirmwareVersion(const USGDevice* SGDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve this device's sub firmware version. v4.12 returns 12.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
||||||
static int32 GetSubFirmwareVersion(const USGDevice* SGDevice);
|
static int32 GetSubFirmwareVersion(const USGDevice* SGDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
||||||
static FString GetFirmwareString(const USGDevice* SGDevice);
|
static FString GetFirmwareString(const USGDevice* SGDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve this Device's Serial/Bluetooth address.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
||||||
static FString GetAddress(const USGDevice* SGDevice);
|
static FString GetAddress(const USGDevice* SGDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this device is currently connected to the system.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
||||||
static bool IsConnected(const USGDevice* SGDevice);
|
static bool IsConnected(const USGDevice* SGDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the connection type of this Sense Glove.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
||||||
static ESGConnectionType GetConnectionType(const USGDevice* SGDevice);
|
static ESGConnectionType GetConnectionType(const USGDevice* SGDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the device's Packets per Second Variable.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
||||||
static int32 PacketsPerSecondReceived(const USGDevice* SGDevice);
|
static int32 PacketsPerSecondReceived(const USGDevice* SGDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the device's Packets per Second Variable.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
||||||
static int32 PacketsPerSecondSent(const USGDevice* SGDevice);
|
static int32 PacketsPerSecondSent(const USGDevice* SGDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the index of this device within SenseCom.
|
||||||
|
*/
|
||||||
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
||||||
|
static int32 GetDeviceIndex(const USGDevice* SGDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change this device's index within the SenseCom. Warning: Can cause errors.
|
||||||
|
*/
|
||||||
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SGDevice")
|
||||||
|
static void SetDeviceIndex(UPARAM(ref) USGDevice* SGDevice, int32 NewIndex);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this device is connected over a connection other than usb cable.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
||||||
static bool IsWireless(const USGDevice* SGDevice);
|
static bool IsWireless(const USGDevice* SGDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this device operates on a battery.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
||||||
static bool HasBattery(const USGDevice* SGDevice);
|
static bool HasBattery(const USGDevice* SGDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this device is currently charging.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SGDevice")
|
||||||
static bool IsCharging(UPARAM(ref) USGDevice* SGDevice);
|
static bool IsCharging(UPARAM(ref) USGDevice* SGDevice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the device's battery level, as a value between 0 (empty) and 1 (full).
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SGDevice")
|
||||||
static bool GetBatteryLevel(UPARAM(ref) USGDevice* SGDevice, float& OutLevel);
|
static bool GetBatteryLevel(UPARAM(ref) USGDevice* SGDevice, float& OutLevel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a string representation of this SGDevice, used for debugging.
|
||||||
|
*/
|
||||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
||||||
static FString ToString(const USGDevice* SGDevice);
|
static FString ToString(const USGDevice* SGDevice);
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user