Slupik98

TOD

Aug 10th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. // PRZYGOTOWANIE DANYCH DO WYSYŁKI
  2. bufor[0] = 0x01; // deviceType - dla 7SEG zawsze 0x01
  3. bufor[1] = 0x01; // dataType - dla czasu zawsze 0x01
  4. if(zegarStatus.kierunek == GORA || zegarStatus.przekroczony){
  5. bufor[2] = (quint8)(zegarStatus.czas_up / 60); // minuty
  6. bufor[3] = (quint8)(zegarStatus.czas_up % 60); // sekundy
  7. } else {
  8. bufor[2] = (quint8)(zegarStatus.czas_down / 60); // minuty
  9. bufor[3] = (quint8)(zegarStatus.czas_down % 60); // sekundy
  10. }
  11. if(bufor.at(2) > 99)
  12. bufor[2] = 99;
  13.  
  14. if(zegarStatus.wygaszaj_wiodace)
  15. bufor[4] = 1;
  16.  
  17. if(zegarStatus.stan_zegara == STAN_ZEGARA_STOPPED)
  18. bufor[5] = 1; // reset wyświetlacza
  19.  
  20. if(zegarStatus.warning)
  21. bufor[6] = 1;
  22.  
  23. if(zegarStatus.przekroczony)
  24. bufor[7] = 1;
  25.  
  26. if(zegarStatus.buzzer){
  27. if(zegarStatus.przekroczony){
  28. if(zegarStatus.czas_up == 1)
  29. bufor[8] = 1;
  30. if(zegarStatus.czas_up == 10)
  31. bufor[8] = 2;
  32. if(zegarStatus.czas_up == 20)
  33. bufor[8] = 20;
  34. bufor[7] = 1;
  35. }
  36. }
  37.  
  38. for(quint8 i = 0; i < this->list_disp7SegNode.count(); i++){
  39. if(this->list_disp7SegNode.at(i)->isConnected()){
  40. if(this->m_webUserLogged && (!this->m_emptyList_B)){
  41. // ściśle pilnujemy lokalizacji jeśli webUser jest zalogowany i lista nie jest pusta
  42. if(this->list_disp7SegNode.at(i)->getLocation().toLower() == location.toLower()){
  43. // display obsługuje bieżącą lokalizację
  44. this->list_disp7SegNode.at(i)->sendData(bufor);
  45. }
  46. } else {
  47. // wszystkie displeje dostają czas z sali A
  48. if((location.toUpper() == "A") && (this->list_disp7SegNode.at(i)->getLocation().toUpper() == "B")){
  49. // jeśli idzie czas sali A do displeja z sali B
  50. // wyłącz sygnalizację dźwiękową
  51. QByteArray tmpBuf = bufor;
  52. tmpBuf[8] = 0;
  53. this->list_disp7SegNode.at(i)->sendData(tmpBuf);
  54. } else {
  55. // czas sali A do displeja z sali A - normalnie, bez zmian
  56. this->list_disp7SegNode.at(i)->sendData(bufor);
  57. }
  58. }
  59. }
  60. }
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment