Skip to content

mrepoDev/ATLib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ATLib

Continuous Integration NuGet Version

ATLib is a C# AT command library that abstracts away the commands and makes it easy to communicate with modems.

Hayes command set (commonly known as AT commands) is a command set commonly used in modems. Read more about it at Wikipedia

ATLib is just in the beginning. Currently only a few commands are implemented, but more will come.

Usage

Install as NuGet package

dotnet add package HeboTech.ATLib

Using a serial port to communicate with a modem is easy:

// Create and connect to serial port
SerialPort serialPort = new SerialPort(); //Use an overload to pass in your settings
serialPort.Open();

// Pipe the serial port stream through a duplex pipe
IDuplexPipe duplexPipe = StreamConnection.GetDuplex(serialPort.BaseStream); // See note below

// Pass in the pipe to the communicator and start communicating!
ICommunicator<string> comm = new Communicator(duplexPipe);

// Send a ping to the modem
var initializeResult = await comm.InitializeAsync();
// Get battery status
var batteryStatus = await comm.GetBatteryStatusAsync();
Note:
IDuplexPipe is an interface in System.IO.Pipelines.
Microsoft and ATLib doesn't come with an implementations for this, but Pipelines.Sockets.Unofficial has one that works great!
Install it with
dotnet add package Pipelines.Sockets.Unofficial

Supported commands:

✔️ = Done 🔧 = In progress

V.25TER

Command Numeric Text Description Notes
ATE[n] ✔️ ✔️
ATV[format] ✔️ ✔️

3GPP TS 27.005

Command Numeric Text Description Notes
AT+CMGF? ✔️ ✔️
AT+CMGF=[mode] ✔️ ✔️
AT+CMGS=[da] 🔧 🔧

3GPP TS 27.007

Command Numeric Text Description Notes
AT+CBC ✔️ ✔️
AT+CSQ ✔️ ✔️
AT+CPIN? ✔️ ✔️

About

AT command library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%