@@ -76,6 +76,7 @@ bool ClientScan::stop(){
7676}
7777
7878void ClientScan::packetSniffer (uint8_t *buf, uint16_t len){
79+ int cliNbr;
7980 if (sniffing && len>27 ){
8081 from.set (buf[16 ],buf[17 ],buf[18 ],buf[19 ],buf[20 ],buf[21 ]);
8182 to.set (buf[22 ],buf[23 ],buf[24 ],buf[25 ],buf[26 ],buf[27 ]);
@@ -87,15 +88,19 @@ void ClientScan::packetSniffer(uint8_t *buf, uint16_t len){
8788 if (clientNum == -1 && results < maxClientScanResults){
8889 data_getVendor (to._get (0 ),to._get (1 ),to._get (2 )).toCharArray (vendors[results],9 );
8990 results++;
90- packets[clients.add (to)]++;
91+ cliNbr = clients.add (to);
92+ packets[cliNbr]++;
93+ connectedToAp[cliNbr] = i;
9194 }else packets[clientNum]++;
92- /* if(debug){
95+ /*
96+ if(debug){
9397 Serial.print("found: ");
9498 from._print();
9599 Serial.print(" => ");
96100 to._print();
97101 Serial.println("");
98- }*/
102+ }
103+ */
99104 }
100105 }
101106 }
@@ -107,6 +112,7 @@ String ClientScan::getClientName(int num){ return nameList.get(clients._get(num)
107112int ClientScan::getClientPackets (int num){ return packets[clients.getNum (clients._get (num))]; }
108113String ClientScan::getClientVendor (int num){ return vendors[num]; }
109114Mac ClientScan::getClientMac (int num){ return clients._get (num); }
115+ int ClientScan::getClientConnectedAp (int num){ return connectedToAp[num]; }
110116bool ClientScan::getClientSelected (int num){ return selected[num]; }
111117int ClientScan::getFirstClient (){
112118 for (int i=0 ;i<maxClientScanResults;i++){
@@ -124,7 +130,8 @@ String ClientScan::getResults(){
124130 json += " \" m\" :\" " +getClientMac (i).toString ()+" \" ," ;
125131 json += " \" n\" :\" " +(String)nameList.get (getClientMac (i))+" \" ," ;
126132 json += " \" v\" :\" " +(String)getClientVendor (i)+" \" ," ;
127- json += " \" s\" :" +(String)getClientSelected (i);
133+ json += " \" s\" :" +(String)getClientSelected (i)+" ," ;
134+ json += " \" a\" :\" " +(String)apScan.getAPName (getClientConnectedAp (i))+" \" " ;
128135 json += " }" ;
129136 if ((i!=results-1 ) && (i!=maxClientScanResults-1 )) json += " ," ;
130137 }
0 commit comments