campo-sirio/include/dongle.h
guy a04f282de0 dongle.cpp Modificata priorita' nella scelta del dongle cui loggarsi
dongle.h     Aggiunto metodo TDongle::can_use_server()
os_*.*       Aggiunta funzione os_dongle_server_running()
skeytsr.h    Aggiunto #pragma pack(1) per 32 bit


git-svn-id: svn://10.65.10.50/trunk@6701 c028cbd2-c16b-5b4b-a496-9718f37d4682
1998-05-28 10:09:12 +00:00

82 lines
2.3 KiB
C++
Executable File

#ifndef __DONGLE_H
#define __DONGLE_H
#ifndef __DATE_H
#include <date.h>
#endif
#ifndef __STRINGS_H
#include <strings.h>
#endif
enum TDongleHardware { _dongle_unknown, _dongle_hardlock, _dongle_eutron, _dongle_network };
enum TDongleType { _no_dongle, _user_dongle, _developer_dongle, _aga_dongle, _prassi_dongle, _procom_dongle };
class TDongle : public TObject
{
TDongleHardware _hardware;
TDongleType _type;
word _serno, _max_users, _year_assist;
word _eprom[64];
TDate _last_update;
TBit_array _module;
bool _dirty;
protected:
bool already_programmed() const;
bool hardlock_login(bool test_all_dongles);
bool eutron_login(bool test_all_dongles);
bool network_login(bool test_all_dongles);
bool burn_hardlock();
bool burn_eutron();
int can_try_server() const;
public: // TObject
virtual bool ok() const
{ return _hardware != _dongle_unknown &&
_type != _no_dongle &&
_serno != 0xFFFF; }
public:
bool login(bool test_all_dongles = FALSE);
bool logout();
word number() const { return _serno; }
word max_users() const { return _max_users; }
word year_assist() const { return _year_assist; }
void garble(word* data) const;
// Solo per un po' di tempo, poi diverranno protected (servono a ba1500 old style)
bool read_words(word reg, word len, word *data) const;
bool write_words(word reg, word len, word *data) const;
TDongleType 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();
TDongleHardware hardware() const { return _hardware; }
bool local() const { return _hardware == _dongle_hardlock || _hardware == _dongle_eutron; }
bool network() const { return _hardware == _dongle_network; }
TDongle();
virtual ~TDongle();
};
TDongle& dongle();
bool destroy_dongle();
#endif