#include "connect.h" #include #include #include #include #if defined(CONFIG_AVM_EVENT) || defined(CONFIG_AVM_EVENT_MODULE) #define AVM_LED_INTERNAL #include #undef AVM_LED_INTERNAL #endif void methode2_init(enum connect_event new_state __maybe_unused){ if (wlan_on == 0) { wlan_on = 1; state_machine_queue_trigger_event(connect_event_turn_wlan_on); } else if(access == access_type_wlan_bridge && uplink == wlan_uplink_down){ state_machine_queue_trigger_event(connect_event_uplink_wlan_bridge_down); } else{ state_machine_queue_trigger_event(connect_event_uplink_other); } } /* Connect Methode 2 */ struct connect_state state_machine_methode2[] = { [connect_state_wait] = default_connect_state_wait, [connect_state_turn_wlan_on] = default_connect_state_turn_wlan_on, [connect_state_init] = { .description = "methode2_connect_state_init", .pre_func = methode2_init, .transitions = { {.event = connect_event_uplink_wlan_bridge_down, .next_state = connect_state_pairing_wlan_wpsenrollee}, {.event = connect_event_uplink_other, .next_state = connect_state_pre_nexus}, {.event = connect_event_turn_wlan_on, .next_state = connect_state_turn_wlan_on}, }, }, [connect_state_pairing_wlan_wpsenrollee] = { .description = "methode2_connect_state_wlan_wpsenrollee", .timeout_auto_trigger_ms = MAIN_PAIRING_TIMEOUT, .auto_trigger_event = connect_event_timeout, .pre_button_events = { avm_event_push_button_wlan_wps_station, }, .post_button_events = { avm_event_push_button_wlan_wps_station_off, }, .transitions = { {.event = connect_event_timeout, .next_state = connect_state_timeout_wps}, {.event = connect_event_wlan_sta_wps_timeout, .next_state = connect_state_timeout_wps}, {.event = connect_event_wlan_sta_wps_error, .next_state = connect_state_error}, {.event = connect_event_wlan_sta_wps_success, .next_state = connect_state_post_nexus}, }, }, [connect_state_timeout_wps] = { .description = "methode2_connect_state_timeout_wps", .pre_led_event = event_connect_pairing_timeout, .pre_button_events = { avm_event_push_button_connect_timeout, }, }, [connect_state_error]= { .description = "methode2_connect_state_error", .pre_led_event = event_connect_pairing_error, .pre_button_events = { avm_event_push_button_connect_error, }, }, [connect_state_success]= { .description = "methode2_connect_state_success", .pre_led_event = event_connect_pairing_success, .pre_button_events = { avm_event_push_button_connect_success, }, }, [connect_state_post_nexus] = { .description = "methode2_connect_state_post_nexus", .timeout_auto_trigger_ms = POST_NEXUS_TIMEOUT, .auto_trigger_event = connect_event_nexus_pairing_timeout, .pre_button_events = { avm_event_push_button_nexus_pairing, }, .post_button_events = { avm_event_push_button_nexus_pairing_off, }, .transitions = { {.event = connect_event_nexus_pairing_success, .next_state = connect_state_post_nexus_success}, {.event = connect_event_nexus_pairing_error, .next_state = connect_state_post_nexus_error}, {.event = connect_event_nexus_pairing_timeout, .next_state = connect_state_post_nexus_timeout} }, }, [connect_state_pre_nexus] = { .description = "methode2_connect_state_pre_nexus", .pre_button_events = { avm_event_push_button_nexus_pairing, }, .timeout_auto_trigger_ms = PRE_NEXUS_TIMEOUT, .auto_trigger_event = connect_event_nexus_pairing_timeout, .transitions = { {.event = connect_event_nexus_pairing_no_trustee_pending, .next_state = connect_state_pairing_plc_wpsauth_nexus}, {.event = connect_event_nexus_pairing_timeout, .next_state = connect_state_pairing_plc_wpsauth_nexus}, {.event = connect_event_nexus_pairing_error, .next_state = connect_state_pairing_plc_wpsauth_nexus}, {.event = connect_event_nexus_pairing_success, .next_state = connect_state_success} }, }, [connect_state_pairing_plc_wpsauth_nexus] = { .description = "methode2_connect_state_pairing_plc_wpsauth_nexus", .timeout_auto_trigger_ms = MAIN_PAIRING_TIMEOUT, .auto_trigger_event = connect_event_timeout, .pre_button_events = { avm_event_push_button_wlan_wps, avm_event_push_button_nexus_pairing, avm_event_push_button_plc_pairing, }, .post_button_events = { avm_event_push_button_wlan_wps_off, avm_event_push_button_plc_pairing_off, }, .transitions = { {.event = connect_event_timeout, .next_state = connect_state_timeout}, {.event = connect_event_nexus_pairing_success, .next_state = connect_state_post_nexus_success}, {.event = connect_event_nexus_pairing_error, .next_state = connect_state_error}, {.event = connect_event_wps_success, .next_state = connect_state_post_nexus_success}, {.event = connect_event_wps_error, .next_state = connect_state_post_nexus_error}, {.event = connect_event_plc_pairing_success, .next_state = connect_state_post_nexus}, {.event = connect_event_plc_pairing_error, .next_state = connect_state_post_nexus_error}, }, }, [connect_state_post_nexus_timeout] = { .description = "methode2_connect_state_post_nexus_timeout", .pre_led_event = event_connect_pairing_done, .pre_button_events = { avm_event_push_button_nexus_pairing_off, }, }, [connect_state_timeout] = { .description = "methode2_connect_state_timeout", .pre_led_event = event_connect_pairing_timeout, .pre_button_events = { avm_event_push_button_nexus_pairing_off, avm_event_push_button_connect_timeout, }, }, [connect_state_post_nexus_error]= { .description = "methode2_connect_state_error", .pre_led_event = event_connect_pairing_done, .pre_button_events = { avm_event_push_button_nexus_pairing_off, avm_event_push_button_connect_error, }, }, [connect_state_post_nexus_success]= { .description = "methode2_connect_state_success", .pre_led_event = event_connect_pairing_success, .pre_button_events = { avm_event_push_button_nexus_pairing_off, avm_event_push_button_connect_success, }, }, };