int application_start(int argc, char *argv[]) { #if AOS_ATCMD at.set_mode(ASYN); at.init(AT_RECV_PREFIX, AT_RECV_SUCCESS_POSTFIX, AT_RECV_FAIL_POSTFIX, AT_SEND_DELIMITER, 1000); #endif #ifdef WITH_SAL sal_init(); #elif defined (CSP_LINUXHOST) aos_post_event(EV_WIFI, CODE_WIFI_ON_GOT_IP, 0u); #endif aos_set_log_level(AOS_LL_DEBUG); aos_register_event_filter(EV_WIFI, wifi_service_event, NULL); netmgr_init(); netmgr_start(false); aos_cli_register_command(&mqttcmd); aos_loop_run(); return 0; }
int application_start(int argc, char *argv[]) { #if AOS_ATCMD uart_dev_t at_uart; at_uart_configure(&at_uart); at.init(&at_uart, AT_RECV_DELIMITER, AT_SEND_DELIMITER, 1000); at.set_mode(ASYN); #endif #ifdef WITH_SAL sal_init(); #endif aos_set_log_level(AOS_LL_DEBUG); aos_register_event_filter(EV_WIFI, wifi_service_event, NULL); netmgr_init(); netmgr_start(false); aos_cli_register_command(&mqttcmd); #ifdef CSP_LINUXHOST mqtt_client_example(); #endif aos_loop_run(); return 0; }
void alink_key_process(input_event_t *eventinfo, void *priv_data) { if (eventinfo->type != EV_KEY) { return; } if (eventinfo->code == CODE_BOOT) { if (eventinfo->value == VALUE_KEY_CLICK) { if (cloud_is_connected() == false) { netmgr_start(true); } else { alink_activate(NULL); } } else if(eventinfo->value == VALUE_KEY_LTCLICK) { netmgr_clear_ap_config(); aos_reboot(); } else if(eventinfo->value == VALUE_KEY_LLTCLICK) { netmgr_clear_ap_config(); alink_factory_reset(); } } }
static void start_netmgr(void *p) { netmgr_start(true); //aos_task_exit(0); }
int application_start(int argc, char *argv[]) { #if AOS_ATCMD uart_dev_t at_uart; at_uart_configure(&at_uart); at.init(&at_uart, AT_RECV_DELIMITER, AT_SEND_DELIMITER, 1000); at.set_mode(ASYN); #endif #ifdef WITH_SAL sal_init(); #endif parse_opt(argc, argv); aos_set_log_level(AOS_LL_DEBUG); #ifndef AOS_AT_ADAPTER if (mesh_mode == MESH_MASTER) { #ifdef CONFIG_AOS_DDM ddm_run(argc, argv); #endif return 0; } #ifdef CONFIG_AOS_DDA dda_enable(atoi(mesh_num)); dda_service_init(); #endif #endif // #ifndef AOS_AT_ADAPTER aos_cli_register_command(&uuidcmd); alink_cloud_init(); if (mesh_mode == MESH_GATEWAY) { aos_cli_register_command(&ncmd); aos_cli_register_command(&modelcmd); aos_cli_register_command(&resetcmd); if (env == SANDBOX) alink_enable_sandbox_mode(); else if (env == DAILY) alink_enable_daily_mode(NULL, 0); #ifndef AOS_AT_ADAPTER aos_register_event_filter(EV_WIFI, alink_service_event, NULL); #else aos_register_event_filter(EV_AT, alink_service_event, NULL); #endif aos_register_event_filter(EV_SYS, alink_connect_event, NULL); aos_register_event_filter(EV_KEY, alink_key_process, NULL); #ifndef AOS_AT_ADAPTER aos_register_event_filter(EV_YUNIO, auto_active_handler, NULL); auto_netmgr = get_auto_netmgr_config(); awss_register_callback(AWSS_HOTSPOT_CONNECTED, &awss_hotspot_connected_handler); awss_register_callback(AWSS_HOTSPOT_SWITCH_AP_DONE, &awss_hotspot_switch_ap_done_handler); if (auto_netmgr) start_auto_netmgr_timer(); #else auto_netmgr = false; at_adapter_init(); #endif netmgr_init(); netmgr_start(auto_netmgr); } #if defined(CONFIG_AOS_DDA) && !defined(AOS_AT_ADAPTER) dda_service_start(); #else aos_loop_run(); LOG("alink end."); alink_end(); #endif return 0; }