Compare commits

..

No commits in common. "4004ec12c31b4099c95e1f8890e66710e6e7cb1e" and "9e5c6003fc53243d665b68d0978164fe0e8bc649" have entirely different histories.

3 changed files with 7 additions and 19 deletions

View file

@ -131,11 +131,7 @@ int ComRobot::Open(string usart) {
* @return Success if above 0, failure if below 0 * @return Success if above 0, failure if below 0
*/ */
int ComRobot::Close() { int ComRobot::Close() {
#ifdef __SIMULATION__
return close(sock);
#elif
return close(fd); return close(fd);
#endif
} }
/** /**
@ -159,22 +155,17 @@ Message *ComRobot::Write(Message* msg) {
char buffer[1024] = {0}; char buffer[1024] = {0};
cout << "[" << __PRETTY_FUNCTION__ << "] Send command: " << s << endl << flush; cout << "[" << __PRETTY_FUNCTION__ << "] Send command: " << s << endl << flush;
send(sock, s.c_str(), s.length(), MSG_NOSIGNAL); send(sock, s.c_str(), s.length(), 0);
int valread = read(sock, buffer, 1024); int valread = read(sock, buffer, 1024);
if (valread < 0) {
if (valread == 0) {
cout << "The communication is out of order" << endl;
msgAnswer = new Message(MESSAGE_ANSWER_COM_ERROR);
} else if (valread < 0) {
cout << "Timeout" << endl;
msgAnswer = new Message(MESSAGE_ANSWER_ROBOT_TIMEOUT); msgAnswer = new Message(MESSAGE_ANSWER_ROBOT_TIMEOUT);
} else { } else {
string s(&buffer[0], valread); string s(&buffer[0], valread);
msgAnswer = StringToMessage(s); msgAnswer = StringToMessage(s);
cout << "Response: " << buffer << ", id: " << msgAnswer->GetID() << endl; //msgAnswer = new Message(MESSAGE_ANSWER_ACK);
} }
cout << "response: " << buffer << ", id: " << msgAnswer->GetID() << endl;
#else #else
AddChecksum(s); AddChecksum(s);

View file

@ -8,12 +8,11 @@
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group> <group>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/tasks.cpp</file> <file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/tasks.cpp</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/lib/comrobot.cpp</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/lib/commonitor.cpp</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/tasks.h</file> <file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/tasks.h</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/main.cpp</file> <file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/main.cpp</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/lib/comrobot.h</file> <file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/lib/comrobot.h</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/lib/commonitor.cpp</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/lib/comrobot.cpp</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/lib/messages.h</file>
</group> </group>
</open-files> </open-files>
</project-private> </project-private>

View file

@ -6,8 +6,6 @@
</data> </data>
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group> <group/>
<file>file:/home/raphael/Documents/real_time/software/simulateur/main.cpp</file>
</group>
</open-files> </open-files>
</project-private> </project-private>