+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;
+
+ PrintAndLog("Simulating - ID: %08X, Raw: %08X%08X",id,(uint32_t)(rawID >> 32),(uint32_t) (rawID & 0xFFFFFFFF));
+
+ UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}};
+ num_to_bytebits(rawID, size, c.d.asBytes);
+ clearCommandBuffer();
+ SendCommand(&c);
+ return 0;
+}
+
+static command_t CommandTable[] = {