File tree 3 files changed +34
-4
lines changed
3 files changed +34
-4
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,28 @@ String APScan::getResults(){
140
140
return json;
141
141
}
142
142
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
+
143
165
void APScan::select (int num){
144
166
if (debug) Serial.println (" seect " +(String)num+" - " +!selected[num]);
145
167
if (selected[num]){
@@ -153,4 +175,4 @@ void APScan::select(int num){
153
175
154
176
bool APScan::isSelected (int num){
155
177
return selected[num];
156
- }
178
+ }
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ class APScan{
19
19
20
20
bool start ();
21
21
String getResults ();
22
+ String getResult (int i);
22
23
void select (int num);
23
24
24
25
String getAPName (int num);
@@ -48,4 +49,4 @@ class APScan{
48
49
bool selected[maxAPScanResults];
49
50
};
50
51
51
- #endif
52
+ #endif
Original file line number Diff line number Diff line change @@ -136,7 +136,14 @@ void startAPScan(){
136
136
}
137
137
}
138
138
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
+ }
140
147
141
148
void selectAP (){
142
149
if (server.hasArg (" num" )) {
@@ -273,4 +280,4 @@ void editClientName(){
273
280
server.send ( 200 , " text/json" , " true" );
274
281
}
275
282
}
276
-
283
+
You can’t perform that action at this time.
0 commit comments