summaryrefslogtreecommitdiff
path: root/cesar/cp
diff options
context:
space:
mode:
authorlaranjeiro2009-03-16 17:32:58 +0000
committerlaranjeiro2009-03-16 17:32:58 +0000
commit63f29b8f2da439b719d11785580e491147bb5324 (patch)
tree1a7600a3002432413a8373b0a1fb391d9b96e527 /cesar/cp
parent3154eb17122e9566ed3cadd8b4938392e46c5359 (diff)
cp/beacon: Added a function to reprogram the timer to awake correctly the new
CCo and the new station. (See #161). git-svn-id: svn+ssh://pessac/svn/cesar/trunk@4225 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/cp')
-rw-r--r--cesar/cp/beacon/beacon.h10
-rw-r--r--cesar/cp/beacon/src/beacon.c15
2 files changed, 24 insertions, 1 deletions
diff --git a/cesar/cp/beacon/beacon.h b/cesar/cp/beacon/beacon.h
index 1efa8c2195..5024d2bcc8 100644
--- a/cesar/cp/beacon/beacon.h
+++ b/cesar/cp/beacon/beacon.h
@@ -182,6 +182,16 @@ cp_beacon_cco_handover (cp_t *ctx, cp_tei_t tei);
void
cp_beacon_discover_compute_interval (cp_t *ctx);
+/**
+ * Compute the new date for the beacon timer.
+ * \param ctx the module context.
+ *
+ * This function adjust the beacon timer for the station concerned by the
+ * handover or when the CCo stops it activity of CCo for others reasons.
+ */
+void
+cp_beacon_reconfigure_timer (cp_t *ctx);
+
END_DECLS
#endif /* cp_beacon_beacon_h */
diff --git a/cesar/cp/beacon/src/beacon.c b/cesar/cp/beacon/src/beacon.c
index 33718b8cec..55db864d69 100644
--- a/cesar/cp/beacon/src/beacon.c
+++ b/cesar/cp/beacon/src/beacon.c
@@ -1084,7 +1084,8 @@ cp_beacon_get_and_process_beacon (cp_t *ctx)
// Store the access mode of the station.
cp_net_set_access (ctx, net, beacon->payload->fc.access);
- if (!ctx->beacon.hoip.hoipcd)
+ if ((!ctx->beacon.hoip.hoipcd)
+ && (cp_sta_own_data_get_cco_status (ctx)))
cp_fsm_post_new_event (ctx, sta, DISCOVERED_STA, net, sta);
/* Our station is associated and the beacon is from our CCo */
@@ -1369,3 +1370,15 @@ cp_beacon_handover (cp_t *ctx, cp_tei_t cco)
}
}
+void
+cp_beacon_reconfigure_timer (cp_t *ctx)
+{
+ bool cco;
+ dbg_assert (ctx);
+
+ // Program the timer.
+ cco = cp_sta_own_data_get_cco_status (ctx);
+ hal_timer_instance_cancel (ctx->hal_timer, &ctx->beacon.leon_timer);
+ hal_timer_instance_program (ctx->hal_timer, &ctx->beacon.leon_timer,
+ cp_pwl_get_next_timer_date (ctx, cco));
+}