{"id":25002355,"url":"https://github.com/ft-t/sl500-api","last_synced_at":"2025-04-23T02:35:44.867Z","repository":{"id":57605329,"uuid":"138277815","full_name":"ft-t/sl500-api","owner":"ft-t","description":"sl500 card reader api","archived":false,"fork":false,"pushed_at":"2024-10-29T15:11:49.000Z","size":965,"stargazers_count":1,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T21:14:31.492Z","etag":null,"topics":["card-reader","go","golang","golang-library","sl500"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ft-t.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-22T08:39:06.000Z","updated_at":"2024-10-29T15:11:53.000Z","dependencies_parsed_at":"2022-08-27T22:40:42.730Z","dependency_job_id":null,"html_url":"https://github.com/ft-t/sl500-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ft-t%2Fsl500-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ft-t%2Fsl500-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ft-t%2Fsl500-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ft-t%2Fsl500-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ft-t","download_url":"https://codeload.github.com/ft-t/sl500-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250358757,"owners_count":21417542,"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":["card-reader","go","golang","golang-library","sl500"],"created_at":"2025-02-04T21:50:38.372Z","updated_at":"2025-04-23T02:35:44.849Z","avatar_url":"https://github.com/ft-t.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# SL500 Card Reader API\n\nThe `sl500_api` package provides a Go-based interface for interacting with the SL500 card reader, allowing applications to communicate with the reader via serial connections. This package includes functions for initializing, configuring, and controlling the SL500, as well as reading and writing data on compatible RFID cards.\n\n## Features\n\n- Initialize and manage serial connections with SL500.\n- Control the reader's antenna, LED, and buzzer.\n- RFID card operations, including reading, writing, and authentication.\n- Compatibility with MIFARE and ISO15693 tags.\n\n## Installation\n\nTo include `sl500_api` in your project, use:\n\n```bash\ngo get github.com/your_username/sl500_api\n```\n\n## Usage\n\n### Initializing a Connection\n\nTo start, create a new connection to the SL500 card reader using the `NewConnection` function. Specify the serial port path, baud rate, logging option, and timeout.\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"time\"\n    \"github.com/ft-t/sl500-api\"\n)\n\nfunc main() {\n    // Initialize SL500 with the appropriate serial port path, baud rate, logging, and timeout\n    reader, err := sl500_api.NewConnection(\"/dev/ttyUSB0\", sl500_api.Baud.Baud9600, true, 3*time.Second)\n    if err != nil {\n        fmt.Println(\"Error initializing SL500:\", err)\n        return\n    }\n    defer reader.Close()\n}\n```\n\n### Basic Commands\n\nBelow are some primary commands for controlling the SL500:\n\n- **Open and Close Connection**\n  ```go\n  err := reader.Open()      // Opens the serial connection\n  err = reader.Close()      // Closes the connection\n  ```\n\n- **Antenna Control**\n  ```go\n  reader.RfAntennaSta(sl500_api.AntennaOn)    // Turn antenna on\n  reader.RfAntennaSta(sl500_api.AntennaOff)   // Turn antenna off\n  ```\n\n- **RFID Card Commands**\n  ```go\n  reader.RfRequest(sl500_api.RequestAll)     // Scan for all cards\n  reader.RfAnticoll()                        // Anti-collision function\n  ```\n\n- **MIFARE Operations**\n  ```go\n  blockNumber := byte(4)\n  data, _ := reader.RfM1Read(blockNumber)    // Read data from block\n  fmt.Printf(\"Data: %x\\n\", data)\n\n  writeData := []byte{0x01, 0x02, 0x03, 0x04}\n  reader.RfM1Write(blockNumber, writeData)   // Write data to block\n  ```\n\n### Advanced Commands\n\n#### Setting Device Type\n```go\nreader.RfInitType(sl500_api.Type_A)\n```\n\n#### Enabling Beep and LED Light\n```go\nreader.RfBeep(100)                        // Beep for 100 milliseconds\nreader.RfLight(sl500_api.ColorGreen)      // Set LED to green\n```\n\n## Error Handling\n\nEach function returns an error object; check this for successful execution. Example:\n```go\nif err := reader.RfAntennaSta(sl500_api.AntennaOn); err != nil {\n    fmt.Println(\"Antenna error:\", err)\n}\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Feel free to submit a pull request or open an issue for feedback or feature requests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fft-t%2Fsl500-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fft-t%2Fsl500-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fft-t%2Fsl500-api/lists"}