Bridge Android radio invitation commands to the core thread

This commit is contained in:
evgeny committed 2026-10-19 13:59:34 +02:00
1 parent a97c915663
commit 34890ea709
2 files changed
+25

No files matched your search

@@ -268,6 +268,9 @@ object NativeLib {
fun callDecline(callId: Long) { nativeCallDecline(callId) }
fun callHangup(callId: Long) { nativeCallHangup(callId) }
fun callIsOnline(channelId: String, peerNodeId: Long): Boolean = nativeCallIsOnline(channelId, peerNodeId)
/* action: radio_call_action, результат — CHAT_EVT_RADIO_CALL (65). */
fun radioCall(id: Long, action: Int, group: Long = 0, peer: Long = 0): Boolean = nativeRadioCall(id, group, peer, action)
private external fun nativeRadioCall(id: Long, group: Long, peer: Long, action: Int): Boolean
/* ── P2P аудио-звонок (медиа) ── */
fun callAudioStart(callId: Long): Boolean = nativeCallAudioStart(callId)
@@ -19,6 +19,7 @@
#include "../../../src/call/call_audio.h"
#include "../../../src/call/call.h"
#include "../../../src/radio/radio.h"
#include "../../../src/radio/radio_call.h"
#include "../../../src/radio/radio_audio.h"
#include "../../../src/dm/dm_core.h"
#include "../../../src/dm/dm_media.h"
@@ -2784,6 +2785,27 @@ JNIEXPORT void JNICALL Java_com_utun_chat_data_NativeLib_nativeCallAccept(
utun_bridge_call_accept((uint64_t)callId);
}
/* Команда адресного вызова рации: копируем запрос до передачи в поток ядра. */
JNIEXPORT jboolean JNICALL Java_com_utun_chat_data_NativeLib_nativeRadioCall(
JNIEnv* env, jobject thiz, jlong id, jlong group, jlong peer, jint action) {
(void)env; (void)thiz;
struct UTUN_INSTANCE* inst = instance_lite_get_instance();
struct UASYNC* ua = instance_lite_get_uasync();
if (!inst || !ua || !uasync_is_running(ua) || !id || action < RADIO_CALL_START || action > RADIO_CALL_REJECT_BUSY) {
DEBUG_ERROR(DEBUG_CATEGORY_RADIO, "radio call JNI rejected id=%lld action=%d core=%p", (long long)id, action, (void*)inst);
return JNI_FALSE;
}
struct radio_call_request* req = u_calloc(1, sizeof(*req));
struct posted_task* task = u_calloc(1, sizeof(*task));
if (!req || !task) {
DEBUG_ERROR(DEBUG_CATEGORY_RADIO, "radio call JNI allocation failed"); u_free(req); u_free(task); return JNI_FALSE;
}
req->inst = inst; req->id = (uint64_t)id; req->group = (uint64_t)group; req->peer = (uint64_t)peer; req->action = action;
task->callback = radio_call_trampoline; task->arg = req;
uasync_post_reserved(ua, task);
return JNI_TRUE;
}
JNIEXPORT void JNICALL Java_com_utun_chat_data_NativeLib_nativeCallDecline(
JNIEnv* env, jobject thiz, jlong callId) {
(void)env; (void)thiz;