Initial Import
This commit is contained in:
commit
00f44bf81b
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
Unreal/Saved/
|
||||
Unreal/Intermediate/
|
||||
Unreal/Plugins/WinBluetoothLE/Intermediate/
|
||||
Unreal/Binaries/
|
||||
Unreal/Plugins/WinBluetoothLE/Binaries/
|
||||
0
Unreal/Config/DefaultEditor.ini
Normal file
0
Unreal/Config/DefaultEditor.ini
Normal file
93
Unreal/Config/DefaultEngine.ini
Normal file
93
Unreal/Config/DefaultEngine.ini
Normal file
@ -0,0 +1,93 @@
|
||||
|
||||
|
||||
[/Script/EngineSettings.GameMapsSettings]
|
||||
GameDefaultMap=/WinBluetoothLE/Sample/PS_BLETest.PS_BLETest
|
||||
EditorStartupMap=/WinBluetoothLE/Sample/PS_BLETest.PS_BLETest
|
||||
|
||||
[/Script/Engine.RendererSettings]
|
||||
r.AllowStaticLighting=False
|
||||
|
||||
r.GenerateMeshDistanceFields=True
|
||||
|
||||
r.DynamicGlobalIlluminationMethod=1
|
||||
|
||||
r.ReflectionMethod=1
|
||||
|
||||
r.SkinCache.CompileShaders=True
|
||||
|
||||
r.RayTracing=True
|
||||
|
||||
r.Shadow.Virtual.Enable=1
|
||||
|
||||
r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=True
|
||||
|
||||
r.DefaultFeature.LocalExposure.HighlightContrastScale=0.8
|
||||
|
||||
r.DefaultFeature.LocalExposure.ShadowContrastScale=0.8
|
||||
|
||||
[/Script/WindowsTargetPlatform.WindowsTargetSettings]
|
||||
DefaultGraphicsRHI=DefaultGraphicsRHI_DX12
|
||||
DefaultGraphicsRHI=DefaultGraphicsRHI_DX12
|
||||
-D3D12TargetedShaderFormats=PCD3D_SM5
|
||||
+D3D12TargetedShaderFormats=PCD3D_SM6
|
||||
-D3D11TargetedShaderFormats=PCD3D_SM5
|
||||
+D3D11TargetedShaderFormats=PCD3D_SM5
|
||||
Compiler=Default
|
||||
AudioSampleRate=48000
|
||||
AudioCallbackBufferFrameSize=1024
|
||||
AudioNumBuffersToEnqueue=1
|
||||
AudioMaxChannels=0
|
||||
AudioNumSourceWorkers=4
|
||||
SpatializationPlugin=
|
||||
SourceDataOverridePlugin=
|
||||
ReverbPlugin=
|
||||
OcclusionPlugin=
|
||||
CompressionOverrides=(bOverrideCompressionTimes=False,DurationThreshold=5.000000,MaxNumRandomBranches=0,SoundCueQualityIndex=0)
|
||||
CacheSizeKB=65536
|
||||
MaxChunkSizeOverrideKB=0
|
||||
bResampleForDevice=False
|
||||
MaxSampleRate=48000.000000
|
||||
HighSampleRate=32000.000000
|
||||
MedSampleRate=24000.000000
|
||||
LowSampleRate=12000.000000
|
||||
MinSampleRate=8000.000000
|
||||
CompressionQualityModifier=1.000000
|
||||
AutoStreamingThreshold=0.000000
|
||||
SoundCueCookQualityIndex=-1
|
||||
|
||||
[/Script/LinuxTargetPlatform.LinuxTargetSettings]
|
||||
-TargetedRHIs=SF_VULKAN_SM5
|
||||
+TargetedRHIs=SF_VULKAN_SM6
|
||||
|
||||
[/Script/HardwareTargeting.HardwareTargetingSettings]
|
||||
TargetedHardwareClass=Desktop
|
||||
AppliedTargetedHardwareClass=Desktop
|
||||
DefaultGraphicsPerformance=Maximum
|
||||
AppliedDefaultGraphicsPerformance=Maximum
|
||||
|
||||
[/Script/WorldPartitionEditor.WorldPartitionEditorSettings]
|
||||
CommandletClass=Class'/Script/UnrealEd.WorldPartitionConvertCommandlet'
|
||||
|
||||
[/Script/Engine.UserInterfaceSettings]
|
||||
bAuthorizeAutomaticWidgetVariableCreation=False
|
||||
FontDPIPreset=Standard
|
||||
FontDPI=72
|
||||
|
||||
[/Script/Engine.Engine]
|
||||
+ActiveGameNameRedirects=(OldGameName="TP_BlankBP",NewGameName="/Script/PS_BLE_Tracker")
|
||||
+ActiveGameNameRedirects=(OldGameName="/Script/TP_BlankBP",NewGameName="/Script/PS_BLE_Tracker")
|
||||
|
||||
[/Script/AndroidFileServerEditor.AndroidFileServerRuntimeSettings]
|
||||
bEnablePlugin=True
|
||||
bAllowNetworkConnection=True
|
||||
SecurityToken=6DA73F314E3A16149E3A6B9832D70D5E
|
||||
bIncludeInShipping=False
|
||||
bAllowExternalStartInShipping=False
|
||||
bCompileAFSProject=False
|
||||
bUseCompression=False
|
||||
bLogFiles=False
|
||||
bReportStats=False
|
||||
ConnectionType=USBOnly
|
||||
bUseManualIPAddress=False
|
||||
ManualIPAddress=
|
||||
|
||||
4
Unreal/Config/DefaultGame.ini
Normal file
4
Unreal/Config/DefaultGame.ini
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
|
||||
[/Script/EngineSettings.GeneralProjectSettings]
|
||||
ProjectID=9C4DADE244CE1285E3747A9C694E9D10
|
||||
84
Unreal/Config/DefaultInput.ini
Normal file
84
Unreal/Config/DefaultInput.ini
Normal file
@ -0,0 +1,84 @@
|
||||
[/Script/Engine.InputSettings]
|
||||
-AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
|
||||
-AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
|
||||
-AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
|
||||
-AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
|
||||
-AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
|
||||
-AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
|
||||
-AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MouseWheelAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_LeftTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_RightTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_Special_Left_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_Special_Left_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
bAltEnterTogglesFullscreen=True
|
||||
bF11TogglesFullscreen=True
|
||||
bUseMouseForTouch=False
|
||||
bEnableMouseSmoothing=True
|
||||
bEnableFOVScaling=True
|
||||
bCaptureMouseOnLaunch=True
|
||||
bEnableLegacyInputScales=True
|
||||
bEnableMotionControls=True
|
||||
bFilterInputByPlatformUser=False
|
||||
bShouldFlushPressedKeysOnViewportFocusLost=True
|
||||
bAlwaysShowTouchInterface=False
|
||||
bShowConsoleOnFourFingerTap=True
|
||||
bEnableGestureRecognizer=False
|
||||
bUseAutocorrect=False
|
||||
DefaultViewportMouseCaptureMode=CapturePermanently_IncludingInitialMouseDown
|
||||
DefaultViewportMouseLockMode=LockOnCapture
|
||||
FOVScale=0.011110
|
||||
DoubleClickTime=0.200000
|
||||
DefaultPlayerInputClass=/Script/EnhancedInput.EnhancedPlayerInput
|
||||
DefaultInputComponentClass=/Script/EnhancedInput.EnhancedInputComponent
|
||||
DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks
|
||||
-ConsoleKeys=Tilde
|
||||
+ConsoleKeys=Tilde
|
||||
|
||||
2323
Unreal/PS_BLE_Tracker.sln
Normal file
2323
Unreal/PS_BLE_Tracker.sln
Normal file
File diff suppressed because it is too large
Load Diff
22
Unreal/PS_BLE_Tracker.uproject
Normal file
22
Unreal/PS_BLE_Tracker.uproject
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"FileVersion": 3,
|
||||
"EngineAssociation": "5.5",
|
||||
"Category": "",
|
||||
"Description": "",
|
||||
"Modules": [
|
||||
{
|
||||
"Name": "PS_BLE_Tracker",
|
||||
"Type": "Runtime",
|
||||
"LoadingPhase": "Default"
|
||||
}
|
||||
],
|
||||
"Plugins": [
|
||||
{
|
||||
"Name": "ModelingToolsEditorMode",
|
||||
"Enabled": true,
|
||||
"TargetAllowList": [
|
||||
"Editor"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
Unreal/Plugins/WinBluetoothLE/Content/Sample/BP_BLEActor.uasset
Normal file
BIN
Unreal/Plugins/WinBluetoothLE/Content/Sample/BP_BLEActor.uasset
Normal file
Binary file not shown.
BIN
Unreal/Plugins/WinBluetoothLE/Content/Sample/BP_Pawn.uasset
Normal file
BIN
Unreal/Plugins/WinBluetoothLE/Content/Sample/BP_Pawn.uasset
Normal file
Binary file not shown.
BIN
Unreal/Plugins/WinBluetoothLE/Content/Sample/GM_Bluetooth.uasset
Normal file
BIN
Unreal/Plugins/WinBluetoothLE/Content/Sample/GM_Bluetooth.uasset
Normal file
Binary file not shown.
BIN
Unreal/Plugins/WinBluetoothLE/Content/Sample/PS_BLETest.umap
Normal file
BIN
Unreal/Plugins/WinBluetoothLE/Content/Sample/PS_BLETest.umap
Normal file
Binary file not shown.
BIN
Unreal/Plugins/WinBluetoothLE/Resources/Icon128.png
Normal file
BIN
Unreal/Plugins/WinBluetoothLE/Resources/Icon128.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 67 KiB |
BIN
Unreal/Plugins/WinBluetoothLE/Source/ThirdParty/BLEproto/Win64/Release/BLEproto64.dll
vendored
Normal file
BIN
Unreal/Plugins/WinBluetoothLE/Source/ThirdParty/BLEproto/Win64/Release/BLEproto64.dll
vendored
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,526 @@
|
||||
// Copyright (C) 2025 SC SIGNATURE UE - By Srdjan Crnjanski
|
||||
// BLE v1.1
|
||||
|
||||
#pragma once
|
||||
#include "Modules/ModuleManager.h"
|
||||
#include "Delegates/Delegate.h"
|
||||
#include "CoreMinimal.h"
|
||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "Kismet/KismetStringLibrary.h"
|
||||
#include "WinBluetoothLE.generated.h"
|
||||
|
||||
#define MAX_NAME_LEN (128)
|
||||
#define PRAGMA_DISABLE_UNSAFE_FUNC_TYPECAST_WARNINGS \
|
||||
__pragma (warning(push)) \
|
||||
__pragma (warning(disable: 4191)) /* 'argument': type cast unsafe conversion from 'type1' to 'type2' */ \
|
||||
|
||||
|
||||
typedef TCHAR TUEstring[MAX_NAME_LEN];
|
||||
typedef TUEstring* PUEstring;
|
||||
|
||||
class DLLOBJ;
|
||||
|
||||
struct DLLGUID
|
||||
{
|
||||
public:
|
||||
uint32 val0;
|
||||
uint16 val1;
|
||||
uint16 val2;
|
||||
uint8 val3[8];
|
||||
};
|
||||
|
||||
struct DLLCharacteristicItem
|
||||
{
|
||||
public:
|
||||
uint64 Descriptor;
|
||||
TUEstring CharacteristicName;
|
||||
DLLGUID cGUID;
|
||||
};
|
||||
typedef DLLCharacteristicItem* PDLLCharacteristicItem;
|
||||
typedef DLLCharacteristicItem* PDLLCharacteristicStartItem;
|
||||
|
||||
struct DLLServiceListItem
|
||||
{
|
||||
public:
|
||||
TUEstring ServName;
|
||||
DLLGUID sGUID;
|
||||
PDLLCharacteristicStartItem CharItem;
|
||||
};
|
||||
typedef DLLServiceListItem* PServicesStartItem;
|
||||
typedef PServicesStartItem PDLLServicesList;
|
||||
|
||||
typedef DLLOBJ USharedBLEdevice;
|
||||
typedef USharedBLEdevice* PShared_dev;
|
||||
typedef uint16 TSERVCHAR; // contains packed indices: Service Index in upper byte, Characteristic Index in lower byte
|
||||
typedef uint16 TGATTSTATUS;
|
||||
|
||||
typedef struct {
|
||||
DLLOBJ* DevRef;
|
||||
uint64 ID;
|
||||
int64 RSSI;
|
||||
TUEstring name;
|
||||
} TUE_dev_rec;
|
||||
typedef TUE_dev_rec* PUE_dev_rec;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
UENUM(BlueprintType, Category = "Bluetooth Low Energy")
|
||||
enum class EGATTStatus : uint8
|
||||
{
|
||||
Success = 0x00 UMETA(DisplayName = "Success"),
|
||||
ReadNotPermitted = 0x02 UMETA(DisplayName = "Read Not Permitted"),
|
||||
WriteNotPermitted = 0x03 UMETA(DisplayName = "Write Not Permitted"),
|
||||
InsuficientAutentication = 0x05 UMETA(DisplayName = "Insuficent Autentication"),
|
||||
RequestNotSupported = 0x06 UMETA(DisplayName = "Request Not Supported"),
|
||||
InvalidOffset = 0x07 UMETA(DisplayName = "Invalid Offset"),
|
||||
InvalidAttributelength = 0x0D UMETA(DisplayName = "Invalid Attribute Length"),
|
||||
InsufficientEncryption = 0x0F UMETA(DisplayName = "Insufficient Encryption"),
|
||||
Failure = 0xFF UMETA(DisplayName = "Failure")
|
||||
};
|
||||
|
||||
UENUM(BlueprintType, Category = "Bluetooth Low Energy")
|
||||
enum class ECharacteristicDescriptor : uint8
|
||||
{
|
||||
Unknown = 0x00 UMETA(DisplayName = "Unknown"),
|
||||
Broadcast = 0x01 UMETA(DisplayName = "Broadcastable"),
|
||||
ExtendedProps = 0x02 UMETA(DisplayName = "Extended properties"),
|
||||
Notifiable = 0x04 UMETA(DisplayName = "Notifiable"),
|
||||
Indicable = 0x08 UMETA(DisplayName = "Indicable"),
|
||||
Readable = 0x10 UMETA(DisplayName = "Readable"),
|
||||
Writable = 0x20 UMETA(DisplayName = "Writable"),
|
||||
WriteNoResponse = 0x40 UMETA(DisplayName = "Write No Response"),
|
||||
SignedWrite = 0x80 UMETA(DisplayName = "Signed Write")
|
||||
};
|
||||
|
||||
UENUM(BlueprintType, Category = "Bluetooth Low Energy")
|
||||
enum class EBLEerror : uint8
|
||||
{
|
||||
NoError = 0x00 UMETA(DisplayName = "Success"),
|
||||
NonReadableChar = 0x01 UMETA(DisplayName = "Non Readable Characteristic"),
|
||||
NonWrittableChar = 0x03 UMETA(DisplayName = "Non Writtable Characteristic"),
|
||||
CanNotSubscribe = 0x04 UMETA(DisplayName = "Can not subscribe/unsubscribe to Non Notifiable or Non Indicable Characteristic"),
|
||||
CanNotUnsubscribe = 0x05 UMETA(DisplayName = "Can not unsubscribe if its not previously subscribed"),
|
||||
AlreadyConnected = 0x06 UMETA(DisplayName = "Device is already connected"),
|
||||
CanNotDisconnect = 0x07 UMETA(DisplayName = "Can not disconnect if not connected"),
|
||||
NeedConnectionFirst = 0x08 UMETA(DisplayName = "That operation requires device is connected first"),
|
||||
ZeroLengthWrite = 0x09 UMETA(DisplayName = "Zero length write"),
|
||||
AlreadySubscribed = 0x0A UMETA(DisplayName = "Already subscribed"),
|
||||
NotSubscribed = 0x0B UMETA(DisplayName = "Not subscribed"),
|
||||
CommunicationFailed = 0x0C UMETA(DisplayName = "Communication Failed: No BLE adapter"),
|
||||
WrittingFailed = 0x0D UMETA(DisplayName = "Writting Failed: No BLE adapter"),
|
||||
SubscriptionFailed = 0x0E UMETA(DisplayName = "Subscription Failed: No BLE adapter"),
|
||||
UnsubscribeFailed = 0x0F UMETA(DisplayName = "Unsubscribe Failed: No BLE adapter"),
|
||||
ReadingFailed = 0x10 UMETA(DisplayName = "Reading Failed: No BLE adapter"),
|
||||
ConnectFailed = 0x11 UMETA(DisplayName = "Connect Failed: No BLE adapter"),
|
||||
DisconnectFailed = 0x12 UMETA(DisplayName = "Disconnect Failed: No BLE adapter"),
|
||||
Failure = 0xFF UMETA(DisplayName = "Unknown Failure")
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
USTRUCT(BlueprintType, Atomic, Category = "Bluetooth Low Energy")
|
||||
struct FMAC_ADDRESS {
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
UPROPERTY(BlueprintReadWrite, Category = "Bluetooth Low Energy")
|
||||
uint8 b0 = 0;
|
||||
UPROPERTY(BlueprintReadWrite, Category = "Bluetooth Low Energy")
|
||||
uint8 b1 = 0;
|
||||
UPROPERTY(BlueprintReadWrite, Category = "Bluetooth Low Energy")
|
||||
uint8 b2 = 0;
|
||||
UPROPERTY(BlueprintReadWrite, Category = "Bluetooth Low Energy")
|
||||
uint8 b3 = 0;
|
||||
UPROPERTY(BlueprintReadWrite, Category = "Bluetooth Low Energy")
|
||||
uint8 b4 = 0;
|
||||
UPROPERTY(BlueprintReadWrite, Category = "Bluetooth Low Energy")
|
||||
uint8 b5 = 0;
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType, Atomic, Category = "Bluetooth Low Energy")
|
||||
struct FCharacteristicListItem {
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
DLLGUID cUUID;
|
||||
bool subscribed = false;
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Bluetooth Low Energy")
|
||||
uint8 Descriptor = 0; // change from v1.0 -> added initialization
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Bluetooth Low Energy")
|
||||
FString CharacteristicName;
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Bluetooth Low Energy")
|
||||
FString CnaracteristicUUID;
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType, Atomic, Category = "Bluetooth Low Energy")
|
||||
struct FServiceListItem {
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
DLLGUID sUUID;
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Bluetooth Low Energy")
|
||||
FString ServiceName;
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Bluetooth Low Energy")
|
||||
FString ServiceUUID;
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Bluetooth Low Energy")
|
||||
TArray<FCharacteristicListItem> Characteristics;
|
||||
};
|
||||
|
||||
DECLARE_DYNAMIC_DELEGATE_OneParam(FOnNewBLEdeviceDiscovered, UWinBLE_device* const, Device_Just_Discovered);
|
||||
DECLARE_DYNAMIC_DELEGATE_OneParam(FOnDiscoveryEnd, const TArray<UWinBLE_device*>&, DiscoveredDevices);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnServicesDiscovered, UWinBLE_device* const, Device, const TArray<FServiceListItem>&, ServicesList);
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnConnect,UWinBLE_device* const, Connected_Device, const TArray<FServiceListItem>&, ServicesList);
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnDisconnect, UWinBLE_device* const, Disconnected_Device);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAnyBLEdeviceConnected, UWinBLE_device* const, Connected_Device);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAnyBLEdeviceDisconnected, UWinBLE_device* const, Disconnected_Device);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnAnyServiceDiscovered, UWinBLE_device* const, Device, const TArray<FServiceListItem>&, ServicesList);
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnRead, EGATTStatus, status, UWinBLE_device*, Device, FString, Service_UUID, FString, Characteristic_UUID, const TArray<uint8>&, data);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FOnNotify, EGATTStatus, status, UWinBLE_device*, Device, FString, Service_UUID, FString, Characteristic_UUID, const TArray<uint8>&, data);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnWrite, EGATTStatus, status, UWinBLE_device*, Device, FString, Service_UUID, FString, Characteristic_UUID);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnSubscribe, EGATTStatus, status, UWinBLE_device*, Device, FString, Service_UUID, FString, Characteristic_UUID);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnUnsubscribe, EGATTStatus, status, UWinBLE_device*, Device, FString, Service_UUID, FString, Characteristic_UUID);
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnBLEerror, EBLEerror, ErrorCode, FString, DeviceAddress, FString, Service_UUID, FString, Characteristic_UUID);
|
||||
|
||||
class UWinBLE_device;
|
||||
class UBLE_manager;
|
||||
|
||||
typedef void(__cdecl* TUEOnNewDiscoveredDevice)(UBLE_manager* const ref, PUE_dev_rec const d);
|
||||
typedef void(__cdecl* TUEOnDiscoveryEnd)(UBLE_manager* const ref, PUE_dev_rec const d, const uint64 cnt);
|
||||
|
||||
typedef void(__cdecl* TUEOnDeviceConnect)(UWinBLE_device* const ref);
|
||||
typedef void(__cdecl* TUEOnDeviceDisconnect)(UWinBLE_device* const ref);
|
||||
typedef void(__cdecl* TUEOnServicesDiscovered)(UWinBLE_device* const ref, PDLLServicesList const sl);
|
||||
|
||||
typedef void(__cdecl* TUEOnNotify)(UWinBLE_device* const ref, const TSERVCHAR servchar, const TGATTSTATUS gatstat, uint8* const val, const uint64 cnt);
|
||||
typedef void(__cdecl* TUEOnRead)(UWinBLE_device* const ref, const TSERVCHAR servchar, const TGATTSTATUS gatstat, uint8* const val, const uint64 cnt);
|
||||
typedef void(__cdecl* TUEOnWrite)(UWinBLE_device* const ref, const TSERVCHAR servchar, const TGATTSTATUS gatstat);
|
||||
typedef void(__cdecl* TUEOnSubscribe)(UWinBLE_device* const ref, const TSERVCHAR servchar, const TGATTSTATUS gatstat);
|
||||
typedef void(__cdecl* TUEOnUnsubscribe)(UWinBLE_device* ref, const TSERVCHAR servchar, const TGATTSTATUS gatstat);
|
||||
|
||||
typedef DLLOBJ* (__cdecl* BLEmanager_create)(void);
|
||||
typedef void(__cdecl* BLEmanager_free)(DLLOBJ* const sender);
|
||||
typedef void(__cdecl* BLEmanager_AssignOnNewDeviceFound)(DLLOBJ* const sender, const TUEOnNewDiscoveredDevice ond);
|
||||
typedef void(__cdecl* BLEmanager_AssignOnDiscoveryEnd)(DLLOBJ* const sender, const TUEOnDiscoveryEnd ond);
|
||||
typedef bool(__cdecl* BLEmanager_StartDiscoveryLive)(DLLOBJ* const sender, UBLE_manager* const ref, const uint64 ms, PUEstring const filt);
|
||||
typedef bool(__cdecl* BLEmanager_StartDiscoveryInBackground)(DLLOBJ* const sender, UBLE_manager* const ref, const uint64 ms, PUEstring const filt);
|
||||
typedef bool(__cdecl* BLEmanager_StopDiscovery)(DLLOBJ* const sender);
|
||||
|
||||
typedef void(__cdecl* BLEdevice_AssignOnConnect)(DLLOBJ* const dev, const TUEOnDeviceConnect ond);
|
||||
typedef void(__cdecl* BLEdevice_AssignOnDisconnect)(DLLOBJ* const dev, const TUEOnDeviceDisconnect ond);
|
||||
typedef void(__cdecl* BLEdevice_AssignOnServicesDiscovered)(DLLOBJ* const dev, const TUEOnServicesDiscovered ond);
|
||||
typedef bool(__cdecl* BLEdevice_Connect)(DLLOBJ* const dev, UWinBLE_device* const ref);
|
||||
typedef bool(__cdecl* BLEdevice_Disconnect)(DLLOBJ* const dev);
|
||||
typedef bool(__cdecl* BLEdevice_IsConnected)(DLLOBJ* const dev);
|
||||
|
||||
typedef void(__cdecl* BLEdevice_AssignOnRead)(DLLOBJ* const dev, const TUEOnRead ond);
|
||||
typedef void(__cdecl* BLEdevice_AssignOnSubscribe)(DLLOBJ* const dev, const TUEOnSubscribe ond);
|
||||
typedef void(__cdecl* BLEdevice_AssignOnUnsubscribe)(DLLOBJ* const dev, const TUEOnUnsubscribe ond);
|
||||
typedef void(__cdecl* BLEdevice_AssignOnWrite)(DLLOBJ* const dev, const TUEOnWrite ond);
|
||||
typedef void(__cdecl* BLEdevice_AssignOnNotify)(DLLOBJ* const dev, const TUEOnNotify ond);
|
||||
typedef bool(__cdecl* BLEdevice_Read)(DLLOBJ* const dev, const TSERVCHAR servchar);
|
||||
typedef bool(__cdecl* BLEdevice_Subscribe)(DLLOBJ* const dev, const TSERVCHAR servchar);
|
||||
typedef bool(__cdecl* BLEdevice_Unsubscribe)(DLLOBJ* const dev, const TSERVCHAR servchar);
|
||||
typedef bool(__cdecl* BLEdevice_Write)(DLLOBJ* const dev, const TSERVCHAR servchar, uint8* const data, const uint64 cnt);
|
||||
|
||||
|
||||
class UWinBluetoothLEModule : public IModuleInterface
|
||||
{
|
||||
friend class UWinBLE_device;
|
||||
friend class UBLE_manager;
|
||||
|
||||
private:
|
||||
void* hinstLib = nullptr;
|
||||
bool CleaningInProgress = false;
|
||||
bool fRunTimeLinkSuccess = false;
|
||||
void SanitizeDllException();
|
||||
|
||||
|
||||
BLEmanager_create BLEman_create = nullptr;
|
||||
BLEmanager_free BLEman_free = nullptr;
|
||||
BLEmanager_AssignOnNewDeviceFound BLEman_AssignOnNewDeviceFound = nullptr;
|
||||
BLEmanager_AssignOnDiscoveryEnd BLEman_AssignOnDiscoveryEnd = nullptr;
|
||||
BLEmanager_StartDiscoveryLive BLEman_StartDiscoveryLive = nullptr;
|
||||
BLEmanager_StartDiscoveryInBackground BLEman_StartDiscoveryInBackground = nullptr;
|
||||
BLEmanager_StopDiscovery BLEman_StopDiscovery = nullptr;
|
||||
|
||||
BLEdevice_AssignOnConnect BLEdev_AssignOnConnect = nullptr;
|
||||
BLEdevice_AssignOnDisconnect BLEdev_AssignOnDisconnect = nullptr;
|
||||
BLEdevice_AssignOnServicesDiscovered BLEdev_AssignOnServicesDiscovered = nullptr;
|
||||
BLEdevice_Connect BLEdev_Connect = nullptr;
|
||||
BLEdevice_Disconnect BLEdev_Disconnect = nullptr;
|
||||
BLEdevice_IsConnected BLEdev_IsConnected = nullptr;
|
||||
|
||||
BLEdevice_Read BLEdev_Read = nullptr;
|
||||
BLEdevice_Write BLEdev_Write = nullptr;
|
||||
BLEdevice_Subscribe BLEdev_Subscribe = nullptr;
|
||||
BLEdevice_Unsubscribe BLEdev_Unsubscribe = nullptr;
|
||||
BLEdevice_AssignOnSubscribe BLEdev_AssignOnSubscribe = nullptr;
|
||||
BLEdevice_AssignOnUnsubscribe BLEdev_AssignOnUnsubscribe = nullptr;
|
||||
BLEdevice_AssignOnRead BLEdev_AssignOnRead = nullptr;
|
||||
BLEdevice_AssignOnWrite BLEdev_AssignOnWrite = nullptr;
|
||||
BLEdevice_AssignOnNotify BLEdev_AssignOnNotify = nullptr;
|
||||
|
||||
static void __cdecl InternalOnNewDiscoveredDevice(UBLE_manager* const ref, const PUE_dev_rec nd);
|
||||
static void __cdecl InternalOnDiscoveryEnd(UBLE_manager* const ref,const PUE_dev_rec nd,const uint64 cnt);
|
||||
static void __cdecl InternalOnDeviceConnect(UWinBLE_device* const ref);
|
||||
static void __cdecl InternalOnDeviceDisconnect(UWinBLE_device* const ref);
|
||||
static void __cdecl InternalOnServicesDiscovered(UWinBLE_device* const ref, PDLLServicesList const sl);
|
||||
static void __cdecl InternalOnRead(UWinBLE_device* const ref,const TSERVCHAR servchar,const EGATTStatus status, uint8* const data, const uint64 count);
|
||||
static void __cdecl InternalOnNotify(UWinBLE_device* const ref,const TSERVCHAR servchar, const EGATTStatus status, uint8* const data, const uint64 count);
|
||||
static void __cdecl InternalOnSubscribe(UWinBLE_device* const ref, const TSERVCHAR servchar, const EGATTStatus status);
|
||||
static void __cdecl InternalOnUnsubscribe(UWinBLE_device* const ref, const TSERVCHAR servchar, const EGATTStatus status);
|
||||
static void __cdecl InternalOnWrite(UWinBLE_device* const ref, const TSERVCHAR servchar, const EGATTStatus status);
|
||||
public:
|
||||
|
||||
static UBLE_manager* GetBleManager(const UWinBluetoothLEModule* mod);
|
||||
|
||||
// IModuleInterface overrides
|
||||
virtual void StartupModule() override;
|
||||
virtual void ShutdownModule() override;
|
||||
|
||||
bool StartDiscoveryLive(UBLE_manager* const ref, const int ms, const FString& filter);
|
||||
bool StartDiscoveryInBackground(UBLE_manager* const ref, const int ms, const FString& filter);
|
||||
bool StopDiscovery();
|
||||
bool ConnectDevice(DLLOBJ* const DevRef, UWinBLE_device* const selfref);
|
||||
bool DisconnectDevice(DLLOBJ* const DevRef);
|
||||
bool IsConnected(DLLOBJ* const DevRef);
|
||||
|
||||
void LinkInternals(DLLOBJ* const DevRef);
|
||||
void UnlinkInternals(DLLOBJ* const DevRef);
|
||||
|
||||
UBLE_manager* Local_BLE_Manager = nullptr;
|
||||
};
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
UCLASS(ClassGroup = (Custom), Category = "Bluetooth Low Energy", meta = (BlueprintSpawnableComponent))
|
||||
class WINBLUETOOTHLE_API UBLE_manager : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
friend UWinBluetoothLEModule;
|
||||
|
||||
private:
|
||||
UWinBluetoothLEModule* BLEmodule;
|
||||
int GetIndexByDevRef(DLLOBJ* const dref);
|
||||
UWinBLE_device* MakeNewDevice(const PUE_dev_rec drec);
|
||||
static uint8 NibbToByte(const FString& Nibble, bool& Valid);
|
||||
|
||||
public:
|
||||
UBLE_manager();
|
||||
~UBLE_manager();
|
||||
void JustDiscoveredDevice(PUE_dev_rec const drec);
|
||||
void JustDiscoveryEnd(const PUE_dev_rec drec, const uint64 cnt);
|
||||
void JustConnectedDevice(UWinBLE_device* const dev);
|
||||
void JustDisconnectedDevice(UWinBLE_device* const dev);
|
||||
void JustDiscoveredServices(UWinBLE_device* const dev);
|
||||
void AttachBLEmodule(UWinBluetoothLEModule* const dllmodule);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bluetooth Low Energy")
|
||||
void DisconnectAll();
|
||||
UFUNCTION(BlueprintCallable, Category = "Bluetooth Low Energy", meta = (DisplayName = "Reset BLE adapter", ReturnDisplayName = "succ"))
|
||||
bool ResetBleAdapter();
|
||||
|
||||
public:
|
||||
bool Attached = false;
|
||||
DLLOBJ* ref_keeper = nullptr;
|
||||
|
||||
FOnNewBLEdeviceDiscovered NewBLEdeviceDiscovered;
|
||||
FOnDiscoveryEnd DiscoveryEnd;
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "Bluetooth Low Energy", meta = (DisplayName = "MAC to string", ReturnDisplayName = "address"))
|
||||
static FString Convert_MAC_Address_To_String(const FMAC_ADDRESS& Address);
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "Bluetooth Low Energy", meta = (DisplayName = "String to MAC", ReturnDisplayName = "MAC"))
|
||||
static FMAC_ADDRESS Convert_String_To_MAC_Address(const FString& Address, bool& Valid);
|
||||
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bluetooth Low Energy", meta = (AutoCreateRefTerm = "OnNewBLEdeviceDiscovered", ToolTip = "Live discovery triggers OnNewBLEdeviceDiscovered every time a divice is found. The length of array of found devices is going to change during discovering process. The filter is comma separated string of words. Any device which in its name has any of the words from the filter as substring will be added to array. Discovering process will end after amount of milliseconds determined by input parameter."))
|
||||
void Start_DiscoveryLive(const FOnNewBLEdeviceDiscovered& OnNewBLEdeviceDiscovered, const FOnDiscoveryEnd& OnDiscoveryEnd, const int64 milliseconds = 5000, const FString& NameOrAddressFilter = "");
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bluetooth Low Energy", meta = (AutoCreateRefTerm = "OnDiscoveryEnd", ToolTip = "Background discovery triggers OnDiscoveryEnd once discovering process is finished after spending miliseconds determined by input parameter. Found devices ar returned in the array. Only devices whose name/address contains at least one word from comma separated sequence of words in fileter string will be added to array"))
|
||||
void Start_DiscoveryInBackground(const FOnDiscoveryEnd& OnDiscoveryEnd, const int64 milliseconds = 5000, const FString& NameOrAddressFilter = "");
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bluetooth Low Energy")
|
||||
void Stop_Discovery();
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Bluetooth Low Energy")
|
||||
FOnAnyBLEdeviceConnected OnAnyBLEdeviceConnected;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Bluetooth Low Energy")
|
||||
FOnAnyBLEdeviceDisconnected OnAnyBLEdeviceDisconnected;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Bluetooth Low Energy")
|
||||
FOnAnyServiceDiscovered OnAnyServiceDiscovered;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Bluetooth Low Energy")
|
||||
FOnBLEerror OnBLEerror;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Bluetooth Low Energy")
|
||||
TArray<UWinBLE_device*> FoundDevices;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Bluetooth Low Energy")
|
||||
bool IsScanInProgress = false;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
UCLASS(ClassGroup = (Custom), Category = "Bluetooth Low Energy", meta = (BlueprintSpawnableComponent))
|
||||
class WINBLUETOOTHLE_API UWinBLE_device : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
friend UWinBluetoothLEModule;
|
||||
friend class BLE_manager;
|
||||
|
||||
private:
|
||||
|
||||
TSERVCHAR FindInList(const FString& serviceUUID, const FString& characteristicUUID, ECharacteristicDescriptor& descriptor);
|
||||
|
||||
public:
|
||||
FString GUIDtoStr(const DLLGUID* g);
|
||||
bool InternalsLinked = false;
|
||||
bool DestroyingInProgress = false;
|
||||
|
||||
UWinBLE_device();
|
||||
~UWinBLE_device();
|
||||
void ParseDllStructure(PDLLServicesList sl);
|
||||
|
||||
//Getter functions
|
||||
UFUNCTION(BlueprintCallable, BlueprintGetter, BlueprintPure, Category = "Bluetooth Low Energy", meta = (DisplayName = "Address as string", ReturnDisplayName = "address"))
|
||||
FString DeviceAddressAsString();
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintGetter, BlueprintPure, Category = "Bluetooth Low Energy", meta = (DisplayName = "Address as int", ReturnDisplayName = "int64"))
|
||||
int64 DeviceAddressAsInt64();
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintGetter, BlueprintPure, Category = "Bluetooth Low Energy", meta = (DisplayName = "Address as MAC", ReturnDisplayName = "MAC"))
|
||||
FMAC_ADDRESS DeviceAddressAsMAC();
|
||||
|
||||
UBLE_manager* RefToManager;
|
||||
UWinBluetoothLEModule* RefToModule;
|
||||
DLLOBJ* RefToDev; // reference to DLL object
|
||||
uint64 ID = 0;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Bluetooth Low Energy")
|
||||
FString DeviceName = "<noname>";
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, BlueprintGetter = "DeviceAddressAsString", Category = "Bluetooth Low Energy")
|
||||
FString AddressAsString;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, BlueprintGetter = "DeviceAddressAsInt64", Category = "Bluetooth Low Energy")
|
||||
int64 AddressAsInt64;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, BlueprintGetter = "DeviceAddressAsMAC", Category = "Bluetooth Low Energy")
|
||||
FMAC_ADDRESS AddressAsMAC;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Bluetooth Low Energy")
|
||||
int RSSI = 0;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Bluetooth Low Energy")
|
||||
FOnConnect OnConnect;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Bluetooth Low Energy")
|
||||
FOnDisconnect OnDisconnect;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Bluetooth Low Energy")
|
||||
FOnServicesDiscovered OnServicesDiscovered;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Bluetooth Low Energy")
|
||||
FOnRead OnRead;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Bluetooth Low Energy")
|
||||
FOnNotify OnNotify;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Bluetooth Low Energy")
|
||||
FOnWrite OnWrite;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Bluetooth Low Energy")
|
||||
FOnSubscribe OnSubscribe;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category = "Bluetooth Low Energy")
|
||||
FOnUnsubscribe OnUnsubscribe;
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bluetooth Low Energy")
|
||||
void Connect();
|
||||
UFUNCTION(BlueprintCallable, Category = "Bluetooth Low Energy")
|
||||
void Disconnect();
|
||||
UFUNCTION(BlueprintCallable, Category = "Bluetooth Low Energy", meta = (DisplayName = "Is Connected", ReturnDisplayName = "connected"))
|
||||
bool IsConnected();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bluetooth Low Energy")
|
||||
void DiscoverServices();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Bluetooth Low Energy")
|
||||
void Read(const FString& Service_UUID, const FString& Characteristic_UUID);
|
||||
UFUNCTION(BlueprintCallable, Category = "Bluetooth Low Energy")
|
||||
void Write(const FString& Service_UUID, const FString& Characteristic_UUID, TArray<uint8> data);
|
||||
UFUNCTION(BlueprintCallable, Category = "Bluetooth Low Energy")
|
||||
void Subscribe(const FString& Service_UUID, const FString& Characteristic_UUID);
|
||||
UFUNCTION(BlueprintCallable, Category = "Bluetooth Low Energy")
|
||||
void Unsubscribe(const FString& Service_UUID, const FString& Characteristic_UUID);
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = "Bluetooth Low Energy")
|
||||
TArray<FServiceListItem> ActiveServices;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
UCLASS()
|
||||
class WINBLUETOOTHLE_API UWinBluetoothLELibrary : public UBlueprintFunctionLibrary
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
friend ECharacteristicDescriptor;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Return Bluetooth Low Energy Manager
|
||||
*
|
||||
* @return -
|
||||
*/
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Bluetooth Low Energy", meta = (DisplayName = "Get BLE manager", ReturnDisplayName = "BLE Manager", Keywords = "Bluetooth LE BLE manager"))
|
||||
static UBLE_manager* Get_BLE_Manager(bool& IsPluginLoaded, bool& BleAdapterFound);
|
||||
|
||||
/**
|
||||
* Convert HEX nibble into byte. Possible TCHAR inputs: 0,1,2,3,4,5,6,7,8,9,a,A,b,B,c,C,d,D,e,E,f,F
|
||||
*
|
||||
* @return - Byte in range 0-15 and Valid bit if input char belongs to those acceptable chars
|
||||
*/
|
||||
UFUNCTION(BlueprintPure, Category = "Bluetooth Low Energy", meta = (DisplayName = "Nibble To Byte", ReturnDisplayName = "Byte"))
|
||||
static uint8 NibbleToByte(const FString& Nibble, bool& Valid);
|
||||
|
||||
/**
|
||||
* Convert BLE Characteristic Descriptor into set of bool results.
|
||||
*
|
||||
* @return - bool results are set according to bits in BLE Characteristic Descriptor
|
||||
*/
|
||||
UFUNCTION(BlueprintPure, Category = "Bluetooth Low Energy", meta = (DisplayName = "Get Descriptor Bits"))
|
||||
static void GetDescriptorBits(const ECharacteristicDescriptor& Descriptor, bool& Broadcastable, bool& ExtendedProperties, bool& Notifiable, bool& Indicable, bool& Readable, bool& Writable, bool& WriteNoResponse, bool& SignedWrite);
|
||||
|
||||
/**
|
||||
* Makes BLE Characteristic Descriptor from set of bool inputs.
|
||||
*
|
||||
* @return - BLE Characteristic Descriptor
|
||||
*/
|
||||
UFUNCTION(BlueprintPure, Category = "Bluetooth Low Energy", meta = (DisplayName = "Make BLE Descriptor"))
|
||||
static ECharacteristicDescriptor MakeDescriptor(const bool Broadcastable, const bool ExtendedProperties, const bool Notifiable, const bool Indicable, const bool Readable, const bool Writable, const bool WriteNoResponse, const bool SignedWrite);
|
||||
|
||||
/**
|
||||
* Convert BLE Characteristic Descriptor into string convenient for textual representation
|
||||
*
|
||||
* @return - String containing Ble descriptor bit states in readable form
|
||||
*/
|
||||
UFUNCTION(BlueprintPure, Category = "Bluetooth Low Energy", meta = (DisplayName = "Descriptor To String", ReturnDisplayName = "Descriptor"))
|
||||
static FString DescriptorToString(const uint8& Descriptor);
|
||||
|
||||
/**
|
||||
* Test if under editor
|
||||
*
|
||||
* @return - True if we are under editor
|
||||
*/
|
||||
UFUNCTION(BlueprintPure, Category = "Bluetooth Low Energy", meta = (DisplayName = "Is Editor Running", ReturnDisplayName = "Editor running"))
|
||||
static bool IsEditorRunning();
|
||||
|
||||
};
|
||||
@ -0,0 +1,54 @@
|
||||
// Copyright (C) 2025 SC SIGNATURE UE - By Srdjan Crnjanski
|
||||
|
||||
using UnrealBuildTool;
|
||||
|
||||
public class WinBluetoothLE : ModuleRules
|
||||
{
|
||||
public WinBluetoothLE(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
PublicIncludePaths.AddRange(
|
||||
new string[] {
|
||||
// ... add public include paths required here ...
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
PrivateIncludePaths.AddRange(
|
||||
new string[] {
|
||||
// ... add other private include paths required here ...
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
PublicDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"Core",
|
||||
"Projects"
|
||||
// ... add other public dependencies that you statically link with here ...
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"CoreUObject",
|
||||
"Engine",
|
||||
"Slate",
|
||||
"SlateCore",
|
||||
// ... add private dependencies that you statically link with here ...
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
DynamicallyLoadedModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
// ... add any modules that your module loads dynamically here ...
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
26
Unreal/Plugins/WinBluetoothLE/WinBluetoothLE.uplugin
Normal file
26
Unreal/Plugins/WinBluetoothLE/WinBluetoothLE.uplugin
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"FileVersion": 3,
|
||||
"Version": 1,
|
||||
"VersionName": "1.2",
|
||||
"FriendlyName": "Win Bluetooth LE",
|
||||
"Description": "Bluetooth Low Energy funcionality",
|
||||
"Category": "Connectivity",
|
||||
"CreatedBy": "Srdjan Crnjanski",
|
||||
"CreatedByURL": "https://www.fab.com/sellers/Srdjan%20Crnjanski",
|
||||
"DocsURL": "https://drive.google.com/file/d/1sphE4PCJ5wZxKgR5bXwkhY2_NU6sGqVV/view?usp=sharing",
|
||||
"MarketplaceURL": "com.epicgames.launcher://ue/Fab/product/d379be5f-8987-4b72-922d-de96b60b2dde",
|
||||
"SupportURL": "mailto:sc.signature.ue@gmail.com",
|
||||
"EngineVersion": "5.5.0",
|
||||
"CanContainContent": true,
|
||||
"Installed": true,
|
||||
"Modules": [
|
||||
{
|
||||
"Name": "WinBluetoothLE",
|
||||
"Type": "Runtime",
|
||||
"LoadingPhase": "PreLoadingScreen",
|
||||
"PlatformAllowList": [
|
||||
"Win64"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
15
Unreal/Source/PS_BLE_Tracker.Target.cs
Normal file
15
Unreal/Source/PS_BLE_Tracker.Target.cs
Normal file
@ -0,0 +1,15 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
using UnrealBuildTool;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class PS_BLE_TrackerTarget : TargetRules
|
||||
{
|
||||
public PS_BLE_TrackerTarget(TargetInfo Target) : base(Target)
|
||||
{
|
||||
Type = TargetType.Game;
|
||||
DefaultBuildSettings = BuildSettingsVersion.V5;
|
||||
|
||||
ExtraModuleNames.AddRange( new string[] { "PS_BLE_Tracker" } );
|
||||
}
|
||||
}
|
||||
12
Unreal/Source/PS_BLE_Tracker/MyClass.cpp
Normal file
12
Unreal/Source/PS_BLE_Tracker/MyClass.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "MyClass.h"
|
||||
|
||||
MyClass::MyClass()
|
||||
{
|
||||
}
|
||||
|
||||
MyClass::~MyClass()
|
||||
{
|
||||
}
|
||||
15
Unreal/Source/PS_BLE_Tracker/MyClass.h
Normal file
15
Unreal/Source/PS_BLE_Tracker/MyClass.h
Normal file
@ -0,0 +1,15 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class PS_BLE_TRACKER_API MyClass
|
||||
{
|
||||
public:
|
||||
MyClass();
|
||||
~MyClass();
|
||||
};
|
||||
23
Unreal/Source/PS_BLE_Tracker/PS_BLE_Tracker.Build.cs
Normal file
23
Unreal/Source/PS_BLE_Tracker/PS_BLE_Tracker.Build.cs
Normal file
@ -0,0 +1,23 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
using UnrealBuildTool;
|
||||
|
||||
public class PS_BLE_Tracker : ModuleRules
|
||||
{
|
||||
public PS_BLE_Tracker(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||
|
||||
// Uncomment if you are using Slate UI
|
||||
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
|
||||
|
||||
// Uncomment if you are using online features
|
||||
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
|
||||
|
||||
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
|
||||
}
|
||||
}
|
||||
6
Unreal/Source/PS_BLE_Tracker/PS_BLE_Tracker.cpp
Normal file
6
Unreal/Source/PS_BLE_Tracker/PS_BLE_Tracker.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#include "PS_BLE_Tracker.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, PS_BLE_Tracker, "PS_BLE_Tracker" );
|
||||
6
Unreal/Source/PS_BLE_Tracker/PS_BLE_Tracker.h
Normal file
6
Unreal/Source/PS_BLE_Tracker/PS_BLE_Tracker.h
Normal file
@ -0,0 +1,6 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
15
Unreal/Source/PS_BLE_TrackerEditor.Target.cs
Normal file
15
Unreal/Source/PS_BLE_TrackerEditor.Target.cs
Normal file
@ -0,0 +1,15 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
using UnrealBuildTool;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class PS_BLE_TrackerEditorTarget : TargetRules
|
||||
{
|
||||
public PS_BLE_TrackerEditorTarget(TargetInfo Target) : base(Target)
|
||||
{
|
||||
Type = TargetType.Editor;
|
||||
DefaultBuildSettings = BuildSettingsVersion.V5;
|
||||
|
||||
ExtraModuleNames.AddRange( new string[] { "PS_BLE_Tracker" } );
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user