connection_register_p2p_result_callback seems block P2P work flow

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

cross mob
MaFa_974161
Level 5
Level 5
100 sign-ins 50 replies posted 50 questions asked

Hello

I'm new in WICED.

I write this simple code.

void p2p_result_callback(connection_p2p_result_t result)

{

    if(result == CONNECTION_P2P_CONNECTED)

    {

       /* I'm happy */

    }

}

void application_start(void)

{

    wiced_init( );

    if(connection_launch(CONNECTION_P2P_GC) != WICED_SUCCESS)

    {

        WPRINT_APP_INFO( ("CONNECTION_P2P_GC failed\n") );

    }

    /*   PLACEHODLDER */

}

This code work propertly. I can connect with my Android Tablet.

Starting WICED Wiced_006.006.000.0009

Platform CYW943907AEVAL1F initialised

Started ThreadX v5.9

WICED_core Initialized

Initialising NetX_Duo v5.12

Creating Packet pools

WLAN MAC Address : A4:08:EA:D9:C0:A2

WLAN Firmware    : wl0: Jul 20 2020 00:08:56 version 7.15.168.149 (21d266a) FWID 01-d4dbc762

WLAN CLM         : API: 12.2 Data: 9.10.74 Compiler: 1.31.3 ClmImport: 1.36.3 Creation: 2020-07-20 00:01:06

Creating p2p app worker thread

P2P GC Start was successful

No persistent GO information! Wait for the invitation

Launched P2P GC: 00000000

Connection Request from:  36:46:EC:AA:94:B2     HUAWEI MediaPad T5 status=02

Starting group formation in PBC mode

P2P group owner intent = 0

connection_p2p_wps_result_handler: WPS completed successfully

Obtaining IPv4 address via DHCP

L1434 : dhcp_client_init() : DHCP CLIENT hostname = [WICED IP]

IPv4 network ready IP: 192.168.49.178

Setting IPv6 link-local address

IPv6 network ready IP: FE80:0000:0000:0000:A408:EAFF:FED9:C0A2

Storing credentials for DIRECT-ud-HUAWEI MediaPad T5 into WIFI DCT[4] section.

status,COMPLETE,result,CLIENT,groupid,36:46:EC:AA:94:B2 DIRECT-ud-HUAWEI MediaPad T5

*** Associated on channel: 42 ***

If I register result callback substituting PLACEHODLDER with

connection_register_p2p_result_callback(&p2p_result_callback);

and try to connect my Android Tablet, the connection stops after invitation .... I dont' see any log after invitation request

and on Android WiFi Direct manager the WICED Direct Device disappears

Starting WICED Wiced_006.006.000.0009

Platform CYW943907AEVAL1F initialised

Started ThreadX v5.9

WICED_core Initialized

Initialising NetX_Duo v5.12

Creating Packet pools

WLAN MAC Address : A4:08:EA:D9:C0:A2

WLAN Firmware    : wl0: Jul 20 2020 00:08:56 version 7.15.168.149 (21d266a) FWID 01-d4dbc762

WLAN CLM         : API: 12.2 Data: 9.10.74 Compiler: 1.31.3 ClmImport: 1.36.3 Creation: 2020-07-20 00:01:06

Creating p2p app worker thread

P2P GC Start was successful

No persistent GO information! Wait for the invitation

Launched P2P GC: 00000000

Connection Request from:  36:46:EC:AA:94:B2     HUAWEI MediaPad T5 status=0A

Invitation request from NOT stored persistent group

Can someone help me ?

0 Likes
1 Solution
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

and we have  a reference from demo\headset\headset_wlan.c

/* for P2P interface */
if (wlan_iface == WICED_P2P_INTERFACE)
{
    /* Start WiFi direct group client */
    HEADSET_CHECK_RESULT(connection_launch(CONNECTION_P2P_GC));
    /* Register a result callback for p2p connection
     * The p2p thread will return a connection result to this callback */
    connection_register_p2p_result_callback(headset_wlan_p2p_connection_cb);
}

You can have a reference how to add p2p call from headset_wlan_p2p_connection_cb.

View solution in original post

0 Likes
2 Replies
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

Hello:

we have a P2P test introduction here, I think you can have a check to see if the callback run well in our examples.

WICED Wi-Fi Direct Testing (SDK 3.1.2)

I will do the same test also.

0 Likes
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

and we have  a reference from demo\headset\headset_wlan.c

/* for P2P interface */
if (wlan_iface == WICED_P2P_INTERFACE)
{
    /* Start WiFi direct group client */
    HEADSET_CHECK_RESULT(connection_launch(CONNECTION_P2P_GC));
    /* Register a result callback for p2p connection
     * The p2p thread will return a connection result to this callback */
    connection_register_p2p_result_callback(headset_wlan_p2p_connection_cb);
}

You can have a reference how to add p2p call from headset_wlan_p2p_connection_cb.

0 Likes