Public Member Functions | Protected Member Functions
SystemLink Class Reference

Brief description of class still missing. More...

#include <SystemLink.h>

Inheritance diagram for SystemLink:
DaemonLink

List of all members.

Public Member Functions

void addComment (const QString &c)
void clearUsb ()
void comments ()
void diskSpace ()
void highRateRefresh ()
void powerOff ()
void reboot ()
 SystemLink (Station *station)

Protected Member Functions

virtual int bytesAvailable (const char *buffer, int bytesCount)

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

Description of constructor still missing

References DaemonLink::setPort(), and TRACE.

  : DaemonLink(station)
{
  TRACE;
  setPort(2978);
  _refresh.setInterval(10000); // 10 s during startup
  QObject::connect(&_refresh, SIGNAL(timeout()), this, SLOT(refreshVariableParameters()));
  _refresh.start();
}

Member Function Documentation

void SystemLink::addComment ( const QString &  c)

References DaemonLink::send(), and TRACE.

Referenced by Station::addComment().

{
  TRACE;
  QByteArray buf=c.toUtf8();
  QByteArray msg;
  msg.setNum(buf.count());
  msg.prepend("addcomment=");
  msg.append("\n");
  send(msg.data(), msg.count());
  send(buf.data(), buf.count());
}
int SystemLink::bytesAvailable ( const char *  buffer,
int  bytesCount 
) [protected, virtual]

Implements DaemonLink.

References bytesAvailable(), comments(), diskSpace(), DaemonLink::match(), and TRACE.

Referenced by bytesAvailable().

{
  TRACE;
  int bytesRead=0;
  while(bytesRead<bytesCount) {
    // Scan for a line
    int newBytesRead;
    for(newBytesRead=bytesRead; newBytesRead<bytesCount && buffer[newBytesRead]!='\n'; newBytesRead++) {}
    if(newBytesRead==bytesCount) {
      return bytesRead; // partial line
    }
    newBytesRead=bytesRead;
    switch(buffer[bytesRead]) {
    case 'c':
      if(match(buffer, newBytesRead, bytesCount, "comments=")) {
        if(!comments(buffer, newBytesRead, bytesCount)) {
          return bytesRead;
        }
      }
      break;
    case 'd':
      if(match(buffer, newBytesRead, bytesCount, "diskspace=")) {
        diskSpace(buffer, newBytesRead, bytesCount);
      }
      break;
    case 'h':
      if(match(buffer, newBytesRead, bytesCount, "halting")) {
        halting(buffer, newBytesRead, bytesCount);
      }
      break;
    default:
      break;
    }
    bytesRead=newBytesRead+1;
    // Skip blanks and additionnal end of line characters
    while(bytesRead<bytesCount && isspace(buffer[bytesRead])) {bytesRead++;}
  }
  return bytesRead;
}

References DaemonLink::send(), and TRACE.

Referenced by Station::clearUsb().

{
  TRACE;
  send("clearusb\n");
}

References DaemonLink::send(), and TRACE.

Referenced by bytesAvailable(), and Station::requestComments().

{
  TRACE;
  send("comments\n");
}

References DaemonLink::send(), and TRACE.

Referenced by bytesAvailable().

{
  TRACE;
  send("diskspace\n");
}
{
  _refresh.setInterval(10000); // 10 s during startup
}

References DaemonLink::send(), and TRACE.

Referenced by Station::powerOff().

{
  TRACE;
  send("poweroff\n");
}

References DaemonLink::send(), and TRACE.

Referenced by Station::reboot().

{
  TRACE;
  send("reboot\n");
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines