mirror of
https://github.com/D-Modem/app.git
synced 2026-11-28 17:38:05 -08:00
The fax machine's side in the app, over the modem's class 1 commands (T.31): T.4's MH coding of the pages, T.30's procedure (DIS/DCS, the training and its fallback to lower rates, the pages with MPS/EOP and their MCF/RTN/RTP, DCN), V.17 to V.27ter as the modem has them. Tested on D-Modem's own modems back to back (native-test's fax_line, modem_test paced as a phone line): our sender to our receiver, efax sending to us and receiving from us, the pages exact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
51 lines
1.5 KiB
C++
51 lines
1.5 KiB
C++
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
* Copyright (C) 2026 Neo-Desktop
|
|
*
|
|
* fax_line.cpp - D-Modem-RE's modem_test (two modems back to back on
|
|
* an audio pipe, a pty for each one's DTE) paced as a
|
|
* phone line is: at the sample clock (MODEM_REALTIME,
|
|
* as the interop tests have it), so that a fax
|
|
* program's T.30 timing meets the line's (modem_test
|
|
* runs as fast as it can once off hook). The app's
|
|
* fax tests' line.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
#include <dsplibs.h>
|
|
#include <log.h>
|
|
|
|
#include "options.h"
|
|
#include "pipe_modem.h"
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
dmd::Options opt;
|
|
int pipe1[2], pipe2[2], ret;
|
|
|
|
dcore::log_level = 1;
|
|
dmd::parse_options(argc, argv, opt);
|
|
dcore::log_open("test");
|
|
prop_dp_init();
|
|
if (pipe(pipe1) < 0 || pipe(pipe2) < 0) {
|
|
perror("pipe");
|
|
return 1;
|
|
}
|
|
dmd::PipeModem a("modemA", 9600, opt.country, pipe1[0], pipe2[1]);
|
|
dmd::PipeModem b("modemB", 9600, opt.country, pipe2[0], pipe1[1]);
|
|
/* (unpaced only when asked: MODEM_REALTIME=0) */
|
|
bool realtime = !getenv("MODEM_REALTIME") || atoi(getenv("MODEM_REALTIME"));
|
|
a.set_realtime(realtime);
|
|
b.set_realtime(realtime);
|
|
fprintf(stderr, "created modemA: %s\ncreated modemB: %s\n",
|
|
a.pty().name(), b.pty().name());
|
|
dmd::PipeModem *modems[] = { &a, &b };
|
|
ret = dmd::PipeModem::run(modems, 2);
|
|
prop_dp_exit();
|
|
dcore::log_close();
|
|
return ret;
|
|
}
|