239 lines
8.8 KiB
C++
239 lines
8.8 KiB
C++
/**
|
|
* @file
|
|
*
|
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
|
*
|
|
* @section LICENSE
|
|
*
|
|
* (The MIT License)
|
|
*
|
|
* Copyright (c) 2020 - 2026 SenseGlove
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
* copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
* SOFTWARE.
|
|
*
|
|
* @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.
|
|
*/
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "SGKismet/SGBlueprintFunctionLibrary.h"
|
|
#include "SGTypes/SGCoreTypes.h"
|
|
|
|
#include "SGDeviceKismetLibrary.generated.h"
|
|
|
|
class USGDevice;
|
|
class USGHapticChannelInfo;
|
|
|
|
UCLASS(meta=(ScriptName = "SenseGloveSGDeviceKismetLibrary"))
|
|
class SENSEGLOVECOREKISMET_API USGDeviceKismetLibrary : public USGBlueprintFunctionLibrary
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
/**
|
|
* Parse a main and sub firmware version from its raw (v4.12) notation
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SGDevice")
|
|
static void ParseFirmware(const FString& RawFirmware, int32& OutMainVersion, int32& OutSubVersion);
|
|
|
|
/**
|
|
* If true, my firmware is newer than the reference firmware.
|
|
* @param MyFirmwareMain
|
|
* @param MyFirmwareSub
|
|
* @param ReferenceMain
|
|
* @param ReferenceSub
|
|
* @param bInclusive
|
|
*/
|
|
UFUNCTION(BlueprintCallable, DisplayName="Firmware Newer Than", Category="SenseGlove | Core | SGDevice")
|
|
static bool FirmwareNewerThan_MF_MF_RM_RS_bI(int32 MyFirmwareMain, int32 MyFirmwareSub,
|
|
int32 ReferenceMain, int32 ReferenceSub,
|
|
bool bInclusive);
|
|
|
|
/**
|
|
* If true, my firmware is older than the reference firmware.
|
|
* @param MyFirmwareMain
|
|
* @param MyFirmwareSub
|
|
* @param ReferenceMain
|
|
* @param ReferenceSub
|
|
* @param bInclusive
|
|
*/
|
|
UFUNCTION(BlueprintCallable, DisplayName="Firmware Older Than", Category="SenseGlove | Core | SGDevice")
|
|
static bool FirmwareOlderThan_MF_MF_RM_RS_bI(int32 MyFirmwareMain, int32 MyFirmwareSub,
|
|
int32 ReferenceMain, int32 ReferenceSub,
|
|
bool bInclusive);
|
|
|
|
/**
|
|
*
|
|
*/
|
|
UFUNCTION(BlueprintCallable, DisplayName="To String", Category="SenseGlove | Core | SGDevice")
|
|
static FString ToString_DT(ESGDeviceType DeviceType);
|
|
|
|
/**
|
|
* Check which DeviceType this class belongs to.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
|
static ESGDeviceType GetDeviceType(const USGDevice* SGDevice);
|
|
|
|
/**
|
|
* Retrieve this device's unique identifier.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
|
static FString GetDeviceId(const USGDevice* SGDevice);
|
|
|
|
/**
|
|
* Retrieve this device's hardware version.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
|
static FString GetHardwareVersion(const USGDevice* SGDevice);
|
|
|
|
/**
|
|
* Retrieve this device's main firmware version. v4.12 returns 4.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
|
static int32 GetFirmwareVersion(const USGDevice* SGDevice);
|
|
|
|
/**
|
|
* Retrieve this device's sub firmware version. v4.12 returns 12.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
|
static int32 GetSubFirmwareVersion(const USGDevice* SGDevice);
|
|
|
|
/**
|
|
*
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
|
static FString GetFirmwareString(const USGDevice* SGDevice);
|
|
|
|
/**
|
|
* Returns true if this glove's firmware is newer than certain version.
|
|
* @param FirmwareMain
|
|
* @param FirmwareSub
|
|
* @param bInclusive
|
|
*/
|
|
UFUNCTION(BlueprintPure, DisplayName="Firmware Newer Than", Category="SenseGlove | Core | SGDevice")
|
|
static bool FirmwareNewerThan_FM_FS_bI(const USGDevice* SGDevice,
|
|
int32 FirmwareMain, int32 FirmwareSub, bool bInclusive);
|
|
|
|
/**
|
|
* Returns true if this glove's firmware is older than certain version.
|
|
* @param FirmwareMain
|
|
* @param FirmwareSub
|
|
* @param bInclusive
|
|
*/
|
|
UFUNCTION(BlueprintPure, DisplayName="Firmware Older Than", Category="SenseGlove | Core | SGDevice")
|
|
static bool FirmwareOlderThan_FM_FS_bI(const USGDevice* SGDevice,
|
|
int32 FirmwareMain, int32 FirmwareSub, bool bInclusive);
|
|
|
|
/**
|
|
* Retrieve this Device's Serial/Bluetooth address.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
|
static FString GetAddress(const USGDevice* SGDevice);
|
|
|
|
/**
|
|
* Check if this device is currently connected to the system.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
|
static bool IsConnected(const USGDevice* SGDevice);
|
|
|
|
/**
|
|
* Retrieve the connection type of this Sense Glove.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
|
static ESGConnectionType GetConnectionType(const USGDevice* SGDevice);
|
|
|
|
/**
|
|
* Retrieve the device's Packets per Second Variable.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
|
static int32 PacketsPerSecondReceived(const USGDevice* SGDevice);
|
|
|
|
/**
|
|
* Retrieve the device's Packets per Second Variable.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | 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")
|
|
static bool IsWireless(const USGDevice* SGDevice);
|
|
|
|
/**
|
|
* Returns true if this device operates on a battery.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
|
static bool HasBattery(const USGDevice* SGDevice);
|
|
|
|
/**
|
|
* Returns true if this device is currently charging.
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | 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")
|
|
static bool GetBatteryLevel(UPARAM(ref) USGDevice* SGDevice, float& OutLevel);
|
|
|
|
/**
|
|
* Assign this Device's Haptic Channels. Should not be done outside the API unless you know what you're doing.
|
|
* @param Channels
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | SGDevice")
|
|
static void SetHapticChannels(UPARAM(ref) USGDevice* SGDevice, const USGHapticChannelInfo* Channels);
|
|
|
|
/**
|
|
* The number of haptic channels this device can support.
|
|
*/
|
|
UFUNCTION(BlueprintPure, DisplayName="Get Haptic Channel Count", Category="SenseGlove | Core | SGDevice")
|
|
static int32 GetHapticChannelCount(const USGDevice* SGDevice);
|
|
|
|
/**
|
|
* How many channels of a specific type this SGDevice possesses.
|
|
* @param ChannelType
|
|
*/
|
|
UFUNCTION(BlueprintPure, DisplayName="Get Haptic Channel Count", Category="SenseGlove | Core | SGDevice")
|
|
static int32 GetHapticChannelCount_CT(const USGDevice* SGDevice, ESGHapticChannelType ChannelType);
|
|
|
|
/**
|
|
* Get a string representation of this SGDevice, used for debugging.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category="SenseGlove | Core | SGDevice")
|
|
static FString ToString(const USGDevice* SGDevice);
|
|
}; |