password_machine.h 1.07 KB
#ifndef ETRADECLIENT_HARDWARE_PASSWORD_MACHINE_H_INCLUDED
#define ETRADECLIENT_HARDWARE_PASSWORD_MACHINE_H_INCLUDED

/*Password machine is used to calculate the password for verifying the DILI card.
*/

/*
密码机信息:
生产厂商:广州江南科友科技股份有限公司
型号:(未知)
*/

#include <string>
#include <cstdint>
#include "tinyxml.h"

class PWDMachine
{
public:
	PWDMachine();
	~PWDMachine();

	//bool ReadConfig();

	std::string GetPassword(const std::string&	key_idx, // 密钥索引
		const std::string&	card_sn, // 卡序列号(卡片内码),用作离散数据
		uint32_t			timeout, 
		std::string sPWMIP,
		uint32_t u32PWMPort) const; // 单位:毫秒

private:
	mutable int32_t m_socket;

	CString GetModulePath();
	//std::string m_sPWMIP;
	//uint32_t m_u32PWMPort;

	bool Connect(const std::string& ip, uint32_t port) const;
	void Disconnect() const;
	std::string GetCardPassword(const std::string&	key_idx, // 密钥索引
		const std::string&	card_sn, // 卡序列号(卡片内码),用作离散数据
		uint32_t			timeout) const; // 单位:毫秒

}; // PWDMachine

#endif // ETRADECLIENT_HARDWARE_PASSWORD_MACHINE_H_INCLUDED