interface.cpp 606 B

12345678910111213141516171819202122232425262728
  1. #include "interface.hpp"
  2. void
  3. Interface::get_informations(){
  4. cout<<endl<<"========= Informations ========="<<endl;
  5. while(true){
  6. listen();
  7. if(has_message){
  8. has_message=false;
  9. switch(message.get_type()){
  10. case STRING:
  11. cout<<message.get_string()<<endl;
  12. break;
  13. case CODE:
  14. if(message.get_code()=='E') return;
  15. cerr<<"[Error] Receive unexpected code "<<message.get_code()<<endl;
  16. return;
  17. break;
  18. default:
  19. cerr<<"[Error] Receive unexpected message"<<endl;
  20. return;
  21. break;
  22. }
  23. }
  24. else usleep(10000);
  25. }
  26. cout<<"================================"<<endl;
  27. }