






Started logging.

<<<
Content-Length: 3234

{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":18180,"clientInfo":{"name":"vscode","version":"1.50.0"},"rootPath":"c:\\Users\\zhang'pei\\Desktop\\ESP32-2432S028例子\\arduino\\Source code\\4_3_wifi_SmartConfig","rootUri":"file:///c%3A/Users/zhang%27pei/Desktop/ESP32-2432S028%E4%BE%8B%E5%AD%90/arduino/Source%20code/4_3_wifi_SmartConfig","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional"},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":false,"tagSupport":{"valueSet":[1,2]}},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true,"tagSupport":{"valueSet":[1]}},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true}},"contextSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true},"codeAction":{"dynamicRegistration":true,"isPreferredSupport":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true},"declaration":{"dynamicRegistration":true,"linkSupport":true},"selectionRange":{"dynamicRegistration":true}},"window":{"workDoneProgress":true}},"initializationOptions":{},"trace":"off","workspaceFolders":[{"uri":"file:///c%3A/Users/zhang%27pei/Desktop/ESP32-2432S028%E4%BE%8B%E5%AD%90/arduino/Source%20code/4_3_wifi_SmartConfig","name":"4_3_wifi_SmartConfig"}]}}
>>>
Content-Length: 598

{"id":0,"result":{"capabilities":{"textDocumentSync":2,"hoverProvider":true,"completionProvider":{"triggerCharacters":[".","\u003e",":"]},"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"codeActionProvider":true,"documentFormattingProvider":true,"documentRangeFormattingProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"\n"},"renameProvider":false,"executeCommandProvider":{"commands":["clangd.applyFix","clangd.applyTweak"]}}},"jsonrpc":"2.0"}
<<<
Content-Length: 52

{"jsonrpc":"2.0","method":"initialized","params":{}}Content-Length: 1508

{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///c%3A/Users/zhang%27pei/Desktop/ESP32-2432S028%E4%BE%8B%E5%AD%90/arduino/Source%20code/4_3_wifi_SmartConfig/4_3_wifi_SmartConfig.ino","languageId":"cpp","version":1,"text":"#include <Arduino.h>\r\n#include \"WiFi.h\"\r\n\r\nvoid mySmartWifiConfig()\r\n{\r\n  WiFi.mode(WIFI_MODE_STA);\r\n  Serial.println(\"开启智能配网:\");\r\n  WiFi.beginSmartConfig();\r\n  while (1)\r\n  {\r\n    Serial.print(\".\");\r\n    delay(500);\r\n    if (WiFi.smartConfigDone())\r\n    {\r\n      Serial.println(\"配网成功\");\r\n      Serial.printf(\"SSID:%s\", WiFi.SSID().c_str());\r\n      Serial.printf(\"PSW:%s\", WiFi.psk().c_str());\r\n      break;\r\n    }\r\n  }\r\n}\r\n\r\nbool autoConfig()\r\n{\r\n  WiFi.disconnect(true,true);\r\n  WiFi.begin();\r\n  for (size_t i = 0; i < 20; i++)\r\n  {\r\n    int wifiStatus = WiFi.status();\r\n    if (wifiStatus == WL_CONNECTED)\r\n    {\r\n      Serial.println(\"自动连接成功!\");\r\n      return 1;\r\n    }\r\n    else\r\n    {\r\n      delay(1000);\r\n      Serial.println(\"等待自动配网中...\");\r\n    }\r\n  }\r\n  Serial.println(\"无法自动配网!\");\r\n  return 0;\r\n}\r\n\r\nvoid setup()\r\n{\r\n  Serial.begin(115200);\r\n  delay(5000);\r\n  if (!autoConfig())\r\n  {\r\n    mySmartWifiConfig();\r\n  }\r\n}\r\nvoid loop()\r\n{\r\n  if (WiFi.isConnected())\r\n  {\r\n    Serial.println(\"网络已连接\");\r\n    delay(1000);\r\n  }\r\n}\r\n"}}}