Восстановлено из транскрипта сессии после потери рабочего дерева на сервере сборки. Что внутри: - четыре новых модуля прошивки (приём, сборка исходящего, меню Messages); - правки существующих файлов в виде скриптов, с порядком применения; - инструменты стенда: снятие экрана рации по USB, дамп кадров, эталонная сборка пакета; - NOTES.md: что проверено в эфире, что не доделано, где грабли. Работало в эфире в августе 2026: данные ходят в обе стороны в режиме хотспота, рация принимает SMS и показывает на экране. Отправка собрана и сверена с эталоном сервера побайтово, но в эфире не проверялась. Claude-Session: https://claude.ai/code/session_01GJtvG5WwqYNe1b7s9LLtgy
75 строки
3.2 KiB
C
75 строки
3.2 KiB
C
/*
|
|
* Copyright (C) 2026 OpenGD77 contributors
|
|
*
|
|
* Receiving DMR packet data (SMS) while the radio is used as a radio, rather than
|
|
* as a hotspot modem.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions
|
|
* are met:
|
|
*
|
|
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
*
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
|
|
* in the documentation and/or other materials provided with the distribution.
|
|
*
|
|
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
|
|
* from this software without specific prior written permission.
|
|
*
|
|
* 4. Use of this source code or binary releases for commercial purposes is strictly forbidden. This includes, without limitation,
|
|
* incorporation in a commercial product or incorporation into a product or project which allows commercial use.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
|
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|
|
#ifndef _OPENGD77_SMS_H_
|
|
#define _OPENGD77_SMS_H_
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
// A single received message, as shown to the user.
|
|
#define SMS_MAX_TEXT_LENGTH 160
|
|
// Longest message we are willing to assemble. Each rate 1/2 block carries 10 bytes of
|
|
// payload once the confirmed-mode overhead is removed, so this covers a full 160 char
|
|
// message with room for the IP/UDP/TMS wrapper around it.
|
|
#define SMS_MAX_BLOCKS 32
|
|
|
|
typedef struct
|
|
{
|
|
uint32_t srcId;
|
|
uint32_t dstId;
|
|
bool isPrivate;
|
|
bool unread;
|
|
char text[SMS_MAX_TEXT_LENGTH + 1];
|
|
} smsMessage_t;
|
|
|
|
/*
|
|
* Called from the HR-C6000 interrupt for every received data burst while the radio is
|
|
* NOT acting as a hotspot modem. Must stay short: it only copies the burst away and
|
|
* flags it, all parsing happens later in smsTick().
|
|
*
|
|
* payload - the 12 byte (96 bit) burst payload as read from the chip
|
|
* dataType - DMR data type of the burst (DT_CSBK / DT_DATA_HEADER / DT_RATE_12_DATA)
|
|
*/
|
|
void smsRxHandleBurst(const uint8_t *payload, uint8_t dataType);
|
|
|
|
/*
|
|
* Runs from normal task context. Turns collected bursts into a message and, when one
|
|
* completes, stores it and raises smsHasUnread().
|
|
*/
|
|
void smsTick(void);
|
|
|
|
void smsInit(void);
|
|
|
|
// Most recently received message, or NULL when nothing has been received yet.
|
|
const smsMessage_t *smsGetLatest(void);
|
|
|
|
bool smsHasUnread(void);
|
|
void smsMarkRead(void);
|
|
|
|
#endif
|