+ ans=PSKDemod(Cmd, TRUE);
+ if (!ans){
+ if (g_debugMode) PrintAndLog("Error demoding: %d",ans);
+ return 0;
+ }
+ psk1TOpsk2(DemodBuffer, DemodBufferLen);
+ PrintAndLog("PSK2 demoded bitstream:");
+ // Now output the bitstream to the scrollback by line of 16 bits
+ printDemodBuff();
+ return 1;
+}
+
+// by marshmellow - combines all raw demod functions into one menu command
+int CmdRawDemod(const char *Cmd)
+{
+ char cmdp = Cmd[0]; //param_getchar(Cmd, 0);
+
+ if (strlen(Cmd) > 14 || cmdp == 'h' || cmdp == 'H' || strlen(Cmd)<2) {
+ PrintAndLog("Usage: data rawdemod [modulation] <help>|<options>");
+ PrintAndLog(" [modulation] as 2 char, 'ab' for ask/biphase, 'am' for ask/manchester, 'ar' for ask/raw, 'fs' for fsk, ...");
+ PrintAndLog(" 'nr' for nrz/direct, 'p1' for psk1, 'p2' for psk2");
+ PrintAndLog(" <help> as 'h', prints the help for the specific modulation");
+ PrintAndLog(" <options> see specific modulation help for optional parameters");
+ PrintAndLog("");
+ PrintAndLog(" sample: data rawdemod fs h = print help for ask/raw demod");
+ PrintAndLog(" : data rawdemod fs = demod GraphBuffer using: fsk - autodetect");
+ PrintAndLog(" : data rawdemod ab = demod GraphBuffer using: ask/biphase - autodetect");
+ PrintAndLog(" : data rawdemod am = demod GraphBuffer using: ask/manchester - autodetect");
+ PrintAndLog(" : data rawdemod ar = demod GraphBuffer using: ask/raw - autodetect");
+ PrintAndLog(" : data rawdemod nr = demod GraphBuffer using: nrz/direct - autodetect");
+ PrintAndLog(" : data rawdemod p1 = demod GraphBuffer using: psk1 - autodetect");
+ PrintAndLog(" : data rawdemod p2 = demod GraphBuffer using: psk2 - autodetect");
+ return 0;
+ }
+ char cmdp2 = Cmd[1];
+ int ans = 0;
+ if (cmdp == 'f' && cmdp2 == 's'){
+ ans = CmdFSKrawdemod(Cmd+3);
+ } else if(cmdp == 'a' && cmdp2 == 'b'){
+ ans = Cmdaskbiphdemod(Cmd+3);
+ } else if(cmdp == 'a' && cmdp2 == 'm'){
+ ans = Cmdaskmandemod(Cmd+3);
+ } else if(cmdp == 'a' && cmdp2 == 'r'){
+ ans = Cmdaskrawdemod(Cmd+3);
+ } else if(cmdp == 'n' && cmdp2 == 'r'){
+ ans = CmdNRZrawDemod(Cmd+3);
+ } else if(cmdp == 'p' && cmdp2 == '1'){
+ ans = CmdPSK1rawDemod(Cmd+3);
+ } else if(cmdp == 'p' && cmdp2 == '2'){
+ ans = CmdPSK2rawDemod(Cmd+3);
+ } else {
+ PrintAndLog("unknown modulation entered - see help ('h') for parameter structure");
+ }
+ return ans;