-int AmVikingDecode(const uint8_t *id){
- // searching the buffer for the id
- //uint8_t id_bits[32];
- // convert 4 bytes of id to 32 bits present in 32 bytes data;
- //bytes_to_bits(id,4,id_bits,sizeof(id_bits));
-
- //print_arraybinary(id_bits,sizeof(id_bits));
- PrintAndLog(" binary: %s", printBits(4, id) );
-
- //size_t idx = 0;
- size_t BitLen = DemodBufferLen;
- uint8_t BitStream[MAX_GRAPH_TRACE_LEN]={0};
- memcpy(BitStream, DemodBuffer, BitLen);
-
- // if (VikingDecode(BitStream,BitLen,&idx,id_bits,sizeof(id_bits)) == 1)
- // {
- // setDemodBuf(BitStream,64, idx);
- // PrintAndLog("Found Viking tag\n");
- // CmdPrintDemodBuff("x");
- // }
- // else
- // {
- // PrintAndLog("Not found Viking tag\n");
- // }
- return 0;
-}
-int AMVikingDemod(const uint8_t *id){
- // demod am clock 32 fail
- if (!ASKDemod("32",g_debugMode,false,1))
- return 0;
- // search for the card id from bitstream.
- return AmVikingDecode(id);
-}
-//by Gusto
-// takes 1 argument <8 bytes of Hex number on the card
-// print binary found and saves in grapbuffer for further commands
-int CmdAMVikingDemod(const char *Cmd){
- uint8_t id[4];
- if (param_gethex(Cmd,0,id,8) == 1)
- {
- PrintAndLog("Usage: data vikingdemod CardID 8 bytes of hex number");
- return 0;
- }
- PrintAndLog("Card ID : %02X%02X%02X%02X\n",id[0],id[1],id[2],id[3]);
- // try to demod AMViking
- return AMVikingDemod(id);
-}
-