SkyPortal-plugin/Source/SkyPortal/Public/SkyPortalSubsystem.h

52 lines
1 KiB
C
Raw Normal View History

2024-09-18 13:30:30 +00:00
#pragma once
#include "CoreMinimal.h"
#include "Subsystems/EngineSubsystem.h"
2024-09-19 12:03:16 +00:00
#include "hidapi.h"
2024-09-18 13:30:30 +00:00
#include "SkyPortalSubsystem.generated.h"
2024-09-19 12:03:16 +00:00
/* Macro Definitions */
#define TIMEOUT 30000
DECLARE_LOG_CATEGORY_EXTERN(LogHIDApi, Log, All);
/* Subsystem */
2024-09-18 13:30:30 +00:00
UCLASS()
class SKYPORTAL_API USkyPortalSubsystem : public UEngineSubsystem
{
GENERATED_BODY()
public:
// Override initialization and deinitialization methods
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
virtual void Deinitialize() override;
2024-09-19 12:03:16 +00:00
// Connect to Portal, return false if portal is not found
UFUNCTION(BlueprintCallable, CallInEditor)
bool ConnectPortal();
FString HidError;
private:
//Portal ref used in the subsystem
hid_device* PortalDevice;
unsigned char* PortalRawData;
FString RawData();
void ReadPortal();
protected:
//Constants
const int VendorIds[4] = { 0x12ba, 0x54c, 0x1430, 0x1430 };
const int ProductIds[4] = { 0x150, 0x967, 0x1f17 };
/////Defaults values, should not be used
2024-09-19 12:03:16 +00:00
const int VendorId = 5168;
const int ProductId = 336;
2024-09-18 13:30:30 +00:00
};
2024-09-19 12:03:16 +00:00