// Copyright PICO Technology Co., Ltd. All rights reserved. // This plugin incorporates portions of the UnrealĀ® Engine. UnrealĀ® is a trademark or registered trademark of Epic Games, Inc. in the United States of America and elsewhere. // Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "UObject/Object.h" #include "Delegates/Delegate.h" #include "PXR_HMDTypes.h" #include "PXR_EventManager.generated.h" //ControllerDelegate DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPXRDeviceMainChangedDelegate,int32,Handness); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPXRHandnessChangedDelegate, int32, Handness); DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FPXRDeviceConnectChangedDelegate,int32,Handness,int32,State); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPXRInputDeviceChangedDelegate,int32,State); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPXRBatteryStateChangedDelegate,int32,State); DECLARE_DYNAMIC_MULTICAST_DELEGATE(FPXRLongHomeKey); DECLARE_MULTICAST_DELEGATE(PXRRawLongHomeKey); DECLARE_DYNAMIC_MULTICAST_DELEGATE(FPXRResume); //HMDDelegate DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPXRIpdChanged,float,NewIpd); //SystemDisplayRateDelegate DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPXRRefreshRateChanged, float, NewRate); //BodyTracking Delegate DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FPXRDeviceMotionTrackerBatteryDelegate,int32,Id,int32,BatteryState); DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FPXRDeviceBodyTrackingStateError,int32,Status,int32,ErrorCode); DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FPXRDeviceMotionTrackerConnectionDelegate,int32,Count,int32,ConnectionState); DECLARE_DYNAMIC_MULTICAST_DELEGATE(FPXRDeviceMotionTrackerRecalibrationDelegate); DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FPXRDeviceBodyTrackingActionDelegate,int32, BoneIndex, EPxrBodyActionList, Action); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPXREventDataMotionTrackerKeyDelegate, FPXREventDataMotionTrackerKey, MotionTrackerKey); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPXREventDataExtDevConnectEventDelegate, FPXREventDataExtDevConnectEvent, ExtDevConnectEvent); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPXREventDataExtDevBatteryEventDelegate, FPXREventDataExtDevBatteryEvent, ExtDevBatteryEvent); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPXREventDataExtDevPassDataEventDelegate, int32, status); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPXREventDataMotionTrackingModeChangedEventDelegate, int32, mode); //MR DECLARE_DYNAMIC_MULTICAST_DELEGATE(FPXRAnchorDataUpdatedDelegate); DECLARE_DYNAMIC_MULTICAST_DELEGATE(FPXRMeshDataUpdatedDelegate); DECLARE_DYNAMIC_MULTICAST_DELEGATE(FPXRSceneCaptureDataUpdatedDelegate); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPXRAnchorServiceStateUpdatedDelegate,EPICOMRState,State); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPXRMeshScanningStateUpdatedDelegate,EPICOMRState,State); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPXRSceneCaptureServiceStateUpdatedDelegate,EPICOMRState,State); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPXRVSTDisplayChangedDelegate,EPICOVSTDisplayStatus,Status); UCLASS() class UPICOXREventManager : public UObject { GENERATED_BODY() public: static UPICOXREventManager* GetInstance(); UPROPERTY(BlueprintAssignable) FPXRDeviceMainChangedDelegate DeviceMainChangedDelegate; UPROPERTY(BlueprintAssignable) FPXRHandnessChangedDelegate HandnessChangedDelegate; UPROPERTY(BlueprintAssignable) FPXRDeviceConnectChangedDelegate DeviceConnectChangedDelegate; UPROPERTY(BlueprintAssignable) FPXRIpdChanged IpdChangedDelegate; UPROPERTY(BlueprintAssignable) FPXRLongHomeKey LongHomePressedDelegate; UPROPERTY(BlueprintAssignable) FPXRResume ResumeDelegate; UPROPERTY(BlueprintAssignable) FPXRRefreshRateChanged RefreshRateChangedDelegate; UPROPERTY(BlueprintAssignable) FPXRInputDeviceChangedDelegate InputDeviceChangedDelegate; UPROPERTY(BlueprintAssignable) FPXRBatteryStateChangedDelegate BatteryStateChangedDelegate; /// Gets the notification of Motion Tracker battery change. /// /// /// - Id: Tracker ID. /// - BatteryState: For Tracker1.0, value range:[0,1]. For Tracker2.0, value range:[0,10]. /// UPROPERTY(BlueprintAssignable) FPXRDeviceMotionTrackerBatteryDelegate MotionTrackerBatteryDelegate; /// Gets the notification of Motion Tracker connection state change. /// /// /// - Count: The count of connected Motion Trackers. /// - ConnectionState: The connection state, `0` for disconnected, `1` for connected. /// UPROPERTY(BlueprintAssignable) FPXRDeviceMotionTrackerConnectionDelegate MotionTrackerConnectionDelegate; /// Gets the notification of Motion Tracking status code and error code. /// /// /// - Status: Refer to the EPXRBodyTrackingStatusCode enum for status code. /// - Error code: Refer to the EPXRBodyTrackingErrorCode enum for error code. Currently, the returned error message result is unique, and you temporarily can not identify the error causes only in the result. /// UPROPERTY(BlueprintAssignable) FPXRDeviceBodyTrackingStateError BodyTrackingStateErrorDelegate; /// Gets the notification about changes in the Action state of body tracking. /// /// /// - BoneIndex: Bone index numbers, currently only include 7 and 8, which are used to distinguish between the left and right feet. /// - Body Action list: /// - Touch Ground: heels on the ground. /// - Keep Static: will be triggered by keep static for 3 seconds. /// - Touch Ground And Keep Static: heels on the ground and keep static. /// - Touch Ground Toe: toes on the ground. /// - Foot Down Action: foot down action. /// UPROPERTY(BlueprintAssignable) FPXRDeviceBodyTrackingActionDelegate BodyTrackingActionDelegate; /// Gets the notification of Motion Tracker errors. It is suggested to recalibrate the Motion Tracker after receiving the notification. /// UPROPERTY(BlueprintAssignable) FPXRDeviceMotionTrackerRecalibrationDelegate MotionTrackerRecalibrationDelegate; /// Gets the notification of Motion Tracker key. /// /// /// - TrackerSN: Serial number of Tracker. /// - Code: Key value, converted to Android standard key value. (Power key: 26) /// - Action: up: `1` and down: `0`. now only action `0` is supported. /// - Repeat: Currently, it appears to be `1`. /// - Short Press: Is it a short press? Currently, short press is supported, so it is all true. /// UPROPERTY(BlueprintAssignable) FPXREventDataMotionTrackerKeyDelegate DataMotionTrackerKeyDelegate; /// Gets the notification of Motion Tracker connect state. /// /// /// - TrackerSN: Serial number of Tracker. /// - State: `1` for connected and `0` for disconnected. /// UPROPERTY(BlueprintAssignable) FPXREventDataExtDevConnectEventDelegate DataExtDevConnectEventDelegate; /// Gets the notification about changes of Motion Tracking battery. /// /// /// - TrackerSN: Serial number of Tracker. /// - OutBattery: Battery, value range:[0,10] /// - OutCharger: Whether the Tracker is on charging, `1` for on charging, `0` for not. /// UPROPERTY(BlueprintAssignable) FPXREventDataExtDevBatteryEventDelegate DataExtDevBatteryEventDelegate; /// Gets the notification about changes of Motion Tracking pass data. /// /// Status: /// '1': Pass data is ready, you need to call `PXR_GetExtDevTrackerByPassData` to retrieve the data by frame. /// `0`: Pass data is stopped. /// UPROPERTY(BlueprintAssignable) FPXREventDataExtDevPassDataEventDelegate DataExtDevPassDataEventDelegate; /// Gets the notification about changes of Motion Tracking mode. /// /// /// Mode: `0` for BodyTracking and `1` for ObjectTracking. /// UPROPERTY(BlueprintAssignable) FPXREventDataMotionTrackingModeChangedEventDelegate DataMotionTrackingModeChangedEventDelegate; /// Gets the update of Anchor data. /// PXRRawLongHomeKey RawLongHomePressedDelegate; UPROPERTY(BlueprintAssignable) FPXRAnchorDataUpdatedDelegate AnchorDataUpdatedDelegate; /// Gets the update of Mesh data. /// UPROPERTY(BlueprintAssignable) FPXRMeshDataUpdatedDelegate MeshDataUpdatedDelegate; /// Gets the update of Scene Capture data. /// UPROPERTY(BlueprintAssignable) FPXRSceneCaptureDataUpdatedDelegate SceneCaptureDataUpdatedDelegate; /// Gets the updated state of Spatial Anchor service. /// /// State of Spatial Anchor service: /// - Initialized: After checking the Spatial Anchor feature in ProjectSettings, the initialization will be completed during the app startup process. /// - Running: This state is set after the Spatial Anchor service has been successfully started. /// - Stopped: This state is set after the Spatial Anchor service has been successfully shut down. /// UPROPERTY(BlueprintAssignable) FPXRAnchorServiceStateUpdatedDelegate SpatialAnchorServiceStateUpdatedDelegate; /// Gets the updated state of Mesh scanning. /// /// State of Spatial Mesh scanning: /// - Initialized: After checking the Spacial Mesh feature in ProjectSettings, the initialization will be completed during the app startup process. /// - Running: This state is set after the Spatial Mesh scanning has been successfully started. /// - Stopped: This state is set after the Spatial Mesh scanning has been successfully shut down. /// UPROPERTY(BlueprintAssignable) FPXRMeshScanningStateUpdatedDelegate MeshScanningStateUpdatedDelegate; /// Gets the updated state of Scene Capture service. /// /// State of Scene Capture service: /// - Initialized: After checking the Scene Capture feature in ProjectSettings, the initialization will be completed during the app startup process. /// - Running: This state is set after the Scene Capture service has been successfully started. /// - Stopped: This state is set after the Scene Capture service has been successfully shut down. /// UPROPERTY(BlueprintAssignable) FPXRSceneCaptureServiceStateUpdatedDelegate SceneCaptureServiceStateUpdatedDelegate; /// Gets the change of VST display. /// /// The change of VST state: /// - Display Disabled: VST is disabled. /// - Display Enabling: VST is enabling. /// - Display Enabled: VST is enabled. /// - Display Disabling: VST is diabling. /// UPROPERTY(BlueprintAssignable) FPXRVSTDisplayChangedDelegate VSTDisplayChangedDelegate; };