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; }
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); } }
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); } }
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; }
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; }
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; }
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; }
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; }
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")); }
void FUGNetzteil::resetOvercurrent() { inputOutput(">B1 1"); }
std::string FUGNetzteil::getIDN() { std::cout << "FIRST TRY: " << inputOutput("?") << std::endl; return inputOutput("?"); }