]> git.kernelconcepts.de Git - rdstmc.git/blobdiff - decoder/tmc.c
More decoding, some minor fixes
[rdstmc.git] / decoder / tmc.c
index f25d277af4a642d278e8079dedc804831f97cdd0..1d52ca32c60e2d18848b9007f478120d3546223e 100644 (file)
@@ -76,9 +76,12 @@ char type_str2[128]="";
 char typechr;
 int typenr, subtype;
 
+       //fprintf(stderr, "mCI=%d CI=%d\n", cur_tmc_msg.CI, CI);
        if (CI != cur_tmc_msg.CI || CI == -1) {
-               //printf("GF evt=%d loc=%d ext=%d CI=%d dir=%d", event, location, extent, CI, direction);
-               //printf("ev=%d ", event);
+#ifdef DEBUG
+               printf("GF evt=%d loc=%d ext=%d CI=%d dir=%d", event, location, extent, CI, direction);
+               printf("ev=%d ", event);
+#endif
                snprintf(sql, 256, "select ROADNUMBER,FIRST_NAME,NEGATIVE_OFFSET,POSITIVE_OFFSET,LINEAR_REFERENCE,TYPE,SUBTYPE from lcl where LOCATIONCODE=%d", location);
                sqlite3_prepare(lcl_db, sql, 256, &ppstmt, NULL);
                if (sqlite3_step(ppstmt) != SQLITE_ROW) {
@@ -96,7 +99,9 @@ int typenr, subtype;
                        subtype = sqlite3_column_int(ppstmt, 6);
                        typechr = type_str1[0];
                        typenr = atoi(&type_str1[1]);
-                       // printf(" type=%c %d stype=%d\n", typechr, typenr, subtype);
+#ifdef DEBUG
+                       printf(" type=%c %d stype=%d\n", typechr, typenr, subtype);
+#endif
                        snprintf(sql, 256, "select SNATDESC from lcl_supc where CLASS='%c' AND TCD=%d AND STCD=%d", typechr, typenr, subtype);
                        sqlite3_prepare(lcl_db, sql, 256, &ppstmt, NULL);
                        if (sqlite3_step(ppstmt) != SQLITE_ROW) {
@@ -190,12 +195,15 @@ int typenr, subtype;
                if (location == 64777) {
                        tmc_msg_ptr += sprintf(tmc_msg_ptr, "%s\n", evt_str);
                } else {
-                       if (extent)
+                       if (extent) {
+#ifdef DEBUG
+                               printf("dir=%d\n", direction);
+#endif
                                if (direction)
                                        tmc_msg_ptr += sprintf(tmc_msg_ptr, "zwischen %s %s und %s %s\n%s\n", type_str1, fst_name, type_str2, last_name, evt_str);
                                else
                                        tmc_msg_ptr += sprintf(tmc_msg_ptr, "zwischen %s %s und %s %s\n%s\n", type_str2, last_name, type_str1, fst_name, evt_str);
-                       else
+                       else
                                tmc_msg_ptr += sprintf(tmc_msg_ptr, "in Höhe %s %s\n%s\n", type_str1, fst_name, evt_str);
                }
        }
@@ -407,6 +415,7 @@ unsigned char ext_buf[256];
 #endif
                        } else {
                                strncpy(evt_str, (char *)sqlite3_column_text(ppstmt, 0), 255);
+                               // printf("(L)='%s'\n", evt_str);
                                if (strlen(lofrstr) != 0 && strstr(evt_str,"(L)")!=NULL) {
                                        replace_str(evt_str, "(L)", lofrstr);
                                }
@@ -505,7 +514,7 @@ unsigned char CI = rdsgroup[1] & 0x07;
        // printf("  0x%04x 0x%04x\n", rdsgroup[2], rdsgroup[3]);
 }
 
-enum TMCtype { TMC_GROUP=0,  TMC_SINGLE,  TMC_SYSTEM,  TMC_TUNING };
+// enum TMCtype { TMC_GROUP=0,  TMC_SINGLE,  TMC_SYSTEM,  TMC_TUNING };
 
 void decode_tmc(unsigned short *rdsgroup)
 {