<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Wireless MCUのトピックRe: Catch scan request on KW45</title>
    <link>https://community.nxp.com/t5/Wireless-MCU/Catch-scan-request-on-KW45/m-p/1814751#M16704</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/229518"&gt;@Liwa&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Hope you are doing well.&lt;/P&gt;
&lt;P&gt;You could try adding the gExtScanNotification_c event as a case in the BleApp_AdvertisingCallback function. This event indicates that a SCAN_REQ PDU has been received by an&amp;nbsp;&lt;SPAN&gt;extended advertiser&lt;/SPAN&gt;.&lt;/P&gt;
&lt;P&gt;Also, it is important to consider that the Scan Type must be set as&amp;nbsp;&lt;SPAN&gt;Active Scanning &lt;/SPAN&gt;on the Scanner device, so this device can send Scan Requests to the advertiser.&lt;/P&gt;
&lt;P&gt;Once the event occurs, you can get this information in gapAdvertisingEvent_t.eventData.scanNotification:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EduardoZamora_0-1708703990773.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/264801iC3787560B2B1676C/image-size/large?v=v2&amp;amp;px=999" role="button" title="EduardoZamora_0-1708703990773.png" alt="EduardoZamora_0-1708703990773.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Eduardo.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Feb 2024 16:00:22 GMT</pubDate>
    <dc:creator>EduardoZamora</dc:creator>
    <dc:date>2024-02-23T16:00:22Z</dc:date>
    <item>
      <title>Catch scan request on KW45</title>
      <link>https://community.nxp.com/t5/Wireless-MCU/Catch-scan-request-on-KW45/m-p/1812882#M16691</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm working on on a KW45 based board, I'm working on BLE ADV, I want to test if a scan request is reveived, then I will send the ADV data with the scan response, but i could not find a way to check if a scan request is received or not, here is my code :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;typedef struct advState_tag{
    bool_t      advOn;
}advState_t;
/* Adv State */
static advState_t  mAdvState;

/*! *********************************************************************************
* \brief        Handles BLE Advertising callback from host stack.
*
* \param[in]    pAdvertisingEvent    Pointer to gapAdvertisingEvent_t.
********************************************************************************** */
static void BleApp_AdvertisingCallback (gapAdvertisingEvent_t* pAdvertisingEvent)
{
    switch (pAdvertisingEvent-&amp;gt;eventType)
    {
        case gAdvertisingStateChanged_c:
        {
            mAdvState.advOn = !mAdvState.advOn;

            if(mAdvState.advOn)
            {
            }
            else
            {
            }
        }
        break;

        case gAdvertisingCommandFailed_c:
        {
        }
        break;

        default:
        {
            ; /* For MISRA Compliance */
        }
        break;
    }
}


static void vBleSensitivityMeasurement( uint32_t channelId )
{
	/* Set New Lowpower Constraint on Advertising start request */
	( void )PWR_SetLowPowerModeConstraint(PWR_WFI);

	/** (!) */
	OSA_vidTaskSleep(10);

    Controller_SetTxPowerLevel(ADV_POWER_DBM, channelId);

	/*LED ON*/
	GPIO_PinWrite(DIAG_LED_GPIO, DIAG_LED_PIN, DIAG_LED_ON);

	BluetoothLEHost_StartAdvertising(&amp;amp;RADIATION_strAdvertisingData, BleApp_AdvertisingCallback, NULL);

	OSA_vidTaskSleep(ADV_DURATION_MS); // TODO change 3000 with ADV_DURATION_MS

	Gap_StopAdvertising();

	GPIO_PinWrite(DIAG_LED_GPIO, DIAG_LED_PIN, DIAG_LED_OFF);

    // Wait for the tester's response
    bool scanRequestReceived = true;// WaitForScanRequest(); // TODO Implement this function

    if (scanRequestReceived) {
        // Scan request received
        // Turn off the LED and send a SCAN Response
        GPIO_PinWrite(DIAG_LED_GPIO, DIAG_LED_PIN, DIAG_LED_OFF);
//        BluetoothLEHost_SendScanResponse(/* scan response data */);
    } else {
        // Scan request not received
        // Light the LED for 500ms
        GPIO_PinWrite(DIAG_LED_GPIO, DIAG_LED_PIN, DIAG_LED_ON);
        OSA_vidTaskSleep(500);
    }&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 21 Feb 2024 14:43:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Wireless-MCU/Catch-scan-request-on-KW45/m-p/1812882#M16691</guid>
      <dc:creator>Liwa</dc:creator>
      <dc:date>2024-02-21T14:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: Catch scan request on KW45</title>
      <link>https://community.nxp.com/t5/Wireless-MCU/Catch-scan-request-on-KW45/m-p/1814751#M16704</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/229518"&gt;@Liwa&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Hope you are doing well.&lt;/P&gt;
&lt;P&gt;You could try adding the gExtScanNotification_c event as a case in the BleApp_AdvertisingCallback function. This event indicates that a SCAN_REQ PDU has been received by an&amp;nbsp;&lt;SPAN&gt;extended advertiser&lt;/SPAN&gt;.&lt;/P&gt;
&lt;P&gt;Also, it is important to consider that the Scan Type must be set as&amp;nbsp;&lt;SPAN&gt;Active Scanning &lt;/SPAN&gt;on the Scanner device, so this device can send Scan Requests to the advertiser.&lt;/P&gt;
&lt;P&gt;Once the event occurs, you can get this information in gapAdvertisingEvent_t.eventData.scanNotification:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EduardoZamora_0-1708703990773.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/264801iC3787560B2B1676C/image-size/large?v=v2&amp;amp;px=999" role="button" title="EduardoZamora_0-1708703990773.png" alt="EduardoZamora_0-1708703990773.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Eduardo.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2024 16:00:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Wireless-MCU/Catch-scan-request-on-KW45/m-p/1814751#M16704</guid>
      <dc:creator>EduardoZamora</dc:creator>
      <dc:date>2024-02-23T16:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Catch scan request on KW45</title>
      <link>https://community.nxp.com/t5/Wireless-MCU/Catch-scan-request-on-KW45/m-p/1814771#M16705</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/200888"&gt;@EduardoZamora&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thank you for your response, just to be sure this is how I should send the scan response is that it ? by advertising with new ADV scan resp data ?&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;static void BleApp_AdvertisingCallback (gapAdvertisingEvent_t* pAdvertisingEvent)
{
    switch (pAdvertisingEvent-&amp;gt;eventType)
    {
        case gAdvertisingStateChanged_c:
        {
            mAdvState.advOn = !mAdvState.advOn;

            if(mAdvState.advOn)
            {
            	 asm("nop");
            }
            else
            {
            	 asm("nop");
            }
        }
        break;

        case gAdvertisingCommandFailed_c:
        {
        	 asm("nop");
			GPIO_PinWrite(DIAG_LED_GPIO, DIAG_LED_PIN, DIAG_LED_OFF);
			OSA_vidTaskSleep(500);
        }
        break;

        case gExtScanNotification_c:
        {
        	GPIO_PinWrite(DIAG_LED_GPIO, DIAG_LED_PIN, DIAG_LED_OFF);

			static gapAdStructure_t RADIATION_scanResponseStruct[1] = {
																		  {
																			.adType = gAdShortenedLocalName_c,
																			.length = 12,
																			.aData = (uint8_t*)"DEVICE_NAME"
																		  }
																		};

			gapScanResponseData_t RADIATION_gAppScanRspData = {NumberOfElements(RADIATION_scanResponseStruct),
														  (void *)RADIATION_scanResponseStruct};

			appAdvertisingParams_t RADIATION_strAdvertisingData = {
																	  .pGapAdvParams = &amp;amp;RADIATION_strGapAdvParams,
																	  .pGapAdvData = &amp;amp;RADIATION_gAppAdvertisingData,
																	  .pScanResponseData = &amp;amp;RADIATION_gAppScanRspData
																   };

			BluetoothLEHost_StartAdvertising(&amp;amp;RADIATION_strAdvertisingData, NULL, NULL);
        }
        break;

        default:
        {
            ; /* For MISRA Compliance */
        }
        break;
    }
}


static void vBleSensitivityMeasurement( uint32_t channelId )
{

	/* Set New Lowpower Constraint on Advertising start request */
	( void )PWR_SetLowPowerModeConstraint(PWR_WFI);

	/** (!) */
	OSA_vidTaskSleep(10);

    Controller_SetTxPowerLevel(ADV_POWER_DBM, channelId);

	/*LED ON*/
	GPIO_PinWrite(DIAG_LED_GPIO, DIAG_LED_PIN, DIAG_LED_ON);

	BluetoothLEHost_StartAdvertising(&amp;amp;RADIATION_strAdvertisingData, BleApp_AdvertisingCallback, NULL);

	OSA_vidTaskSleep(ADV_DURATION_MS);

	Gap_StopAdvertising();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2024 16:29:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Wireless-MCU/Catch-scan-request-on-KW45/m-p/1814771#M16705</guid>
      <dc:creator>Liwa</dc:creator>
      <dc:date>2024-02-23T16:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Catch scan request on KW45</title>
      <link>https://community.nxp.com/t5/Wireless-MCU/Catch-scan-request-on-KW45/m-p/1814894#M16707</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;gapAdStructure_t can be defined as static const gapAdStructure_t scanResponseStruct[1]. Both gapAdStructure_t and gapScanResponseData_t structures can be defined in source/app_config.c file.&lt;/P&gt;
&lt;P&gt;Please, test you application under these modifications and let me know your findings.&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Eduardo.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2024 21:44:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Wireless-MCU/Catch-scan-request-on-KW45/m-p/1814894#M16707</guid>
      <dc:creator>EduardoZamora</dc:creator>
      <dc:date>2024-02-23T21:44:14Z</dc:date>
    </item>
  </channel>
</rss>

