wlan_result_t wlan_activate()
{
    wlan_result_t result = wiced_wlan_connectivity_init();
    if (!result)
        wiced_network_register_link_callback(HAL_WLAN_notify_connected, HAL_WLAN_notify_disconnected, WICED_STA_INTERFACE);
    wlan_refresh_antenna();
    return result;
}
Exemple #2
0
void application_start(void)
{
    wiced_interface_t interface;
    wiced_result_t result;
	int fail = 0;
    wiced_init( );
	command_console_init(STDIO_UART, 300, cmdline, 10, history, " ");
	console_add_cmd_table(commands);
	memset(write_buffer, 0, BUFFER_SIZE);
	ws2812_init();
	write_ws2812(0, 3, init_data);
	wiced_network_register_link_callback(link_cb_up, link_cb_down, WICED_STA_INTERFACE);
    result = wiced_network_up_default( &interface, NULL);
//	result = wiced_network_up(WICED_STA_INTERFACE, WICED_USE_EXTERNAL_DHCP_SERVER, NULL);

    if( result != WICED_SUCCESS ) {
        printf("Bringing up network interface failed !\r\n");
		fail = 1;
    }

    /* Create UDP socket */
    if (wiced_udp_create_socket(&udp_socket, PORTNUM, interface) != WICED_SUCCESS) {
        WPRINT_APP_INFO( ("UDP socket creation failed\n") );
		fail = 1;
    } else {
	//	wiced_udp_register_callbacks(&udp_socket, udp_cb, &udp_socket);
		wiced_rtos_register_timed_event( &process_udp_rx_event, WICED_NETWORKING_WORKER_THREAD, &process_received_udp_packet, (1*SECONDS)/50, 0 );
	}
	if(!fail){
		init_data[0] = 0x10;
		init_data[1] = 0x00;
		init_data[2] = 0x00;
	} else {
		init_data[0] = 0x00;
		init_data[1] = 0x10;
		init_data[2] = 0x00;
	}
	write_ws2812(0, 3, init_data);
}