Merge branch 'master' of https://github.com/cyberman54/ESP32-Paxcounter
This commit is contained in:
		
						commit
						bd60d53746
					
				| @ -118,10 +118,15 @@ void do_send(osjob_t* j){ | ||||
|     mydata[0] = (data & 0xff00) >> 8; | ||||
|     mydata[1] = data  & 0xff; | ||||
|      | ||||
|     #ifdef BLECOUNTER | ||||
|     // Sum of unique BLE MACs seen
 | ||||
|     data = (uint16_t) bles.size(); | ||||
|     mydata[2] = (data & 0xff00) >> 8; | ||||
|     mydata[3] = data  & 0xff; | ||||
|     #else | ||||
|     mydata[2] = 0; | ||||
|     mydata[3] = 0; | ||||
|     #endif | ||||
| 
 | ||||
|     // Total BLE+WIFI unique MACs seen
 | ||||
|     // TBD ?
 | ||||
|  | ||||
| @ -60,10 +60,13 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) { | ||||
|             if (sniff_type == MAC_SNIFF_WIFI ) { | ||||
|                 rgb_set_color(COLOR_GREEN); | ||||
|                 wifis.insert(hashedmac);   // add hashed MAC to wifi container if new unique
 | ||||
|             } else if (sniff_type == MAC_SNIFF_BLE ) { | ||||
|             }  | ||||
|             #ifdef BLECOUNTER | ||||
|             else if (sniff_type == MAC_SNIFF_BLE ) { | ||||
|                 rgb_set_color(COLOR_MAGENTA); | ||||
|                 bles.insert(hashedmac);    // add hashed MAC to BLE container if new unique
 | ||||
|             } | ||||
|             #endif | ||||
|             // Not sure user will have time to see the LED
 | ||||
|             // TBD do light off further in the code
 | ||||
|             rgb_set_color(COLOR_NONE); | ||||
| @ -72,7 +75,12 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) { | ||||
|         ESP_LOGI(TAG, "%s RSSI %ddBi -> MAC %s -> Hash %04X -> WiFi:%d  BLE:%d  %s",  | ||||
|                         sniff_type==MAC_SNIFF_WIFI ? "WiFi":"BLE ",  | ||||
|                         rssi, buff, hashedmac,  | ||||
|                         (int) wifis.size(), (int) bles.size(), | ||||
|                         (int) wifis.size(),  | ||||
|                         #ifdef BLECOUNTER | ||||
|                             (int) bles.size(), | ||||
|                         #else | ||||
|                             0, | ||||
|                         #endif | ||||
|                         added ? "New" : "Already seen"); | ||||
| 
 | ||||
|     #ifdef VENDORFILTER | ||||
| @ -96,7 +104,7 @@ class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks { | ||||
|         /* to be done here:
 | ||||
|         #ifdef VENDORFILTER | ||||
|          | ||||
|         filter BLE devices using their advertisements to get second filter additional to vendor OUI | ||||
|         filter BLE devices using their advertisements to get filter alternative to vendor OUI | ||||
|         if vendorfiltering is on, we ... | ||||
|         - want to count: mobile phones and tablets | ||||
|         - don't want to count: beacons, peripherals (earphones, headsets, printers), cars and machines | ||||
| @ -105,11 +113,9 @@ class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks { | ||||
| 
 | ||||
|         http://www.libelium.com/products/meshlium/smartphone-detection/
 | ||||
| 
 | ||||
|         http://dev.ti.com/tirex/content/simplelink_academy_cc2640r2sdk_1_12_01_16/modules/ble_scan_adv_basic/ble_scan_adv_basic.html
 | ||||
|         https://www.question-defense.com/2013/01/12/bluetooth-cod-bluetooth-class-of-deviceclass-of-service-explained
 | ||||
| 
 | ||||
|         http://microchipdeveloper.com/wireless:ble-link-layer-packet-types
 | ||||
| 
 | ||||
|         http://microchipdeveloper.com/wireless:ble-link-layer-address
 | ||||
|         https://www.bluetooth.com/specifications/assigned-numbers/baseband
 | ||||
| 
 | ||||
|         "The Class of Device (CoD) in case of Bluetooth which allows us to differentiate the type of  | ||||
|         device (smartphone, handsfree, computer, LAN/network AP). With this parameter we can  | ||||
|  | ||||
							
								
								
									
										16
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								src/main.cpp
									
									
									
									
									
								
							| @ -218,7 +218,7 @@ void lorawan_loop(void * pvParameters) { | ||||
| #ifdef BLECOUNTER | ||||
|     void BLECount(void); | ||||
| #else | ||||
|     btStop(); | ||||
|     bool btstop = btStop(); | ||||
| #endif | ||||
| 
 | ||||
| void set_onboard_led(int st){ | ||||
| @ -272,21 +272,24 @@ void sniffer_loop(void * pvParameters) { | ||||
|         ESP_LOGI(TAG, "Wifi set channel %d", channel); | ||||
| 
 | ||||
|         snprintf(buff, sizeof(buff), "PAX:%d", (int) macs.size()); // convert 16-bit MAC counter to decimal counter value
 | ||||
|         u8x8.draw2x2String(0, 0, buff);          // display number on unique macs total Wifi + BLE
 | ||||
|         u8x8.setCursor(0,3); | ||||
|         u8x8.draw2x2String(0, 0, buff);          // display number on unique macs total
 | ||||
| 
 | ||||
|         #ifdef BLECOUNTER | ||||
|             // We just state out of BLE scanning
 | ||||
|             u8x8.setCursor(0,3); | ||||
|             if (currentScanDevice) { | ||||
|                 u8x8.printf("BLE:  %-4d %-4d", (int) bles.size(), currentScanDevice); | ||||
|             } else { | ||||
|                 u8x8.printf("BLE:  %-4d", (int) bles.size()); | ||||
|             } | ||||
|         #endif | ||||
| 
 | ||||
|         u8x8.setCursor(0,4); | ||||
|         u8x8.printf("WIFI: %-4d", (int) wifis.size()); | ||||
|         u8x8.setCursor(11,4); | ||||
|         u8x8.printf("ch:%02i", channel); | ||||
|         u8x8.setCursor(0,5); | ||||
|         u8x8.printf(!cfg.rssilimit ? "RLIM: off" : "RLIM: %-3d", cfg.rssilimit); | ||||
|         //u8x8.printf(" ch:%02i", channel);
 | ||||
| 
 | ||||
|         // duration of one wifi scan loop reached? then send data and begin new scan cycle
 | ||||
|         if ( nloop >= ( (100 / cfg.wifichancycle) * (cfg.wifiscancycle * 2)) +1 ) { | ||||
| @ -336,8 +339,9 @@ void sniffer_loop(void * pvParameters) { | ||||
|         else { | ||||
|             #ifdef BLECOUNTER | ||||
|                 if (nloop % (WIFI_CHANNEL_MAX * cfg.blescancycle) == 0 )   // once after cfg.blescancycle Wifi scans, do a BLE scan
 | ||||
|                     if (cfg.blescan)                 // execute BLE count if BLE function is enabled
 | ||||
|                         BLECount();            | ||||
|                     if (cfg.blescan) {              // execute BLE count if BLE function is enabled
 | ||||
|                         BLECount();                 // start BLE scan, this is a blocking call
 | ||||
|                     } | ||||
|             #endif | ||||
|         } // end of channel rotation loop
 | ||||
|     } // end of infinite wifi scan loop
 | ||||
|  | ||||
| @ -68,7 +68,9 @@ void set_reset(int val) { | ||||
|             ESP_LOGI(TAG, "Remote command: reset MAC counter"); | ||||
|             macs.clear(); // clear all macs container
 | ||||
|             wifis.clear(); // clear Wifi macs container
 | ||||
|             #ifdef BLECOUNTER | ||||
|                 bles.clear(); // clear BLE macs container
 | ||||
|             #endif | ||||
|             salt_reset(); // get new 16bit salt
 | ||||
|             u8x8.clearLine(0); u8x8.clearLine(1); // clear Display counter
 | ||||
|             u8x8.clearLine(5); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user