Test
This commit is contained in:
35
main.cpp
35
main.cpp
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user