summaryrefslogtreecommitdiff
path: root/cp/beacon/inc/beacons.h
blob: 9ea003dcbc6697adb0c54e967688470f17460329 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#ifndef cp_beacon_inc_beacons_h
#define cp_beacon_inc_beacons_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    cp/beacon/inc/beacons.h
 * \brief   central beacon private functions.
 * \ingroup cp_beacon 
 *
 */

/**
 * Initialize the sub module for the discover, central and proxy beacons.
 * The beacon_ctx corresponds to the each part contained in the ctx.
 *
 * \param  ctx  the becon module context.
 * \param  beacon_ctx  the central, discover or proxy context.
 */
void
cp_beacon_init_beacons (cp_beacon_t *ctx, cp_beacon_common_t *beacon_ctx);

/**
 * Uninit the sub beacon modules.
 *
 * \param  ctx  the beacon module context
 * \param  beacon_ctx  the beacon context to uninit.
 */
void
cp_beacon_uninit_beacons (cp_beacon_t *ctx, cp_beacon_common_t *beacon_ctx);

/**
 * Compute the beacon period using the beacon period thereotic calculated
 * during the pw frequency detection.
 *
 * \param  ctx  the beacon period context.
 */
uint
cp_beacon_pwl_period (cp_beacon_t *ctx);

/**
 * Fill the payload of the beacon when the STA is accting as CCo or UCCo.
 * Can be use for 
 *  - the Central beacon when acting as a CCo
 *  - the discover beacon when acting as a UCCo.
 * 
 *
 * \param  ctx  the beacon module context
 * \param  beacon  the beacon to fill.
 * \param  beacon_type  the beacon type, central, discover or proxy.
 */
void
cp_beacon_xcco_fill_common_part (cp_beacon_t *ctx, cp_beacon_desc_t *beacon,
                                 uint beacon_type);

/**
 * Generate the central beacon.
 *
 * \param  ctx  the beacon context.
 * \param  beacon  the central beacon to fill
 */
void
cp_beacon_cco_beacon_central_generate (cp_beacon_t *ctx, 
                    cp_beacon_desc_t *beacon);

/**
 * Generate the discover beacon when STA is UCCo.
 *
 * \param  ctx  the beacon context.
 * \param  beacon  the central beacon to fill
 */
void
cp_beacon_cco_beacon_discover_generate (cp_beacon_t *ctx,
                    cp_beacon_desc_t *beacon);


/**
 * Send the beacon over the PWL.
 * TODO Implement the proxy beacon part
 *
 * \param  ctx  the cp beacon context
 * \param  beacon the beacon to send
 * \param  beacon_type  the beacon type.
 */
void
cp_beacon_send_beacon (cp_beacon_t *ctx, cp_beacon_desc_t *beacon,
                       uint beacon_type);

/**
 * Process the received beacon
 *
 * \param  ctx  the beacon context.
 * \param  beacon  the beacon received.
 */
void
cp_beacon_process_beacon (cp_beacon_t *ctx, cp_beacon_desc_t *beacon);

/**
 * Function call by the timer when the timer expires.
 *
 * \param  ctx  the beacon context.
 */
void
cp_beacon_timer_it (cp_beacon_t *ctx);

#endif /* cp_beacon_inc_beacons_h */