/test_SDK

Primary LanguageC++

Lovense SDK 2.0.1

The Windows SDK is a library for Windows that allows you to directly access Lovense toys through the Lovense USB Bluetooth Adater. If you need to make your own Windows application, you usually choose this option.
avatar

Step 1: Get the Developer Token

Go to the Dashboard, get your developer token.
Note: You need to fill in the developer token when using the SDK, otherwise the SDK will not work.

Step 2: Download demo examples and SDK

From the demo, you can find a quick way to get started.

Step 3: Configure the SDK in your application

For example, the method below is to configure SDK in Visual Studio 2019

  1. Set the path of the SDK header file
    avatar
  2. Set the path of SDK lib file
    avatar

Step 4: Connect Lovense Toys and Send Commands

#include <Lovense.h>
...
class CEventCallBack: public ILovenseSDKNotify
{
	public:
		/*Call when toy search start*/
		virtual	void LovenseDidSearchStart();

		/*Call when toy searching toy*/
		virtual  void LovenseSearchingToys(lovense_toy_info_t *info) = 0;

		/*Call when Something went wrong*/
		virtual  void LovenseErrorOutPut(int errorCode,const char *errorMsg) = 0;


		/*Call when toy search end*/
		virtual  void LovenseDidSearchEnd();

		/*Call when send cmd start*/
		virtual	void LovenseDidSendCmdStart();

		/*Call when send cmd return*/
		virtual  void LovenseSendCmdResult(const char * szToyID, CLovenseToy::CmdType cmd,const char *result,CLovenseToy::Error errorCode);

		/*Call when send cmd end*/
		virtual	void LovenseDidSendCmdEnd();

		/*Call when toy connected, or disconnected*/
		virtual void LovenseToyConnectedStatus(const char *szToyID, bool isConnected) ;
};

...
	//TODO:This is a simple process  
	CEventCallBack *callBack = new CEventCallBack();
	CLovenseToyManager *manager = GetLovenseToyManager();
	manager->SetDeveloperToken(...);
	manager->RegisterEventCallBack(callBack);
	manager->StartSearchToy();//Search for the toys via USB Dongle

Send a command

	CLovenseToyManager *manager = GetLovenseToyManager();
	//Send a vibration command
	manager->SendCommand(toyID,CLovenseToy::CmdType::COMMAND_VIBRATE,10);

What commands are supported?
You can see the following definition in LovenseDef.h.

namespace CLovenseToy
{
	typedef enum {

		/**
		-Power off!
		- param Key = no parameter
		*/
		COMMAND_POWER_OFF = 100,

		/**
		- Vibrate the toy .The parameter must be between 0 and 20!
		- Supported toys = all
		*/
		COMMAND_VIBRATE = 101,

		/**
		- Rotate the toy .The parameter must be between 0 and 20!
		- Supported toys = Nora
		*/
		COMMAND_ROTATE = 102,
		.
		.
		.
	}
}

Usage

  1. Insert the usb Bluetooth adapter into the usb interface of the PC.
  2. Then turn on the toy power and you will see the toy light flashing.
  3. Open the app and start searching for toys.

Other instructions for using Dongle

  1. When Dongle is searching for toys, it will not be able to send other commands for toys.
  2. If you need to get the toy's power regularly, the best way is to start a thread loop to get it.
  3. Don't send toy instructions frequently, because Dongle cannot process a large number of instructions in a short period of time.
  4. If you use it for the first time, you can refer to the usage method in SDK Demo.

View log output

Here is a simple way, is to use the editbin command.
(You can see that there are logs output from the console.)
Note:If there is an "editbin not found" error when compiling, there is a solution.
avatar