Tip / 登入 to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Translation_Bot
Community Manager
Community Manager
Community Manager
100 likes received

我正在編寫一個簡單的應用程序,以連接到蘋果設備並使用 IOS 的 ANCS 服務接收通知。 我能夠連接和綁定,但我在堆疊事件處理程序中收到未定義的事件。 為了詳細說明,我使用 switch 語句管理收到的事件,在 DEFA " ULT: 情"況下,我打印出收到的事件代碼。 連接和連接 IOS 設備後,我會收到 0x0111,0x010C 和 0x010A 的事件代碼。 我無法在源文件中找到這些事件的引用。 例如,我收到事件代碼 0x0021,該代碼對應於 BLE_STACK.h 中的 CYBLE_EVT_GAP_AUTH_REQ, 但我找不到這些新代碼的引用。 我的應用程序與 100 天內 100 個項目示例中的 22 天項目幾乎相同。

該應用程序似乎正常運行,但我想正確處理這些事件,而不是忽略它們。

有人可以指向我正確的方向或解釋這些事件指的是什麼?

謝謝,

馬克

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/PSoC-4/PSOC-4-ANCS-notification-consumer-receives-undefined-events/td-p/645563

1 解決方案
Translation_Bot
Community Manager
Community Manager
Community Manager
100 likes received

您是否更改了任何堆疊配置? 堆疊中不應有大於 0xFF 的事件。

Owen_Zhang123_0-1710209154574.png

 

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/PSoC-4/PSOC-4-ANCS-notification-consumer-receives-undefined-events/m-p/711971

在原始文章中檢視解決方案

0
3 回應
Translation_Bot
Community Manager
Community Manager
Community Manager
100 likes received

你在哪裡看到這些事件? 它是否在 ANCS_Eventhandler()中?

您可以在打印活動的地方共享代碼嗎?

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/PSoC-4/PSOC-4-ANCS-notification-consumer-receives-undefined-events/m-p/646111

0
lock attach
Attachments are accessible only for community members.
Translation_Bot
Community Manager
Community Manager
Community Manager
100 likes received

事件發生在主堆疊處理程序中(由主函數中 CYBLE_START(StackEventHandler)定義)。 我添加了一個名為 default 的新交換器大小寫:來處理範例代碼中未處理的所有事件。 在這種默認情況下,我只是將 EventCode 參數傳遞給 StackEventHandler 的事件代碼參數為 UART。 如果您想查看整個代碼,我已經包含了我的工作區(但這只是一個學習項目)。

這是我從 StackEventHandler.c 中使用的代碼片段 :

void StackEventHandler(uint32 eventCode, void * eventParam)
{
    CYBLE_GATTC_HANDLE_VALUE_NTF_PARAM_T * handleValueNotification;
    uint16_t advertizingIntervalMaxValue = 0;
    CYBLE_BLESS_CLK_CFG_PARAMS_T clockConfig;
    CYBLE_GAP_AUTH_INFO_T authInfo;
    CYBLE_GAP_SMP_KEY_DIST_T KEY;
    
    switch(eventCode)
    {
        case CYBLE_EVT_STACK_ON:
        break;
.
.
.
        case 266:   // undocumented event received after bonding with ANCS Notification Provider (iPad)
            printf("Unknown event after bonding: 266\r\n");
            //***DEBUG***
            // set flag to request connection parameter change in main loop (only once per connection)
            connectionUpdateRequest = 1;
            //***DEBUG***
        break;

        case 268:   // undocumented event received after bonding with ANCS Notification Provider (iPad)
            printf("Unknown event after bonding: 268\r\n");
        break;
            
        case 273:   // undocumented event received after bonding with ANCS Notification Provider (iPad)
            printf("Unknown event after bonding: 273\r\n");
        break;
            
        default: 
            printf("UNPROGRAMMED EVENT #%ld\r\n",eventCode);
        break;
    }
}

我在我的終端應用程序上看到這個輸出:

CYBLE_STATE_ADVERTISING:
CYBLE_EVT_GATT_CONNECT_IND

Connected to a peer device.
Service changed indication. Redo service discovery.CYBLE_EVT_GATTC_HANDLE_VALUE_IND

Authentication complete. AUTHENTICATION_COMPLETED:
Security: Unauthenticated and Encryption
Bonding:yes
eKeySize: 0x10
err: 0x0
CYBLE_EVT_GAP_ENCRYPT_CHANGE

Encryption ON
Bonding complete. Negociated MTU size is 185
Unknown event after bonding: 273
Unknown event after bonding: 273
Unknown event after bonding: 273
Unknown event after bonding: 273
Unknown event after bonding: 273
Unknown event after bonding: 273
Unknown event after bonding: 273
Unknown event after bonding: 268
Unknown event after bonding: 268
Unknown event after bonding: 268
Unknown event after bonding: 268
Unknown event after bonding: 268
Unknown event after bonding: 268
Unknown event after bonding: 266
CYBLE_EVT_GATTC_LONG_PROCEDURE_END

 

我想處理 StackEventHandler 函數接收的那些 3 個事件(273,268,266)。

有什麼想法,我可以在哪裡找到這些事件是什麼? 它們是我應該忽略的內部堆疊事件,還是通過藍牙連接來自 iPad?

謝謝,

馬克

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/PSoC-4/PSOC-4-ANCS-notification-consumer-receives-undefined-events/m-p/646361

0
Translation_Bot
Community Manager
Community Manager
Community Manager
100 likes received

您是否更改了任何堆疊配置? 堆疊中不應有大於 0xFF 的事件。

Owen_Zhang123_0-1710209154574.png

 

smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/PSoC-4/PSOC-4-ANCS-notification-consumer-receives-undefined-events/m-p/711971

0