Exemplo n.º 1
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 (...) {}
    }
    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 (...) { }
	}