{"id":13780161,"url":"https://github.com/dumbowumbo/buttplugCpp","last_synced_at":"2025-05-11T13:31:33.531Z","repository":{"id":177374254,"uuid":"660309128","full_name":"dumbowumbo/buttplugCpp","owner":"dumbowumbo","description":"C++ API for Buttplug IO","archived":false,"fork":false,"pushed_at":"2023-07-17T20:26:59.000Z","size":31,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-03T18:14:48.435Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dumbowumbo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-06-29T18:04:14.000Z","updated_at":"2024-06-14T08:33:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"12b2e37a-3e59-40ad-b659-4efe474a5793","html_url":"https://github.com/dumbowumbo/buttplugCpp","commit_stats":null,"previous_names":["dumbowumbo/buttplugcpp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dumbowumbo%2FbuttplugCpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dumbowumbo%2FbuttplugCpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dumbowumbo%2FbuttplugCpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dumbowumbo%2FbuttplugCpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dumbowumbo","download_url":"https://codeload.github.com/dumbowumbo/buttplugCpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225056772,"owners_count":17414206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T18:01:12.930Z","updated_at":"2025-05-11T13:31:33.517Z","avatar_url":"https://github.com/dumbowumbo.png","language":"C++","readme":"# Buttplug C++ Client Library\n\nA C++ client implementation for the Buttplug intimate hardware control protocol.\n\n## Overview\n\nThis library provides a C++ client for the Buttplug Server, allowing developers to connect to and control various intimate hardware devices. The implementation supports C++11 and higher with minimal external dependencies.\n\nKey features:\n- WebSocket-based communication with Buttplug servers\n- Thread-safe device control\n- Support for various device commands (vibration, linear, rotation)\n- Support for sensor reading and subscription\n- Built-in logging capabilities\n\n## Dependencies\n\nThe library has the following dependencies:\n- [IXWebSocket](https://github.com/machinezone/IXWebSocket) - WebSocket client\n- [nlohmann/json](https://github.com/nlohmann/json) - JSON parsing\n- C++11 compatible compiler\n\n## Building\n\n### Linux (Ubuntu)\n\n1. Install the required dependencies:\n\n```bash\n# Install build tools\nsudo apt-get update\nsudo apt-get install build-essential cmake git\n\n# Install nlohmann/json (via package manager if available)\nsudo apt-get install nlohmann-json3-dev\n\n# Or manually (if not available in package manager)\ngit clone https://github.com/nlohmann/json.git\ncd json\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake\nsudo make install\ncd ../..\n```\n\n2. Build IXWebSocket:\n\n```bash\ngit clone https://github.com/machinezone/IXWebSocket.git\ncd IXWebSocket\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake\nsudo make install\ncd ../..\n```\n\n3. Clone and build this repository:\n\n```bash\ngit clone https://github.com/dumbowumbo/buttplugCpp\ncd buttplugCpp\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake\n```\n\n4. Install the library system-wide (optional):\n\n```bash\nsudo make install\n```\n\nThis will install:\n- Library files to `/usr/local/lib` (or as configured)\n- Headers to `/usr/local/include/buttplug`\n- CMake configuration files for dependent projects\n\n5. To uninstall the library (if needed):\n\n```bash\nsudo make uninstall\n```\n\n### Windows\n\n#### Using Visual Studio and vcpkg\n\n1. Install [Visual Studio](https://visualstudio.microsoft.com/) with C++ development tools\n\n2. Install [vcpkg](https://github.com/microsoft/vcpkg):\n\n```cmd\ngit clone https://github.com/Microsoft/vcpkg.git\ncd vcpkg\nbootstrap-vcpkg.bat\n```\n\n3. Install dependencies via vcpkg:\n\n```cmd\nvcpkg install nlohmann-json:x64-windows\nvcpkg install ixwebsocket:x64-windows\nvcpkg integrate install\n```\n\n4. Clone this repository and open it in Visual Studio:\n\n```cmd\ngit clone https://github.com/dumbowumbo/buttplugCpp\ncd buttplugCpp\n```\n\n5. Create a new CMake project in Visual Studio, or run the following from Developer Command Prompt:\n\n```cmd\nmkdir build\ncd build\ncmake .. -DCMAKE_TOOLCHAIN_FILE=[path\\to\\vcpkg]\\scripts\\buildsystems\\vcpkg.cmake\n```\n\n6. Build the project:\n\n```cmd\ncmake --build . --config Release\n```\n\n7. Install the library (optional, run as Administrator):\n\n```cmd\ncmake --install . --config Release\n```\n\nThis will install:\n- Library files to the system library directory \n- Headers to the system include directory\n- CMake configuration files for dependent projects\n\n8. To uninstall the library (if needed, run as Administrator):\n\n```cmd\ncmake -P cmake_uninstall.cmake\n```\n\n## Usage\n\n### Basic Example\n\n```cpp\n#include \u003cbuttplug/buttplugclient.h\u003e\n#include \u003ciostream\u003e\n#include \u003cthread\u003e\n#include \u003cchrono\u003e\n\n// Callback for handling device messages\nvoid messageHandler(const mhl::Messages\u0026 msg) {\n    if (msg.messageType == mhl::MessageTypes::DeviceAdded) {\n        std::cout \u003c\u003c \"New device added: \" \u003c\u003c msg.deviceAdded.device.DeviceName \u003c\u003c std::endl;\n    }\n}\n\nint main() {\n    // Create client connection to a buttplug server at localhost:12345\n    Client client(\"ws://localhost\", 12345);\n    \n    // Connect to the server\n    client.connect(messageHandler);\n    \n    // Start scanning for devices\n    client.startScan();\n    \n    // Wait for devices to connect\n    std::this_thread::sleep_for(std::chrono::seconds(5));\n    \n    // Get list of connected devices\n    auto devices = client.getDevices();\n    \n    if (!devices.empty()) {\n        // Control the first device (simple vibration at 50% power)\n        client.sendScalar(devices[0], 0.5);\n        \n        std::this_thread::sleep_for(std::chrono::seconds(3));\n        \n        // Stop the device\n        client.stopDevice(devices[0]);\n    }\n    \n    return 0;\n}\n```\n\n### Using as a Dependency in CMake Projects\n\nAfter installing the library, you can easily use it in your CMake projects:\n\n```cmake\nfind_package(ButtplugClient REQUIRED)\n\nadd_executable(my_app main.cpp)\ntarget_link_libraries(my_app PRIVATE ButtplugClient::buttplugclient)\n```\n\n## Documentation\n\nThe Buttplug protocol documentation is available at:\n- [Buttplug Protocol Spec](https://docs.buttplug.io/docs/spec/)\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n","funding_links":[],"categories":["Development and Libraries"],"sub_categories":["General Development"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdumbowumbo%2FbuttplugCpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdumbowumbo%2FbuttplugCpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdumbowumbo%2FbuttplugCpp/lists"}