summaryrefslogtreecommitdiffstats
path: root/src/progs/icd1/base/icd1_prog.cpp
blob: 0f7927022d02e9f6e5a19302c642296edf07a034 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/***************************************************************************
 *   Copyright (C) 2006 Nicolas Hadacek <[email protected]>                  *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/
#include "icd1_prog.h"

#include <tqdir.h>

#include "progs/base/prog_config.h"
#include "devices/list/device_list.h"
#include "icd1_serial.h"

//-----------------------------------------------------------------------------
void Icd1::ProgrammerBase::clear()
{
  Icd::ProgrammerBase::clear();
  _selfTestResult = ::Programmer::Nb_ResultTypes;
}

bool Icd1::ProgrammerBase::selfTest(bool ask)
{
  log(Log::DebugLevel::Normal, "  Self-test");
  _selfTestResult = (hardware().selfTest() ? ::Programmer::Pass : ::Programmer::Fail);
  if ( _selfTestResult==::Programmer::Fail ) {
    if ( ask && !askContinue(i18n("Self-test failed. Do you want to continue anyway?")) ) {
      logUserAbort();
      return false;
    }
  }
  return true;
}

//----------------------------------------------------------------------------
Programmer::Properties Icd1::Group::properties() const
{
   return ::Programmer::Programmer | ::Programmer::HasFirmware | ::Programmer::CanUploadFirmware | ::Programmer::HasSelfTest | ::Programmer::CanReadMemory | ::Programmer::HasConnectedState;
}

Programmer::Hardware *Icd1::Group::createHardware(::Programmer::Base &base, const ::Programmer::HardwareDescription &hd) const
{
  return new Hardware(base, hd.port.device);
}

Programmer::DeviceSpecific *Icd1::Group::createDeviceSpecific(::Programmer::Base &base) const
{
  return new Icd::DeviceSpecific(base);
}