{"id":20504163,"url":"https://github.com/haradama/ofxsocketcan","last_synced_at":"2025-06-17T15:33:22.485Z","repository":{"id":152487404,"uuid":"625967230","full_name":"haradama/ofxSocketCAN","owner":"haradama","description":"openFrameworks addon for SocketCAN","archived":false,"fork":false,"pushed_at":"2023-04-29T12:40:02.000Z","size":57,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T20:52:21.241Z","etag":null,"topics":["automotive","openframeworks","openframeworks-addon","socketcan","vehicle"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haradama.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-04-10T14:07:48.000Z","updated_at":"2023-04-12T09:39:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"e1b0f10a-bfd6-426c-b937-6c7d02c41177","html_url":"https://github.com/haradama/ofxSocketCAN","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"d11648cd09a3f89930c315b47dbad82f12c22cc1"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/haradama/ofxSocketCAN","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haradama%2FofxSocketCAN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haradama%2FofxSocketCAN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haradama%2FofxSocketCAN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haradama%2FofxSocketCAN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haradama","download_url":"https://codeload.github.com/haradama/ofxSocketCAN/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haradama%2FofxSocketCAN/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260388302,"owners_count":23001506,"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":["automotive","openframeworks","openframeworks-addon","socketcan","vehicle"],"created_at":"2024-11-15T19:36:41.633Z","updated_at":"2025-06-17T15:33:17.475Z","avatar_url":"https://github.com/haradama.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ofxSocketCAN\n\nA simple wrapper of SocketCAN for [openFrameworks](https://openframeworks.cc).\n\n\n## Usage\n\n| Method                                                              | Description                                                                                                                                  |\n| ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |\n| `bool setup(const std::string\u0026 interface, bool use_can_fd = false)` | Initializes the SocketCAN connection with the specified interface and optional CAN FD support. Returns `true` on success, `false` otherwise. |\n| `bool send(const can_frame\u0026 frame)`                                 | Sends a standard CAN frame. Returns `true` on success, `false` otherwise. Use this method when CAN FD is not enabled.                        |\n| `bool send(const canfd_frame\u0026 frame)`                               | Sends a CAN FD frame. Returns `true` on success, `false` otherwise. Use this method when CAN FD is enabled.                                  |\n| `bool receive(can_frame\u0026 frame)`                                    | Receives a standard CAN frame. Returns `true` on success, `false` otherwise. Use this method when CAN FD is not enabled.                     |\n| `bool receive(canfd_frame\u0026 frame)`                                  | Receives a CAN FD frame. Returns `true` on success, `false` otherwise. Use this method when CAN FD is enabled.                               |\n| `bool available()`                                                  | Rutuns `true` if the device is available, `false` otherwise.                                                                                 |\n\n## Example\n\n```cpp\n#pragma once\n\n#include \"ofMain.h\"\n#include \"ofxSocketCAN.h\"\n\nclass ofApp : public ofBaseApp{\n\n\tpublic:\n\t\tvoid setup();\n\t\tvoid update();\n\t\tvoid draw();\n\n\t\tvoid keyPressed(int key);\n\t\tvoid keyReleased(int key);\n\t\tvoid mouseMoved(int x, int y );\n\t\tvoid mouseDragged(int x, int y, int button);\n\t\tvoid mousePressed(int x, int y, int button);\n\t\tvoid mouseReleased(int x, int y, int button);\n\t\tvoid mouseEntered(int x, int y);\n\t\tvoid mouseExited(int x, int y);\n\t\tvoid windowResized(int w, int h);\n\t\tvoid dragEvent(ofDragInfo dragInfo);\n\t\tvoid gotMessage(ofMessage msg);\n\n\tofxSocketCAN device;\n\tstd::string interfaceName;\n\tcan_frame receiveFrame;\n\t\t\n};\n\n```\n\n```cpp\n#include \"ofApp.h\"\n\n//--------------------------------------------------------------\nvoid ofApp::setup(){\n    ofSetWindowTitle(\"ofxSocketCAN Example\");\n\n    interfaceName = \"vcan0\";\n    device.setup(interfaceName);\n\n    if (device.available()) {\n        ofLogNotice(\"ofApp::setup\") \u003c\u003c \"Connected to \" \u003c\u003c interfaceName;\n\n        can_frame sendFrame;\n        sendFrame.can_id = 0x123;\n        sendFrame.can_dlc = 3;\n        sendFrame.data[0] = 0x11;\n        sendFrame.data[1] = 0x22;\n        sendFrame.data[2] = 0x33;\n\n        if (device.send(sendFrame)) {\n            ofLogNotice(\"ofApp::setup\") \u003c\u003c \"Sent CAN frame: ID 0x\" \u003c\u003c std::hex \u003c\u003c sendFrame.can_id;\n        } else {\n            ofLogError(\"ofApp::setup\") \u003c\u003c \"Failed to send CAN frame.\";\n        }\n    } else {\n        ofLogError(\"ofApp::setup\") \u003c\u003c \"Failed to connect to \" \u003c\u003c interfaceName;\n    }\n}\n\n//--------------------------------------------------------------\nvoid ofApp::update(){\n    if (device.available()) {\n        if (device.receive(receiveFrame)) {\n            ofLogNotice(\"ofApp::update\") \u003c\u003c \"Received CAN frame: ID 0x\" \u003c\u003c std::hex \u003c\u003c receiveFrame.can_id;\n        }\n    }\n}\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharadama%2Fofxsocketcan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharadama%2Fofxsocketcan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharadama%2Fofxsocketcan/lists"}