std::shared_ptr<ISO7816ReaderUnit> STidSTRReaderProvider::createReaderUnit(std::string readerunitname)
 {
     auto ru = std::dynamic_pointer_cast<STidSTRReaderUnit>(createReaderUnit());
     auto dt = std::make_shared<STidSTRDataTransport>(readerunitname);
     dt->setPortBaudRate(38400);
     ru->setDataTransport(dt);
     return ru;
 }
Ejemplo n.º 2
0
STidPRGReaderUnit::STidPRGReaderUnit() : ReaderUnit(READER_STIDPRG)
{
    d_readerUnitConfig = std::make_shared<STidPRGReaderUnitConfiguration>();
    setDefaultReaderCardAdapter(std::make_shared<STidPRGReaderCardAdapter>());
    auto dt = std::make_shared<STidPRGDataTransport>();
    dt->setPortBaudRate(9600);
    getDefaultReaderCardAdapter()->setDataTransport(dt);
    setDataTransport(dt);
}
Ejemplo n.º 3
0
    bool OK5553ReaderUnit::connectToReader()
    {
        LOG(LogLevel::INFOS) << "Starting connection to reader...";
        std::shared_ptr<DataTransport> dataTransport = getDataTransport();
        if (!dataTransport->getReaderUnit())
        {
            dataTransport->setReaderUnit(shared_from_this());
            setDataTransport(dataTransport);
        }

        return getDataTransport()->connect();
    }
Ejemplo n.º 4
0
	DeisterReaderUnit::DeisterReaderUnit()
		: ReaderUnit()
	{
		d_readerUnitConfig.reset(new DeisterReaderUnitConfiguration());
		setDefaultReaderCardAdapter (boost::shared_ptr<DeisterReaderCardAdapter> (new DeisterReaderCardAdapter()));
		boost::shared_ptr<SerialPortDataTransport> dataTransport(new SerialPortDataTransport());
		setDataTransport(dataTransport);
		d_card_type = "UNKNOWN";

		try
		{
			boost::property_tree::ptree pt;
			read_xml((boost::filesystem::current_path().string() + "/DeisterReaderUnit.config"), pt);
			d_card_type = pt.get("config.cardType", "UNKNOWN");
		}
		catch (...) { }
	}
    IdOnDemandReaderUnit::IdOnDemandReaderUnit()
        : ReaderUnit(READER_IDONDEMAND)
    {
        d_readerUnitConfig.reset(new IdOnDemandReaderUnitConfiguration());
        setDefaultReaderCardAdapter(std::shared_ptr<IdOnDemandReaderCardAdapter>(new IdOnDemandReaderCardAdapter()));
        std::shared_ptr<SerialPortDataTransport> dataTransport(new SerialPortDataTransport());
        setDataTransport(dataTransport);
		d_card_type = CHIP_UNKNOWN;

        try
        {
            boost::property_tree::ptree pt;
            read_xml((boost::filesystem::current_path().string() + "/IdOnDemandReaderUnit.config"), pt);
			d_card_type = pt.get("config.cardType", CHIP_UNKNOWN);
        }
        catch (...) {}
    }
Ejemplo n.º 6
0
 void ReaderUnit::unSerialize(boost::property_tree::ptree& node)
 {
     disconnectFromReader();
     d_readerUnitConfig->unSerialize(node.get_child(d_readerUnitConfig->getDefaultXmlNodeName()));
     std::string transportType = node.get_child("TransportType").get_value<std::string>();
     std::shared_ptr<DataTransport> dataTransport = LibraryManager::getInstance()->getDataTransport(transportType);
     // Cannot create data transport instance from xml, use default one
     if (!dataTransport)
     {
         dataTransport = getDataTransport();
     }
     if (dataTransport && transportType == dataTransport->getTransportType())
     {
         dataTransport->unSerialize(node.get_child(dataTransport->getDefaultXmlNodeName()));
         setDataTransport(dataTransport);
     }
 }
    AxessTMC13ReaderUnit::AxessTMC13ReaderUnit()
        : ReaderUnit(READER_AXESSTMC13)
    {
        d_readerUnitConfig.reset(new AxessTMC13ReaderUnitConfiguration());
        setDefaultReaderCardAdapter(std::shared_ptr<AxessTMC13ReaderCardAdapter>(new AxessTMC13ReaderCardAdapter()));
        std::shared_ptr<AxessTMC13DataTransport> dataTransport(new AxessTMC13DataTransport());
        dataTransport->setPortBaudRate(57600);
        setDataTransport(dataTransport);
		d_card_type = CHIP_UNKNOWN;

        try
        {
            boost::property_tree::ptree pt;
            read_xml((boost::filesystem::current_path().string() + "/AxessTMC13ReaderUnit.config"), pt);
			d_card_type = pt.get("config.cardType", CHIP_UNKNOWN);
        }
        catch (...) {}
    }
    NFCReaderUnit::NFCReaderUnit(const std::string& name):
        ReaderUnit(READER_NFC),
        d_device(NULL),
        d_name(name),
        d_connectedName(name),
        d_chip_connected(false)
	{
        d_readerUnitConfig.reset(new NFCReaderUnitConfiguration());
        setDefaultReaderCardAdapter(std::shared_ptr<NFCReaderCardAdapter>(new NFCReaderCardAdapter()));

        std::shared_ptr<NFCDataTransport> dataTransport(new NFCDataTransport());
        setDataTransport(dataTransport);
        d_card_type = "UNKNOWN";

        try
        {
            boost::property_tree::ptree pt;
            read_xml((boost::filesystem::current_path().string() + "/NFCReaderUnit.config"), pt);
            d_card_type = pt.get("config.cardType", "UNKNOWN");
        }
        catch (...) {}
    }
	AxessTMCLegicReaderUnit::AxessTMCLegicReaderUnit()
		: ReaderUnit()
	{		
		d_readerUnitConfig.reset(new AxessTMCLegicReaderUnitConfiguration());
		setDefaultReaderCardAdapter (boost::shared_ptr<AxessTMCLegicReaderCardAdapter> (new AxessTMCLegicReaderCardAdapter()));
		boost::shared_ptr<SerialPortDataTransport> dataTransport(new SerialPortDataTransport());
#ifndef UNIX
		dataTransport->setPortBaudRate(CBR_57600);
#else
		dataTransport->setPortBaudRate(B57600);
#endif
		setDataTransport(dataTransport);
		d_card_type = "UNKNOWN";

		try
		{
			boost::property_tree::ptree pt;
			read_xml((boost::filesystem::current_path().string() + "/AxessTMCLegicReaderUnit.config"), pt);
			d_card_type = pt.get("config.cardType", "UNKNOWN");
		}
		catch (...) { }
	}
Ejemplo n.º 10
0
	OSDPReaderUnit::OSDPReaderUnit()
		: ReaderUnit(READER_OSDP)
	{
		d_readerUnitConfig.reset(new OSDPReaderUnitConfiguration());

		setDataTransport(std::shared_ptr<OSDPDataTransport>(new OSDPDataTransport()));

		std::shared_ptr<ReaderCardAdapter> rca(new ReaderCardAdapter());
		rca->setDataTransport(getDataTransport());

		m_commands.reset(new OSDPCommands());
		m_commands->setReaderCardAdapter(rca);

		d_card_type = CHIP_UNKNOWN;

		try
		{
			boost::property_tree::ptree pt;
			read_xml((boost::filesystem::current_path().string() + "/OSDPReaderUnit.config"), pt);
			d_card_type = pt.get("config.cardType", CHIP_UNKNOWN);
		}
		catch (...) { }
	}