Add external libraries

This commit is contained in:
sylvieee-iot 2024-05-02 20:28:41 +03:00 committed by GitHub
parent 70f443b06e
commit e8dc11cc31
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 2010 additions and 0 deletions

View file

@ -0,0 +1,51 @@
// buttplugCpp.cpp : Defines the entry point for the application.
//
#include "buttplugCpp.h"
using namespace std;
void callbackFunction(const mhl::Messages msg) {
if (msg.messageType == mhl::MessageTypes::DeviceList) {
cout << "Device List callback" << endl;
}
if (msg.messageType == mhl::MessageTypes::DeviceAdded) {
cout << "Device Added callback" << endl;
}
if (msg.messageType == mhl::MessageTypes::ServerInfo) {
cout << "Server Info callback" << endl;
}
if (msg.messageType == mhl::MessageTypes::DeviceRemoved) {
cout << "Device Removed callback" << endl;
}
if (msg.messageType == mhl::MessageTypes::SensorReading) {
cout << "Sensor Reading callback" << endl;
}
}
int main()
{
std::string url = "ws://127.0.0.1";
std::cout << "\n";
Client client(url, 12345, "test.txt");
client.connect(callbackFunction);
client.requestDeviceList();
client.startScan();
while (1) {
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
client.stopScan();
break;
}
//std::vector<DeviceClass> myDevices = client.getDevices();
//client.sendScalar(myDevices[0], 0.5);
//client.sendScalar(myDevices[1], 0.5);
//client.sensorSubscribe(myDevices[0], 0);
//std::this_thread::sleep_for(std::chrono::milliseconds(20000));
//client.sensorUnsubscribe(myDevices[0], 0);
//client.stopAllDevices();
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
return 0;
}

View file

@ -0,0 +1,9 @@
// buttplugCpp.h : Include file for standard system include files,
// or project specific include files.
#pragma once
#include <iostream>
#include "../include/buttplugclient.h"
// TODO: Reference additional headers your program requires here.