mirror of
https://github.com/radio95-rnt/rds95.git
synced 2026-02-26 20:33:53 +01:00
Enhance RDS handling by adding RTP state toggling and improving command parsing
This commit is contained in:
@@ -278,7 +278,13 @@ static void handle_ptynen(char *arg, RDSModulator* mod, char* output) {
|
||||
}
|
||||
|
||||
static void handle_rtprun(char *arg, RDSModulator* mod, char* output) {
|
||||
set_rds_rtplus_flags(mod->enc, atoi(arg));
|
||||
int flag1, flag2;
|
||||
if (sscanf(arg, "%d,%d", &flag1, &flag2) == 2) {
|
||||
set_rds_rtplus_flags(mod->enc, flag1);
|
||||
if(flag2) mod->enc->rtpState[mod->enc->program].toggle ^= 1;
|
||||
} else {
|
||||
set_rds_rtplus_flags(mod->enc, atoi(arg));
|
||||
}
|
||||
strcpy(output, "+\0");
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ void poll_control_pipe(RDSModulator* mod) {
|
||||
if (bytes_read <= 0) return;
|
||||
|
||||
token = strtok((char *)pipe_buf, "\r\n");
|
||||
if(token == NULL) token = strtok((char *)pipe_buf, "\x1A");
|
||||
if(token == NULL) token = strtok((char *)pipe_buf, "\r");
|
||||
while (token != NULL) {
|
||||
size_t cmd_len = strlen(token);
|
||||
if (cmd_len > 0 && cmd_len < CMD_BUFFER_SIZE) {
|
||||
@@ -40,7 +40,7 @@ void poll_control_pipe(RDSModulator* mod) {
|
||||
process_ascii_cmd(mod, cmd_buf);
|
||||
}
|
||||
token = strtok(NULL, "\r\n");
|
||||
if(token == NULL) token = strtok(NULL, "\x1A");
|
||||
if(token == NULL) token = strtok(NULL, "\r");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
11
src/rds.c
11
src/rds.c
@@ -367,6 +367,14 @@ static void get_rds_oda_group(RDSEncoder* enc, uint16_t *blocks) {
|
||||
if (enc->oda_state[enc->program].current >= enc->oda_state[enc->program].count) enc->oda_state[enc->program].current = 0;
|
||||
}
|
||||
|
||||
static void get_rds_rtp_oda_group(RDSEncoder* enc, uint16_t *blocks) {
|
||||
blocks[1] |= 3 << 12;
|
||||
|
||||
blocks[1] |= GET_GROUP_TYPE(enc->rtpData[enc->program].group) << 1;
|
||||
blocks[1] |= GET_GROUP_VER(enc->rtpData[enc->program].group);
|
||||
blocks[3] = ODA_AID_RTPLUS;
|
||||
}
|
||||
|
||||
static void get_rds_ct_group(RDSEncoder* enc, uint16_t *blocks) {
|
||||
(void)enc;
|
||||
struct tm *utc, *local_time;
|
||||
@@ -696,7 +704,7 @@ static void get_rds_group(RDSEncoder* enc, uint16_t *blocks) {
|
||||
if(enc->state[enc->program].rtp_oda == 0) {
|
||||
get_rds_rtplus_group(enc, blocks);
|
||||
} else {
|
||||
get_rds_oda_group(enc, blocks);
|
||||
get_rds_rtp_oda_group(enc, blocks);
|
||||
}
|
||||
enc->state[enc->program].rtp_oda ^= 1;
|
||||
goto group_coded;
|
||||
@@ -725,7 +733,6 @@ void get_rds_bits(RDSEncoder* enc, uint8_t *bits) {
|
||||
}
|
||||
|
||||
static void init_rtplus(RDSEncoder* enc, uint8_t group, uint8_t program) {
|
||||
register_oda(enc, group, ODA_AID_RTPLUS, 0);
|
||||
enc->rtpData[program].group = group;
|
||||
enc->rtpData[program].enabled = 0;
|
||||
}
|
||||
|
||||
@@ -142,9 +142,6 @@ typedef struct {
|
||||
uint16_t udg2[8][3];
|
||||
|
||||
RDSEON eon[EONS];
|
||||
|
||||
RDSMessages messages;
|
||||
RDSScheduler schedule;
|
||||
} RDSData;
|
||||
typedef struct {
|
||||
uint8_t ecc_or_lic : 1;
|
||||
@@ -194,7 +191,7 @@ typedef struct {
|
||||
uint16_t custom_group[GROUP_LENGTH];
|
||||
|
||||
uint8_t rtp_oda : 1;
|
||||
uint8_t grp_seq_idx[2];
|
||||
uint8_t grp_seq_idx[3];
|
||||
uint8_t udg_idxs[2];
|
||||
|
||||
uint8_t last_minute : 6;
|
||||
@@ -241,6 +238,10 @@ typedef struct {
|
||||
uint16_t site_addr[2];
|
||||
RDSEncoderASCIIData ascii_data;
|
||||
RDSEncoderUECPData uecp_data;
|
||||
uint16_t special_features;
|
||||
RDSScheduler schedule;
|
||||
RDSMessages messages;
|
||||
// uint8_t rds2_buffer[16384];
|
||||
} RDSEncoderData;
|
||||
typedef struct {
|
||||
RDSEncoderData encoder_data[PROGRAMS];
|
||||
|
||||
@@ -13,6 +13,7 @@ DPS1MOD (partial)
|
||||
- DTTMOUT
|
||||
- EQTEXT1
|
||||
LABPER
|
||||
LPS - P232 Only
|
||||
MS
|
||||
PI
|
||||
PS
|
||||
@@ -52,8 +53,11 @@ LEVEL
|
||||
(PHASE) - No phase control
|
||||
(MJD) - Data is taken...
|
||||
(PILOT) - No info
|
||||
RDSGEN
|
||||
- PSNMAIN
|
||||
- RDS2MOD
|
||||
RDSGEN - Partial
|
||||
RESET
|
||||
- SETFEAT
|
||||
(SPEED) - No COM
|
||||
- STATUS, ??
|
||||
(TIME) - Time is taken...
|
||||
@@ -62,7 +66,7 @@ VER
|
||||
- CC
|
||||
DSN*
|
||||
ECCEN
|
||||
G
|
||||
G - Partial
|
||||
GRPSEQ
|
||||
LIC
|
||||
- NOHDR
|
||||
@@ -73,9 +77,12 @@ PSN*
|
||||
(PSW) - Could be
|
||||
RTP
|
||||
RTPRUN
|
||||
- SETSPY
|
||||
SHORTRT
|
||||
- SEL
|
||||
- SITE *SITE
|
||||
- STORE
|
||||
UDG1
|
||||
UDG2
|
||||
- UECP
|
||||
- UECP
|
||||
- XCMD
|
||||
Reference in New Issue
Block a user