How can I disconnect AP?



  • I use RAK439 in STA mode.
    After TCP communication with external server, I want to send disconnecting message to AP after close socket.
    How can I do it?

    // atmel example function as follows:
    sint8 m2m_wifi_disconnect(void)
    {
    return hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_DISCONNECT, NULL, 0, NULL, 0,0);
    }



  • you can call rw_sysDriverDeinit to disable rak439, if you want send data to server again then use rw_wlanConnect to reconnect ap and build socket again.



  • (1) After I disabling RAK439, How does it take a time to disconnect in AP side?
    (2) after (1), If I enable RAK439, I 'll call function "wifi_STA_init();" is it right?
    (disable RAK439: only call function "rw_sysDriverDeinit();
    /*****************************************************************************************

    • @fn wifi_STA_init
      *****************************************************************************************/
      void wifi_STA_init(void)
      {
      platform_init();
      rw_appdemo_context_init();
      wifi_Stamp=WIFI_NO_MESSAGE;
      rw_network_startSTA();
      }

    /*****************************************************************************************

    • @fn wifi_STA_TcpClient_main <--- event handle in while(1) loop
      *****************************************************************************************/
      void wifi_STA_TcpClient_main(void)
      {
      int ret = 0;

      if((ret =rw_sysDriverLoop()) != RW_OK)
      {
      DPRINTF("rw_sysDriverLoop error =%d\r\n", ret);
      }

      if (app_demo_ctx.rw_connect_status == STATUS_OK && app_demo_ctx.rw_ipquery_status == STATUS_OK)
      {
      // RAK_TcpServer_EventHandle();
      RAK_TcpClient_EventHandle();
      // RAK_UdpServer_EventHandle();
      // RAK_UdpClient_EventHandle();
      }
      else if (app_demo_ctx.rw_connect_status == STATUS_FAIL || app_demo_ctx.rw_ipquery_status == STATUS_FAIL)
      {
      wifi_Stamp=WIFI_NO_MESSAGE;
      DPRINTF("reconnect and ipquery...\r\n");
      rw_appdemo_context_init();
      rw_sysDriverReset();
      rw_network_init(&conn, DHCP_CLIENT, NULL);
      }
      ret = ret;
      }



  • (1) After I disabling RAK439, How does it take a time to disconnect in AP side?
    using router work as AP? It is normal for router taking a time (about 30s)to find 439 disconnected.

    (2) after (1), If I enable RAK439, I 'll call function "wifi_STA_init();" is it right?
    yes


Log in to reply
 

Looks like your connection to RAK Support Center was lost, please wait while we try to reconnect.