5 #include <CoreMinimal.h>
10 #include "LovenseEvents.h"
11 #include "LovenseTypes.h"
129 void UpdateAdapters();
138 void ClearAllCommands(
class ULovenseToy* toy =
nullptr);
141 void ReloadLovenseConfig();
149 FORCEINLINE
const TArray<class ULovenseToy*>&
GetToys() {
return this->toys; }
158 bool IsIPStringValid(
const FString& ipString,
const TCHAR* delimiter = TEXT(
"."));
160 bool IsDomainStringValid(
const FString& domainString);
162 bool IsPortStringValid(
const FString& portString);
165 FString ConvertIPStringToDomainString(
const FString& ipString);
167 FString ConvertDomainStringToIPString(
const FString& domainString);
170 void StartTimer(FTimerHandle& timerHandle,
float timerRate,
bool bIsLooped);
172 void StartTimer(FTimerHandle& timerHandle,
const FTimerDelegate& delegate,
float timerRate,
bool bIsLooped);
174 void StartTimer(FTimerHandle& timerHandle,
const FTimerDynamicDelegate& delegate,
float timerRate,
bool bIsLooped);
176 void StopTimer(FTimerHandle& timerHandle);
178 bool IsTimerRunning(FTimerHandle timerHandle);
180 bool IsTimerExecuting(FTimerHandle timerHandle);
199 ELovenseCommand command,
205 const FString& presetName = TEXT(
""),
207 FOnLovenseResponse callback = FOnLovenseResponse()
234 bool SendCommand_Vibrate(
class ULovenseToy* toy, uint8 vibrationSpeed);
247 bool SendCommand_Vibrate1(
class ULovenseToy* toy, uint8 vibrationSpeed);
260 bool SendCommand_Vibrate2(
class ULovenseToy* toy, uint8 vibrationSpeed);
273 bool SendCommand_Rotate(
class ULovenseToy* toy, uint8 rotationSpeed);
286 bool SendCommand_RotateAntiClockwise(
class ULovenseToy* toy, uint8 rotationSpeed);
299 bool SendCommand_RotateClockwise(
class ULovenseToy* toy, uint8 rotationSpeed);
310 bool SendCommand_RotateChange(
class ULovenseToy* toy);
323 bool SendCommand_AirAuto(
class ULovenseToy* toy, uint8 pulseSpeed);
359 bool SendCommand_Thrust(
class ULovenseToy* toy, uint8 thrustingSpeed);
371 bool SendCommand_Suck(
class ULovenseToy* toy, uint8 suctionSpeed);
383 bool SendCommand_Finger(
class ULovenseToy* toy, uint8 fingeringSpeed);
396 bool SendCommand_Preset(
class ULovenseToy* toy, uint8 pattern);
408 bool SendCommand_Battery(
class ULovenseToy* toy, FOnLovenseResponse callback);
424 bool SendCommand_AVibrate(
class ULovenseToy* toy, uint8 vibrationSpeed, int32 time);
442 bool SendCommand_AVibrate1(
class ULovenseToy* toy, uint8 vibrationSpeed, int32 time);
460 bool SendCommand_AVibrate2(
class ULovenseToy* toy, uint8 vibrationSpeed, int32 time);
477 bool SendCommand_ARotate(
class ULovenseToy* toy, uint8 rotationSpeed, int32 time);
494 bool SendCommand_AAirLevel(
class ULovenseToy* toy, uint8 pulseSpeed, int32 time);
510 bool SendCommand_AThrust(
class ULovenseToy* toy, uint8 thrustingSpeed, int32 time);
526 bool SendCommand_ASuck(
class ULovenseToy* toy, uint8 suctionSpeed, int32 time);
542 bool SendCommand_AFinger(
class ULovenseToy* toy, uint8 fingeringSpeed, int32 time);
559 bool SendCommand_APreset(
class ULovenseToy* toy,
const FString& patternName, int32 time);
580 bool SendCommand_AVibRotate(
class ULovenseToy* toy, uint8 vibrationSpeed, uint8 rotationSpeed, int32 time);
601 bool SendCommand_AVibAir(
class ULovenseToy* toy, uint8 vibrationSpeed, uint8 pulseSpeed, int32 time);
618 bool SendCommand_AVibRotateAir(
class ULovenseToy* toy, uint8 vibrationSpeed, uint8 rotationSpeed, uint8 pulseSpeed, int32 time);
633 bool SendCommand_AAll(
class ULovenseToy* toy, uint8 speed, int32 time);
649 template<
typename TCallback>
651 for (TSharedPtr<class ILovenseAdapter> adapter : this->lovenseAdapters) callback(adapter);
664 void OnCommandFailed();
678 FORCEINLINE
void SetToyDelay(int32 value) { this->toyDelay = value; }
703 void SetToyVibrationEnabled(
bool value);
715 void SetToyRotationEnabled(
bool value);
727 void SetToyAirEnabled(
bool value);
739 void SetToyThrustingEnabled(
bool value);
751 void SetToySuctionEnabled(
bool value);
763 void SetToyFingeringEnabled(
bool value);
784 void FilterAdaptersAndAddOfflineAdapters();
790 void PruneAdapters();
795 void UpdateToys_Internal();
801 void ClearData(
bool bClearCurrentData);
809 void OnUpdateAdaptersTimerFinished();
817 void StartUpdateAdaptersTimer();
824 void ResetUpdateAdaptersTimer();
827 void OnUpdateToysTimerLoop();
829 void StartUpdateToysTimer();
833 TStrongObjectPtr<class ULovenseEvents> lovenseEvents;
837 TArray<TSharedPtr<class ILovenseAdapter>> lovenseAdapters;
839 TArray<class ULovenseToy*> toys;
843 int32 numAdaptersWaitingForGetToysResponse;
845 int32 numAdaptersFailedGetToys;
850 TArray<TSharedPtr<class ILovenseAdapter>> temporaryLovenseAdapters;
855 TArray<class ULovenseToy*> temporaryToys;
858 bool bIsLovenseRunning;
860 bool bIsUpdatingAdapters;
862 bool bIsUpdatingToys;
865 FTimerHandle updateAdaptersTimerHandle;
870 float currentUpdateAdaptersTimerInterval;
875 FTimerHandle updateToysTimerHandle;
892 float toyStrengthMultiplier;
898 bool bToyVibrationEnabled;
904 bool bToyRotationEnabled;
916 bool bToyThrustingEnabled;
922 bool bToySuctionEnabled;
928 bool bToyFingeringEnabled;