Why does the serial debugging assistant output the entire response?Actually, I only need the content between ******************************* to be returned.
i use:
esp8266 ch340 wifi
b4r 4.0
openjdk14
Arduino IDE 2.3.2
B4R:
Sub Process_Globals
Public Serial1 As Serial
Private wifi As ESP8266WiFi
Private timer1 As Timer
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
'example of connecting to a local network
If wifi.Connect2("HONOR 20", "12345678") Then
Log("connect WiFi")
Log(JoinStrings(Array As String("esp8266 IP :",wifi.LocalIp)))
HttpJob.Initialize("getip")
timer1.Initialize("Timer1_Tick",10000)
timer1.Enabled=True
Else
Log(" WiFi filed")
End If
End Sub
Private Sub Timer1_Tick
HttpJob.Download("https://ipservice.ws.126.net/locate/api/getLocByIp")
End Sub
Sub JobDone (Job As JobResult)
Log("*******************************")
If Job.Success Then
If Job.JobName = "getip" Then
Log(Job.Response)
End If
Else
Log("ErrorMessage: ", Job.ErrorMessage)
Log("Status: ", Job.Status)
Log(Job.Response)
End If
Log("*******************************")
End Sub
serial' http response:
trying to connect to: ipservice.ws.126.net port: 443 ssl: 1
connected: ipservice.ws.126.net
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 13 Apr 2024 10:31:08 GMT
Content-Type: application/json;
charset=utf-8
Content-Length: 361
Connection: close
Vary: Accept-Encoding
vary: Accept-Encoding
x-envoy-upstream-service-time: 9
X-Content-From: netease
{"message":"查询成功","status":20
0,"result":{"administrativeCode":"32300","areaCode":"86","areaLat":"31.74043","areaLng":"119.57757"
,"city":"city1","company":"chinaunicom.com","continentCode":"AP","country":"china","countrySymbol"
:"CN","ip":"172.195.38.71","network":"AP","operator":"联通","province":"江苏","timezone":"Asia/S
hanghai","utc":"UTC+8"}}
*******************************
{"message":"查询成功","status":20
0,"result":{"administrativeCode":"32300","areaCode":"86","areaLat":"31.74043","areaLng":"119.57757"
,"city":"city1","company":"chinaunicom.com","continentCode":"AP","country":"china","countrySymbol"
:"CN","ip":"172.195.38.71","network":"AP","operator":"联通","province":"江苏","timezone":"Asia/S
hanghai","utc":"UTC+8"}}
*******************************
i use:
esp8266 ch340 wifi
b4r 4.0
openjdk14
Arduino IDE 2.3.2