Driver-agnostic connectivity probes (UDP, TCP, TLS, DTLS, HTTP, HTTPS) for cellular modems under Mbed CE.
Compile-time procedure selection - only the chosen test is built, so flash
footprint stays small. Works with any NetworkInterface; supports native
Mbed TLS or modem-offloaded TLS/DTLS.
Set cellular-test.test-procedure in mbed_app.json5:
| Value | Procedure |
|---|---|
| 0 | UDP echo |
| 1 | TCP echo |
| 2 | TLS echo, native Mbed TLS |
| 3 | TLS echo, modem offload (fwTLS) |
| 4 | DTLS echo, native Mbed TLS |
| 5 | DTLS echo, modem offload (fwDTLS) |
| 6 | HTTP GET |
| 7 | HTTPS GET |
Offload procedures (3, 5) require nsapi.offload-tlssocket=true and a modem
driver that honours the NSAPI_TLSSOCKET_* setsockopt contract. Set
tls-security-profile to the modem profile ID provisioned with the CA.
Add the library and wire it up:
add_subdirectory(cellular_test)
target_link_libraries(your_app_target cellular-test)#include "cellular_test.h"
int main() {
NetworkInterface *net = CellularInterface::get_default_instance();
cellular_test::ITest *test = cellular_test::create_test(*net);
if (test) {
test->run();
test->print_results();
}
}For TLS/DTLS/HTTPS, supply certificates before run() via
TlsServerConfig / DtlsServerConfig / HttpServerConfig - use
create_tls_test() / create_dtls_test() / create_http_test() to inject
them.
All keys live under the cellular-test namespace in
mbed_lib.json.
| Option | Default | Notes |
|---|---|---|
udp-echo-server-hostname |
"echo.example.com" |
Procedure 0 |
udp-echo-server-ip |
"0.0.0.0" |
Used when use-direct-ip=true |
udp-echo-server-port |
7 |
|
tcp-echo-server-hostname |
"echo.example.com" |
Procedure 1 |
tcp-echo-server-ip |
"0.0.0.0" |
|
tcp-echo-server-port |
7 |
|
tls-echo-server-hostname |
"echo.example.com" |
Procedures 2–5 (DNS + SNI) |
tls-echo-server-ip |
"0.0.0.0" |
|
tls-echo-server-port |
443 |
|
dtls-echo-server-port |
5684 |
|
http-server-hostname |
"httpbin.org" |
Procedures 6–7 |
http-server-ip |
"0.0.0.0" |
|
http-server-port |
80 |
|
https-server-port |
443 |
|
http-path |
"/get" |
| Option | Default | Notes |
|---|---|---|
use-direct-ip |
false |
Skip DNS. Hostname is still used for SNI. |
ping-pong-cycles |
5 |
Echo iterations |
test-payload |
"HELLO_NBIOT" |
Echo payload |
tls-security-profile |
0 |
Modem profile ID (offload only, 0–15) |
cert-verify-mode |
0 |
Native TLS/DTLS: 0=REQUIRED, 1=OPTIONAL, 2=NONE (debug only) |
socket-timeout-ms |
15000 |
Data exchange timeout |
tls-handshake-timeout-ms |
60000 |
TLS/DTLS handshake timeout |
connect-retry-count |
3 |
Network connect retries |
cert-verify-mode can also be overridden per-test at runtime by setting
TlsServerConfig::cert_verify_mode / DtlsServerConfig::cert_verify_mode
before run(). Never ship with mode 2 (VERIFY_NONE) - it disables
server authentication entirely.
cellular_test/
├── CMakeLists.txt
├── mbed_lib.json
├── include/
│ ├── cellular_test.h # Public entry point + factory
│ └── cellular_test/
│ ├── ITest.h # Test interface
│ ├── TestConfig.h # *ServerConfig structs
│ ├── TestProcedure.h # CELLULAR_TEST_IS_* macros
│ ├── TestResults.h, TestTimer.h, TestPrint.h
│ ├── NetworkTestHelper.h # Connect / DNS / retry helper
│ └── EchoTest.h, TlsTest.h, DtlsTest.h, HttpTest.h
└── src/
├── NetworkTestHelper.cpp
└── EchoTest.cpp, TlsTest.cpp, DtlsTest.cpp, HttpTest.cpp
- iot-test-service: Docker testbed exposing the UDP / TCP / TLS / DTLS / HTTP / HTTPS endpoints this library drives, plus a .NET management API for run metadata.
- mbed-ce-bc660kgl-app: Quectel BC660K-GL EVKIT app using this library.
- mbed-ce-bg770agl-app: Quectel BG770A-GL EVKIT app using this library.
- mbed-ce-st87m01-app: ST ST87M01-1 EVKIT app using this library.
Apache License 2.0. See LICENSE.