Lovense Integration
LovenseTypes.h
1 // (CVN) - Candy Valley Network GmbH
2 
3 #pragma once
4 
5 #include <CoreMinimal.h>
6 
7 // EXTERNAL INCLUDES
8 #include <TimerManager.h>
9 #include <UObject/StrongObjectPtr.h>
10 
11 // INTERNAL INCLUDES
12 
13 #include "LovenseTypes.generated.h"
14 
15 
16 namespace LovenseIntegration {
17  // ReSharper disable CppVariableCanBeMadeConstexpr - FString constructors are not constexpr, so we can't make these constexpr either.
19  LOVENSEINTEGRATION_API extern const FString configFileName;
21  LOVENSEINTEGRATION_API extern const FString configSectionName;
28  LOVENSEINTEGRATION_API extern const FString configStartWithLovenseActiveKeyName;
33  [[deprecated("Use configDeviceIpOverrideKeyName instead.")]]
34  LOVENSEINTEGRATION_API extern const FString configMobileDeviceIpOverrideKeyName;
39  [[deprecated("Use configDevicePortOverrideKeyName instead.")]]
40  LOVENSEINTEGRATION_API extern const FString configMobileDevicePortOverrideKeyName;
47  LOVENSEINTEGRATION_API extern const FString configDeviceIpOverrideKeyName;
54  LOVENSEINTEGRATION_API extern const FString configDevicePortOverrideKeyName;
61  LOVENSEINTEGRATION_API extern const FString configToyDelayKeyName;
68  LOVENSEINTEGRATION_API extern const FString configToyStrengthMultiplierKeyName;
75  LOVENSEINTEGRATION_API extern const FString configToyVibrationKeyName;
82  LOVENSEINTEGRATION_API extern const FString configToyRotationKeyName;
89  LOVENSEINTEGRATION_API extern const FString configToyAirKeyName;
96  LOVENSEINTEGRATION_API extern const FString configToyThrustingKeyName;
103  LOVENSEINTEGRATION_API extern const FString configToySuctionKeyName;
110  LOVENSEINTEGRATION_API extern const FString configToyFingeringKeyName;
111  // ReSharper restore CppVariableCanBeMadeConstexpr
112 }
113 
114 
118 UENUM(BlueprintType)
119 enum class ELovenseCommand : uint8 {
121  Unknown = 0,
123  Test = 1,
125  Stop = 2,
127  Vibrate = 3,
129  Vibrate1 = 4,
131  Vibrate2 = 5,
133  Rotate = 6,
135  RotateAntiClockwise = 7,
137  RotateClockwise = 8,
139  RotateChange = 9,
141  AirAuto = 10,
143  AirIn = 11,
145  AirOut = 12,
147  Thrust = 13,
149  Suck = 14,
151  Finger = 15,
153  Preset = 16,
155  Battery = 17,
157  AVibrate = 18,
159  AVibrate1 = 19,
161  AVibrate2 = 20,
163  ARotate = 21,
165  AAirLevel = 22,
167  AThrust = 23,
169  ASuck = 24,
171  AFinger = 25,
173  APreset = 26,
175  AVibRotate = 27,
177  AVibAir = 28,
179  AVibRotateAir = 29,
181  AAll = 30,
183  Pattern = 31,
184  EnumCount = 32 // Enum field count.
185 };
186 
187 
191 USTRUCT(BlueprintType)
192 struct LOVENSEINTEGRATION_API FLovenseToyDescription {
193  GENERATED_USTRUCT_BODY()
194 
195 
196  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
197  FString id;
198 
200  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
201  FString name;
202 
204  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
205  int32 status;
206 
212  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
213  int32 battery;
214 
216  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
217  FString firmwareVersion;
218 
220  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
221  FString nickname;
222 
224  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
225  FString version;
226 
227  FString ToString() const {
228  FString output = TEXT("");
229  FLovenseToyDescription::StaticStruct()->ExportText(output, this, nullptr, nullptr, 0, nullptr);
230  return output;
231  }
232 
234  this->id = TEXT("");
235  this->name = TEXT("");
236  this->status = 0;
237  this->battery = 0;
238  this->firmwareVersion = TEXT("");
239  this->nickname = TEXT("");
240  this->version = TEXT("");
241  }
242 };
243 
244 
248 USTRUCT(BlueprintType)
249 struct LOVENSEINTEGRATION_API FLovenseAdapterDescription {
250  GENERATED_BODY()
251 
252 
256  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
257  FString deviceCode;
258 
265  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
266  int32 online;
267 
273  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
274  FString domain;
275 
282  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
283  int32 httpsPort;
284 
292  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
293  int32 wssPort;
294 
296  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
297  FString platform;
298 
300  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
301  FString appVersion;
302 
304  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
305  FString appType;
306 
312  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
314 
315  FString ToString() const {
316  FString output = TEXT("");
317  FLovenseAdapterDescription::StaticStruct()->ExportText(output, this, nullptr, nullptr, 0, nullptr);
318  return output;
319  }
320 
322  this->deviceCode = TEXT("");
323  this->online = 0;
324  this->domain = TEXT("");
325  this->httpsPort = 0;
326  this->wssPort = 0;
327  this->platform = TEXT("");
328  this->appVersion = TEXT("");
329  this->appType = TEXT("");
330  this->toys = TArray<FLovenseToyDescription>();
331  }
332 };
333 
334 
338 USTRUCT(BlueprintType)
339 struct LOVENSEINTEGRATION_API FLovenseGetAdaptersResponseData {
340  GENERATED_BODY()
341 
342 
343  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
344  int32 code;
345 
347  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
348  FString message;
349 
351  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
352  TArray<FLovenseAdapterDescription> adapters;
353 
355  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
356  FString jsonString;
357 
359  this->code = 0;
360  this->message = TEXT("");
361  this->adapters = TArray<FLovenseAdapterDescription>();
362  this->jsonString = TEXT("");
363  }
364 };
365 
366 
370 USTRUCT(BlueprintType)
371 struct LOVENSEINTEGRATION_API FLovenseGetToysResponseData {
372  GENERATED_BODY()
373 
374 
375  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
376  FString type;
377 
379  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
380  int32 code;
381 
383  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
385 
387  UPROPERTY(BlueprintReadOnly, Category = "Lovense")
388  FString jsonString;
389 
391  this->type = TEXT("");
392  this->code = 0;
393  this->toys = TArray<FLovenseToyDescription>();
394  this->jsonString = TEXT("");
395  }
396 };
397 
398 
402 USTRUCT(BlueprintType)
403 struct LOVENSEINTEGRATION_API FLovensePattern {
404  GENERATED_BODY()
405 
406 
407  UPROPERTY(BlueprintReadWrite, Category = "Lovense")
408  bool bVibrate;
409 
411  UPROPERTY(BlueprintReadWrite, Category = "Lovense")
412  bool bRotate;
413 
415  UPROPERTY(BlueprintReadWrite, Category = "Lovense")
416  bool bPump;
417 
419  UPROPERTY(BlueprintReadWrite, Category = "Lovense")
420  bool bThrust;
421 
423  UPROPERTY(BlueprintReadWrite, Category = "Lovense")
424  bool bSuck;
425 
427  UPROPERTY(BlueprintReadWrite, Category = "Lovense")
428  bool bFinger;
429 
431  UPROPERTY(BlueprintReadWrite, Category = "Lovense")
432  int32 interval;
433 
435  UPROPERTY(BlueprintReadWrite, Category = "Lovense")
436  TArray<int32> pattern;
437 
439  UPROPERTY(BlueprintReadWrite, Category = "Lovense")
440  int32 time;
441 
443  FString ParsePattern();
444 
445  FLovensePattern() {
446  this->bVibrate = true;
447  this->bRotate = true;
448  this->bPump = true;
449  this->bThrust = true;
450  this->bSuck = true;
451  this->bFinger = true;
452  this->interval = 100;
453  this->pattern = TArray<int32>();
454  this->time = 1;
455  }
456 };
457 
458 
466  FTimerHandle commandDelayTimerHandle_Vibrate = FTimerHandle();
467  FTimerHandle commandDelayTimerHandle_Vibrate1 = FTimerHandle();
468  FTimerHandle commandDelayTimerHandle_Vibrate2 = FTimerHandle();
469  FTimerHandle commandDelayTimerHandle_VibRotateAir = FTimerHandle();
470  FTimerHandle commandDelayTimerHandle_Rotate = FTimerHandle();
471  FTimerHandle commandDelayTimerHandle_Air = FTimerHandle();
472  FTimerHandle commandDelayTimerHandle_Thrust = FTimerHandle();
473  FTimerHandle commandDelayTimerHandle_Suck = FTimerHandle();
474  FTimerHandle commandDelayTimerHandle_Finger = FTimerHandle();
475  FTimerHandle commandDelayTimerHandle_Preset = FTimerHandle();
476  FTimerHandle commandDelayTimerHandle_All = FTimerHandle();
477  FTimerHandle commandDelayTimerHandle_Pattern = FTimerHandle();
478  float commandDelay_Vibrate = 0.2f;
479  float commandDelay_Vibrate1 = 0.2f;
480  float commandDelay_Vibrate2 = 0.2f;
481  float commandDelay_VibRotateAir = 0.2f;
482  float commandDelay_Rotate = 1.0f;
483  float commandDelay_Air = 1.0f;
484  float commandDelay_Thrust = 0.2f;
485  float commandDelay_Suck = 0.2f;
486  float commandDelay_Finger = 0.2f;
487  float commandDelay_Preset = 1.0f;
488  float commandDelay_All = 0.2f;
489  float commandDelay_Pattern = 0.1f;
490 };
491 
492 
498 DECLARE_DELEGATE_OneParam(FOnLovenseGetAdaptersResponse, FLovenseGetAdaptersResponseData);
505 DECLARE_DELEGATE_TwoParams(FOnLovenseGetToysResponse, FLovenseGetToysResponseData, const TArray<TStrongObjectPtr<class ULovenseToy>>&);
512 DECLARE_DYNAMIC_DELEGATE_TwoParams(FOnLovenseResponseDynamic, class ULovenseToy*, toy, int32, responseValue);
513 
519 DECLARE_DELEGATE_OneParam(FOnLovenseResponse, int32);
LovenseIntegration::configDevicePortOverrideKeyName
const LOVENSEINTEGRATION_API FString configDevicePortOverrideKeyName
Config value key name for the DevicePortOverride setting. This setting is a string value....
Definition: LovenseTypes.h:54
LovenseIntegration::configFileName
const LOVENSEINTEGRATION_API FString configFileName
File path+name (excluding file extension) for the lovense config relative to the generated config dir...
Definition: LovenseTypes.h:19
LovenseIntegration::configDeviceIpOverrideKeyName
const LOVENSEINTEGRATION_API FString configDeviceIpOverrideKeyName
Config value key name for the DeviceIpOverride setting. This setting is a string value....
Definition: LovenseTypes.h:47
LovenseIntegration::configToyAirKeyName
const LOVENSEINTEGRATION_API FString configToyAirKeyName
Config value key name for the ToyAir setting. This setting is a bool value. Default is true....
Definition: LovenseTypes.h:89
LovenseIntegration::configMobileDeviceIpOverrideKeyName
const LOVENSEINTEGRATION_API FString configMobileDeviceIpOverrideKeyName
Deprecated. Superseded by configDeviceIpOverrideKeyName. Only used to upgrade config.
Definition: LovenseTypes.h:34
FLovenseCommandDelayTimers
These timers define the minimum update frequencies for the respective commands. There's a global se...
Definition: LovenseTypes.h:465
LovenseIntegration::configToyStrengthMultiplierKeyName
const LOVENSEINTEGRATION_API FString configToyStrengthMultiplierKeyName
Config value key name for the ToyStrengthMultiplier setting. This setting is a float value....
Definition: LovenseTypes.h:68
LovenseIntegration::configToyVibrationKeyName
const LOVENSEINTEGRATION_API FString configToyVibrationKeyName
Config value key name for the ToyVibration setting. This setting is a bool value....
Definition: LovenseTypes.h:75
LovenseIntegration::configToyThrustingKeyName
const LOVENSEINTEGRATION_API FString configToyThrustingKeyName
Config value key name for the ToyThrusting setting. This setting is a bool value....
Definition: LovenseTypes.h:96
ULovenseToy
UObject representing a Lovense Toy.
Definition: LovenseToy.h:19
LovenseIntegration::configToyFingeringKeyName
const LOVENSEINTEGRATION_API FString configToyFingeringKeyName
Config value key name for the ToyFingering setting. This setting is a bool value....
Definition: LovenseTypes.h:110
FLovenseGetToysResponseData
Container holding (mostly) raw HTTP request json data from ILovenseAdapter::GetToys() response.
Definition: LovenseTypes.h:371
LovenseIntegration::configSectionName
const LOVENSEINTEGRATION_API FString configSectionName
The config section the config values will be stored under. Value is "Lovense.Lovense".
Definition: LovenseTypes.h:21
LovenseIntegration::configMobileDevicePortOverrideKeyName
const LOVENSEINTEGRATION_API FString configMobileDevicePortOverrideKeyName
Deprecated. Superseded by configDevicePortOverrideKeyName. Only used to upgrade config.
Definition: LovenseTypes.h:40
FLovensePattern
Structure holding all necessary information for a pattern command.
Definition: LovenseTypes.h:403
LovenseIntegration::configToyDelayKeyName
const LOVENSEINTEGRATION_API FString configToyDelayKeyName
Config value key name for the ToyDelay setting. This setting is an integer value....
Definition: LovenseTypes.h:61
LovenseIntegration
Definition: LovenseIntegration.Build.cs:6
LovenseIntegration::configToyRotationKeyName
const LOVENSEINTEGRATION_API FString configToyRotationKeyName
Config value key name for the ToyRotation setting. This setting is a bool value....
Definition: LovenseTypes.h:82
FLovenseGetAdaptersResponseData
Container holding (mostly) raw HTTP request json data from ILovenseAdapter::TryGetAdapterData() respo...
Definition: LovenseTypes.h:339
FLovenseToyDescription
Container holding (mostly) raw HTTP request json data for a Lovense Toy instance.
Definition: LovenseTypes.h:192
LovenseIntegration::configToySuctionKeyName
const LOVENSEINTEGRATION_API FString configToySuctionKeyName
Config value key name for the ToySuction setting. This setting is a bool value. Default is true....
Definition: LovenseTypes.h:103
FLovenseAdapterDescription
Container holding (mostly) raw HTTP request json data for a Lovense App instance in the local network...
Definition: LovenseTypes.h:249
LovenseIntegration::configStartWithLovenseActiveKeyName
const LOVENSEINTEGRATION_API FString configStartWithLovenseActiveKeyName
Config value key name for the StartWithLovenseActive setting. This setting is a bool value....
Definition: LovenseTypes.h:28