OSStatus MICOStartApplication( mico_Context_t * const inContext ) { app_log_trace(); OSStatus err = kNoErr; require_action(inContext, exit, err = kParamErr); haProtocolInit(inContext); PlatformUartInitialize(inContext); err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "UART Recv", uartRecv_thread, 0x500, (void*)inContext ); require_noerr_action( err, exit, app_log("ERROR: Unable to start the uart recv thread.") ); if(inContext->flashContentInRam.appConfig.localServerEnable == true){ err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "Local Server", localTcpServer_thread, 0x200, (void*)inContext ); require_noerr_action( err, exit, app_log("ERROR: Unable to start the local server thread.") ); } if(inContext->flashContentInRam.appConfig.remoteServerEnable == true){ err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "Remote Client", remoteTcpClient_thread, 0x500, (void*)inContext ); require_noerr_action( err, exit, app_log("ERROR: Unable to start the remote client thread.") ); } exit: return err; }
void ConfigSoftApWillStart(mico_Context_t * const inContext ) { OSStatus err; haProtocolInit(inContext); PlatformUartInitialize(inContext); err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "UART Recv", uartRecv_thread, 0x500, (void*)inContext ); require_noerr_action( err, exit, config_delegate_log("ERROR: Unable to start the uart recv thread.") ); if(inContext->flashContentInRam.appConfig.localServerEnable == true){ err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "Local Server", localTcpServer_thread, 0x200, (void*)inContext ); require_noerr_action( err, exit, config_delegate_log("ERROR: Unable to start the local server thread.") ); } exit: return; }
OSStatus MICOStartApplication( mico_Context_t * const inContext ) { app_log_trace(); OSStatus err = kNoErr; mico_uart_config_t uart_config; require_action(inContext, exit, err = kParamErr); haProtocolInit(inContext); /*Bonjour for service searching*/ if(inContext->flashContentInRam.micoSystemConfig.bonjourEnable == true) MICOStartBonjourService( Station, inContext ); /*UART receive thread*/ uart_config.baud_rate = inContext->flashContentInRam.appConfig.USART_BaudRate; uart_config.data_width = DATA_WIDTH_8BIT; uart_config.parity = NO_PARITY; uart_config.stop_bits = STOP_BITS_1; uart_config.flow_control = FLOW_CONTROL_DISABLED; if(inContext->flashContentInRam.micoSystemConfig.mcuPowerSaveEnable == true) uart_config.flags = UART_WAKEUP_ENABLE; else uart_config.flags = UART_WAKEUP_DISABLE; ring_buffer_init ( (ring_buffer_t *)&rx_buffer, (uint8_t *)rx_data, UART_BUFFER_LENGTH ); MicoUartInitialize( UART_FOR_APP, &uart_config, (ring_buffer_t *)&rx_buffer ); err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "UART Recv", uartRecv_thread, 0x200, (void*)inContext ); require_noerr_action( err, exit, app_log("ERROR: Unable to start the uart recv thread.") ); if(inContext->flashContentInRam.appConfig.localServerEnable == true){ err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "Local Server", localTcpServer_thread, 0x350, (void*)inContext ); require_noerr_action( err, exit, app_log("ERROR: Unable to start the local server thread.") ); } if(inContext->flashContentInRam.appConfig.remoteServerEnable == true){ err = mico_rtos_create_thread(NULL, MICO_APPLICATION_PRIORITY, "Remote Client", remoteTcpClient_thread, 0x300, (void*)inContext ); require_noerr_action( err, exit, app_log("ERROR: Unable to start the remote client thread.") ); } exit: return err; }