~ubuntu-branches/ubuntu/karmic/piklab/karmic

« back to all changes in this revision

Viewing changes to src/progs/icd1/base/icd1_serial.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Miriam Ruiz
  • Date: 2008-01-25 22:26:25 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080125222625-p27qjurf8xiu5t8p
Tags: 0.15.2-1
* New Upstream Release.
* Bumped standards version from 3.7.2 to 3.7.3. No changes needed.
* Added Homepage label to debian/control.
* Added manpage for piklab-coff.
* Added -Wl,--as-needed to LDFLAGS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#include <qdatetime.h>
13
13
#include "common/global/global.h"
14
14
#include "common/common/misc.h"
 
15
#include "common/common/number.h"
15
16
 
16
17
//-----------------------------------------------------------------------------
17
18
Icd1::SerialPort::SerialPort(const QString &device, Log::Base &log)
47
48
    if ( !readPin(CTS, Port::PositiveLogic, bit) ) return false;
48
49
    if ( !bit) break;
49
50
    if ( uint(time.elapsed())>3000 ) { // 3 seconds
50
 
      log(Log::Error, i18n("Timeout synchronizing."));
 
51
      log(Log::LineType::Error, i18n("Timeout synchronizing."));
51
52
      return false;
52
53
    }
53
54
  }
54
55
  return setPinOn(RTS, true, Port::PositiveLogic);
55
56
}
56
 
  
 
57
 
57
58
bool Icd1::SerialPort::sendCommand(uint cmd)
58
59
{
59
60
  Q_ASSERT( cmd<=0xFFFF );
60
61
  synchronize();
61
62
  char c[7] = "$XXXX\r";
62
63
  QString cs = toHex(cmd, 4);
63
 
  log(Log::ExtraDebug, QString("Send command: %1").arg(toPrintable(cs, PrintAlphaNum)));
 
64
  log(Log::DebugLevel::Extra, QString("Send command: %1").arg(toPrintable(cs, PrintAlphaNum)));
64
65
  c[1] = cs[0].latin1();
65
66
  c[2] = cs[1].latin1();
66
67
  c[3] = cs[2].latin1();