Oakrey.AT 3.1.2

dotnet add package Oakrey.AT --version 3.1.2
                    
NuGet\Install-Package Oakrey.AT -Version 3.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Oakrey.AT" Version="3.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Oakrey.AT" Version="3.1.2" />
                    
Directory.Packages.props
<PackageReference Include="Oakrey.AT" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Oakrey.AT --version 3.1.2
                    
#r "nuget: Oakrey.AT, 3.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Oakrey.AT@3.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Oakrey.AT&version=3.1.2
                    
Install as a Cake Addin
#tool nuget:?package=Oakrey.AT&version=3.1.2
                    
Install as a Cake Tool

Oakrey.AT

Overview

Oakrey.AT is a .NET 10 library for communicating with AT command-based devices such as modems, cellular modules, and IoT peripherals. It provides a strongly-typed, async handler model built around ITransmitter, covering audio control, call management, SMS, phonebook operations, and eCall (IVS/PSAP) support.

Main Features

Audio Control

  • Open and close I2C logical channels.
  • Configure master clock control.
  • Write data to I2C peripherals.

Call Management

  • Answer incoming calls.
  • Dial numbers, names, or phonebook entries.
  • Enable or disable calling line identification.
  • Manage automatic answering and call status reporting.
  • Retrieve incoming call information and hang up calls.

eCall Support

  • Enable or disable eCall features.
  • Configure and test eCall settings (IVS and PSAP).
  • Manage in-band modem activation and loudspeaker/microphone URC controls.
  • Factory class HandlerFactoryIVS for convenient IVS handler creation.

General Device Management

  • Retrieve device serial numbers, signal power, and operator information.
  • Check communication status with the device.

Phonebook Operations

  • Add, delete, and search contacts.
  • Retrieve phonebook entries by index or range.
  • Configure SIM phonebook storage.

SMS Handling

  • Send and receive SMS messages in text or PDU mode.
  • Manage SMS storage and delete messages.
  • Retrieve a list of all stored SMS messages.

Extensibility

  • Layered base classes for custom AT command handlers.
  • ATCommandException for structured error propagation.
  • Per-command reply timeout (500 ms default).

Architecture

The library is structured around a handler hierarchy. Each handler represents one AT command and exposes an async Execute method. Device access is serialized via a SemaphoreSlim passed into every call.

classDiagram
    direction TB
    class IHandler {
        <<interface>>
        +Command: string
        +Parameter: string
        +ATCommandType: ATCommandType
        +ProcessReplay(data, ct)
    }
    class HandlerBase~TSelf~ {
        <<abstract>>
    }
    class ReplayHandler~TSelf, TReplay~ {
        <<abstract>>
        #Run(transmitter, deviceLock, data, ct) Task~TReplay~
    }
    class StatusHandler~TSelf~ {
        #HandleStatusReply(data, ct)
    }
    class DialNumberHandler
    class SendSMSMessageToNumberHandler

    IHandler <|-- HandlerBase~TSelf~
    HandlerBase~TSelf~ <|-- ReplayHandler~TSelf,TReplay~
    ReplayHandler~TSelf,TReplay~ <|-- StatusHandler~TSelf~
    StatusHandler~TSelf~ <|-- DialNumberHandler
    StatusHandler~TSelf~ <|-- SendSMSMessageToNumberHandler

The ITransmitter interface decouples the library from any specific serial or socket transport:

public interface ITransmitter
{
    void Send(string command);
}

Incoming device responses are routed back to the awaiting handler by calling ProcessReplay on the matching IHandler.

Requirements

Installation

.NET CLI

dotnet add package Oakrey.AT

Package Manager Console

Install-Package Oakrey.AT

NuGet Package Manager

  1. Open your project in Visual Studio.
  2. Navigate to Tools > NuGet Package Manager > Manage NuGet Packages for Solution.
  3. Search for Oakrey.AT and click Install.

Usage

1. Implement ITransmitter

Provide a transport-specific implementation that writes the formatted AT command string to the device:

public class SerialTransmitter : ITransmitter
{
    private readonly SerialPort _port;

    public SerialTransmitter(SerialPort port) => _port = port;

    public void Send(string command) => _port.WriteLine(command);
}

2. Route device responses

When data arrives from the device, call ProcessReplay on the handler that is currently waiting:

activeHandler.ProcessReplay(receivedLine, cancellationToken);

3. Execute a command

Each handler is instantiated independently. Pass the transmitter and a shared SemaphoreSlim to serialize access across concurrent callers:

SemaphoreSlim deviceLock = new SemaphoreSlim(1, 1);
ITransmitter transmitter = new SerialTransmitter(port);

// Dial a number
DialNumberHandler dialHandler = new DialNumberHandler();
bool success = await dialHandler.Execute(transmitter, deviceLock, "+420123456789", CancellationToken.None);

// Send an SMS
SendSMSMessageToNumberHandler smsHandler = new SendSMSMessageToNumberHandler();
bool sent = await smsHandler.Execute(transmitter, deviceLock, "+420123456789", "Hello", CancellationToken.None);

4. eCall IVS setup

Use HandlerFactoryIVS to create the standard set of IVS handlers:

ECallFeatureEnableHandler enableHandler = HandlerFactoryIVS.CreateECallFeatureEnableHandler();
await enableHandler.Execute(transmitter, deviceLock, CancellationToken.None);

Extensibility

To add a custom AT command, inherit from StatusHandler<TSelf> (for OK/ERROR responses) or ReplayHandler<TSelf, TReplay> (for typed responses):

public class MyCustomHandler : StatusHandler<MyCustomHandler>
{
    public override string Command => "AT+MYCMD";
    public override ATCommandType ATCommandType => ATCommandType.EXECUTION;
    public override string Parameter => "";

    public Task<bool> Execute(ITransmitter transmitter, SemaphoreSlim deviceLock, CancellationToken cancellationToken)
        => Run(transmitter, deviceLock, GetCommandFormat(Command, ATCommandType, Parameter), cancellationToken);
}

Project Information

Field Value
Author Oakrey
License MIT
NuGet Oakrey.AT
Repository Azure DevOps

License

This project is licensed under the MIT License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.1.2 27 5/22/2026
3.1.1 89 5/15/2026
3.1.0 114 3/13/2026
3.0.0 175 2/2/2026
2.0.1 521 6/18/2025
2.0.0 483 6/16/2025
1.0.0 510 4/22/2025