summaryrefslogtreecommitdiff
path: root/cesar
diff options
context:
space:
mode:
authormercadie2010-06-02 15:46:30 +0000
committermercadie2010-06-02 15:46:30 +0000
commit1bedae8101dedfb9143932764d2eba21ed39dc30 (patch)
tree72da89f0083c82e3f0b4cbeb0edc12314a3a7b2c /cesar
parente94b7ea52646ce3901ba31786225f31e7336fa99 (diff)
cesar/cp/sta/action/vs: complete imac_get_discover_list_req, closes #1005
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7151 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar')
-rw-r--r--cesar/cp/sta/action/src/vs.c13
-rw-r--r--cesar/cp/sta/action/test/utest/src/vs.c63
2 files changed, 65 insertions, 11 deletions
diff --git a/cesar/cp/sta/action/src/vs.c b/cesar/cp/sta/action/src/vs.c
index 853c1e307e..5ebe62dceb 100644
--- a/cesar/cp/sta/action/src/vs.c
+++ b/cesar/cp/sta/action/src/vs.c
@@ -18,6 +18,7 @@
#include "cp/sta/mgr/sta_mgr.h"
#include "cp/inc/context.h"
#include "mac/common/tonemap.h"
+#include "cp/sta/action/misc.h"
/**
* Handle STARTED => VS_GET_TONEMAP.REQ.
@@ -545,13 +546,19 @@ cp_sta_action_vs__started__imac_get_discover_list_req (cp_t *ctx,
cp_sta = cp_net_sta_get_next (ctx, net, cp_sta))
{
cp_msg_imac_discover_list_sta_info_t data;
+ cp_tei_t tei = cp_sta_get_tei (cp_sta);
data.mac = cp_sta_get_mac_address (cp_sta);
- data.ble_tx = 0;
- data.ble_rx = 0;
+ data.ble_tx =
+ cp_sta_action_get_average_ble (ctx, tei, true,
+ false);
+;
+ data.ble_rx =
+ cp_sta_action_get_average_ble (ctx, tei, false,
+ false);
cp_msg_imac_get_discover_list_cnf_send (ctx, mme_tx,
- &data);
+ &data);
}
}
}
diff --git a/cesar/cp/sta/action/test/utest/src/vs.c b/cesar/cp/sta/action/test/utest/src/vs.c
index 1d59b0dbfc..b1ce1ef0aa 100644
--- a/cesar/cp/sta/action/test/utest/src/vs.c
+++ b/cesar/cp/sta/action/test/utest/src/vs.c
@@ -643,9 +643,17 @@ imac_get_discover_list_test_case (test_t t)
/* Create our net/AVLN. */
test_sta_action_create_our_net (&ctx, our_nid, tei_1);
cp_net_t *my_net = cp_sta_mgr_get_our_avln (cp);
- cp_sta_t *sta_1 = cp_sta_mgr_sta_add (cp, my_net, tei_1, mac_1);
- test_begin (t, "one sta in our net")
+ cp_sta_t *sta_1 = cp_sta_mgr_sta_add (cp, my_net, tei_1, mac_1);
+ sta_t *sta1 = mac_store_sta_get (cp->mac_store, tei_1);
+ sta1->tx_tonemaps->intervals->intervals_nb = 0;
+ sta1->tx_tonemaps->default_tmi = PHY_MOD_ROBO;
+ sta1->rx_tonemaps->intervals->intervals_nb = 0;
+ sta1->rx_tonemaps->default_tmi = PHY_MOD_HS_ROBO;
+ cp->mac_config->tonemask_info.tonemap_robo[PHY_MOD_ROBO].ble = 0x15;
+ cp->mac_config->tonemask_info.tonemap_robo[PHY_MOD_HS_ROBO].ble = 0x16;
+
+ test_begin (t, "one station in our net")
{
scenario_entry_t entries[] =
{
@@ -659,8 +667,8 @@ imac_get_discover_list_test_case (test_t t)
.num_stations = 1),
SCENARIO_EVENT (cp_msg_imac_get_discover_list_cnf_send,
.mac = mac_1,
- .ble_tx = 0,
- .ble_rx = 0),
+ .ble_tx = 69,
+ .ble_rx = 138),
SCENARIO_EVENT (cp_msg_imac_get_discover_list_cnf_send_end),
SCENARIO_END
};
@@ -670,7 +678,38 @@ imac_get_discover_list_test_case (test_t t)
cp_net_t *other_net = cp_sta_mgr_add_avln (cp, 5, our_nid+1);
cp_sta_t *sta_2 = cp_sta_mgr_sta_add (cp, other_net, tei_1+1, mac_1+1);
- test_begin (t, "one sta in our net and one in an other net")
+ cp_sta_t *sta_3 = cp_sta_mgr_sta_add (cp, my_net, tei_1+2, mac_1+2);
+ sta_t *sta3 = mac_store_sta_get (cp->mac_store, tei_1+2);
+ sta3->tx_tonemaps->intervals->intervals_nb = 0;
+ sta3->tx_tonemaps->default_tmi = TONEMAP_INDEX_NEGOTIATED_FIRST;
+
+ sta3->tx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST] = tonemap_alloc ();
+ sta3->tx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST]->ble = 0x23;
+
+ sta3->rx_tonemaps->intervals->intervals_nb = 4;
+ sta3->rx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST] = tonemap_alloc ();
+ sta3->rx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST]->ble = 0xFF;
+ sta3->rx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 1] = tonemap_alloc ();
+ sta3->rx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 1]->ble = 0x00;
+ sta3->rx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 2] = tonemap_alloc ();
+ sta3->rx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 2]->ble = 0x08;
+ sta3->rx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 3] = tonemap_alloc ();
+ sta3->rx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 3]->ble = 0x0F;
+
+ sta3->rx_tonemaps->intervals->interval[0].tmi =
+ TONEMAP_INDEX_NEGOTIATED_FIRST;
+ sta3->rx_tonemaps->intervals->interval[0].end_offset_atu = 10;
+ sta3->rx_tonemaps->intervals->interval[1].tmi =
+ TONEMAP_INDEX_NEGOTIATED_FIRST + 1;
+ sta3->rx_tonemaps->intervals->interval[1].end_offset_atu = 100;
+ sta3->rx_tonemaps->intervals->interval[2].tmi =
+ TONEMAP_INDEX_NEGOTIATED_FIRST + 2;
+ sta3->rx_tonemaps->intervals->interval[2].end_offset_atu = 400;
+ sta3->rx_tonemaps->intervals->interval[3].tmi =
+ TONEMAP_INDEX_NEGOTIATED_FIRST + 3;
+ sta3->rx_tonemaps->intervals->interval[3].end_offset_atu = 500;
+
+ test_begin (t, "one more station in our net and one in an other net")
{
scenario_entry_t entries[] =
{
@@ -682,11 +721,15 @@ imac_get_discover_list_test_case (test_t t)
.peer = peer,
.result = CP_MSG_IMAC_GET_DISCOVER_LIST_RESULT_SUCCESS,
.version = CP_MSG_GET_DISCOVER_LIST_VERSION,
- .num_stations = 2),
+ .num_stations = 3),
SCENARIO_EVENT (cp_msg_imac_get_discover_list_cnf_send,
.mac = mac_1,
- .ble_tx = 0,
- .ble_rx = 0),
+ .ble_tx = 69,
+ .ble_rx = 138),
+ SCENARIO_EVENT (cp_msg_imac_get_discover_list_cnf_send,
+ .mac = mac_1+2,
+ .ble_tx = 18,
+ .ble_rx = 65),
SCENARIO_EVENT (cp_msg_imac_get_discover_list_cnf_send,
.mac = mac_1+1,
.ble_tx = 0,
@@ -698,6 +741,10 @@ imac_get_discover_list_test_case (test_t t)
} test_end;
/* Cleanup. */
+ blk_release (sta1);
+ blk_release (sta3);
+ slab_release (sta_3);
+ cp_sta_mgr_sta_remove_from_mac (cp, mac_1+2);
slab_release (sta_2);
cp_sta_mgr_sta_remove_from_mac (cp, mac_1+1);
slab_release (sta_1);