Exemplo n.º 1
0
	std::vector<boost::shared_ptr<Chip> > DeisterReaderUnit::getChipList()
	{
		std::vector<boost::shared_ptr<Chip> > chipList;
		boost::shared_ptr<Chip> singleChip = getSingleChip();
		if (singleChip)
		{
			chipList.push_back(singleChip);
		}
		return chipList;
	}
 std::vector<std::shared_ptr<Chip> > IdOnDemandReaderUnit::getChipList()
 {
     std::vector<std::shared_ptr<Chip> > chipList;
     std::shared_ptr<Chip> singleChip = getSingleChip();
     if (singleChip)
     {
         chipList.push_back(singleChip);
     }
     return chipList;
 }
Exemplo n.º 3
0
    bool OK5553ReaderUnit::connect()
    {
        LOG(LogLevel::INFOS) << "Starting connect...";
        if (getSingleChip())
        {
            if (getSingleChip()->getCardType() == "DESFire")
            {
                std::vector<unsigned char> tmp = rats();
                if (tmp.size() == 0)
                {
                    d_insertedChip = getChipInAir();
                    tmp = rats();
                    if (tmp.size() == 0)
                    {
                        d_insertedChip.reset();
                    }
                }
            }
        }

        return bool(d_insertedChip);
    }
Exemplo n.º 4
0
    bool ISO7816ReaderUnit::reconnect(int action)
    {
        try
        {
            auto chip = getSingleChip();
            if (chip
                && chip->getGenericCardType() == CHIP_SAM)
            {
                std::this_thread::sleep_for(std::chrono::milliseconds(200));

                auto command = std::dynamic_pointer_cast<logicalaccess::SAMCommands<logicalaccess::KeyEntryAV2Information, logicalaccess::SETAV2 >>(chip->getCommands());
                if (command)
                    command->lockUnlock(getISO7816Configuration()->getSAMUnLockKey(), logicalaccess::SAMLockUnlock::Unlock, 0, 0, 0);
            }
        }
        catch (std::exception& ex)
        {
            LOG(ERRORS) << "ISO7816ReaderUnit reconnect: " << ex.what();
            return false;
        }

        return true;
    }