aboutsummaryrefslogtreecommitdiffstats
path: root/src/pocsag/main.c
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2024-04-10 21:30:35 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2024-04-10 21:30:35 +0200
commitb642f82390b678cadf8cd47028ebed3d4c7677ee (patch)
tree827cb8303f616a1c443ad0137de301ad872db10a /src/pocsag/main.c
parentf294261285e1f12d9527635cde7aad9ab06be6fc (diff)
pocsag: Add option to change text message padding character
Diffstat (limited to 'src/pocsag/main.c')
-rw-r--r--src/pocsag/main.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pocsag/main.c b/src/pocsag/main.c
index 3546707..2bc70a0 100644
--- a/src/pocsag/main.c
+++ b/src/pocsag/main.c
@@ -50,6 +50,7 @@ static double polarity = -1;
static int polarity_given = 0;
static enum pocsag_function function = POCSAG_FUNCTION_NUMERIC;
static const char *message = "1234";
+static char padding = 4;
static enum pocsag_language language = LANGUAGE_DEFAULT;
static uint32_t scan_from = 0;
static uint32_t scan_to = 0;
@@ -87,6 +88,8 @@ void print_help(const char *arg0)
printf(" time. The upper 5 digits of the RIC are sent as message, if numeric\n");
printf(" function was selected. The upper 3 digits of the RIC are sent as\n");
printf(" message (2 digits hexadecimal), if alphanumeric function was selected.\n");
+ printf(" --padding 4 | 0 | ...\n");
+ printf(" Text message padding uses 4 (EOT) by default. Old pagers want 0 (NUL).\n");
printf("\n");
printf("File: %s\n", MSG_SEND);
printf(" Write \"<ric>,0,message\" to it to send a numerical message.\n");
@@ -97,6 +100,8 @@ void print_help(const char *arg0)
main_mobile_print_hotkeys();
}
+#define OPT_PADDING 256
+
static void add_options(void)
{
main_mobile_add_options();
@@ -109,6 +114,7 @@ static void add_options(void)
option_add('M', "message", 1);
option_add('L', "language", 0);
option_add('S', "scan", 2);
+ option_add(OPT_PADDING, "padding", 1);
}
static int handle_options(int short_option, int argi, char **argv)
@@ -188,6 +194,9 @@ static int handle_options(int short_option, int argi, char **argv)
return -EINVAL;
}
break;
+ case OPT_PADDING:
+ padding = atoi(argv[argi++]);
+ break;
default:
return main_mobile_handle_options(short_option, argi, argv);
}
@@ -343,7 +352,7 @@ int main(int argc, char *argv[])
printf("Invalid channel '%s', Use '-k list' to get a list of all channels.\n\n", kanal[i]);
goto fail;
}
- rc = pocsag_create(kanal[i], frequency, dsp_device[i], use_sdr, dsp_samplerate, rx_gain, tx_gain, tx, rx, language, baudrate, deviation, polarity, function, message, scan_from, scan_to, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback);
+ rc = pocsag_create(kanal[i], frequency, dsp_device[i], use_sdr, dsp_samplerate, rx_gain, tx_gain, tx, rx, language, baudrate, deviation, polarity, function, message, padding, scan_from, scan_to, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback);
if (rc < 0) {
fprintf(stderr, "Failed to create \"Sender\" instance. Quitting!\n");
goto fail;