void ACSACR1222LReaderUnit::establish_background_connection() { kill_background_connection(); LLA_LOG_CTX("Setting up feedback PCSC connection for ACSACR1222L."); auto provider = std::dynamic_pointer_cast<PCSCReaderProvider>(getReaderProvider()); assert(provider); assert(getACSACR1222LConfiguration()); auto name = getACSACR1222LConfiguration()->getUserFeedbackReader(); if (name.empty()) { LOG(WARNINGS) << "Cannot fetch name for the reader unit that would be used as " << "a background connection for ACSACR1222L"; return; } try { sam_used_as_perma_connection_ = std::dynamic_pointer_cast<PCSCReaderUnit>( provider->createReaderUnit(name)); assert(sam_used_as_perma_connection_); sam_used_as_perma_connection_->setup_pcsc_connection(SC_DIRECT); } catch (const std::exception &e) { LOG(ERRORS) << "Failed to establish PCSC connection when establishing " << "background connection for ACSACR1222L: " << e.what(); sam_used_as_perma_connection_ = nullptr; return; } auto lcd = std::make_shared<ACSACR1222LLCDDisplay>(); lcd->setReaderCardAdapter( sam_used_as_perma_connection_->getDefaultReaderCardAdapter()); sam_used_as_perma_connection_->setLCDDisplay(lcd); auto ledbuzzer = std::make_shared<ACSACR1222LLEDBuzzerDisplay>(); ledbuzzer->setReaderCardAdapter( sam_used_as_perma_connection_->getDefaultReaderCardAdapter()); sam_used_as_perma_connection_->setLEDBuzzerDisplay(ledbuzzer); }
std::shared_ptr<Chip> STidPRGReaderUnit::getCurrentChip() { auto ret = getDefaultReaderCardAdapter()->sendCommand({0x21, 0, 0, 0}); if (ret.size() > 3) { auto uid_len = ret[2]; if (static_cast<size_t>(3 + uid_len) >= ret.size()) { auto card_uid = std::vector<uint8_t>(ret.begin() + 3, ret.end()); auto chip = createChip("Prox", card_uid); auto cmd = std::make_shared<ProxCommand>(); cmd->setReaderCardAdapter(getDefaultReaderCardAdapter()); chip->setCommands(cmd); return chip; } else assert(0); } return nullptr; }