{"id":20291549,"url":"https://github.com/edisonslightbulbs/rfcomm-cpp","last_synced_at":"2025-06-26T13:33:22.940Z","repository":{"id":118368886,"uuid":"378866011","full_name":"edisonslightbulbs/RFCOMM-CPP","owner":"edisonslightbulbs","description":"Bluetooth socket: RFCOMM communication between Linux and Android (Linux side)","archived":false,"fork":false,"pushed_at":"2021-06-28T15:08:14.000Z","size":14,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T05:11:19.573Z","etag":null,"topics":["bluez-dbus","cmake","cpp","rfcomm"],"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/edisonslightbulbs.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-21T08:50:19.000Z","updated_at":"2023-07-26T19:59:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"c2ba81da-22ee-4be4-8bd6-ce123e8bee10","html_url":"https://github.com/edisonslightbulbs/RFCOMM-CPP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/edisonslightbulbs/RFCOMM-CPP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edisonslightbulbs%2FRFCOMM-CPP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edisonslightbulbs%2FRFCOMM-CPP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edisonslightbulbs%2FRFCOMM-CPP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edisonslightbulbs%2FRFCOMM-CPP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edisonslightbulbs","download_url":"https://codeload.github.com/edisonslightbulbs/RFCOMM-CPP/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edisonslightbulbs%2FRFCOMM-CPP/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262076766,"owners_count":23255065,"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":["bluez-dbus","cmake","cpp","rfcomm"],"created_at":"2024-11-14T15:12:52.284Z","updated_at":"2025-06-26T13:33:22.892Z","avatar_url":"https://github.com/edisonslightbulbs.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"#### Usage of this tiny bluez CPP helper library 👏🍻🍻\n\n*   the channel interface\n```cpp\nnamespace channel {\n\n/**\n * channel.h\n *   Establishes RFCOMM (TX) channel associated with\n *   a given UUID and MAC address.\n *\n *   @ref\n *     https://people.csail.mit.edu/albert/bluez-intro/x604.html\n *\n *   accessed\n *     18 June 2021\n */\nint queryID(uint8_t* uuid, char *deviceAddress);\n}\n\n```\n*   the client interface\n```cpp\nnamespace client {\n\n/**\n * callServer\n *   Calls a remote server over a RFCOMM (TX) channel.\n *\n *   @ref\n *     https://people.csail.mit.edu/albert/bluez-intro/x502.html\n *\n *   accessed\n *     05:22 18 June 2021\n */\nvoid callServer(int channel, char *deviceAddress);\n}\n\n```\n*  the server inteface  \n\n```cpp\nnamespace server {\n\n/**\n * setup\n *   Uses host machine as a local server: opens an RFCOMM (RX) channel\n *   for a specified number of connections.\n *\n *   @ref\n *     https://people.csail.mit.edu/albert/bluez-intro/x502.html\n *\n *   accessed\n *     05:22 18 June 2021\n */\nvoid setup(int channelID, int connectionCount);\n}\n\n```\n\nhere's an example of how to use the interfaces\n\n```cpp\n\n// RFCOMM connection between Linux system and Android device.\n//\n#include \u003cthread\u003e\n\n#include \"channel.h\"\n#include \"client.h\"\n#include \"server.h\"\n\n// configure setup\n//\n#define SETUP_CLIENT 1 // use host machine as a client\n#define SETUP_SERVER 0 // use host machine as a server\n\nvoid setupClient(uint8_t *uuid, char *deviceAddress)\n{\n#if SETUP_CLIENT == 1\n    int clientChannel = channel::queryID(uuid, deviceAddress);\n    client::callServer(clientChannel, deviceAddress);\n#endif\n}\n\nvoid setupServer(int channelID, int connectionCount)\n{\n#if SETUP_SERVER == 1\n    server::setup(channelID, connectionCount);\n#endif\n}\n\n\nint main()\n{\n    /** client config */\n    // UUID: d8308c4e-9469-4051-8adc-7a2663e415e2\n    //  n.b. make sure UUID on the android device is the same as this one.\n    uint8_t CHANNEL_UUID[16] = { 0xd8, 0x30, 0x8c, 0x4e, 0x94, 0x69,\n        0x40, 0x51, 0x8a, 0xdc, 0x7a, 0x26, 0x63, 0xe4, 0x15, 0xe2 };\n    char deviceAddress[18] = \"C0:8C:71:61:34:8C\"; // \u003c-- android address\n\n    /** server config */\n    const int CHANNEL_ID = 20;             // use channel 20 ...\n    const int NUMBER_OF_CONNECTIONS = 1;   // ... for a single connection\n\n    std::thread clientWorker(setupClient, CHANNEL_UUID, deviceAddress);\n    std::thread serverWorker(setupServer, CHANNEL_ID, NUMBER_OF_CONNECTIONS);\n\n    clientWorker.join();\n    serverWorker.join();\n    return 0;\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedisonslightbulbs%2Frfcomm-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedisonslightbulbs%2Frfcomm-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedisonslightbulbs%2Frfcomm-cpp/lists"}