| 669 | // Connection/disconnection event |
| 670 | |
| 671 | void RemoteDebug::onConnection(boolean connected) { |
| 672 | |
| 673 | // Clear variables |
| 674 | |
| 675 | D("rd onconn %d", connected); |
| 676 | |
| 677 | _bufferPrint = ""; // Clean buffer |
| 678 | |
| 679 | _lastTimeCommand = millis(); // To mark time for inactivity |
| 680 | |
| 681 | _command = ""; // Clear command |
| 682 | _lastCommand = ""; // Clear las command |
| 683 | |
| 684 | _lastTimePrint = millis(); // Clear the time |
| 685 | |
| 686 | _silence = false; // No silence |
| 687 | _silenceTimeout = 0; |
| 688 | |
| 689 | #ifdef CLIENT_BUFFERING |
| 690 | // Client buffering - send data in intervals to avoid delays or if its is too big |
| 691 | _bufferSend = ""; |
| 692 | _sizeBufferSend = 0; |
| 693 | _lastTimeSend = millis(); |
| 694 | #endif |
| 695 | |
| 696 | // Password request ? - 18/07/18 |
| 697 | |
| 698 | if (_password != "") { |
| 699 | |
| 700 | _passwordOk = false; |
| 701 | |
| 702 | #ifdef REMOTEDEBUG_PWD_ATTEMPTS |
| 703 | _passwordAttempt = 1; |
| 704 | #endif |
| 705 | } |
| 706 | |
| 707 | // Save it |
| 708 | |
| 709 | _connected = connected; |
| 710 | |
| 711 | // Process |
| 712 | |
| 713 | if (connected) { // Connected ? |
| 714 | |
| 715 | |
| 716 | // Callback |
| 717 | |
| 718 | if (_callbackNewClient) { |
| 719 | _callbackNewClient(); |
| 720 | } |
| 721 | |
| 722 | // Show the initial message |
| 723 | |
| 724 | #if SHOW_HELP |
| 725 | showHelp(); |
| 726 | #endif |
| 727 | } |
| 728 | } |