#include <cstdlib>
#include <iostream>
#include <string>
#include <conio.h>
#include "nxt.h"
using namespace std;
//set up the NXT
Connection *connection = new Bluetooth();
Filesystem *fs = new Filesystem(connection);
int main()
{
try{
cout << "Try to connect to the NXT" << endl;
connection->connect(40);
cout << "Connected" << endl;
fs->upload_file("c:\\upload.txt", "nxt_file.txt"); //upload the upload.txt from the pc and save it as nxt_file.txt
fs->download_file("c:\\dowmload.txt", "nxt_file.txt");//download the nxt_file.txt and save it as download.txt
//upload.txt and download.txt should be the same
connection->disconnect();
}
catch (Nxt_exception& e){
//some error occurred - print it out
cout << e.what() << endl;
cout << "error code: " << e.error_code() << endl;
cout << "error type: " << e.error_type() << endl;
cout << e.who() << endl;
connection->disconnect();
}
system("pause");
return 0;
}