summaryrefslogtreecommitdiff
path: root/cesar/cp/sta
diff options
context:
space:
mode:
authorNélio Laranjeiro2012-11-20 11:04:02 +0100
committerNélio Laranjeiro2012-12-17 17:01:01 +0100
commitda1c76ac1e2d4e46020397a89bde4eedbbfeadf0 (patch)
treed3218bccb17f98558589fa48e4776dde4d1c02ab /cesar/cp/sta
parentc06dac0f6a2dc1c3576308a190f504f4da0121b1 (diff)
cesar/cp/av: add vs_get_attenuation_list MME, refs #3485
Diffstat (limited to 'cesar/cp/sta')
-rw-r--r--cesar/cp/sta/action/src/vs.c58
-rw-r--r--cesar/cp/sta/action/vs.h9
2 files changed, 67 insertions, 0 deletions
diff --git a/cesar/cp/sta/action/src/vs.c b/cesar/cp/sta/action/src/vs.c
index 3934bb465b..d3050d9482 100644
--- a/cesar/cp/sta/action/src/vs.c
+++ b/cesar/cp/sta/action/src/vs.c
@@ -12,6 +12,7 @@
*/
#include "common/std.h"
+#include "hal/arch/platform.h"
#include "mac/common/store.h"
#include "cp/msg/msg.h"
#include "cp/sta/mgr/sta.h"
@@ -663,3 +664,60 @@ cp_sta_action_vs__started__vs_get_mactotei_req (cp_t *ctx, cp_mme_rx_t *mme)
cp_msg_vs_get_mactotei_cnf_send_end (ctx, mme_tx);
}
}
+
+void
+cp_sta_action_vs__started__vs_get_attenuation_list_req (
+ cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+
+ if (cp_msg_vs_get_attenuation_list_req_receive (ctx, mme))
+ {
+ cp_mme_tx_t *mme_tx;
+ cp_net_t *net = NULL;
+ uint nb_stations = 0;
+ cp_sta_t *sta;
+ cp_tei_t tei;
+ sta_t *mac_sta;
+ s8 attenuation_db;
+
+ /* To get our AVLN it must be at least associated i.e. Have a TEI. */
+ if (MAC_TEI_IS_STA (cp_sta_own_data_get_tei (ctx)))
+ {
+ net = cp_sta_mgr_get_our_avln (ctx);
+ nb_stations = cp_net_num_sta_associated (ctx, net);
+ }
+ else
+ nb_stations = 0;
+
+ mme_tx = cp_msg_vs_get_attenuation_list_cnf_send_begin (
+ ctx, &mme->peer, nb_stations);
+
+ /* If no station is associated in the AVLN or the plug is not
+ * associated, there is no need to processed anything, just send an
+ * empty MME. */
+ if (nb_stations)
+ {
+ s8 attenuation_offset_db =
+ arch_is_spc300 () ? CP_AGC_SPC300_ATTENUATION_OFFSET : 0;
+
+ for (sta = cp_net_sta_get_first (ctx, net, CP_NET_STA_ASSOC);
+ sta;
+ sta = cp_net_sta_get_next (ctx, net, sta))
+ {
+ tei = cp_sta_get_tei (sta);
+ mac_sta = mac_store_sta_get (ctx->mac_store, tei);
+ dbg_assert (mac_sta);
+ attenuation_db = mac_sta->agc_gain + attenuation_offset_db
+ - CP_AV_AGC_GAIN_OFFSET;
+ blk_release (mac_sta);
+ cp_msg_vs_get_attenuation_list_cnf_send_entry (
+ ctx, mme_tx, cp_sta_get_mac_address (sta),
+ tei, mac_sta->agc_gain_valid, attenuation_db);
+ }
+ }
+
+ cp_msg_vs_get_attenuation_list_cnf_send_end (ctx, mme_tx);
+ }
+}
diff --git a/cesar/cp/sta/action/vs.h b/cesar/cp/sta/action/vs.h
index 4ab9016f03..fa615d258f 100644
--- a/cesar/cp/sta/action/vs.h
+++ b/cesar/cp/sta/action/vs.h
@@ -98,6 +98,15 @@ void
cp_sta_action_vs__started__imac_get_discover_list_req (cp_t *ctx,
cp_mme_rx_t *mme);
+/**
+ * Handle STARTED => VS_GET_ATTENUATION_LIST.REQ.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ */
+void
+cp_sta_action_vs__started__vs_get_attenuation_list_req (
+ cp_t *ctx, cp_mme_rx_t *mme);
+
END_DECLS
#endif /* cp_sta_action_vs_h */