Lines Matching refs:conn
187 static int update_wifi_config(netmgr_conn_t* conn, const char *name);
191 static void handle_wifi_event(netmgr_conn_t* conn, int event);
199 static void wifi_status_change(netmgr_conn_t *conn, int event);
330 netmgr_conn_t* conn = g_wifi_conn_info; in wifi_scan_completed_cb() local
381 if(conn == NULL || result == NULL || result->ap_num <= 0 || result->ap_list == NULL) { in wifi_scan_completed_cb()
388 saved_ap_conf = (netmgr_wifi_ap_config_t* )conn->saved_config; in wifi_scan_completed_cb()
536 netmgr_conn_t * conn = g_wifi_conn_info; in tcpip_dhcpc_cb() local
558 if(conn != NULL) { in tcpip_dhcpc_cb()
559 if(0 != (ret = ioctl(conn->hdl, WIFI_DEV_CMD_NOTIFY_IP_STATE2DRV , &in))) { in tcpip_dhcpc_cb()
588 netmgr_conn_t* conn; in wifi_dhcp_start() local
591 conn = g_wifi_conn_info; in wifi_dhcp_start()
592 net_if = conn->netif; in wifi_dhcp_start()
618 netmgr_conn_t* conn = g_wifi_conn_info; in reconnect_task_handle() local
620 if(conn == NULL) { in reconnect_task_handle()
625 saved_ap_conf = (netmgr_wifi_ap_config_t*) conn->saved_config; in reconnect_task_handle()
634 conn->reconnect_task_running = false; in reconnect_task_handle()
645 if(false == conn->auto_reconnect) { in reconnect_task_handle()
647 conn->reconnect_task_running = false; in reconnect_task_handle()
651 NETMGR_WIFI_LOGI("%s:%d state=%d\n", __func__, __LINE__, conn->state); in reconnect_task_handle()
652 if(conn->state == CONN_STATE_DISCONNECTED) { in reconnect_task_handle()
657 if(0 != netmgr_wifi_connect(conn->hdl, (netmgr_wifi_params_t*)¶ms)) { in reconnect_task_handle()
658 if(ioctl(conn->hdl, WIFI_DEV_CMD_CANCEL_CONNECT, NULL) != 0) { in reconnect_task_handle()
661 conn->reconnect_task_running = false; in reconnect_task_handle()
662 netmgr_conn_state_change(conn, CONN_STATE_FAILED); in reconnect_task_handle()
666 else if(conn->state == CONN_STATE_NETWORK_CONNECTED) in reconnect_task_handle()
669 conn->reconnect_task_running = false; in reconnect_task_handle()
680 netmgr_conn_t* conn = g_wifi_conn_info; in wifi_auto_reconnect_task() local
682 if(conn == NULL) { in wifi_auto_reconnect_task()
687 if(conn->reconnect_task_running == true) { in wifi_auto_reconnect_task()
692 conn->reconnect_task_running = true; in wifi_auto_reconnect_task()
713 static int wifi_connected(netmgr_conn_t* conn) in wifi_connected() argument
717 if(conn == NULL) { in wifi_connected()
722 net_if = conn->netif; in wifi_connected()
735 return netmgr_conn_state_change(conn, CONN_STATE_OBTAINING_IP); in wifi_connected()
738 static int wifi_failed(netmgr_conn_t* conn) in wifi_failed() argument
740 if(conn == NULL) { in wifi_failed()
745 NETMGR_WIFI_LOGI("%s:%d auto_reconnect=%d\n", __func__, __LINE__, conn->auto_reconnect); in wifi_failed()
746 if(conn->auto_reconnect == true) { in wifi_failed()
748 netmgr_conn_state_change(conn, CONN_STATE_DISCONNECTING); in wifi_failed()
753 netmgr_conn_state_change(conn, CONN_STATE_DISCONNECTED); in wifi_failed()
758 static int wifi_obtaining_ip(netmgr_conn_t* conn) in wifi_obtaining_ip() argument
760 if(conn == NULL) { in wifi_obtaining_ip()
765 if(conn->use_ip_mode == NETMGR_WIFI_IP_MODE_STATIC) { in wifi_obtaining_ip()
766 struct netif* net_if = conn->netif; in wifi_obtaining_ip()
773 netifapi_netif_set_addr(net_if, &conn->static_ip, &conn->static_mask, &conn->static_gw); in wifi_obtaining_ip()
775 dns_setserver(0, &conn->static_dns); in wifi_obtaining_ip()
798 if(0 != (ret = ioctl(conn->hdl, WIFI_DEV_CMD_NOTIFY_IP_STATE2DRV , &in))) { in wifi_obtaining_ip()
822 netmgr_conn_t* conn = g_wifi_conn_info; in wifi_link_check() local
824 if(conn == NULL) { in wifi_link_check()
829 if(conn->state != CONN_STATE_NETWORK_CONNECTED) { in wifi_link_check()
830 …_WIFI_LOGI("%s:%d conn state %d is not network connected,exit\n", __func__, __LINE__, conn->state); in wifi_link_check()
854 static int wifi_network_connected(netmgr_conn_t* conn) in wifi_network_connected() argument
870 static int wifi_disconnecting(netmgr_conn_t* conn) in wifi_disconnecting() argument
874 if(conn == NULL) { in wifi_disconnecting()
879 net_if = conn->netif; in wifi_disconnecting()
885 netmgr_conn_state_change(conn, CONN_STATE_DISCONNECTED); in wifi_disconnecting()
889 static int wifi_disconnected(netmgr_conn_t* conn) in wifi_disconnected() argument
898 net_if = conn->netif; in wifi_disconnected()
908 if(0 != (ret = ioctl(conn->hdl, WIFI_DEV_CMD_DISCONNECT, NULL))) { in wifi_disconnected()
1213 static int update_wifi_config(netmgr_conn_t* conn, const char *name) in update_wifi_config() argument
1225 if(conn == NULL) { in update_wifi_config()
1230 if(0 != (ret = (ioctl(conn->hdl, WIFI_DEV_CMD_GET_CHANNEL, &channel)))) { in update_wifi_config()
1235 saved_ap_conf = (netmgr_wifi_ap_config_t* )conn->saved_config; in update_wifi_config()
1362 static int update_wifi_status(netmgr_conn_t* conn, const char *name, char* wpa_status) in update_wifi_status() argument
1376 if(conn == NULL) { in update_wifi_status()
1380 if(0 != (ret = (ioctl(conn->hdl, WIFI_DEV_CMD_GET_CHANNEL, &channel)))) { in update_wifi_status()
1396 wifi_get_mac(conn->hdl, mac); in update_wifi_status()
1398 saved_ap_conf = (netmgr_wifi_ap_config_t* )conn->saved_config; in update_wifi_status()
1421 net_if = conn->netif; in update_wifi_status()
1493 static void wifi_status_change(netmgr_conn_t *conn, int event) in wifi_status_change() argument
1495 if(conn == NULL) { in wifi_status_change()
1499 NETMGR_WIFI_LOGI("%s:%d event=%d conn->state=%d\n", __func__, __LINE__, event, conn->state); in wifi_status_change()
1527 netmgr_conn_state_change(conn, CONN_STATE_CONNECTED); in wifi_status_change()
1529 update_wifi_config(conn, NETMGR_WIFI_CONF); in wifi_status_change()
1536 update_wifi_status(conn, NETMGR_WIFI_STATUS, WPA_STATE_COMPLETED); in wifi_status_change()
1537 netmgr_conn_state_change(conn, CONN_STATE_NETWORK_CONNECTED); in wifi_status_change()
1554 netmgr_conn_state_change(conn, CONN_STATE_FAILED); in wifi_status_change()
1567 if(conn->state != CONN_STATE_CONNECTING) { in wifi_status_change()
1569 update_wifi_status(conn, NETMGR_WIFI_STATUS, WPA_STATE_DISCONNECTED); in wifi_status_change()
1573 NETMGR_WIFI_LOGD("%s:%d event=%d stat=%d\n", __func__, __LINE__, event, conn->state); in wifi_status_change()
1574 if(conn->state == CONN_STATE_CONNECTING) { in wifi_status_change()
1583 netmgr_conn_state_change(conn, CONN_STATE_FAILED); in wifi_status_change()
1587 } else if((conn->state != CONN_STATE_DISCONNECTING) in wifi_status_change()
1588 && (conn->state != CONN_STATE_DISCONNECTED)) { in wifi_status_change()
1590 netmgr_conn_state_change(conn, CONN_STATE_FAILED); in wifi_status_change()
1600 handle_wifi_event(conn, event); in wifi_status_change()
1606 static void handle_wifi_event(netmgr_conn_t* conn, int event) in handle_wifi_event() argument
1612 if(conn == NULL) { in handle_wifi_event()
1618 netmgr_wifi_msg_cb_node_t* node = conn->msg_cb_list; in handle_wifi_event()
1640 saved_ap_conf = (netmgr_wifi_ap_config_t* )conn->saved_config; in handle_wifi_event()
1717 netmgr_conn_t* conn = g_wifi_conn_info; in wifi_indicate_event_handle() local
1728 conn->netif = (struct netif*)arg; in wifi_indicate_event_handle()
1817 if(conn == NULL) { in wifi_indicate_event_handle()
1823 wifi_status_change(conn, event); in wifi_indicate_event_handle()
1987 static netmgr_conn_t* conn; in netmgr_wifi_deinit() local
1993 conn = g_wifi_conn_info; in netmgr_wifi_deinit()
2012 net_if = conn->netif; in netmgr_wifi_deinit()
2031 netmgr_conn_t *conn = g_wifi_conn_info; in netmgr_wifi_get_netif() local
2032 return conn->netif; in netmgr_wifi_get_netif()
2035 static int wifi_start_scan(netmgr_conn_t* conn, netmgr_wifi_ap_config_t* saved_ap_conf) in wifi_start_scan() argument
2044 if(conn == NULL) { in wifi_start_scan()
2083 if(0 != (ret = ioctl(conn->hdl, WIFI_DEV_CMD_START_SPECIFIED_SCAN, &scan_result))) in wifi_start_scan()
2086 if(0 != (ret = ioctl(conn->hdl, WIFI_DEV_CMD_START_SCAN, NULL))) { in wifi_start_scan()
2104 static int wifi_start_soft_ap(netmgr_conn_t* conn, const char* ssid, in wifi_start_soft_ap() argument
2110 if(conn == NULL) { in wifi_start_soft_ap()
2129 NETMGR_WIFI_LOGI("%s:%d state=%d\n", __func__, __LINE__, conn->state); in wifi_start_soft_ap()
2130 if((conn->state == CONN_STATE_DISCONNECTED) || in wifi_start_soft_ap()
2131 (conn->state == CONN_STATE_CONNECTING)) { in wifi_start_soft_ap()
2134 ret = ioctl(conn->hdl, WIFI_DEV_CMD_CONNECT, &type); in wifi_start_soft_ap()
2145 static int wifi_start_sta(netmgr_hdl_t hdl, netmgr_conn_t *conn, const char *ssid, in wifi_start_sta() argument
2151 if(conn == NULL) { in wifi_start_sta()
2168 NETMGR_WIFI_LOGI("%s:%d state=%d\n", __func__, __LINE__, conn->state); in wifi_start_sta()
2169 if((conn->state == CONN_STATE_DISCONNECTED) || in wifi_start_sta()
2170 (conn->state == CONN_STATE_CONNECTING)) { in wifi_start_sta()
2211 int wifi_ap_start(netmgr_conn_t* conn, const char *svr_ip, const char *gw_ip, const char *netmask_i… in wifi_ap_start() argument
2223 if(conn == NULL) { in wifi_ap_start()
2228 if(0 != wifi_start_soft_ap(conn, ssid, passwd, beacon_interval, hide)) { in wifi_ap_start()
2246 net_if = conn->netif; in wifi_ap_start()
2293 netmgr_conn_t* conn = g_wifi_conn_info; in netmgr_wifi_connect() local
2303 if(conn == NULL) { in netmgr_wifi_connect()
2313 if(conn->hdl != hdl) { in netmgr_wifi_connect()
2322 …return wifi_ap_start(conn, ap_params->svr_ip, ap_params->gw_ip, ap_params->netmask_ip, ap_params->… in netmgr_wifi_connect()
2335 saved_ap_conf = (netmgr_wifi_ap_config_t* )conn->saved_config; in netmgr_wifi_connect()
2339 netmgr_conn_state_change(conn, CONN_STATE_FAILED); in netmgr_wifi_connect()
2349 netmgr_conn_state_change(conn, CONN_STATE_FAILED); in netmgr_wifi_connect()
2353 if((conn->state == CONN_STATE_CONNECTED) in netmgr_wifi_connect()
2354 ||(conn->state == CONN_STATE_OBTAINING_IP) in netmgr_wifi_connect()
2355 ||(conn->state == CONN_STATE_NETWORK_CONNECTED)) { in netmgr_wifi_connect()
2357 netmgr_conn_state_change(conn, CONN_STATE_DISCONNECTED); in netmgr_wifi_connect()
2398 netmgr_conn_state_change(conn, CONN_STATE_CONNECTING); in netmgr_wifi_connect()
2402 NETMGR_WIFI_LOGI("%s:%d state=%d\n", __func__, __LINE__, conn->state); in netmgr_wifi_connect()
2405 if(conn->state == CONN_STATE_NETWORK_CONNECTED) { in netmgr_wifi_connect()
2413 saved_ap_conf = (netmgr_wifi_ap_config_t* )conn->saved_config; in netmgr_wifi_connect()
2427 update_wifi_config(conn, NETMGR_WIFI_CONF); in netmgr_wifi_connect()
2431 else if(conn->state == CONN_STATE_DISCONNECTED) { in netmgr_wifi_connect()
2433 net_if = conn->netif; in netmgr_wifi_connect()
2447 net_if = conn->netif; in netmgr_wifi_connect()
2468 net_if = conn->netif; in netmgr_wifi_connect()
2498 if(0 != wifi_start_scan(conn, saved_ap_conf)) { in netmgr_wifi_connect()
2545 ret = wifi_start_sta(hdl, conn, in netmgr_wifi_connect()
2553 ret = wifi_start_sta(hdl, conn, saved_ap_conf->config[i].gbk_ssid, in netmgr_wifi_connect()
2585 netmgr_conn_state_change(conn, CONN_STATE_FAILED); in netmgr_wifi_connect()
2593 netmgr_conn_t *conn = g_wifi_conn_info; in netmgr_wifi_disconnect() local
2598 if(conn != NULL) { in netmgr_wifi_disconnect()
2599 NETMGR_WIFI_LOGE("%s:%d state=%d\n", __func__, __LINE__, conn->state); in netmgr_wifi_disconnect()
2600 netmgr_conn_state_change(conn, CONN_STATE_DISCONNECTED); in netmgr_wifi_disconnect()
2606 net_if = conn->netif; in netmgr_wifi_disconnect()
2634 netmgr_conn_t *conn = g_wifi_conn_info; in netmgr_wifi_auto_reconnect() local
2635 if(conn == NULL) { in netmgr_wifi_auto_reconnect()
2641 conn->auto_reconnect = enable; in netmgr_wifi_auto_reconnect()
2643 if((conn->auto_reconnect == true) in netmgr_wifi_auto_reconnect()
2644 && (conn->state == CONN_STATE_DISCONNECTED)) { in netmgr_wifi_auto_reconnect()
2708 netmgr_conn_t *conn = g_wifi_conn_info; in netmgr_wifi_set_msg_cb() local
2716 if(conn == NULL) { in netmgr_wifi_set_msg_cb()
2727 node = (netmgr_wifi_msg_cb_node_t *) conn->msg_cb_list; in netmgr_wifi_set_msg_cb()
2730 conn->msg_cb_list = (netmgr_wifi_msg_cb_node_t *)malloc(sizeof(netmgr_wifi_msg_cb_node_t)); in netmgr_wifi_set_msg_cb()
2731 if(conn->msg_cb_list == NULL) { in netmgr_wifi_set_msg_cb()
2735 node = (netmgr_wifi_msg_cb_node_t *) conn->msg_cb_list; in netmgr_wifi_set_msg_cb()
2763 netmgr_conn_t *conn = g_wifi_conn_info; in netmgr_wifi_del_msg_cb() local
2768 if(conn == NULL) { in netmgr_wifi_del_msg_cb()
2773 node = (netmgr_wifi_msg_cb_node_t *) conn->msg_cb_list; in netmgr_wifi_del_msg_cb()
2781 conn->msg_cb_list = NULL; in netmgr_wifi_del_msg_cb()
2801 netmgr_conn_t *conn = g_wifi_conn_info; in netmgr_wifi_set_ip_mode() local
2804 if(conn->use_ip_mode != mode) { in netmgr_wifi_set_ip_mode()
2806 conn->use_ip_mode = mode; in netmgr_wifi_set_ip_mode()
2807 net_if = conn->netif; in netmgr_wifi_set_ip_mode()
2824 netifapi_netif_set_addr(net_if, &conn->static_ip, &conn->static_mask, &conn->static_gw); in netmgr_wifi_set_ip_mode()
2826 dns_setserver(0, &conn->static_dns); in netmgr_wifi_set_ip_mode()
2835 netmgr_conn_t *conn = g_wifi_conn_info; in netmgr_wifi_get_ip_mode() local
2836 return conn->use_ip_mode; in netmgr_wifi_get_ip_mode()
2842 static netmgr_conn_t* conn; in netmgr_wifi_get_ip_addr() local
2844 conn = g_wifi_conn_info; in netmgr_wifi_get_ip_addr()
2846 net_if = conn->netif; in netmgr_wifi_get_ip_addr()
2865 netmgr_conn_t *conn = g_wifi_conn_info; in netmgr_wifi_set_static_ip_stat() local
2876 &((u8_t *)&conn->static_ip.addr)[0], in netmgr_wifi_set_static_ip_stat()
2877 &((u8_t *)&conn->static_ip.addr)[1], in netmgr_wifi_set_static_ip_stat()
2878 &((u8_t *)&conn->static_ip.addr)[2], in netmgr_wifi_set_static_ip_stat()
2879 &((u8_t *)&conn->static_ip.addr)[3]); in netmgr_wifi_set_static_ip_stat()
2881 ((u8_t *)&conn->static_ip.addr)[0], in netmgr_wifi_set_static_ip_stat()
2882 ((u8_t *)&conn->static_ip.addr)[1], in netmgr_wifi_set_static_ip_stat()
2883 ((u8_t *)&conn->static_ip.addr)[2], in netmgr_wifi_set_static_ip_stat()
2884 ((u8_t *)&conn->static_ip.addr)[3]); in netmgr_wifi_set_static_ip_stat()
2887 &((u8_t *)&conn->static_mask.addr)[0], in netmgr_wifi_set_static_ip_stat()
2888 &((u8_t *)&conn->static_mask.addr)[1], in netmgr_wifi_set_static_ip_stat()
2889 &((u8_t *)&conn->static_mask.addr)[2], in netmgr_wifi_set_static_ip_stat()
2890 &((u8_t *)&conn->static_mask.addr)[3]); in netmgr_wifi_set_static_ip_stat()
2892 ((u8_t *)&conn->static_mask.addr)[0], in netmgr_wifi_set_static_ip_stat()
2893 ((u8_t *)&conn->static_mask.addr)[1], in netmgr_wifi_set_static_ip_stat()
2894 ((u8_t *)&conn->static_mask.addr)[2], in netmgr_wifi_set_static_ip_stat()
2895 ((u8_t *)&conn->static_mask.addr)[3]); in netmgr_wifi_set_static_ip_stat()
2898 &((u8_t *)&conn->static_gw.addr)[0], in netmgr_wifi_set_static_ip_stat()
2899 &((u8_t *)&conn->static_gw.addr)[1], in netmgr_wifi_set_static_ip_stat()
2900 &((u8_t *)&conn->static_gw.addr)[2], in netmgr_wifi_set_static_ip_stat()
2901 &((u8_t *)&conn->static_gw.addr)[3]); in netmgr_wifi_set_static_ip_stat()
2903 ((u8_t *)&conn->static_gw.addr)[0], in netmgr_wifi_set_static_ip_stat()
2904 ((u8_t *)&conn->static_gw.addr)[1], in netmgr_wifi_set_static_ip_stat()
2905 ((u8_t *)&conn->static_gw.addr)[2], in netmgr_wifi_set_static_ip_stat()
2906 ((u8_t *)&conn->static_gw.addr)[3]); in netmgr_wifi_set_static_ip_stat()
2909 &((u8_t *)&conn->static_dns.addr)[0], in netmgr_wifi_set_static_ip_stat()
2910 &((u8_t *)&conn->static_dns.addr)[1], in netmgr_wifi_set_static_ip_stat()
2911 &((u8_t *)&conn->static_dns.addr)[2], in netmgr_wifi_set_static_ip_stat()
2912 &((u8_t *)&conn->static_dns.addr)[3]); in netmgr_wifi_set_static_ip_stat()
2914 ((u8_t *)&conn->static_dns.addr)[0], in netmgr_wifi_set_static_ip_stat()
2915 ((u8_t *)&conn->static_dns.addr)[1], in netmgr_wifi_set_static_ip_stat()
2916 ((u8_t *)&conn->static_dns.addr)[2], in netmgr_wifi_set_static_ip_stat()
2917 ((u8_t *)&conn->static_dns.addr)[3]); in netmgr_wifi_set_static_ip_stat()
2918 net_if = conn->netif; in netmgr_wifi_set_static_ip_stat()
2923 netifapi_netif_set_addr(net_if, &conn->static_ip, &conn->static_mask, &conn->static_gw); in netmgr_wifi_set_static_ip_stat()
2925 dns_setserver(0, &conn->static_dns); in netmgr_wifi_set_static_ip_stat()
2935 static netmgr_conn_t* conn; in netmgr_wifi_get_ip_stat() local
2938 conn = g_wifi_conn_info; in netmgr_wifi_get_ip_stat()
2940 net_if = conn->netif; in netmgr_wifi_get_ip_stat()
2972 if (-1 != wifi_get_mac(conn->hdl, mac)) { in netmgr_wifi_get_ip_stat()
3016 netmgr_conn_t* conn = g_wifi_conn_info; in netmgr_wifi_del_config() local
3027 if(conn == NULL) { in netmgr_wifi_del_config()
3032 saved_ap_conf = (netmgr_wifi_ap_config_t*) conn->saved_config; in netmgr_wifi_del_config()
3075 update_wifi_config(conn, NETMGR_WIFI_CONF); in netmgr_wifi_del_config()
3197 netmgr_conn_t* conn = g_wifi_conn_info; local
3199 if(conn) {
3200 NETMGR_WIFI_LOGD("%s:%d state=%d\n", __func__, __LINE__, conn->state);
3201 return conn->state;
3208 netmgr_conn_t* conn = g_wifi_conn_info; local
3210 if(conn != NULL) {
3211 if(ioctl(conn->hdl, WIFI_DEV_CMD_START_MONITOR, NULL) != 0) {
3218 netmgr_conn_t* conn = g_wifi_conn_info; local
3220 if(conn != NULL) {
3221 if(ioctl(conn->hdl, WIFI_DEV_CMD_STOP_MONITOR, NULL) != 0) {
3228 netmgr_conn_t* conn = g_wifi_conn_info; local
3230 if(conn != NULL) {
3231 if(ioctl(conn->hdl, WIFI_DEV_CMD_START_MGNT_MONITOR, NULL) != 0) {
3238 netmgr_conn_t* conn = g_wifi_conn_info; local
3240 if(conn != NULL) {
3241 if(ioctl(conn->hdl, WIFI_DEV_CMD_STOP_MGNT_MONITOR, NULL) != 0) {
3363 netmgr_conn_t* conn = g_wifi_conn_info; local
3364 if(conn != NULL) {
3372 … if(ioctl(conn->hdl, WIFI_DEV_CMD_REGISTER_MGNT_MONITOR_CB, wifi_mgnt_monitor_data_cb) != 0) {
3376 if(ioctl(conn->hdl, WIFI_DEV_CMD_REGISTER_MGNT_MONITOR_CB, fn) != 0) {
3384 netmgr_conn_t* conn = g_wifi_conn_info; local
3385 if(conn != NULL) {
3390 return ioctl(conn->hdl, WIFI_DEV_CMD_SEND_80211_RAW_FRAME, &frame);
3440 netmgr_conn_t* conn = g_wifi_conn_info; local
3448 if(conn != NULL) {
3449 …wifi_ap_start(conn, params->svr_ip, params->gw_ip, params->netmask_ip, params->ssid, params->pwd, …
3526 netmgr_conn_t* conn = g_wifi_conn_info; local
3527 if(conn != NULL) {
3528 netmgr_wifi_disconnect(conn->hdl);