Lovense Integration
LovenseConnectAdapterBase Class Reference

Base class for all Lovense Connect adapters. More...

#include <LovenseIntegration/Source/LovenseIntegration/Classes/Adapters/LovenseConnectAdapterBase.h>

Inheritance diagram for LovenseConnectAdapterBase:
ILovenseAdapter LovenseConnectDesktopAdapter LovenseConnectMobileAdapter LovenseConnectAndroidAdapter LovenseConnectIOSAdapter

Protected Member Functions

virtual void ParseToyDescription (FLovenseToyDescription &toyDescription, TSharedPtr< class FJsonObject > toyObject) override
 Parses a json object holding toy data and fills a toy description. The json structure is different between the API's, so allow child classes to override this. More...
 
- Protected Member Functions inherited from ILovenseAdapter
 ILovenseAdapter (const ILovenseAdapter &)
 
virtual FHttpRequestPtr CreateHTTPRequest_GetToys ()=0
 Create HTTP request to poll for toy info.
Each API+Platform combination requires different HTTP request settings, so allow child classes to create the HTTP request with the correct settings.
 
virtual FHttpRequestPtr CreateHTTPRequest_SendCommand (const FString &parameters)=0
 Create HTTP request to send a command.
Each API+Platform combination requires different HTTP request settings, so allow child classes to create the HTTP request with the correct settings. More...
 
void CreateLovenseToy (FLovenseToyDescription &toyDescription)
 Creates a toy object and adds it to the toyStrongPointers array. Also adds the toyDescription to the responseData.toys array.
 
virtual void GetToysDataJsonObject (TSharedPtr< class FJsonObject > jsonObject, TSharedPtr< class FJsonObject > &outToysJsonObject)
 Retrieve a json object holding an array of toys. The json structure is different between the API's, so allow child classes to override this. More...
 
virtual bool SendCommand (const FString &parameters, FOnLovenseResponse callback=FOnLovenseResponse())
 Send a HTTP request to the respective Lovense App. More...
 
virtual void OnToyTestTimerFinished ()
 Test timer finished event. Will set vibration speed of the relevant toy to 0 and remove the relevant timer handle from the toyTestTimerHandles array.
 

Additional Inherited Members

- Public Member Functions inherited from ILovenseAdapter
const FORCEINLINE FLovenseAdapterDescriptionGetAdapterDescription ()
 The adapter description that was used to initialize this adapter. Holds (mostly) raw TryGetAdapterData() HTTP request json data for this adapter.
 
const TArray< TPair< FString, FTimerHandle > > GetToyTestTimerHandles ()
 Array of toy deviceId string and test timer handle.
This holds the toy deviceId so we can check if a toy is running a test command and to send a command to that toy to stop vibrating when the timer finishes.
 
virtual bool Initialize (FLovenseAdapterDescription &description)
 Initializes the adapter with the passed in adapter description. More...
 
virtual void Shutdown ()
 Deinitialize the adapter. This will stop any running test timers and clear toy objects.
 
virtual bool GetToys (FOnLovenseGetToysResponse callback)
 Polls the Lovense App for toys and creates toy objects for all received toys.
We always directly poll the respective Lovense Apps to get our toy info so we don't put unnecessary load on the Lovense servers. More...
 
virtual bool SendCommand_Test (const FString &toyId)
 See FLovenseManager::SendCommand_Test() for information on this command. More...
 
virtual bool SendCommand_Stop (const FString &parameters, const FString &toyId)
 See FLovenseManager::SendCommand_Stop() for information on this command. More...
 
virtual bool SendCommand_Vibrate (const FString &parameters, const FString &toyId, uint8 vibrationSpeed)
 See FLovenseManager::SendCommand_Vibrate() for information on this command. More...
 
virtual bool SendCommand_Vibrate1 (const FString &parameters, const FString &toyId, uint8 vibrationSpeed)
 See FLovenseManager::SendCommand_Vibrate1() for information on this command. More...
 
virtual bool SendCommand_Vibrate2 (const FString &parameters, const FString &toyId, uint8 vibrationSpeed)
 See FLovenseManager::SendCommand_Vibrate2() for information on this command. More...
 
virtual bool SendCommand_Rotate (const FString &parameters, const FString &toyId, uint8 rotationSpeed)
 See FLovenseManager::SendCommand_Rotate() for information on this command. More...
 
virtual bool SendCommand_RotateAntiClockwise (const FString &parameters, const FString &toyId, uint8 rotationSpeed)
 See FLovenseManager::SendCommand_RotateAntiClockwise() for information on this command. More...
 
virtual bool SendCommand_RotateClockwise (const FString &parameters, const FString &toyId, uint8 rotationSpeed)
 See FLovenseManager::SendCommand_RotateClockwise() for information on this command. More...
 
virtual bool SendCommand_RotateChange (const FString &parameters, const FString &toyId)
 See FLovenseManager::SendCommand_RotateChange() for information on this command. More...
 
virtual bool SendCommand_AirAuto (const FString &parameters, const FString &toyId, uint8 pulseSpeed)
 See FLovenseManager::SendCommand_AirAuto() for information on this command. More...
 
virtual bool SendCommand_AirIn (const FString &parameters, const FString &toyId)
 See FLovenseManager::SendCommand_AirIn() for information on this command. More...
 
virtual bool SendCommand_AirOut (const FString &parameters, const FString &toyId)
 See FLovenseManager::SendCommand_AirOut() for information on this command. More...
 
virtual bool SendCommand_Thrust (const FString &parameters, const FString &toyId, uint8 thrustingSpeed)
 See FLovenseManager::SendCommand_Vibrate() for information on this command. More...
 
virtual bool SendCommand_Suck (const FString &parameters, const FString &toyId, uint8 suctionSpeed)
 See FLovenseManager::SendCommand_Vibrate() for information on this command. More...
 
virtual bool SendCommand_Finger (const FString &parameters, const FString &toyId, uint8 fingeringSpeed)
 See FLovenseManager::SendCommand_Vibrate() for information on this command. More...
 
virtual bool SendCommand_Preset (const FString &parameters, const FString &toyId, uint8 pattern)
 See FLovenseManager::SendCommand_Preset() for information on this command. More...
 
virtual bool SendCommand_Battery (const FString &parameters, const FString &toyId, FOnLovenseResponse callback)
 See FLovenseManager::SendCommand_Battery() for information on this command. More...
 
virtual bool SendCommand_AVibrate (const FString &parameters, const FString &toyId, uint8 vibrationSpeed, int32 time)
 See FLovenseManager::SendCommand_AVibrate() for information on this command. More...
 
virtual bool SendCommand_AVibrate1 (const FString &parameters, const FString &toyId, uint8 vibrationSpeed, int32 time)
 See FLovenseManager::SendCommand_AVibrate1() for information on this command. More...
 
virtual bool SendCommand_AVibrate2 (const FString &parameters, const FString &toyId, uint8 vibrationSpeed, int32 time)
 See FLovenseManager::SendCommand_AVibrate2() for information on this command. More...
 
virtual bool SendCommand_ARotate (const FString &parameters, const FString &toyId, uint8 rotationSpeed, int32 time)
 See FLovenseManager::SendCommand_ARotate() for information on this command. More...
 
virtual bool SendCommand_AAirLevel (const FString &parameters, const FString &toyId, uint8 pulseSpeed, int32 time)
 See FLovenseManager::SendCommand_AAirLevel() for information on this command. More...
 
virtual bool SendCommand_AThrust (const FString &parameters, const FString &toyId, uint8 thrustingSpeed, int32 time)
 See FLovenseManager::SendCommand_AThrust() for information on this command. More...
 
virtual bool SendCommand_ASuck (const FString &parameters, const FString &toyId, uint8 suctionSpeed, int32 time)
 See FLovenseManager::SendCommand_ASuck() for information on this command. More...
 
virtual bool SendCommand_AFinger (const FString &parameters, const FString &toyId, uint8 fingeringSpeed, int32 time)
 See FLovenseManager::SendCommand_AFinger() for information on this command. More...
 
virtual bool SendCommand_APreset (const FString &parameters, const FString &toyId, const FString &patternName, int32 time)
 See FLovenseManager::SendCommand_APreset() for information on this command. More...
 
virtual bool SendCommand_AVibRotate (const FString &parameters, const FString &toyId, uint8 vibrationSpeed, uint8 rotationSpeed, int32 time)
 See FLovenseManager::SendCommand_AVibRotate() for information on this command. More...
 
virtual bool SendCommand_AVibAir (const FString &parameters, const FString &toyId, uint8 vibrationSpeed, uint8 pulseSpeed, int32 time)
 See FLovenseManager::SendCommand_AVibAir() for information on this command. More...
 
virtual bool SendCommand_AVibRotateAir (const FString &parameters, const FString &toyId, uint8 vibrationSpeed, uint8 rotationSpeed, uint8 pulseSpeed, int32 time)
 See FLovenseManager::SendCommand_AVibRotateAir() for information on this command. More...
 
virtual bool SendCommand_AAll (const FString &parameters, const FString &toyId, uint8 vibrationSpeed, uint8 rotationSpeed, uint8 pulseSpeed, uint8 thrustingSpeed, uint8 fingeringSpeed, uint8 suctionSpeed, int32 time)
 See FLovenseManager::SendCommand_AAll() for information on this command. More...
 
virtual bool SendCommand_Pattern (const FString &parameters, const FString &toyId, FLovensePattern &pattern)
 See FLovenseManager::SendCommand_Pattern() for information on this command. More...
 
- Static Public Member Functions inherited from ILovenseAdapter
static bool TryGetAdapterData (FOnLovenseGetAdaptersResponse callback)
 Polls "https://api.lovense-api.com/api/lan/v2/app" for toys in the local network.
This is the same for all API+Platform combinations, so we can make it static. More...
 
- Static Protected Member Functions inherited from ILovenseAdapter
static TSharedPtr< class ILovenseAdapterCreateLovenseAdapter (const FLovenseAdapterDescription &adapterDescription)
 Factory function for lovense adapters.
Checks the adapterDescription.platform and adapterDescription.appType strings to determine which adapter should be created.
 
- Protected Attributes inherited from ILovenseAdapter
TSharedPtr< class LovenseToyEventsWebSocketHandlerlovenseToyEventsWebSocketHandler
 
FLovenseAdapterDescription adapterDescription
 The adapter description that was used to initialize this adapter. Holds (mostly) raw TryGetAdapterData() HTTP request json data for this adapter.
 
FString deviceIp
 Device IP string (excluding port) the Lovense App instance is running on. Parsed in Initialize().
 
FString webProtocol
 The web protocol to use. Default is HTTPS, but will be set to HTTP if li.Request.UseDirectIP is true
as the SSL certificate does not work with direct IPs and we can't ignore SSL host verification without modifying the engine.
 
FLovenseGetToysResponseData responseData
 Holds (mostly) raw GetToys() HTTP request json data.
 
TArray< TStrongObjectPtr< class ULovenseToy > > toyStrongPointers
 Array of the Lovense toy object instances. Is strong object pointer so these UObjects aren't gc'd.
 
TArray< TPair< FString, FTimerHandle > > toyTestTimerHandles
 Array of toy deviceId string and test timer handle.
This holds the toy deviceId so we can check if a toy is running a test command and to send a command to that toy to stop vibrating when the timer finishes.
 

Detailed Description

Base class for all Lovense Connect adapters.

Member Function Documentation

◆ ParseToyDescription()

void LovenseConnectAdapterBase::ParseToyDescription ( FLovenseToyDescription outToyDescription,
TSharedPtr< class FJsonObject >  toyObject 
)
overrideprotectedvirtual

Parses a json object holding toy data and fills a toy description. The json structure is different between the API's, so allow child classes to override this.

Parameters
outToyDescriptionResult toy description data. Will not be default initialized.
toyObjectJson object holding data for a single toy.

Implements ILovenseAdapter.


The documentation for this class was generated from the following files: