diff --git a/src/Adapters/BlinkerMQTT.h b/src/Adapters/BlinkerMQTT.h index e7a4b280..9d16c5cf 100644 --- a/src/Adapters/BlinkerMQTT.h +++ b/src/Adapters/BlinkerMQTT.h @@ -929,7 +929,7 @@ void BlinkerMQTT::flush() { BLINKER_LOG_ALL(BLINKER_F("flush")); - _needCheckShare = false; + // _needCheckShare = false; free(msgBuf_MQTT); isFresh_MQTT = false; isAvail_MQTT = false; isAliAvail = false; isDuerAvail = false; isMIOTAvail = false;//isBavail = false; @@ -1863,125 +1863,6 @@ int BlinkerMQTT::connectServer() { String host = BLINKER_F(BLINKER_SERVER_HOST); String fingerprint = BLINKER_F("84 5f a4 8a 70 5e 79 7e f5 b3 b4 20 45 c8 35 55 72 f6 85 5a"); - // WiFiClientSecure client_s; - -// BearSSL::WiFiClientSecure *client_s; - -// client_s = new BearSSL::WiFiClientSecure(); - -// BLINKER_LOG_ALL(BLINKER_F("connecting to "), host); - -// // BLINKER_LOG_FreeHeap(); - -// uint8_t connet_times = 0; -// // client_s.stop(); -// ::delay(100); - -// // bool mfln = client_s.probeMaxFragmentLength(host, httpsPort, 1024); -// // if (mfln) { -// // client_s.setBufferSizes(1024, 1024); -// // } -// client_s->setFingerprint(fingerprint.c_str()); - -// client_s->setInsecure(); - -// // while (1) { -// bool cl_connected = false; -// if (!client_s->connect(host, httpsPort)) { -// BLINKER_ERR_LOG(BLINKER_F("server connection failed")); -// // connet_times++; - -// ::delay(1000); -// } -// else { -// BLINKER_LOG_ALL(BLINKER_F("connection succeed")); -// cl_connected = true; - -// // break; -// } - -// // if (connet_times >= 4 && !cl_connected) return BLINKER_CMD_FALSE; -// // } - -// String client_msg; - -// String url_iot = BLINKER_F("/api/v1/user/device/diy/auth?authKey="); -// url_iot += _authKey; -// url_iot += _aliType; -// url_iot += _duerType; - -// // #if defined(BLINKER_ALIGENIE_LIGHT) -// // url_iot += BLINKER_F("&aliType=light"); -// // #elif defined(BLINKER_ALIGENIE_OUTLET) -// // url_iot += BLINKER_F("&aliType=outlet"); -// // #elif defined(BLINKER_ALIGENIE_SWITCH) -// // #elif defined(BLINKER_ALIGENIE_SENSOR) -// // url_iot += BLINKER_F("&aliType=sensor"); -// // #endif - -// BLINKER_LOG_ALL(BLINKER_F("HTTPS begin: "), host, url_iot); - -// client_msg = BLINKER_F("GET "); -// client_msg += url_iot; -// client_msg += BLINKER_F(" HTTP/1.1\r\nHost: "); -// client_msg += host; -// client_msg += BLINKER_F(":"); -// client_msg += STRING_format(httpsPort); -// client_msg += BLINKER_F("\r\nConnection: close\r\n\r\n"); - -// client_s->print(client_msg); - -// BLINKER_LOG_ALL(BLINKER_F("client_msg: "), client_msg); - -// unsigned long timeout = millis(); -// while (client_s->available() == 0) { -// if (millis() - timeout > 5000) { -// BLINKER_LOG_ALL(BLINKER_F(">>> Client Timeout !")); -// client_s->stop(); -// return false; -// } -// } - -// String _dataGet; -// String lastGet; -// String lengthOfJson; -// while (client_s->available()) { -// // String line = client_s.readStringUntil('\r'); -// _dataGet = client_s->readStringUntil('\n'); - -// if (_dataGet.startsWith("Content-Length: ")){ -// int addr_start = _dataGet.indexOf(' '); -// int addr_end = _dataGet.indexOf('\0', addr_start + 1); -// lengthOfJson = _dataGet.substring(addr_start + 1, addr_end); -// } - -// if (_dataGet == "\r") { -// BLINKER_LOG_ALL(BLINKER_F("headers received")); - -// break; -// } -// } - -// for(int i=0;iread(); -// } - -// // BLINKER_LOG_FreeHeap(); - -// client_s->stop(); -// client_s->flush(); - -// free(client_s); - -// // BLINKER_LOG_FreeHeap(); - -// _dataGet = lastGet; - -// BLINKER_LOG_ALL(BLINKER_F("_dataGet: "), _dataGet); - -// String payload = _dataGet; - - #ifndef BLINKER_WITHOUT_SSL client_mqtt.stop();