{"id":26046688,"url":"https://github.com/will-lynas/generic-serial-protocol","last_synced_at":"2026-06-01T04:31:39.299Z","repository":{"id":275744798,"uuid":"927051267","full_name":"will-lynas/generic-serial-protocol","owner":"will-lynas","description":"A Rust implementation of a custom serial protocol","archived":false,"fork":false,"pushed_at":"2025-02-04T12:05:26.000Z","size":39,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-25T22:53:04.259Z","etag":null,"topics":["protocol","rust","serial-communication"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/will-lynas.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":"2025-02-04T10:19:23.000Z","updated_at":"2025-02-04T12:41:44.000Z","dependencies_parsed_at":"2025-02-04T11:39:52.651Z","dependency_job_id":null,"html_url":"https://github.com/will-lynas/generic-serial-protocol","commit_stats":null,"previous_names":["will-lynas/generic-serial-protocol"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/will-lynas/generic-serial-protocol","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/will-lynas%2Fgeneric-serial-protocol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/will-lynas%2Fgeneric-serial-protocol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/will-lynas%2Fgeneric-serial-protocol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/will-lynas%2Fgeneric-serial-protocol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/will-lynas","download_url":"https://codeload.github.com/will-lynas/generic-serial-protocol/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/will-lynas%2Fgeneric-serial-protocol/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33760645,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["protocol","rust","serial-communication"],"created_at":"2025-03-07T21:12:22.450Z","updated_at":"2026-06-01T04:31:39.281Z","avatar_url":"https://github.com/will-lynas.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Generic Serial Protocol\n\nA Rust implementation of a custom serial protocol for reliable message transmission over serial connections.\n\n## Protocol Specification\n\n### Message Format\n\n```\n+------------+------------------+--------------------+------------------+\n| Start Byte | Length (2 bytes) | Msg Type (2 bytes) |      Data        |\n|    0x58    |     LE u16       |     LE u16         | Variable length  |\n+------------+------------------+--------------------+------------------+\n```\n\nEvery message starts with a start byte (`0x58`). This is the ground truth for the start of a message, and any other start byte will trigger a resync to the next packet.\n\nTo encode a literal `0x58` within the packet (length field, msg type, or data) it must be *escaped*. This is done by replacing the `0x58` with the escape byte (`0x42`) followed by the original byte XORed with `0x69`. This poses an additional problem with sending a literal `0x42`. So `0x42` must itself be escaped in the same way.\n\nFor example:\n- `0x58` becomes `[0x42, 0x31]` (`0x58 ^ 0x69 = 0x31`)\n- `0x42` becomes `[0x42, 0x2B]` (`0x42 ^ 0x69 = 0x2B`)\n\nThe length field is the size of the data field plus two bytes for the message type. It is the length *before* escaping, so that the actual number of bytes transmitted may be greater than this number.\n\nAll multi-byte fields are transmitted in little-endian format.\n\n## Usage\n\nThe protocol can be used with any type that implements `Read + Write`. Here's an example using Unix domain sockets:\n\n```rust\nuse generic_serial_protocol::{SerialManager, Message, message_types};\nuse std::os::unix::net::UnixStream;\n\n// Create a pair of connected Unix domain sockets\nlet (stream1, stream2) = UnixStream::pair().unwrap();\n\n// Create managers for both ends\nlet mut sender = SerialManager::new(stream1);\nlet mut receiver = SerialManager::new(stream2);\n\n// Send a message\nlet message = Message::U8(message_types::U8 { num: 0x57 });\nsender.send(message.clone()).unwrap();\n\n// Receive the message\nlet received = receiver.receive().unwrap();\nassert_eq!(message, received);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwill-lynas%2Fgeneric-serial-protocol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwill-lynas%2Fgeneric-serial-protocol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwill-lynas%2Fgeneric-serial-protocol/lists"}