예제 #1
0
int FUGNetzteil::switchVoltage(int i)
{
  int success=0;
  std::string command="F";
  command +=std::to_string(i);
  command=inputOutput(command);
  if (command=="E0"){ success = i;  voltagesOnOf=i;}
  else success = 3;
  return success;
  
}
예제 #2
0
bool FUGNetzteil::readDigitalRemote()
{
  int success=0;
  std::string answer="";

  answer=inputOutput(">DSD?");
  if (answer[0]=='D')
  {
   answer= answer.erase(0, 4);
  return std::stod(answer) == 1;
  }
  else if (answer[0]=='E')
  {
  setError("digitalRemote", answer);
  }
}
예제 #3
0
bool FUGNetzteil::readVoltageLimitation()
{
  int success=0;
  std::string answer="";

  answer=inputOutput(">DVR?");
  if (answer[0]=='D')
  {
   answer= answer.erase(0, 4);
  return std::stod(answer) == 1;
  }
  else if (answer[0]=='E')
  {
  setError("voltageLimitation", answer);
  }
}
예제 #4
0
int FUGNetzteil::setU(double U)
{
  int success=0;
  std::string command="U";
  std::string answer="";
  command +=std::to_string(U);
  answer=inputOutput(command);
  std::cout<<"setU answer: "<<answer<<std::endl;
  if (answer=="E0"){ success = 1;}
  else
  {
  success = 0;
  setError(command, answer);
  }
  return success;
  
}
예제 #5
0
bool FUGNetzteil::readOvercurrent()
{
  int success=0;
  std::string answer="";

  answer=inputOutput(">D3R?");
  if (answer[0]=='D')
  {
   answer= answer.erase(0, 4);
  return std::stod(answer) == 1;
  }
  else if (answer[0]=='E')
  {
  setError("hasOvercurrent", answer);
  }

  return false;
}
예제 #6
0
double FUGNetzteil::readSetpointU()
{
  int success=0;
  std::string answer="";

  answer=inputOutput(">S0?");
  if (answer[0]=='S')
  {
   answer= answer.erase(0, 3);
  return std::stod(answer);
  }
  else if (answer[0]=='E')
  {
  setError("getSetpointU", answer);
  }

  return -1;
  
}
예제 #7
0
double FUGNetzteil::readI()
{
  int success=0;
  std::string answer="";
   answer=inputOutput(">M1?");
      std::cout<<"answer: "<<answer<<std::endl;
  if (answer[0]=='M')
  {
   answer= answer.erase(0, 3);
  return std::stod(answer);
  }
  else if (answer[0]=='E')
  {
  setError("getI", answer);
  }

  return -1;
  
}
예제 #8
0
double FUGNetzteil::readSetpointI()
{
  int success=0;
  std::string answer="";
//   answer=inputOutput(">S1?");
   std::string iO = inputOutput(">S1?"); //Das Zwillingsparadoxon ?!?!
      std::cout<<"i/O: "<<iO<<std::endl;
      std::cout<<"answer: "<<answer<<std::endl;
  if (answer[0]=='S')
  {
   answer= answer.erase(0, 3);
  return std::stod(answer);
  }
  else if (answer[0]=='E')
  {
  setError("getSetpointI", answer);
  }

  return -1;
  
}
예제 #9
0
void tst_QVCard21Writer::testQuotedPrintableEncode()
{
    QByteArray encodedBytes;

    // Nothing to encode
    QString nothingToEncode(QStringLiteral("nothing to encode"));
    QVERIFY(!mWriter->quotedPrintableEncode(nothingToEncode));

    // Special characters
    QString inputOutput(QStringLiteral("\n"));
    QVERIFY(mWriter->quotedPrintableEncode(inputOutput));
    QCOMPARE(inputOutput, QStringLiteral("=0A"));
    inputOutput = QStringLiteral("\r");
    QVERIFY(mWriter->quotedPrintableEncode(inputOutput));
    QCOMPARE(inputOutput, QStringLiteral("=0D"));
    inputOutput = QStringLiteral("!");
    QVERIFY(mWriter->quotedPrintableEncode(inputOutput));
    QCOMPARE(inputOutput, QStringLiteral("=21"));
    inputOutput = QStringLiteral("\"");
    QVERIFY(mWriter->quotedPrintableEncode(inputOutput));
    QCOMPARE(inputOutput, QStringLiteral("=22"));
    inputOutput = QStringLiteral("#");
    QVERIFY(mWriter->quotedPrintableEncode(inputOutput));
    QCOMPARE(inputOutput, QStringLiteral("=23"));
    inputOutput = QStringLiteral("$");
    QVERIFY(mWriter->quotedPrintableEncode(inputOutput));
    QCOMPARE(inputOutput, QStringLiteral("=24"));
    inputOutput = QStringLiteral("=");
    QVERIFY(mWriter->quotedPrintableEncode(inputOutput));
    QCOMPARE(inputOutput, QStringLiteral("=3D"));
    inputOutput = QStringLiteral("@");
    QVERIFY(mWriter->quotedPrintableEncode(inputOutput));
    QCOMPARE(inputOutput, QStringLiteral("=40"));
    inputOutput = QStringLiteral("[");
    QVERIFY(mWriter->quotedPrintableEncode(inputOutput));
    QCOMPARE(inputOutput, QStringLiteral("=5B"));
    inputOutput = QStringLiteral("\\");
    QVERIFY(mWriter->quotedPrintableEncode(inputOutput));
    QCOMPARE(inputOutput, QStringLiteral("=5C"));
    inputOutput = QStringLiteral("]");
    QVERIFY(mWriter->quotedPrintableEncode(inputOutput));
    QCOMPARE(inputOutput, QStringLiteral("=5D"));
    inputOutput = QStringLiteral("^");
    QVERIFY(mWriter->quotedPrintableEncode(inputOutput));
    QCOMPARE(inputOutput, QStringLiteral("=5E"));
    inputOutput = QStringLiteral("`");
    QVERIFY(mWriter->quotedPrintableEncode(inputOutput));
    QCOMPARE(inputOutput, QStringLiteral("=60"));
    inputOutput = QStringLiteral("{");
    QVERIFY(mWriter->quotedPrintableEncode(inputOutput));
    QCOMPARE(inputOutput, QStringLiteral("=7B"));
    inputOutput = QStringLiteral("|");
    QVERIFY(mWriter->quotedPrintableEncode(inputOutput));
    QCOMPARE(inputOutput, QStringLiteral("=7C"));
    inputOutput = QStringLiteral("}");
    QVERIFY(mWriter->quotedPrintableEncode(inputOutput));
    QCOMPARE(inputOutput, QStringLiteral("=7D"));
    inputOutput = QStringLiteral("~");
    QVERIFY(mWriter->quotedPrintableEncode(inputOutput));
    QCOMPARE(inputOutput, QStringLiteral("=7E"));
}
예제 #10
0
void FUGNetzteil::resetOvercurrent()
{
  inputOutput(">B1 1");
}
예제 #11
0
std::string FUGNetzteil::getIDN()
{
  std::cout << "FIRST TRY: " << inputOutput("?") << std::endl;
  return inputOutput("?");
}