+ \r
+ if ( hits > 1) {\r
+ PrintAndLog("Found [%d] possible matches for modulation.",hits);\r
+ for(int i=0; i<hits; ++i){\r
+ PrintAndLog("--[%d]---------------", i+1);\r
+ printConfiguration( tests[i] );\r
+ }\r
+ }\r
+ return FALSE;\r
+}\r
+\r
+bool testModulation(uint8_t mode, uint8_t modread){\r
+ switch( mode ){\r
+ case DEMOD_FSK:\r
+ if (modread > 3 && modread < 8) return TRUE;\r
+ break;\r
+ case DEMOD_ASK:\r
+ if (modread == DEMOD_ASK) return TRUE;\r
+ break;\r
+ case DEMOD_PSK1:\r
+ if (modread == DEMOD_PSK1) return TRUE;\r
+ break;\r
+ case DEMOD_PSK2:\r
+ if (modread == DEMOD_PSK2) return TRUE;\r
+ break;\r
+ case DEMOD_PSK3:\r
+ if (modread == DEMOD_PSK3) return TRUE;\r
+ break;\r
+ case DEMOD_NRZ:\r
+ if (modread == DEMOD_NRZ) return TRUE;\r
+ break;\r
+ case DEMOD_BI:\r
+ if (modread == DEMOD_BI) return TRUE;\r
+ break;\r
+ case DEMOD_BIa:\r
+ if (modread == DEMOD_BIa) return TRUE;\r
+ break; \r
+ default:\r
+ return FALSE;\r
+ }\r
+ return FALSE;\r
+}\r
+\r
+bool testBitRate(uint8_t readRate, uint8_t mod){\r
+ uint8_t expected[8] = {8, 16, 32, 40, 50, 64, 100, 128};\r
+ uint8_t detRate = 0;\r
+ switch( mod ){\r
+ case DEMOD_FSK:\r
+ detRate = GetFskClock("",FALSE, FALSE); \r
+ if (expected[readRate] == detRate) {\r
+ config.bitrate = readRate;\r
+ return TRUE;\r
+ }\r
+ break;\r
+ case DEMOD_FSK1:\r
+ detRate = GetFskClock("",FALSE, FALSE); \r
+ if (expected[readRate] == detRate) {\r
+ config.bitrate = readRate;\r
+ return TRUE;\r
+ }\r
+ break;\r
+ case DEMOD_FSK1a:\r
+ detRate = GetFskClock("",FALSE, FALSE); \r
+ if (expected[readRate] == detRate) {\r
+ config.bitrate = readRate;\r
+ return TRUE;\r
+ }\r
+ break;\r
+ case DEMOD_FSK2:\r
+ detRate = GetFskClock("",FALSE, FALSE); \r
+ if (expected[readRate] == detRate) {\r
+ config.bitrate = readRate;\r
+ return TRUE;\r
+ }\r
+ break;\r
+ case DEMOD_FSK2a:\r
+ detRate = GetFskClock("",FALSE, FALSE); \r
+ if (expected[readRate] == detRate) {\r
+ config.bitrate = readRate;\r
+ return TRUE;\r
+ }\r
+ break;\r
+ case DEMOD_ASK:\r
+ detRate = GetAskClock("",FALSE, FALSE); \r
+ if (expected[readRate] == detRate) {\r
+ config.bitrate = readRate;\r
+ return TRUE;\r
+ }\r
+ break;\r
+ case DEMOD_PSK1:\r
+ detRate = GetPskClock("",FALSE, FALSE); \r
+ if (expected[readRate] == detRate) {\r
+ config.bitrate = readRate;\r
+ return TRUE;\r
+ }\r
+ break;\r
+ case DEMOD_PSK2:\r
+ detRate = GetPskClock("",FALSE, FALSE); \r
+ if (expected[readRate] == detRate) {\r
+ config.bitrate = readRate;\r
+ return TRUE;\r
+ }\r
+ break;\r
+ case DEMOD_PSK3:\r
+ detRate = GetPskClock("",FALSE, FALSE); \r
+ if (expected[readRate] == detRate) {\r
+ config.bitrate = readRate;\r
+ return TRUE;\r
+ }\r
+ break;\r
+ case DEMOD_NRZ:\r
+ detRate = GetNrzClock("",FALSE, FALSE); \r
+ if (expected[readRate] == detRate) {\r
+ config.bitrate = readRate;\r
+ return TRUE;\r
+ }\r
+ break;\r
+ case DEMOD_BI:\r
+ case DEMOD_BIa:\r
+ detRate = GetAskClock("",FALSE, FALSE); \r
+ if (expected[readRate] == detRate) {\r
+ config.bitrate = readRate;\r
+ return TRUE;\r
+ }\r
+ break;\r
+ default:\r
+ return FALSE;\r
+ }\r
+ return FALSE;\r