summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cesar/cp/eoc/cco/action/src/cco_action.c1
-rw-r--r--cesar/cp/eoc/sta/action/Module2
-rw-r--r--cesar/cp/eoc/sta/action/src/assoc.c10
-rw-r--r--cesar/cp/eoc/sta/action/src/drv.c256
-rw-r--r--cesar/cp/eoc/sta/action/src/poweron.c66
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/inc/scenario_defs.h22
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/fsm_stub.c99
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/test_fsm.c32
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/Makefile3
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/override/cp/inc/context.h2
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/src/mgr_stub.c15
-rw-r--r--cesar/cp/fsm/src/fsm/cp_eoc_sta.fsm26
12 files changed, 532 insertions, 2 deletions
diff --git a/cesar/cp/eoc/cco/action/src/cco_action.c b/cesar/cp/eoc/cco/action/src/cco_action.c
index 932438a786..2b65f418f1 100644
--- a/cesar/cp/eoc/cco/action/src/cco_action.c
+++ b/cesar/cp/eoc/cco/action/src/cco_action.c
@@ -55,6 +55,7 @@ cp_eoc_cco_action_send_central_beacon (cp_t *ctx)
cp_eoc_cco_bw_bp_allocations (ctx);
cp_beacon_cco_send_central_beacon (ctx);
+ cp_eoc_cco_bw_scheduler (ctx);
}
void
diff --git a/cesar/cp/eoc/sta/action/Module b/cesar/cp/eoc/sta/action/Module
index 5cff98c96c..d53e26daa9 100644
--- a/cesar/cp/eoc/sta/action/Module
+++ b/cesar/cp/eoc/sta/action/Module
@@ -1 +1 @@
-SOURCES := assoc.c sleep.c
+SOURCES := assoc.c sleep.c poweron.c drv.c
diff --git a/cesar/cp/eoc/sta/action/src/assoc.c b/cesar/cp/eoc/sta/action/src/assoc.c
index a120c2491a..fa6e727f66 100644
--- a/cesar/cp/eoc/sta/action/src/assoc.c
+++ b/cesar/cp/eoc/sta/action/src/assoc.c
@@ -22,6 +22,15 @@
void
cp_eoc_sta_action_assoc__detecting_detected (cp_t *ctx)
{
+ dbg_assert (ctx);
+ /* Send association request. */
+ cp_msg_cc_assoc_req_t data = {
+ CP_MSG_CC_ASSOC_REQ_TYPE_NEW,
+ cp_sta_own_data_get_nid (ctx),
+ CP_CCO_LEVEL,
+ CP_PCO_CAP
+ };
+ cp_msg_cc_assoc_req_send (ctx, &ctx->sta_action.assoc.peer, &data);
}
void
@@ -159,6 +168,7 @@ cp_eoc_sta_action_assoc__beacon_not_received (cp_t *ctx)
ctx->sta_action.assoc.beacon_loss++;
if (ctx->sta_action.assoc.beacon_loss > CP_MAX_NO_BEACON)
{
+ ctx->sta_action.assoc.beacon_loss = 0;
cp_fsm_trigger_new_event (ctx, bare, no_beacons);
}
}
diff --git a/cesar/cp/eoc/sta/action/src/drv.c b/cesar/cp/eoc/sta/action/src/drv.c
new file mode 100644
index 0000000000..502579edd1
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/src/drv.c
@@ -0,0 +1,256 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/action/src/drv.c
+ * \brief STA action, driver related definitions.
+ * \ingroup cp_sta_action
+ */
+#include "common/std.h"
+
+#include "cp/sta/action/action.h"
+
+#include "cp/msg/msg.h"
+#include "cp/inc/context.h"
+#include "cp/fsm/fsm.h"
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_mac_addr_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ mac_t mac;
+ bool ok = cp_msg_drv_sta_set_mac_addr_req_receive (ctx, mme, &mac);
+ if (ok)
+ cp_sta_own_data_set_mac_address (ctx, mac);
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_MAC_ADDR_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_cco_pref_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ bool cco_pref;
+ bool ok = cp_msg_drv_sta_set_cco_pref_req_receive (ctx, mme, &cco_pref);
+ if (ok)
+ {
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (ctx);
+ own->cco_prefered = cco_pref;
+ }
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_CCO_PREF_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_was_cco_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ bool was_cco;
+ bool ok = cp_msg_drv_sta_set_was_cco_req_receive (ctx, mme, &was_cco);
+ if (ok)
+ cp_sta_own_data_set_was_cco (ctx, was_cco);
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_WAS_CCO_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+}
+
+// void
+// cp_sta_action_drv__stopped__drv_sta_set_npw_req (cp_t *ctx,
+// cp_mme_rx_t *mme)
+// {
+// char npw[CP_NPW_MAX_SIZE + 1];
+// bool ok = cp_msg_drv_sta_set_npw_req_receive (ctx, mme, npw);
+// if (ok)
+// {
+// /* Compute NID from received information. */
+// cp_security_level_t sl;
+// sl = cp_sta_own_data_get_security_level (ctx);
+// cp_sta_own_data_set_npw (ctx, npw);
+// cp_compute_nmk_and_nid_from_npw (ctx, npw, sl);
+// }
+// cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_NPW_CNF,
+// ok ? CP_MSG_DRV_RESULT_SUCCESS
+// : CP_MSG_DRV_RESULT_FAILURE);
+// }
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_dpw_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ char dpw[CP_DPW_MAX_SIZE + 1];
+ bool ok = cp_msg_drv_sta_set_dpw_req_receive (ctx, mme, dpw);
+ if (ok)
+ cp_sta_own_data_set_dpw (ctx, dpw);
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_DPW_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+}
+
+// void
+// cp_sta_action_drv__stopped__drv_sta_set_sl_req (cp_t *ctx,
+// cp_mme_rx_t *mme)
+// {
+// cp_security_level_t sl;
+// bool ok = cp_msg_drv_sta_set_sl_req_receive (ctx, mme, &sl);
+// if (ok)
+// {
+// /* Compute NID from received information. */
+// const char *npw;
+// npw = cp_sta_own_data_get_npw (ctx);
+//
+// cp_sta_own_data_set_security_level (ctx, sl);
+// cp_compute_nmk_and_nid_from_npw (ctx, npw, sl);
+// }
+// cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_SL_CNF,
+// ok ? CP_MSG_DRV_RESULT_SUCCESS
+// : CP_MSG_DRV_RESULT_FAILURE);
+// }
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_nid_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ cp_nid_t nid;
+ bool ok = cp_msg_drv_sta_set_nid_req_receive (ctx, mme, &nid);
+ if (ok)
+ cp_sta_own_data_set_nid (ctx, nid);
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_NID_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_tonemask_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ u32 tonemask[PHY_TONEMASK_WORDS];
+ bool ok = cp_msg_drv_sta_set_tonemask_req_receive (ctx, mme, tonemask);
+ if (ok)
+ {
+ /* TODO. */
+ }
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_TONEMASK_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_mac_start_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ bool ok = cp_msg_drv_sta_mac_start_req_receive (ctx, mme);
+ if (ok)
+ {
+ /* Start power-on procedure. */
+ cp_sta_action_poweron_start (ctx);
+ }
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_MAC_START_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+
+}
+
+void
+cp_sta_action_drv__started__drv_sta_mac_stop_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ bool ok = cp_msg_drv_sta_mac_stop_req_receive (ctx, mme);
+ /* This come from the driver, it should be OK. */
+ dbg_assert (ok);
+ /* Save driver address. */
+ ctx->sta_action.drv_peer = mme->peer;
+ /* Stop station. */
+ cp_sta_action_poweron_stop (ctx);
+}
+
+// void
+// cp_sta_action_drv__stopped__drv_sta_set_key_req (cp_t *ctx, cp_mme_rx_t *mme)
+// {
+// cp_key_t nmk;
+// enum cp_msg_drv_sta_set_key_type_t type;
+// cp_nid_t nid;
+// cp_security_level_t sl;
+//
+// dbg_assert (ctx);
+// dbg_assert (mme);
+//
+// if (cp_msg_drv_sta_set_key_req_receive (ctx, mme, &nmk, &type, &nid, &sl))
+// {
+// cp_sta_own_data_set_nmk (ctx, nmk);
+// switch (type)
+// {
+// case CP_MSG_DRV_STA_SET_KEY_TYPE_CHANGE_NID:
+// sl = cp_sta_own_data_get_security_level (ctx);
+// nid = ((cp_nid_t) sl << 52) | nid;
+// cp_sta_own_data_set_nid (ctx, nid);
+// break;
+// case CP_MSG_DRV_STA_SET_KEY_TYPE_CHANGE_SECURITY_LEVEL:
+// cp_sta_own_data_set_security_level (ctx, sl);
+// nid = ((cp_nid_t) sl << 52) | nid;
+// cp_sta_own_data_set_nid (ctx, nid);
+// break;
+// default:
+// dbg_assert_default ();
+// }
+//
+// cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_KEY_CNF,
+// CP_MSG_DRV_RESULT_SUCCESS);
+// }
+// else
+// {
+// cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_KEY_CNF,
+// CP_MSG_DRV_RESULT_FAILURE);
+// }
+// }
+
+// void
+// cp_sta_action_drv__stopped__drv_sta_set_dak_req (cp_t *ctx, cp_mme_rx_t *mme)
+// {
+// cp_key_t dak;
+// dbg_assert (ctx);
+// dbg_assert (mme);
+//
+// if (cp_msg_drv_sta_set_dak_req_receive (ctx, mme, &dak))
+// {
+// cp_sta_own_data_set_dak (ctx, dak);
+// cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_DAK_CNF,
+// CP_MSG_DRV_RESULT_SUCCESS);
+// }
+// else
+// {
+// cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_DAK_CNF,
+// CP_MSG_DRV_RESULT_FAILURE);
+// }
+// }
+//
+// void
+// cp_sta_action_drv__drv_sta_get_key_req (cp_t *ctx, cp_mme_rx_t *mme)
+// {
+// cp_msg_drv_sta_get_key_t data;
+// dbg_assert (ctx);
+// dbg_assert (mme);
+//
+// memset (&data, 0, sizeof (cp_msg_drv_sta_get_key_t));
+// if (cp_msg_drv_sta_get_key_req_receive (ctx, mme))
+// {
+// data.result = CP_MSG_DRV_RESULT_SUCCESS;
+// data.nmk = cp_sta_own_data_get_nmk (ctx);
+// data.nid = cp_sta_own_data_get_nid (ctx);
+// data.sl = cp_sta_own_data_get_security_level (ctx);
+//
+// cp_msg_drv_sta_get_key_cnf_send (ctx, &mme->peer, &data);
+// }
+// else
+// {
+// data.result = CP_MSG_DRV_RESULT_FAILURE;
+// cp_msg_drv_sta_get_key_cnf_send (ctx, &mme->peer, &data);
+// }
+// }
diff --git a/cesar/cp/eoc/sta/action/src/poweron.c b/cesar/cp/eoc/sta/action/src/poweron.c
new file mode 100644
index 0000000000..1e9636d4cf
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/src/poweron.c
@@ -0,0 +1,66 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/action/src/poweron.c
+ * \brief STA action, power on procedure related definitions.
+ * \ingroup cp_sta_action
+ */
+#include "common/std.h"
+
+#include "cp/sta/action/action.h"
+
+#include "cp/defs.h"
+#include "cp/msg/msg.h"
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/fsm/fsm.h"
+#include "cp/beacon/beacon.h"
+#include "cp/cco/action/cco_action.h"
+
+#include "cp/inc/context.h"
+
+void
+cp_sta_action_poweron_start (cp_t *ctx)
+{
+ cp_fsm_trigger_new_event (ctx, bare, to_poweron);
+}
+
+void
+cp_sta_action_poweron_stop (cp_t *ctx)
+{
+ cp_fsm_trigger_new_event (ctx, bare, to_stop);
+}
+
+void
+cp_sta_action_poweron__idle__to_poweron (cp_t *ctx)
+{
+ cp_beacon_create_default_schedules (ctx);
+ sar_activate (ctx->sar, true);
+ pbproc_activate (ctx->pbproc, true);
+}
+
+// void
+// cp_sta_action_poweron__poweron__beacon (cp_t *ctx, cp_beacon_desc_t *beacon,
+// cp_net_t *net, cp_sta_t *sta)
+// {
+// dbg_assert (ctx);
+// dbg_assert (beacon);
+// dbg_assert (net);
+// dbg_assert (sta);
+// cp_sta_action_poweron_beacon_match_and_join (
+// ctx, beacon, net, sta,
+// CP_FSM_BRANCH (POWERON, BEACON, nid_match),
+// CP_FSM_BRANCH (POWERON, BEACON, no_nid_match));
+// }
+
+// void
+// cp_sta_action_poweron__sta__to_stop (cp_t *ctx)
+// {
+// dbg_assert (ctx);
+// cp_sta_action_assoc_leave (ctx);
+// }
+//
diff --git a/cesar/cp/eoc/sta/action/test/utest/inc/scenario_defs.h b/cesar/cp/eoc/sta/action/test/utest/inc/scenario_defs.h
index ef975c0faf..7999520223 100644
--- a/cesar/cp/eoc/sta/action/test/utest/inc/scenario_defs.h
+++ b/cesar/cp/eoc/sta/action/test/utest/inc/scenario_defs.h
@@ -73,6 +73,16 @@ scenario_action_process_urgent_cb (scenario_globals_t *globals,
/* Scenario events. */
#define SCENARIO_DEFS_EVENTS \
+ cp_fsm__STOPPED__drv_sta_set_mac_addr_req, \
+ cp_fsm__STOPPED__drv_sta_set_cco_pref_req, \
+ cp_fsm__STOPPED__drv_sta_set_was_cco_req, \
+ cp_fsm__STOPPED__drv_sta_set_dpw_req, \
+ cp_fsm__STOPPED__drv_sta_set_nid_req, \
+ cp_fsm__STOPPED__drv_sta_set_tonemask_req, \
+ cp_fsm__STOPPED__drv_sta_set_key_req, \
+ cp_fsm__STOPPED__drv_sta_set_dak_req, \
+ cp_fsm__STOPPED__drv_sta_mac_start_req, \
+ cp_fsm__STARTED__poweron__idle__to_poweron, \
cp_fsm__DETECTING_BEACON__BEACON, \
cp_fsm__DETECTING_BEACON__BEACON_NOT_RECEIVED, \
cp_fsm__DETECTING_BEACON__nd_beacon, \
@@ -80,6 +90,7 @@ scenario_action_process_urgent_cb (scenario_globals_t *globals,
cp_fsm__ASSOCIATING__timeout_associating, \
cp_fsm__ASSOCIATING__assoc_cnf, \
cp_fsm__ASSOCIATING__no_beacons, \
+ cp_fsm__ASSOCIATING__beacon_not_received, \
cp_fsm__UNASSOCIATED__enter_sleep_unassociated, \
cp_fsm__UNASSOCIATED__retry_unassociated, \
cp_fsm__SLEEP_UNASSOCIATED__exit_sleep_unassociated, \
@@ -99,6 +110,16 @@ typedef struct
cp_fsm_branch_t branch;
} scenario_event_transition_with_branch_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_mac_addr_req_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_cco_pref_req_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_was_cco_req_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_dpw_req_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_nid_req_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_tonemask_req_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_key_req_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_dak_req_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_mac_start_req_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STARTED__poweron__idle__to_poweron_t;
typedef scenario_empty_t scenario_event_cp_fsm__DETECTING_BEACON__BEACON_t;
typedef scenario_empty_t scenario_event_cp_fsm__DETECTING_BEACON__BEACON_NOT_RECEIVED_t;
typedef scenario_empty_t scenario_event_cp_fsm__DETECTING_BEACON__nd_beacon_t;
@@ -106,6 +127,7 @@ typedef scenario_empty_t scenario_event_cp_fsm__DETECTING_BEACON__nd_beacon_time
typedef scenario_event_transition_with_branch_t scenario_event_cp_fsm__ASSOCIATING__timeout_associating_t;
typedef scenario_event_transition_with_branch_t scenario_event_cp_fsm__ASSOCIATING__assoc_cnf_t;
typedef scenario_empty_t scenario_event_cp_fsm__ASSOCIATING__no_beacons_t;
+typedef scenario_empty_t scenario_event_cp_fsm__ASSOCIATING__beacon_not_received_t;
typedef scenario_empty_t scenario_event_cp_fsm__UNASSOCIATED__enter_sleep_unassociated_t;
typedef scenario_empty_t scenario_event_cp_fsm__UNASSOCIATED__retry_unassociated_t;
typedef scenario_empty_t scenario_event_cp_fsm__SLEEP_UNASSOCIATED__exit_sleep_unassociated_t;
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/fsm_stub.c b/cesar/cp/eoc/sta/action/test/utest/src/fsm_stub.c
index 2dc667b809..6c8d87101c 100644
--- a/cesar/cp/eoc/sta/action/test/utest/src/fsm_stub.c
+++ b/cesar/cp/eoc/sta/action/test/utest/src/fsm_stub.c
@@ -78,10 +78,109 @@ cp_eoc_sta_action_assoc__beacon_received (cp_t *ctx);
void
cp_eoc_sta_action_assoc__beacon_not_received (cp_t *ctx);
+void
+cp_sta_action_drv__stopped__drv_sta_set_mac_addr_req (cp_t *ctx, cp_mme_rx_t *mme);
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_cco_pref_req (cp_t *ctx, cp_mme_rx_t *mme);
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_was_cco_req (cp_t *ctx, cp_mme_rx_t *mme);
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_dpw_req (cp_t *ctx, cp_mme_rx_t *mme);
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_nid_req (cp_t *ctx, cp_mme_rx_t *mme);
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_tonemask_req (cp_t *ctx, cp_mme_rx_t *mme);
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_key_req (cp_t *ctx, cp_mme_rx_t *mme);
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_dak_req (cp_t *ctx, cp_mme_rx_t *mme);
+
+void
+cp_sta_action_drv__stopped__drv_sta_mac_start_req (cp_t *ctx, cp_mme_rx_t *mme);
+
+void
+cp_sta_action_poweron__idle__to_poweron (cp_t *ctx);
+
+void
+cp_beacon_beacon_not_received (cp_t *ctx);
+
/* Include generated tables. */
#include "cp_fsm_tables.h"
void
+cp_sta_action_drv__stopped__drv_sta_set_mac_addr_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_mac_addr_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_cco_pref_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_cco_pref_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_was_cco_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_was_cco_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_dpw_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_dpw_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_nid_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_nid_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_tonemask_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_tonemask_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_key_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_key_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_dak_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_dak_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_mac_start_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_mac_start_req);
+}
+
+void
+cp_sta_action_poweron__idle__to_poweron (cp_t *ctx)
+{
+ scenario_event (cp_fsm__STARTED__poweron__idle__to_poweron);
+}
+
+void
+cp_beacon_beacon_not_received (cp_t *ctx)
+{
+ scenario_event (cp_fsm__ASSOCIATING__beacon_not_received);
+}
+
+void
cp_eoc_sta_action_assoc__detecting_detected (cp_t *ctx)
{
scenario_event (cp_fsm__DETECTING_BEACON__nd_beacon);
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/test_fsm.c b/cesar/cp/eoc/sta/action/test/utest/src/test_fsm.c
index 63707fbb6a..ce0c884c05 100644
--- a/cesar/cp/eoc/sta/action/test/utest/src/test_fsm.c
+++ b/cesar/cp/eoc/sta/action/test/utest/src/test_fsm.c
@@ -34,6 +34,14 @@ test_fsm_basic_test_case (test_t t)
cp_fsm_init (&cp);
cp.sta_core_flag = false;
scenario_entry_t entries[] = {
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_MAC_START_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_mac_start_req),
+ /* STARTED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_to_poweron),
+ SCENARIO_EVENT (cp_fsm__STARTED__poweron__idle__to_poweron),
/* DETECTING_BEACON */
SCENARIO_ACTION (post_and_process,
.type = CP_FSM_EVENT_TYPE_nd_beacon),
@@ -72,6 +80,14 @@ test_fsm_basic_test_case (test_t t)
cp_fsm_init (&cp);
cp.sta_core_flag = false;
scenario_entry_t entries[] = {
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_MAC_START_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_mac_start_req),
+ /* STARTED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_to_poweron),
+ SCENARIO_EVENT (cp_fsm__STARTED__poweron__idle__to_poweron),
/* DETECTING_BEACON, beacon detected */
SCENARIO_ACTION (post_and_process,
.type = CP_FSM_EVENT_TYPE_nd_beacon),
@@ -157,6 +173,14 @@ test_fsm_basic_test_case (test_t t)
cp_fsm_init (&cp);
cp.sta_core_flag = false;
scenario_entry_t entries[] = {
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_MAC_START_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_mac_start_req),
+ /* STARTED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_to_poweron),
+ SCENARIO_EVENT (cp_fsm__STARTED__poweron__idle__to_poweron),
/* DETECTING_BEACON */
SCENARIO_ACTION (post_and_process,
.type = CP_FSM_EVENT_TYPE_nd_beacon),
@@ -297,6 +321,14 @@ test_fsm_basic_test_case (test_t t)
cp_fsm_init (&cp);
cp.sta_core_flag = false;
scenario_entry_t entries[] = {
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_MAC_START_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_mac_start_req),
+ /* STARTED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_to_poweron),
+ SCENARIO_EVENT (cp_fsm__STARTED__poweron__idle__to_poweron),
/* DETECTING_BEACON */
SCENARIO_ACTION (post_and_process,
.type = CP_FSM_EVENT_TYPE_nd_beacon),
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/Makefile b/cesar/cp/eoc/sta/action/test/utest_eoc/Makefile
index c4e136ac2d..f6d5f1431b 100644
--- a/cesar/cp/eoc/sta/action/test/utest_eoc/Makefile
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/Makefile
@@ -7,7 +7,8 @@ HOST_PROGRAMS = assoc
assoc_SOURCES = assoc.c mgr_stub.c
assoc_MODULES = lib cp/sta/mgr mac/common cp/eoc/sta/action \
- cp/fsm/stub cl/stub mac/sar/stub cp/eoc/sta/mgr
+ cp/fsm/stub cl/stub mac/sar/stub cp/eoc/sta/mgr \
+ cp/msg/stub cp/secu cp/beacon/stub
assoc_MODULES_CONFIG = cp
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/override/cp/inc/context.h b/cesar/cp/eoc/sta/action/test/utest_eoc/override/cp/inc/context.h
index 140cfdd796..2a7331a944 100644
--- a/cesar/cp/eoc/sta/action/test/utest_eoc/override/cp/inc/context.h
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/override/cp/inc/context.h
@@ -28,6 +28,7 @@
#include "mac/sar/sar.h"
#include "cl/cl.h"
#include "cp/msg/inc/context.h"
+#include "mac/pbproc/inc/context.h"
struct cp_t
{
@@ -57,6 +58,7 @@ struct cp_t
sar_t *sar;
/** messages context. */
cp_msg_t msg;
+ pbproc_t *pbproc;
};
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/mgr_stub.c b/cesar/cp/eoc/sta/action/test/utest_eoc/src/mgr_stub.c
index 8a473346ad..10d7c0897c 100644
--- a/cesar/cp/eoc/sta/action/test/utest_eoc/src/mgr_stub.c
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/src/mgr_stub.c
@@ -77,3 +77,18 @@ cp_sta_core_get_date_ms (cp_t *ctx)
return 0;
}
+void
+cp_sta_core_checkpoint (cp_t *ctx)
+{
+}
+
+void
+sar_activate (sar_t *ctx, bool activate)
+{
+}
+
+void
+pbproc_activate (pbproc_t *ctx, bool flag)
+{
+}
+
diff --git a/cesar/cp/fsm/src/fsm/cp_eoc_sta.fsm b/cesar/cp/fsm/src/fsm/cp_eoc_sta.fsm
index a01f1a0655..5dc6163f39 100644
--- a/cesar/cp/fsm/src/fsm/cp_eoc_sta.fsm
+++ b/cesar/cp/fsm/src/fsm/cp_eoc_sta.fsm
@@ -2,6 +2,8 @@ Control Plane STA FSM
STA FSM for control plane.
States:
+ STOPPED
+ STARTED
DETECTING_BEACON
ASSOCIATING
UNASSOCIATED
@@ -13,6 +15,12 @@ States:
Events:
BEACON
BEACON_NOT_RECEIVED
+ BEACON_TIMER_EXPIRES
+ HOIP_EXPIRED
+ HANDOVER_DISCOVERED_STA
+ HANDOVER_DISCOVER_PROCESS_DONE
+ to_poweron
+ to_stop
nd_beacon
timeout_associating
assoc_cnf
@@ -104,6 +112,20 @@ Events:
CM_HFID_CNF
CM_MME_ERROR_IND
+STOPPED:
+ DRV_STA_SET_MAC_ADDR_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_mac_addr_req]
+ DRV_STA_SET_CCO_PREF_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_cco_pref_req]
+ DRV_STA_SET_WAS_CCO_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_was_cco_req]
+ DRV_STA_SET_DPW_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_dpw_req]
+ DRV_STA_SET_NID_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_nid_req]
+ DRV_STA_SET_TONEMASK_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_tonemask_req]
+ DRV_STA_SET_KEY_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_key_req]
+ DRV_STA_SET_DAK_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_dak_req]
+ DRV_STA_MAC_START_REQ -> STARTED [cp_sta_action_drv__stopped__drv_sta_mac_start_req]
+
+STARTED:
+ to_poweron -> DETECTING_BEACON [cp_sta_action_poweron__idle__to_poweron]
+
DETECTING_BEACON:
BEACON -> . [cp_eoc_sta_action_assoc__beacon_received]
nd_beacon -> ASSOCIATING [cp_eoc_sta_action_assoc__detecting_detected]
@@ -115,6 +137,7 @@ ASSOCIATING:
assoc_cnf: success -> ASSOCIATED [cp_eoc_sta_action_assoc__associating_cnf]
assoc_cnf: unsuccess -> UNASSOCIATED
assoc_cnf: unrelated -> UNASSOCIATED
+ BEACON_TIMER_EXPIRES -> . [cp_beacon_beacon_not_received]
BEACON_NOT_RECEIVED -> . [cp_eoc_sta_action_assoc__beacon_not_received]
no_beacons -> UNASSOCIATED [cp_eoc_sta_action_assoc__associating_no_beacons]
@@ -131,6 +154,7 @@ ASSOCIATED:
get_key_cnf: not_granted -> UNASSOCIATED
get_key_cnf: unrelated -> UNASSOCIATED
encrypt_payload_rsp -> UNASSOCIATED [cp_eoc_sta_action_assoc__associated_encrypt_payload_rsp]
+ BEACON_TIMER_EXPIRES -> . [cp_beacon_beacon_not_received]
BEACON_NOT_RECEIVED -> . [cp_eoc_sta_action_assoc__beacon_not_received]
no_beacons -> UNASSOCIATED [cp_eoc_sta_action_assoc__associated_no_beacons]
timeout_authenticating -> UNASSOCIATED [cp_eoc_sta_action_assoc__associated_timeout]
@@ -138,11 +162,13 @@ ASSOCIATED:
AUTHENTICATED:
sleep_enter_cnf -> SLEEP_AUTHENTICATED [cp_eoc_sta_action_sleep__authenticated_sleep_enter]
+ BEACON_TIMER_EXPIRES -> .[cp_beacon_beacon_not_received]
BEACON_NOT_RECEIVED -> . [cp_eoc_sta_action_assoc__beacon_not_received]
no_beacons -> UNASSOCIATED [cp_eoc_sta_action_assoc__authenticated_no_beacons]
leave_ind -> DETECTING_BEACON [cp_eoc_sta_action_assoc__authenticated_leave]
SLEEP_AUTHENTICATED:
sleep_exit_rsp -> AUTHENTICATED [cp_eoc_sta_action_sleep__sleep_authenticated_exit]
+ BEACON_TIMER_EXPIRES -> . [cp_beacon_beacon_not_received]
BEACON_NOT_RECEIVED -> . [cp_eoc_sta_action_assoc__beacon_not_received]
no_beacons -> UNASSOCIATED [cp_eoc_sta_action_assoc__sleep_authenticated_no_beacons]