// Main application thread which is started by the RTOS after boot
void application_start(void)
{
    wiced_init( );
    dbStart();

    WPRINT_APP_INFO(("Starting WWEP Server\n"));

    while(wiced_network_up( INTERFACE, DHCP_MODE, &ip_settings ) != WICED_SUCCESS); // Keep trying until you get hooked up

    // I created all of the server code in a separate thread to make it easier to put the server
    // and client together in one application.

    wiced_rtos_create_thread(&tcp_thread, TCP_SERVER_NONSECURE_THREAD_PRIORITY, "Server TCP Server", tcp_server_nonsecure_thread_main, TCP_SERVER_NONSECURE_STACK_SIZE, 0);
    wiced_rtos_create_thread(&ping_thread, PING_THREAD_PRIORITY, "Ping", pingAP, 1024, 0);

    // Setup Display
    WPRINT_APP_INFO(("#\t     IP\t\tPort\tMessage\n"));
    WPRINT_APP_INFO(("----------------------------------------------------------------------\n"));


    // just blink the led while the whole thing is running
    while(1)
    {
        wiced_gpio_output_low( WICED_LED1 );
        wiced_rtos_delay_milliseconds( 250 );
        wiced_gpio_output_high( WICED_LED1 );
        wiced_rtos_delay_milliseconds( 250 );
    }
}
Example #2
0
bool barrackServerStart(BarrackServer *self) {
    special("======================");
    special("=== Barrack server ===");
    special("======================");

    // Start dbSession
    if (!(dbStart(self->dbSession))) {
        error("Cannot start sessions db.");
        return false;
    }

    // Initialize itemFactory
    if (!(itemFactoryStart(serverGetMySQLInfo(self->server)))) {
        error("Cannot initialize item factory.");
        return false;
    }

    if (!(serverStart (self->server))) {
        error("Cannot start the Server.");
        return false;
    }

    return true;
}