DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
sigfox.h
Go to the documentation of this file.
1// Copyright (C) 2026 Douglas Quigg (dstroy0) <dquigg123@gmail.com>
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4/**
5 * @file sigfox.h
6 * @brief Sigfox modem AT-command codec (DETWS_ENABLE_SIGFOX) - Wisol / Murata over UART.
7 *
8 * The tiny-uplink half of a Sigfox-to-web bridge. A Wisol (SFM10R) / Murata Sigfox modem
9 * is driven by AT commands over a UART: sigfox_build_uplink() formats an `AT$SF=<hex>`
10 * command for a payload (the Sigfox network caps a message at 12 bytes and ~140 messages
11 * per day, so uplinks are rare and small), and sigfox_parse_response() classifies the
12 * modem's reply as OK, ERROR, or still pending (nothing conclusive yet). Pure text codec -
13 * you carry the bytes over your UART - so it is fully host-testable. This is uplink-only
14 * (the common Sigfox use); a device sends readings up, it is not addressed downlink.
15 *
16 * @author Douglas Quigg (dstroy0)
17 * @date 2026
18 */
19
20#ifndef DETERMINISTICESPASYNCWEBSERVER_SIGFOX_H
21#define DETERMINISTICESPASYNCWEBSERVER_SIGFOX_H
22
23#include "ServerConfig.h"
24
25#if DETWS_ENABLE_SIGFOX
26
27#include <stddef.h>
28#include <stdint.h>
29
30/** @brief Classification of a Sigfox modem response line. */
31enum class sigfox_result : uint8_t
32{
33 SIGFOX_PENDING = 0, ///< nothing conclusive yet (echo / partial); keep reading
34 SIGFOX_OK = 1, ///< the modem accepted / completed the command
35 SIGFOX_ERROR = 2, ///< the modem reported an error
36};
37
38/**
39 * @brief Format an `AT$SF=<hex>\r\n` uplink command for @p payload into @p out (a NUL-
40 * terminated C string).
41 * @return the command length (excluding the NUL), or 0 if @p len exceeds
42 * DETWS_SIGFOX_MAX_PAYLOAD or the command would not fit @p cap.
43 */
44uint16_t sigfox_build_uplink(const uint8_t *payload, uint8_t len, char *out, uint16_t cap);
45
46/**
47 * @brief Classify a modem reply (scans @p buf for "OK" / "ERROR").
48 * @return sigfox_result::SIGFOX_OK, sigfox_result::SIGFOX_ERROR, or sigfox_result::SIGFOX_PENDING if neither is present
49 * yet.
50 */
51sigfox_result sigfox_parse_response(const char *buf, uint16_t len);
52
53#endif // DETWS_ENABLE_SIGFOX
54
55#endif // DETERMINISTICESPASYNCWEBSERVER_SIGFOX_H
User-facing configuration for DeterministicESPAsyncWebServer.