CometTextel.NET 1.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package CometTextel.NET --version 1.2.0
                    
NuGet\Install-Package CometTextel.NET -Version 1.2.0
                    
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="CometTextel.NET" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CometTextel.NET" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="CometTextel.NET" />
                    
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 CometTextel.NET --version 1.2.0
                    
#r "nuget: CometTextel.NET, 1.2.0"
                    
#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 CometTextel.NET@1.2.0
                    
#: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=CometTextel.NET&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=CometTextel.NET&version=1.2.0
                    
Install as a Cake Tool

CometTextel.NET

.NET wrapper for the CometTextel GSM SMS library (comettextel.dll).
Send / list / delete short messages over a serial modem, or encode / decode PDU hex without hardware.

GitHub .NET Nuget CI

Requirements

Item Detail
OS Windows 10+
Architecture x64 only (PlatformTarget=x64)
.NET net8.0-windows / net9.0-windows / net10.0-windows
Native Ships comettextel.dll (CometTextel C ABI, win-x64)
Hardware GSM modem / USB dongle that speaks AT commands in PDU mode (for send/list/delete)

x86 / Arm64 processes cannot load the bundled 64-bit native DLL.

NuGet

PM> Install-Package CometTextel.NET

Consumer projects must target Windows x64 so comettextel.dll can load.

Important notes

Concatenated SMS

Pdu.EncodeSubmit is single-segment (fails if the payload is too long).
Pdu.EncodeSubmitSegments and GsmModem.Send auto-split with concat UDH (IEI 0x00, ≤ 255 parts).

Payload caps: single GSM 7-bit ≤ 160 / 8-bit·UCS-2 ≤ 140; concat GSM 7-bit ≤ 153 / 8-bit·UCS-2 ≤ 134.

On receive, if TP-UDHI is set, the UDH is skipped (HasUdh == true). Concat IEI 0x00 / 0x08 populate IsConcatenated, ConcatRef, ConcatTotal, ConcatSeq. Multi-part messages are not reassembled.

Strings

All text fields are UTF-8 at the native boundary (LPUTF8Str / UTF-8 byte fields). Prefer ASCII digits for SMSC / destination addresses.

Native lifetime

GsmModem owns a native handle. Always Dispose() (or using) when finished.
Do not use an instance after dispose.

Errors

Failed native calls throw CometTextelException with a numeric Status (ct_status) and message from ct_status_string.

Quick start

PDU only (no modem)

using CometTextel.NET.Core;

string hex = Pdu.EncodeSubmit(
    destination: "886912345678",
    text: "Hello from CometTextel.NET",
    serviceCenter: "886932000000",
    coding: DataCoding.Ucs2);

Console.WriteLine(hex);

SmsMessage decoded = Pdu.Decode(hex);
Console.WriteLine(decoded.PeerAddress + " => " + decoded.UserData);

Send / list / delete

using CometTextel.NET.Core;

using var modem = new GsmModem();
modem.Open("COM3", baudRate: 115200);

modem.Send(
    destination: "886912345678",
    text: "Hello",
    serviceCenter: "886932000000",
    coding: DataCoding.Ucs2);

foreach (var message in modem.List())
{
    Console.WriteLine($"[{message.Index}] {message.PeerAddress}: {message.UserData}");
}

// modem.Delete(index: 1);

Smoke tests

Requires CometTextel.NET/Lib/comettextel.dll (same as packing):

dotnet test CometTextel.NET.Tests\CometTextel.NET.Tests.csproj -c Release -p:Platform=x64

pack.ps1 and Windows CI run these before producing the NuGet package.

Examples project

From nuget/CometTextel.NET (after pack.ps1 or a native Release build that copied Lib/comettextel.dll):

dotnet run --project CometTextel.Example -c Release -p:Platform=x64 -- pdu 886912345678 "Hello" 886932000000
dotnet run --project CometTextel.Example -c Release -p:Platform=x64 -- list COM3
dotnet run --project CometTextel.Example -c Release -p:Platform=x64 -- send COM3 886932000000 886912345678 "Hello"
dotnet run --project CometTextel.Example -c Release -p:Platform=x64 -- delete COM3 1

Build & pack

Requires CMake + MSVC (for comettextel.dll) and .NET SDK 8+ on Windows.

# From repository: comettextel/nuget/CometTextel.NET
.\pack.ps1

This script:

  1. Configures/builds the C++ library (COMETTEXTEL_BUILD_C_API=ON, win-x64 Release)
  2. Copies comettextel.dll into CometTextel.NET/Lib/
  3. Runs dotnet pack and writes .nupkg under artifacts/

Manual steps (native DLL must already be in CometTextel.NET/Lib/):

dotnet build CometTextel.NET.sln -c Release -p:Platform=x64
dotnet pack CometTextel.NET\CometTextel.NET.csproj -c Release -p:Platform=x64 -o artifacts

API surface (summary)

Area Highlights
Modem GsmModem.Open, Send, List, Delete, Dispose
PDU Pdu.EncodeSubmit, Pdu.EncodeSubmitSegments, Pdu.Decode
Types SmsMessage, DataCoding, CometTextelException

Namespace: CometTextel.NET.Core.

Native C ABI (inside comettextel.dll): ct_modem_*, ct_pdu_encode_submit, ct_pdu_decode — see include/comettextel/c_api.h in the C++ tree.

License

Copyright (c) 2026 Ji-Feng Tsai.
Code released under the MIT license.

TODO

  • Concatenated SMS reassembly APIs
  • Optional linux-x64 NuGet RID assets

Donation

If this application help you reduce time to coding, you can give me a cup of coffee 😃

paypal

Paypal Me

Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net9.0-windows7.0 is compatible.  net10.0-windows was computed.  net10.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0-windows7.0

    • No dependencies.
  • net8.0-windows7.0

    • No dependencies.
  • net9.0-windows7.0

    • No dependencies.

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
1.7.0 37 9/18/2026
1.6.0 111 8/27/2026
1.5.0 93 8/21/2026
1.4.0 92 8/21/2026
1.3.0 104 8/15/2026
1.2.0 96 8/14/2026
1.1.0 109 8/14/2026
1.0.0 101 8/8/2026

1.2.0: encode auto-splits long SMS with concatenated UDH (EncodeSubmitSegments; modem send follows).