Ticket #287: submitunknown.diff

File submitunknown.diff, 2.1 KB (added by someone somewhere <pere-telldus@…>, 6 years ago)

untested draft patch to submit events also for unparsed messages.

  • receive.c

    diff --git a/receive.c b/receive.c
    index 721fa6f..69f000b 100644
    a b static volatile unsigned short dataP = 0; 
    2020#define TRIGGER_LEVEL 3 
    2121#define TRIGGER_MASK 0b00000111; 
    2222 
     23static char rfSubmitUnknownMessage(unsigned short scanP, unsigned char scanBit, 
     24                                   signed int dist) { 
     25        UCHAR8 msgbuf[DATA_BYTES]; 
     26        rfMessageBeginRaw(); 
     27        rfMessageAddString("protocol", "unknown"); 
     28        for (unsigned int i = 0; i < dist; i += 8) { 
     29                UCHAR8 byte; 
     30                for (UCHAR8 bit = 0; bit < 8; bit++) { 
     31                  byte |= getBit(*scanP, *scanBit) << bit; 
     32                  rfRetreatBit(scanP, scanBit); 
     33                } 
     34                msgbuf[i >> 8] = byte; 
     35           
     36        } 
     37        rfMessageAddHexString("data", msgbuf, dist >> 8); 
     38        rfMessageEnd(1); 
     39} 
     40 
    2341void rfReceiveUpdate(unsigned char antenna) { 
    2442        static unsigned char buffer = 0, cnt = 0; 
    2543        static unsigned char preFilterBuffer = 0, preFilterCnt=0; 
    void rfReceiveTask() { 
    129147        static unsigned unsigned char count0 = 0, count1 = 0; 
    130148        UCHAR8 found = FALSE; 
    131149        static UCHAR8 parsed = FALSE; 
     150        unsigned short matches = 0; 
    132151         
    133152        while(scanP != dataP) { 
    134153                //Count silence and restart on high 
    void rfReceiveTask() { 
    196215//              printf("%i\r\n", dist ); 
    197216//              return 0; 
    198217        } 
    199         parseArcTechSelflearning(startSilenceP, startSilenceBit); 
    200         parseArcTechCodeSwitch(startSilenceP, startSilenceBit); 
    201         parseFineOffset(startSilenceP, startSilenceBit); 
     218 
     219        matches += parseArcTechSelflearning(startSilenceP, startSilenceBit); 
     220        matches += parseArcTechCodeSwitch(startSilenceP, startSilenceBit); 
     221        matches += parseFineOffset(startSilenceP, startSilenceBit); 
    202222        //matches += parseSartano(startSilenceP, startSilenceBit);  //will be detected by arctech 
    203         parseEverFlourish(startSilenceP, startSilenceBit); 
    204         parseMandolyn(startSilenceP, startSilenceBit); 
    205         parseX10(startSilenceP, startSilenceBit); 
    206         clearOregon(); 
     223        matches += parseEverFlourish(startSilenceP, startSilenceBit); 
     224        matches += parseMandolyn(startSilenceP, startSilenceBit); 
     225        matches += parseX10(startSilenceP, startSilenceBit); 
     226        matches += clearOregon(); 
     227        if (0 == matches) { 
     228                rfSubmitUnknownMessage(startSilenceP, startSilenceBit, dist); 
     229        } 
    207230        parsed = TRUE; 
    208231        return; 
    209232}