You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2022/09/26 11:52:29 UTC

[GitHub] [mynewt-nimble] m-gorecki opened a new pull request, #1370: apps: Add exteneded scanner sample

m-gorecki opened a new pull request, #1370:
URL: https://github.com/apache/mynewt-nimble/pull/1370

   Sample application showing how to configure extended scanning.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #1370: apps: Add exteneded scanner sample

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on PR #1370:
URL: https://github.com/apache/mynewt-nimble/pull/1370#issuecomment-1257961424

   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### apps/ext_scanner/src/main.c
   <details>
   
   ```diff
   @@ -129,58 +129,58 @@
        if (desc->props & BLE_HCI_ADV_LEGACY_MASK) {
    
    
   -    console_printf("Legacy PDU type %d", desc->legacy_event_type);
   -    if (desc->legacy_event_type == BLE_HCI_ADV_RPT_EVTYPE_DIR_IND) {
   -    directed = 1;
   -    }
   -    goto common_data;
   +        console_printf("Legacy PDU type %d", desc->legacy_event_type);
   +        if (desc->legacy_event_type == BLE_HCI_ADV_RPT_EVTYPE_DIR_IND) {
   +            directed = 1;
   +        }
   +        goto common_data;
        }
    
        console_printf("Extended adv: ");
        if (desc->props & BLE_HCI_ADV_CONN_MASK) {
   -    console_printf("'conn' ");
   +        console_printf("'conn' ");
        }
        if (desc->props & BLE_HCI_ADV_SCAN_MASK) {
   -    console_printf("'scan' ");
   +        console_printf("'scan' ");
        }
        if (desc->props & BLE_HCI_ADV_DIRECT_MASK) {
   -    console_printf("'dir' ");
   -    directed = 1;
   +        console_printf("'dir' ");
   +        directed = 1;
        }
    
        if (desc->props & BLE_HCI_ADV_SCAN_RSP_MASK) {
   -    console_printf("'scan rsp' ");
   -    }
   -
   -    switch(desc->data_status) {
   +        console_printf("'scan rsp' ");
   +    }
   +
   +    switch (desc->data_status) {
        case BLE_GAP_EXT_ADV_DATA_STATUS_COMPLETE:
   -    console_printf("complete");
   -    break;
   +        console_printf("complete");
   +        break;
        case BLE_GAP_EXT_ADV_DATA_STATUS_INCOMPLETE:
   -    console_printf("incomplete");
   -    break;
   +        console_printf("incomplete");
   +        break;
        case BLE_GAP_EXT_ADV_DATA_STATUS_TRUNCATED:
   -    console_printf("truncated");
   -    break;
   +        console_printf("truncated");
   +        break;
        default:
   -    console_printf("reserved %d", desc->data_status);
   -    break;
   -    }
   -
   -    common_data:
   +        console_printf("reserved %d", desc->data_status);
   +        break;
   +    }
   +
   +common_data:
        console_printf(" rssi=%d txpower=%d, pphy=%d, sphy=%d, sid=%d,"
        " periodic_adv_itvl=%u, addr_type=%d addr=",
        desc->rssi, desc->tx_power, desc->prim_phy, desc->sec_phy,
        desc->sid, desc->periodic_adv_itvl, desc->addr.type);
        print_addr(desc->addr.val);
        if (directed) {
   -    console_printf(" init_addr_type=%d inita=", desc->direct_addr.type);
   -    print_addr(desc->direct_addr.val);
   +        console_printf(" init_addr_type=%d inita=", desc->direct_addr.type);
   +        print_addr(desc->direct_addr.val);
        }
    
        console_printf("\n");
    
   -    if(!desc->length_data) {
   +    if (!desc->length_data) {
            return;
        }
    
   @@ -191,52 +191,52 @@
    scan_event(struct ble_gap_event *event, void *arg)
    {
        switch (event->type) {
   -        /* advertising report has been received during discovery procedure */
   -        case BLE_GAP_EVENT_EXT_DISC:
   -            switch(current_scan_mode) {
   -                case 0:
   -                    console_printf("Legacy scan advertising report received!\n");
   -                    break;
   -                case 1:
   -                    console_printf("Uncoded scan advertising report received!\n");
   -                    break;
   -                case 2:
   -                    console_printf("Coded scan advertising report received!\n");
   -                    break;
   -                case 3:
   -                    console_printf("Uncoded/coded scan advertising report received!\n");
   -                    break;
   -            }
   -            decode_event_type(&event->ext_disc);
   +    /* advertising report has been received during discovery procedure */
   +    case BLE_GAP_EVENT_EXT_DISC:
   +        switch (current_scan_mode) {
   +        case 0:
   +            console_printf("Legacy scan advertising report received!\n");
   +            break;
   +        case 1:
   +            console_printf("Uncoded scan advertising report received!\n");
   +            break;
   +        case 2:
   +            console_printf("Coded scan advertising report received!\n");
   +            break;
   +        case 3:
   +            console_printf("Uncoded/coded scan advertising report received!\n");
   +            break;
   +        }
   +        decode_event_type(&event->ext_disc);
   +        return 0;
   +
   +    /* discovery procedure has terminated */
   +    case BLE_GAP_EVENT_DISC_COMPLETE:
   +        MODLOG_DFLT(INFO, "Discovery completed, terminaton code: %d\n",
   +                        event->disc_complete.reason);
   +
   +        switch (current_scan_mode) {
   +        case BOTH_SCAN:
   +            console_printf("START LEGACY SCAN\n");
   +            legacy_scan();
                return 0;
   -
   -        /* discovery procedure has terminated */
   -        case BLE_GAP_EVENT_DISC_COMPLETE:
   -            MODLOG_DFLT(INFO, "Discovery completed, terminaton code: %d\n",
   -                        event->disc_complete.reason);
   -
   -            switch(current_scan_mode) {
   -                case BOTH_SCAN:
   -                    console_printf("START LEGACY SCAN\n");
   -                    legacy_scan();
   -                    return 0;
   -                case LEGACY_SCAN:
   -                    console_printf("START UNCODED SCAN\n");
   -                    ext_scan_uncoded();
   -                    return 0;
   -                case UNCODED_SCAN:
   -                    console_printf("START CODED SCAN\n");
   -                    ext_scan_coded();
   -                    return 0;
   -                case CODED_SCAN:
   -                    console_printf("START BOTH SCAN\n");
   -                    ext_scan_both();
   -                    return 0;
   -            }
   -        default:
   -
   -            MODLOG_DFLT(ERROR, "Discovery event not handled\n");
   +        case LEGACY_SCAN:
   +            console_printf("START UNCODED SCAN\n");
   +            ext_scan_uncoded();
                return 0;
   +        case UNCODED_SCAN:
   +            console_printf("START CODED SCAN\n");
   +            ext_scan_coded();
   +            return 0;
   +        case CODED_SCAN:
   +            console_printf("START BOTH SCAN\n");
   +            ext_scan_both();
   +            return 0;
   +        }
   +    default:
   +
   +        MODLOG_DFLT(ERROR, "Discovery event not handled\n");
   +        return 0;
        }
    }
    
   ```
   
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #1370: apps: Add exteneded scanner sample

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on PR #1370:
URL: https://github.com/apache/mynewt-nimble/pull/1370#issuecomment-1259433906

   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### apps/ext_scanner/src/main.c
   <details>
   
   ```diff
   @@ -129,58 +129,58 @@
        if (desc->props & BLE_HCI_ADV_LEGACY_MASK) {
    
    
   -    console_printf("Legacy PDU type %d", desc->legacy_event_type);
   -    if (desc->legacy_event_type == BLE_HCI_ADV_RPT_EVTYPE_DIR_IND) {
   -    directed = 1;
   -    }
   -    goto common_data;
   +        console_printf("Legacy PDU type %d", desc->legacy_event_type);
   +        if (desc->legacy_event_type == BLE_HCI_ADV_RPT_EVTYPE_DIR_IND) {
   +            directed = 1;
   +        }
   +        goto common_data;
        }
    
        console_printf("Extended adv: ");
        if (desc->props & BLE_HCI_ADV_CONN_MASK) {
   -    console_printf("'conn' ");
   +        console_printf("'conn' ");
        }
        if (desc->props & BLE_HCI_ADV_SCAN_MASK) {
   -    console_printf("'scan' ");
   +        console_printf("'scan' ");
        }
        if (desc->props & BLE_HCI_ADV_DIRECT_MASK) {
   -    console_printf("'dir' ");
   -    directed = 1;
   +        console_printf("'dir' ");
   +        directed = 1;
        }
    
        if (desc->props & BLE_HCI_ADV_SCAN_RSP_MASK) {
   -    console_printf("'scan rsp' ");
   -    }
   -
   -    switch(desc->data_status) {
   +        console_printf("'scan rsp' ");
   +    }
   +
   +    switch (desc->data_status) {
        case BLE_GAP_EXT_ADV_DATA_STATUS_COMPLETE:
   -    console_printf("complete");
   -    break;
   +        console_printf("complete");
   +        break;
        case BLE_GAP_EXT_ADV_DATA_STATUS_INCOMPLETE:
   -    console_printf("incomplete");
   -    break;
   +        console_printf("incomplete");
   +        break;
        case BLE_GAP_EXT_ADV_DATA_STATUS_TRUNCATED:
   -    console_printf("truncated");
   -    break;
   +        console_printf("truncated");
   +        break;
        default:
   -    console_printf("reserved %d", desc->data_status);
   -    break;
   -    }
   -
   -    common_data:
   +        console_printf("reserved %d", desc->data_status);
   +        break;
   +    }
   +
   +common_data:
        console_printf(" rssi=%d txpower=%d, pphy=%d, sphy=%d, sid=%d,"
        " periodic_adv_itvl=%u, addr_type=%d addr=",
        desc->rssi, desc->tx_power, desc->prim_phy, desc->sec_phy,
        desc->sid, desc->periodic_adv_itvl, desc->addr.type);
        print_addr(desc->addr.val);
        if (directed) {
   -    console_printf(" init_addr_type=%d inita=", desc->direct_addr.type);
   -    print_addr(desc->direct_addr.val);
   +        console_printf(" init_addr_type=%d inita=", desc->direct_addr.type);
   +        print_addr(desc->direct_addr.val);
        }
    
        console_printf("\n");
    
   -    if(!desc->length_data) {
   +    if (!desc->length_data) {
            return;
        }
    
   @@ -193,19 +193,19 @@
        switch (event->type) {
        /* advertising report has been received during discovery procedure */
        case BLE_GAP_EVENT_EXT_DISC:
   -        switch(current_scan_mode) {
   -            case 0:
   -                console_printf("Legacy scan advertising report received!\n");
   -                break;
   -            case 1:
   -                console_printf("Uncoded scan advertising report received!\n");
   -                break;
   -            case 2:
   -                console_printf("Coded scan advertising report received!\n");
   -                break;
   -            case 3:
   -                console_printf("Uncoded/coded scan advertising report received!\n");
   -                break;
   +        switch (current_scan_mode) {
   +        case 0:
   +            console_printf("Legacy scan advertising report received!\n");
   +            break;
   +        case 1:
   +            console_printf("Uncoded scan advertising report received!\n");
   +            break;
   +        case 2:
   +            console_printf("Coded scan advertising report received!\n");
   +            break;
   +        case 3:
   +            console_printf("Uncoded/coded scan advertising report received!\n");
   +            break;
            }
            decode_event_type(&event->ext_disc);
            return 0;
   @@ -215,23 +215,23 @@
            MODLOG_DFLT(INFO, "Discovery completed, terminaton code: %d\n",
                        event->disc_complete.reason);
    
   -        switch(current_scan_mode) {
   -            case BOTH_SCAN:
   -                console_printf("START LEGACY SCAN\n");
   -                legacy_scan();
   -                return 0;
   -            case LEGACY_SCAN:
   -                console_printf("START UNCODED SCAN\n");
   -                ext_scan_uncoded();
   -                return 0;
   -            case UNCODED_SCAN:
   -                console_printf("START CODED SCAN\n");
   -                ext_scan_coded();
   -                return 0;
   -            case CODED_SCAN:
   -                console_printf("START BOTH SCAN\n");
   -                ext_scan_both();
   -                return 0;
   +        switch (current_scan_mode) {
   +        case BOTH_SCAN:
   +            console_printf("START LEGACY SCAN\n");
   +            legacy_scan();
   +            return 0;
   +        case LEGACY_SCAN:
   +            console_printf("START UNCODED SCAN\n");
   +            ext_scan_uncoded();
   +            return 0;
   +        case UNCODED_SCAN:
   +            console_printf("START CODED SCAN\n");
   +            ext_scan_coded();
   +            return 0;
   +        case CODED_SCAN:
   +            console_printf("START BOTH SCAN\n");
   +            ext_scan_both();
   +            return 0;
            }
        default:
    
   ```
   
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org