This commit is contained in:
2021-08-22 21:46:31 +02:00
parent 72b67feb25
commit ac26fc6bdd
17 changed files with 3293 additions and 8 deletions

View File

@@ -9,12 +9,24 @@
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/split.hpp>
#include "TimeoutSerial.h"
#include "XModem.h"
using namespace std;
using namespace boost;
typedef vector< string > split_vector_type;
bool dataHandler(unsigned long blockNo, char* buffer, int size)
{
cout << "Block No. = " << blockNo << endl;
for (int i=0 ; i<size ; i++) {
cout << char(buffer[i]) << " ";
}
cout << endl;
return true;
}
int main(int argc, char* argv[])
{
string line;
@@ -65,6 +77,29 @@ int main(int argc, char* argv[])
cout << "vlhkost = " << humidity << endl;
cout << "tlak = " << pressure << endl;
XModem modem(&serial,dataHandler);
serial.writeString("capture\r\n");
sleep(1);
line = serial.readStringUntil("\r\n");
cout << line << endl;
line = serial.readStringUntil("\r\n");
cout << line << endl;
line = serial.readStringUntil("\r\n");
cout << line << endl;
line = serial.readStringUntil("\r\n");
cout << line << endl;
// line = serial.readStringUntil("\r\n");
// cout << line << endl;
serial.writeString("rb\r\n");
sleep(1);
serial.readChar(1);
serial.readChar(1);
modem.receive();
sleep(1);
serial.writeString("free\r\n");
serial.close();
} catch(boost::system::system_error& e)