1997-09-30 09:34:49 +00:00
|
|
|
#ifndef __BA1500_H__
|
|
|
|
#define __BA1500_H__
|
|
|
|
|
1996-05-28 09:39:05 +00:00
|
|
|
#ifndef __STRINGS_H
|
|
|
|
#include <strings.h>
|
|
|
|
#endif
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
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:
|
|
|
|
|
1997-12-17 13:40:59 +00:00
|
|
|
bool login(bool test_all_keys = FALSE);
|
1997-12-15 15:11:40 +00:00
|
|
|
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;
|
1997-09-30 09:34:49 +00:00
|
|
|
|
1996-05-28 09:39:05 +00:00
|
|
|
class TInformazione_moduli : public TObject
|
|
|
|
{
|
|
|
|
TString_array _infos;
|
1997-09-30 09:34:49 +00:00
|
|
|
int _index[MAX_AUT];
|
1996-05-28 09:39:05 +00:00
|
|
|
int _unassigned_modules; // Moduli non assegnati, con descrizione vuota
|
|
|
|
|
|
|
|
public:
|
1997-12-15 15:11:40 +00:00
|
|
|
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() {};
|
1996-05-28 09:39:05 +00:00
|
|
|
};
|
|
|
|
|
1997-09-30 09:34:49 +00:00
|
|
|
#endif
|