CometTextel.NET 1.6.0

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

CometTextel.NET

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

Native RID assets: runtimes/win-x64/native/comettextel.dll and runtimes/linux-x64/native/libcomettextel.so.

GitHub .NET Nuget CI

Requirements

Item Detail
OS Windows 10+ or Linux (x64)
Architecture x64 only (PlatformTarget=x64)
.NET net8.0 / net9.0 / net10.0
Native Ships win-x64 DLL + linux-x64 .so (CometTextel C ABI)
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 library.

NuGet

PM> Install-Package CometTextel.NET

Target an x64 process so the RID-native library can load (win-x64 or linux-x64).

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 septets (GSM 03.38 alphabet; ESC chars count as 2) / 8-bit·UCS-2 ≤ 140; concat GSM 7-bit ≤ 153 / 8-bit·UCS-2 ≤ 134.

GSM 7-bit UserData is UTF-8. Characters outside the default alphabet + ESC extension fail encode (use UCS-2).

On receive / list, if TP-UDHI is set, the UDH is skipped (HasUdh == true). Concat IEI 0x00 / 0x08 populate IsConcatenated, ConcatRef, ConcatTotal, ConcatSeq. GsmModem.ListMessages rejoins complete segment sets (ConcatSeq == 0, IsReassembledConcat). Incomplete parts remain separate.

Validity Period / Status Report

Submit APIs omit TP-VP and TP-SRR by default. Set relativeValidityPeriod to 0..255 to add a GSM relative TP-VP (0 means five minutes), and set requestStatusReport: true to set TP-SRR. These options are available on Pdu.EncodeSubmit, Pdu.EncodeSubmitSegments, and GsmModem.Send. This requests a report; automatic modem delivery-event tracking is not yet provided.

The C++ core exposes status-report decoding. In .NET use Pdu.DecodeStatusReport() to obtain MessageReference, TpStatus, RecipientAddress, ServiceTimestamp, and DischargeTime. Pdu.ApiVersion reports the native C ABI feature version; a legacy DLL is reported as version 1 and produces a clear unsupported error for this method.

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);   // Linux: "/dev/ttyUSB0"

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/win-x64/comettextel.dll (same as packing):

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

pack.ps1 and 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/win-x64/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.
Full multi-RID packages also need a Linux libcomettextel.so (CI pack-nuget job merges both).

# From repository: comettextel/nuget/CometTextel.NET
.\pack.ps1
# Optional: include linux-x64 from a staged SO
# .\pack.ps1 -LinuxSoPath D:\path\to\libcomettextel.so -RequireLinuxNative

This script:

  1. Configures/builds the C++ library (COMETTEXTEL_BUILD_C_API=ON, win-x64 Release)
  2. Copies comettextel.dll into CometTextel.NET/Lib/win-x64/
  3. Runs smoke tests, then dotnet packartifacts/

CI uploads CometTextel.NET-nupkg with both win-x64 and linux-x64 RID folders.

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: ct_modem_*, ct_pdu_encode_submit, ct_pdu_decode — see include/comettextel/c_api.h.

License

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

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 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.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.6.0: Adds SMS-STATUS-REPORT decoding, C ABI v2 with legacy DLL compatibility checks, and SDK support; ships win-x64 and linux-x64 RID natives. TFMs are net8.0/net9.0/net10.0.