File tree Expand file tree Collapse file tree 3 files changed +34
-4
lines changed
Expand file tree Collapse file tree 3 files changed +34
-4
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,28 @@ String APScan::getResults(){
140140 return json;
141141}
142142
143+ String APScan::getResult (int i){
144+ if (debug) Serial.print (" getting AP scan result JSON for ID " + String (i));
145+ String json = " { \" aps\" :[ " ;
146+ if (debug) Serial.print (" ." );
147+ json += " {" ;
148+ json += " \" i\" :" +(String)i+" ," ;
149+ json += " \" c\" :" +(String)getAPChannel (i)+" ," ;
150+ json += " \" m\" :\" " +getAPMac (i)+" \" ," ;
151+ json += " \" ss\" :\" " +getAPName (i)+" \" ," ;
152+ json += " \" r\" :" +(String)getAPRSSI (i)+" ," ;
153+ json += " \" e\" :" +(String)encryption[i]+" ," ;
154+ // json += "\"v\":\""+getAPVendor(i)+"\",";
155+ json += " \" se\" :" +(String)getAPSelected (i);
156+ json += " }" ;
157+ json += " ] }" ;
158+ if (debug){
159+ Serial.println (json);
160+ Serial.println (" done" );
161+ }
162+ return json;
163+ }
164+
143165void APScan::select (int num){
144166 if (debug) Serial.println (" seect " +(String)num+" - " +!selected[num]);
145167 if (selected[num]){
@@ -153,4 +175,4 @@ void APScan::select(int num){
153175
154176bool APScan::isSelected (int num){
155177 return selected[num];
156- }
178+ }
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ class APScan{
1919
2020 bool start ();
2121 String getResults ();
22+ String getResult (int i);
2223 void select (int num);
2324
2425 String getAPName (int num);
@@ -48,4 +49,4 @@ class APScan{
4849 bool selected[maxAPScanResults];
4950};
5051
51- #endif
52+ #endif
Original file line number Diff line number Diff line change @@ -136,7 +136,14 @@ void startAPScan(){
136136 }
137137}
138138
139- void sendAPResults (){ server.send ( 200 , " text/json" , apScan.getResults ()); }
139+ void sendAPResults (){
140+ if (server.hasArg (" apid" )) {
141+ int apid = server.arg (" apid" ).toInt ();
142+ server.send ( 200 , " text/json" , apScan.getResult (apid));
143+ } else {
144+ server.send ( 200 , " text/json" , apScan.getResults ());
145+ }
146+ }
140147
141148void selectAP (){
142149 if (server.hasArg (" num" )) {
@@ -273,4 +280,4 @@ void editClientName(){
273280 server.send ( 200 , " text/json" , " true" );
274281 }
275282}
276-
283+
You can’t perform that action at this time.
0 commit comments