Files correlati : xvaga.dll Ricompilazione Demo : [ ] Commento : Aggiunto supporto per le Property Grid git-svn-id: svn://10.65.10.50/trunk@18531 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			74 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			74 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
#ifndef __SMARTCARD_H
 | 
						|
#define __SMARTCARD_H
 | 
						|
 | 
						|
#ifndef __MASK_H
 | 
						|
#include <mask.h>
 | 
						|
#endif
 | 
						|
 | 
						|
#define MAX_SM_FIELDS 16
 | 
						|
 | 
						|
typedef enum {no_smartcard, ase_smartcard} smartcard_type;
 | 
						|
typedef enum {no_smarterror, wrong_function, card_removed, no_power, wrong_card,
 | 
						|
							wrong_password, password_blocked,invelid_handle, invalid_parameter,
 | 
						|
							no_card, reset_card, protection_error, unknown_reader, no_reader,
 | 
						|
							buffer_overflow, sevice_stopped, timeout_err, no_memory, new_card, unknown_err } smartcard_error;
 | 
						|
 | 
						|
class TSmart_card : public TObject
 | 
						|
{
 | 
						|
	smartcard_type _type;
 | 
						|
	int _last_smart_field;
 | 
						|
	int _num_fields;
 | 
						|
	int _key_field;
 | 
						|
	int _anno_field;
 | 
						|
	int _ndoc_field;
 | 
						|
	int _check_field;
 | 
						|
	bool _has_pwd;
 | 
						|
	bool _card_connected;
 | 
						|
	int _input_field[MAX_SM_FIELDS];
 | 
						|
	int _output_field[MAX_SM_FIELDS];
 | 
						|
	int _prog_field[MAX_SM_FIELDS];
 | 
						|
	TBit_array _prot_field;
 | 
						|
	TString_array _tab_field;
 | 
						|
	TString_array _values;
 | 
						|
	TString16 _password;
 | 
						|
 | 
						|
	TString _ASE_reader_name;
 | 
						|
 | 
						|
	unsigned long ASEsearch();
 | 
						|
	unsigned long ASEread(char ** buffer);
 | 
						|
	unsigned long ASEwrite(char * buffer) const ;
 | 
						|
	bool ASEloadlibrary();
 | 
						|
 | 
						|
protected:
 | 
						|
	bool init();
 | 
						|
 | 
						|
public:
 | 
						|
	smartcard_type type() const { return _type; }
 | 
						|
	int anno_field() const { return _anno_field;}
 | 
						|
	int ndoc_field() const { return _ndoc_field;}
 | 
						|
	void display_error(smartcard_error error) const ;
 | 
						|
	bool card_connected() const { return _card_connected; }
 | 
						|
	const bool with_card(const TMask & m) { return m.get_bool(_check_field); }
 | 
						|
 | 
						|
	smartcard_error connect_card();
 | 
						|
	smartcard_error disconnect_card();
 | 
						|
	smartcard_error read();
 | 
						|
	smartcard_error write() const ;
 | 
						|
 | 
						|
	smartcard_error check_key(const TMask & m);
 | 
						|
	void mask2card(const TMask & m);
 | 
						|
	void card2mask(TMask & m);
 | 
						|
	void enable_prot_fields(TMask & m, bool on = true) const;
 | 
						|
	void disable_prot_fields(TMask & m) const { enable_prot_fields(m, false); }
 | 
						|
 | 
						|
	const TString & get(int field) const { return _values.row(field);}
 | 
						|
	int get_int(int field) const { return atoi(get(field));}
 | 
						|
	void add2field(int field, real & val);
 | 
						|
	void sub2field(int field, real & val) { add2field(field, -val);}
 | 
						|
 | 
						|
	TSmart_card();
 | 
						|
	virtual ~TSmart_card() {}
 | 
						|
};
 | 
						|
 | 
						|
#endif // __SMARTCARD_H
 |