esp32_marauder/WiFiScan.cpp
// Function to start running any BLE scan
Function to start running any BLE scan
Function to start running any BLE scan
void WiFiScan::RunBluetoothScan(uint8_t scan_mode, uint16_t color)
{
  display_obj.print_delay_1 = 50;
  display_obj.print_delay_2 = 20;
  BLEDevice::init("");
  pBLEScan = BLEDevice::getScan(); 
  if (scan_mode == BT_SCAN_ALL)
  {
    display_obj.TOP_FIXED_AREA_2 = 48;
    display_obj.tteBar = true;
    display_obj.initScrollValues(true);
    tft.setTextWrap(false);
    tft.setTextColor(TFT_BLACK, color);
    tft.fillRect(0,16,240,16, color);
    tft.drawCentreString(" Bluetooth Sniff ",120,16,2);
    display_obj.touchToExit();
    tft.setTextColor(TFT_CYAN, TFT_BLACK);
    display_obj.setupScrollArea(display_obj.TOP_FIXED_AREA_2, BOT_FIXED_AREA);
    pBLEScan->setAdvertisedDeviceCallbacks(new bluetoothScanAllCallback());
  }
  else if (scan_mode == BT_SCAN_SKIMMERS)
  {
    display_obj.TOP_FIXED_AREA_2 = 160;
    display_obj.tteBar = true;
    tft.fillScreen(TFT_DARKGREY);
    display_obj.initScrollValues(true);
    tft.setTextWrap(false);
    tft.setTextColor(TFT_BLACK, color);
    tft.fillRect(0,16,240,16, color);
    tft.drawCentreString(" Detect Card Skimmers ",120,16,2);
    display_obj.twoPartDisplay("Scanning for\nBluetooth-enabled skimmers\nHC-03, HC-05, and HC-06...");
    tft.setTextColor(TFT_BLACK, TFT_DARKGREY);
    display_obj.setupScrollArea(display_obj.TOP_FIXED_AREA_2, BOT_FIXED_AREA);
    pBLEScan->setAdvertisedDeviceCallbacks(new bluetoothScanSkimmersCallback());
  }
  pBLEScan->setActiveScan(true); 
  pBLEScan->setInterval(100);
  pBLEScan->setWindow(99);  
  pBLEScan->start(0, scanCompleteCB);
  Serial.println("Started BLE Scan");
  initTime = millis();
}
void WiFiScan :: RunBluetoothScan ( uint8_t scan_mode , uint16_t color ) { display_obj . print_delay_1 = 50 ; display_obj . print_delay_2 = 20 ; BLEDevice :: init ( " " ) ; pBLEScan = BLEDevice :: getScan ( ) ; if ( scan_mode == BT_SCAN_ALL ) { display_obj . TOP_FIXED_AREA_2 = 48 ; display_obj . tteBar = true ; display_obj . initScrollValues ( true ) ; tft . setTextWrap ( false ) ; tft . setTextColor ( TFT_BLACK , color ) ; tft . fillRect ( 0 , 16 , 240 , 16 , color ) ; tft . drawCentreString ( " " , 120 , 16 , 2 ) ; display_obj . touchToExit ( ) ; tft . setTextColor ( TFT_CYAN , TFT_BLACK ) ; display_obj . setupScrollArea ( display_obj . TOP_FIXED_AREA_2 , BOT_FIXED_AREA ) ; pBLEScan -> setAdvertisedDeviceCallbacks ( new bluetoothScanAllCallback ( ) ) ; } else if ( scan_mode == BT_SCAN_SKIMMERS ) { display_obj . TOP_FIXED_AREA_2 = 160 ; display_obj . tteBar = true ; tft . fillScreen ( TFT_DARKGREY ) ; display_obj . initScrollValues ( true ) ; tft . setTextWrap ( false ) ; tft . setTextColor ( TFT_BLACK , color ) ; tft . fillRect ( 0 , 16 , 240 , 16 , color ) ; tft . drawCentreString ( " " , 120 , 16 , 2 ) ; display_obj . twoPartDisplay ( " \n \n " ) ; tft . setTextColor ( TFT_BLACK , TFT_DARKGREY ) ; display_obj . setupScrollArea ( display_obj . TOP_FIXED_AREA_2 , BOT_FIXED_AREA ) ; pBLEScan -> setAdvertisedDeviceCallbacks ( new bluetoothScanSkimmersCallback ( ) ) ; } pBLEScan -> setActiveScan ( true ) ; pBLEScan -> setInterval ( 100 ) ; pBLEScan -> setWindow ( 99 ) ; pBLEScan -> start ( 0 , scanCompleteCB ) ; Serial . println ( " " ) ; initTime = millis ( ) ; }
Function to start running any BLE scan
Function to start running any BLE scan
/*
  esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
  esp_err_t init_ret = esp_bt_controller_init(&bt_cfg);
  if (init_ret != ESP_OK)
    Serial.println("Could not initialize BT Controller: " + (String)init_ret);

  //esp_bt_controller_enable(ESP_BT_MODE_CLASSIC_BT);
  //esp_bt_controller_disable();


  esp_err_t ret = esp_bt_controller_enable(ESP_BT_MODE_BTDM);
  if (ret != ESP_OK)
    Serial.println("Could not enable BT Controller: " + (String)ret);

  Serial.println("BT Controller Status: " + (String)esp_bt_controller_get_status());
  */ //create new scan //display_obj.clearScreen(); //bluetoothScanAllCallback myCallbacks; //pBLEScan->setAdvertisedDeviceCallbacks(&myCallbacks); //display_obj.clearScreen(); //active scan uses more power, but get results faster // less or equal setInterval value