#ifndef cp2_beacon_beacon_h #define cp2_beacon_beacon_h /* Cesar project {{{ * * Copyright (C) 2008 Spidcom * * <<>> * * }}} */ /** * \file cp2/beacon/beacon.h * \brief Beacon module public API. * \ingroup cp2_beacon * * Beacon module. Use to generate and read a beacon. */ #include "cp2/cp.h" #include "cp2/defs.h" #include "cp2/beacon/defs.h" #include "cp2/beacon/beacon_desc.h" /** * Function call back prototype. * \param user data the user data provided on the callback function * registration. * \param cb the function to call on the event. * * This will post an event in the FSM. */ typedef void (*cp_beacon_event_cb_t) (void *user_data); /** * Initialise the beacon module. * \param ctx the module context. */ void cp_beacon_init (cp_t *ctx); /** * Unitialise the beacon module. * \param ctx the module context. */ void cp_beacon_uninit (cp_t *ctx); /** * Initialise the function to call each time the beacon module needs to * post an event in the FSM. * \param ctx the module context. * \param user_data The user data to provide on function call. * \param cb Function call back. * * Those events are : * - beacon_timer, on this event the FSM shall call the following * functions. * - CCo : send central beacon * - UCo : send discover beacon * - POND : create_default_schedules * - Sta, Usta : beacon not receive. * - beacon_received */ void cp_beacon_init_event_callback (cp_t *ctx, void *user_data, cp_beacon_event_cb_t cb); /** * Generate and send a beacon when the station acts as a CCo or Unassociated * CCo. * \param ctx the module context. * \param beacon_type The beacon type to send (central, discover or proxy). * */ void cp_beacon_cco_send_beacon (cp_t *ctx, uint beacon_type); /** * Generate and send a discover beacon. * \param ctx the module context. * */ extern inline void cp_beacon_cco_send_central_beacon (cp_t *ctx) { cp_beacon_cco_send_beacon (ctx, CP_BEACON_CENTRAL_BEACON); } /** * Generate and send a discover beacon. * \param ctx the module context. * */ extern inline void cp_beacon_cco_send_discover_beacon (cp_t *ctx) { cp_beacon_cco_send_beacon (ctx, CP_BEACON_DISCOVER_BEACON); } /** * Create default schedules and provide it to the Channel Access. * \param ctx the module context. * */ void cp_beacon_create_default_schedules (cp_t *ctx); /** * This function is only called when the station is acting as a CCo. * \param ctx the module context. * \param snid The new SNID. * * It allows the beacon module to put the change SNID bentry in the central * beacon. Once the count down of the SNID reach 1, the SNID is inserted * in the station own data and in the mac config */ void cp_beacon_change_snid (cp_t *ctx, u8 snid); /** * Process the first beacon in the received list. * \param ctx the control plane context. */ void cp_beacon_get_and_process_beacon (cp_t *ctx); /** * Process a tracked network using the central beacon or the proxy beacon. * \param ctx the CP module context. * \param beacon the beacon received and tracked. */ void cp_beacon_process_tracked_avln (cp_t *ctx, cp_beacon_desc_t *beacon); /** * Function to call once the beacon has not been received. * \param ctx the module context. * * The beacon timer has expired and this function had been called by the FSM. */ void cp_beacon_beacon_not_received (cp_t *ctx); #endif /* cp2_beacon_beacon_h */