#ifndef __BA1500_H__ #define __BA1500_H__ #ifndef __STRINGS_H #include #endif class TDongle : public TObject { public: enum KeyType { _user_key, _aga_key, _prassi_key, _procom_key }; private: word _serno, _max_users, _year_assist; KeyType _type; word _eprom[64]; TDate _last_update; #if XVT_OS == XVT_OS_SCOUNIX word _port; #endif TBit_array _module; bool _dirty; protected: bool already_programmed() const; bool write_octect(word reg, word data[4]) const; public: bool login(bool test_all_keys = FALSE); bool logout(); word number() const { return _serno; } bool ok() const { return _serno != 0xFFFF; } word max_users() const { return _max_users; } word year_assist() const { return _year_assist; } void garble(word data[4]) const; KeyType type() const { return _type; } bool active(word module) const { return _module[module]; } void activate(word module, bool on = TRUE) { _module.set(module, on); _dirty = TRUE; } void deactivate(word module) { activate(module, FALSE); } void set_max_users(word u) { _max_users = u; _dirty = TRUE; } void set_year_assist(word y) { _year_assist = y; _dirty = TRUE; } const TDate& last_update() const { return _last_update; } bool dirty() const { return _dirty; } bool burn(); TDongle(); virtual ~TDongle() { logout(); } }; const int MAX_AUT = 48 * 3; class TInformazione_moduli : public TObject { TString_array _infos; int _index[MAX_AUT]; int _unassigned_modules; // Moduli non assegnati, con descrizione vuota public: const char* get_description_by_order(int index); const char* get_name_by_order(int index); int get_module_by_order(int index); const char* get_description(int module); const char* get_name(int module); int get_index(int module); TDongle::KeyType get_owner(int module) const; bool test_owner(int module, TDongle::KeyType owner) const; int unassigned() const { return _unassigned_modules; } int items() const { return _infos.items(); } TInformazione_moduli(); virtual ~TInformazione_moduli() {}; }; #endif