-static command_t CommandTable[] =
-{
- {"help", CmdHelp, 1, "This help"},
- {"demod",CmdVikingDemod ,1, "<8 digits tag id> -- Extract tag data"},
- {"clone", CmdVikingClone, 1, "<16 digits card data> clone viking tag"},
+int CmdVikingSim(const char *Cmd) {
+ uint32_t id = 0;
+ uint64_t rawID = 0;
+ uint8_t clk = 32, encoding = 1, separator = 0, invert = 0;
+
+ char cmdp = param_getchar(Cmd, 0);
+ if (strlen(Cmd) == 0 || cmdp == 'h' || cmdp == 'H') return usage_lf_viking_sim();
+
+ id = param_get32ex(Cmd, 0, 0, 16);
+ if (id == 0) return usage_lf_viking_sim();
+
+ rawID = getVikingBits(id);
+
+ uint16_t arg1, arg2;
+ size_t size = 64;
+ arg1 = clk << 8 | encoding;
+ arg2 = invert << 8 | separator;
+
+ UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}};
+ PrintAndLog("preparing to sim ask data: %d bits", size);
+ num_to_bytebits(rawID, 64, c.d.asBytes);
+ clearCommandBuffer();
+ SendCommand(&c);
+ return 0;
+}
+
+static command_t CommandTable[] = {
+ {"help", CmdHelp, 1, "This help"},
+ {"read", CmdVikingRead, 0, "Attempt to read and Extract tag data"},
+ {"clone", CmdVikingClone, 0, "<8 digit ID number> clone viking tag"},
+ {"sim", CmdVikingSim, 0, "<8 digit ID number> simulate viking tag"},