Merge pull request #420 from adafruit/develop

fix #391
This commit is contained in:
Ha Thach authored and GitHub committed 2020-01-15 15:31:35 +07:00
commit e01ac26d20
1 file changed
+17 -17
@@ -245,7 +245,7 @@ void scan_callback(ble_gap_evt_adv_report_t* report)
memset(buffer, 0, sizeof(buffer)); memset(buffer, 0, sizeof(buffer));
/* Display the timestamp and device address */ /* Display the timestamp and device address */
if (report->scan_rsp) if (report->type.scan_response)
{ {
Serial.printf("[SR%10d] Packet received from ", millis()); Serial.printf("[SR%10d] Packet received from ", millis());
} }
@@ -258,11 +258,11 @@ void scan_callback(ble_gap_evt_adv_report_t* report)
Serial.println(""); Serial.println("");
/* Raw buffer contents */ /* Raw buffer contents */
Serial.printf("%14s %d bytes\n", "PAYLOAD", report->dlen); Serial.printf("%14s %d bytes\n", "PAYLOAD", report->data.len);
if (report->dlen) if (report->data.len)
{ {
Serial.printf("%15s", " "); Serial.printf("%15s", " ");
Serial.printBuffer(report->data, report->dlen, '-'); Serial.printBuffer(report->data.p_data, report->data.len, '-');
Serial.println(); Serial.println();
} }
@@ -271,20 +271,20 @@ void scan_callback(ble_gap_evt_adv_report_t* report)
/* Adv Type */ /* Adv Type */
Serial.printf("%14s ", "ADV TYPE"); Serial.printf("%14s ", "ADV TYPE");
switch (report->type) if ( report->type.connectable )
{ {
case BLE_GAP_ADV_TYPE_ADV_IND: Serial.print("Connectable ");
Serial.printf("Connectable undirected\n"); }else
break; {
case BLE_GAP_ADV_TYPE_ADV_DIRECT_IND: Serial.print("Non-connectable ");
Serial.printf("Connectable directed\n"); }
break;
case BLE_GAP_ADV_TYPE_ADV_SCAN_IND: if ( report->type.directed )
Serial.printf("Scannable undirected\n"); {
break; Serial.println("directed");
case BLE_GAP_ADV_TYPE_ADV_NONCONN_IND: }else
Serial.printf("Non-connectable undirected\n"); {
break; Serial.println("undirected");
} }
/* Shortened Local Name */ /* Shortened Local Name */