{"id":23330382,"url":"https://github.com/hbjorgo/atlib","last_synced_at":"2025-10-29T14:38:42.101Z","repository":{"id":42023766,"uuid":"137475951","full_name":"hbjorgo/ATLib","owner":"hbjorgo","description":"ATLib is a C# library that makes it easy to communicate with modems.","archived":false,"fork":false,"pushed_at":"2024-12-21T10:33:36.000Z","size":506,"stargazers_count":54,"open_issues_count":4,"forks_count":20,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-05T02:02:37.148Z","etag":null,"topics":["at","atcommand","atcommands","c-sharp","gsm","gsm-modem","hayes","modem","sms"],"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/hbjorgo.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-15T10:42:57.000Z","updated_at":"2025-03-05T14:36:42.000Z","dependencies_parsed_at":"2023-11-06T08:25:42.299Z","dependency_job_id":"f91756ed-3ac0-4ca8-a983-89dc73850710","html_url":"https://github.com/hbjorgo/ATLib","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hbjorgo%2FATLib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hbjorgo%2FATLib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hbjorgo%2FATLib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hbjorgo%2FATLib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hbjorgo","download_url":"https://codeload.github.com/hbjorgo/ATLib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276161,"owners_count":20912288,"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":["at","atcommand","atcommands","c-sharp","gsm","gsm-modem","hayes","modem","sms"],"created_at":"2024-12-20T22:16:49.345Z","updated_at":"2025-10-29T14:38:42.038Z","avatar_url":"https://github.com/hbjorgo.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ATLib\n[![CI](https://github.com/hbjorgo/ATLib/workflows/CI/badge.svg)](https://github.com/hbjorgo/ATLib)\n[![Nuget](https://img.shields.io/nuget/v/hebotech.atlib)](https://www.nuget.org/packages/HeboTech.ATLib)\n[![Nuget](https://img.shields.io/nuget/dt/HeboTech.ATLib)](https://www.nuget.org/packages/HeboTech.ATLib)\n\nATLib is a C# AT command library that abstracts away the commands and makes it easy to communicate with modems.\n\nHayes command set (commonly known as AT commands) is a command set frequently used in modems. Read more about it at [Wikipedia](https://en.wikipedia.org/wiki/Hayes_command_set).\n\nFeedback is very much welcome and please request features 🙂\n\n## Supported commands:\n- Send SMS in PDU format (GSM 7 bit or UCS2 encoding)\n- Send concatenated SMS (message that spans over multiple SMSs) in PDU format (GSM 7 bit or UCS2 encoding)\n- SMS supports emojies\n- List SMSs\n- Read SMS (PDU format (GSM 7 bit or UCS2 encoding))\n- Delete SMS\n- Get SMS Status Report (delivery status)\n- Dial number\n- Answer incoming call\n- Hang up call\n- Get SIM status\n- Enter SIM PIN\n- Get remaining PIN \u0026 PUK attempts\n- Get product information\n- Get battery status\n- Get signal strength\n- Get / set date and time\n- Disable echo\n- Send USSD code\n- Get / set character set\n- Get IMSI\n- Some modems may also support modem specific commands\n\n## Events\n- Incoming call\n- Missed call\n- Call started\n- Call ended\n- SMS received\n- SMS Status Report received\n- Error received\n- USSD response received\n- Generic event\n\n## Supported modems:\n- Adafruit FONA 3G (based on SIMCOM SIM5320 chipset)\n- D-Link DWM-222 (based on Qualcomm MDM9225 chipset)\n- TP-LINK MA260 (based on a Qualcomm chipset)\n- Cinterion MC55i\n- Other modems may work using one of the implementations above. You can add your own implementation using the existing functionality as base.\n\n## Other\n- Debug functionality that lets you intercept incoming and outgoing data\n\n## Usage\nInstall as NuGet package\n```shell\ndotnet add package HeboTech.ATLib\n```\n\nUsing a serial port to communicate with a modem is easy:\n```csharp\nusing HeboTech.ATLib.Messaging;\nusing HeboTech.ATLib.Misc;\nusing HeboTech.ATLib.Modems;\nusing HeboTech.ATLib.Modems.Adafruit;\nusing HeboTech.ATLib.Numbering;\nusing HeboTech.ATLib.Parsing;\nusing System;\nusing System.IO.Ports;\nusing System.Threading.Tasks;\n\nnamespace HeboTech.ATLib.TestConsole\n{\n    public class GetStartedExample\n    {\n        public static async Task RunAsync(string portName, int baudRate, string pin, string recepientPhoneNumber)\n        {\n            // Set up serial port\n            using SerialPort serialPort = new SerialPort(portName, baudRate, Parity.None, 8, StopBits.One)\n            {\n                Handshake = Handshake.RequestToSend\n            };\n            serialPort.Open();\n\n            // Create AT channel\n            using AtChannel atChannel = AtChannel.Create(serialPort.BaseStream);\n\n            // Create the modem\n            using IModem modem = new Fona3G(atChannel);\n\n            // Listen to incoming SMSs\n            modem.SmsReceived += (sender, args) =\u003e\n            {\n                Console.WriteLine($\"SMS received: {args.SmsDeliver}\");\n            };\n\n            // Listen to incoming SMSs stored in memory\n            modem.SmsStorageReferenceReceived += (sender, args) =\u003e\n            {\n                Console.WriteLine($\"SMS received. Index {args.Index} at storage location {args.Storage}\");\n            };\n\n            // Open AT channel\n            atChannel.Open();\n\n            // Configure modem with required settings before PIN\n            var requiredSettingsBeforePin = await modem.SetRequiredSettingsBeforePinAsync();\n\n            // Get SIM status\n            var simStatus = await modem.GetSimStatusAsync();\n            Console.WriteLine($\"SIM Status: {simStatus}\");\n\n            // Check if SIM needs PIN\n            if (simStatus.Result == SimStatus.SIM_PIN)\n            {\n                var simPinStatus = await modem.EnterSimPinAsync(new PersonalIdentificationNumber(pin));\n                Console.WriteLine($\"SIM PIN Status: {simPinStatus}\");\n            }\n\n            // Configure modem with required settings after PIN\n            var requiredSettingsAfterPin = await modem.SetRequiredSettingsAfterPinAsync();\n\n            // Read SMS at index 1\n            var sms = await modem.ReadSmsAsync(1);\n            if (sms.Success)\n                Console.WriteLine(sms.Result);\n\n            // Send SMS to the specified number\n            PhoneNumber phoneNumber = PhoneNumberFactory.CreateCommonIsdn(recepientPhoneNumber);\n            string message = \"Hello ATLib!\";\n            var smsReferences = await modem.SendSmsAsync(new SmsSubmitRequest(phoneNumber, message));\n            foreach (var smsReference in smsReferences)\n                Console.WriteLine($\"SMS Reference: {smsReference}\");\n        }\n    }\n}\n```\nBecause it relies on a stream, you can even control a modem over a network! Either use a network attached modem, or forward a modem serial port to a network port.\n\nFor more examples, check out the TestConsole project in the code.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhbjorgo%2Fatlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhbjorgo%2Fatlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhbjorgo%2Fatlib/lists"}