Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Peer Search Receptor

This module handles the Peer search Receptor Process.

Modules

 Peer Search Initiator
 This module handles the Peer search Initiation Process.
 

Macros

#define PEER_RESPONSE_TIMEOUT_IN_MICRO_SEC   (200000)
 
#define PEER_RESPONSE_TIMEOUT_IN_MICRO_SEC   (200000)
 

Enumerations

enum  peer_search_receptor_state_t {
  PEER_RSP_SEND,
  WAIT_FOR_PEER_CONF,
  PEER_SEARCH_RECEPTOR_SUCCESS,
  NUM_PEER_SEARCH_RECEPTOR_STATES,
  PEER_RSP_SEND,
  WAIT_FOR_PEER_CONF,
  PEER_SEARCH_RECEPTOR_SUCCESS,
  NUM_PEER_SEARCH_RECEPTOR_STATES
}
 
enum  peer_search_receptor_state_t {
  PEER_RSP_SEND,
  WAIT_FOR_PEER_CONF,
  PEER_SEARCH_RECEPTOR_SUCCESS,
  NUM_PEER_SEARCH_RECEPTOR_STATES,
  PEER_RSP_SEND,
  WAIT_FOR_PEER_CONF,
  PEER_SEARCH_RECEPTOR_SUCCESS,
  NUM_PEER_SEARCH_RECEPTOR_STATES
}
 

Functions

static void app_peer_conf_tmr_handler_cb (void *parameter)
 Timer handler for supporting peer search. More...
 
static void peer_rsp_send_init (void *arg)
 Application task handling peer search. More...
 
static void peer_rsp_send_init (trx_id_t trx, void *arg)
 Application task handling peer search. More...
 
static void peer_rsp_send_tx_done_cb (retval_t status, frame_info_t *frame)
 Callback that is called once tx is done in PEER_RSP_SEND state. More...
 
static void peer_rsp_send_tx_done_cb (trx_id_t trx, retval_t status, frame_info_t *frame)
 Callback that is called once tx is done in PEER_RSP_SEND state. More...
 
void peer_search_receptor_exit (trx_id_t trx)
 Function to exit peer search receptor state. More...
 
void peer_search_receptor_exit (void)
 Function to exit peer search receptor state. More...
 
void peer_search_receptor_init (void *arg)
 Application task to start peer search. More...
 
void peer_search_receptor_init (trx_id_t trx, void *arg)
 Application task to start peer search. More...
 
void peer_search_receptor_rx_cb (trx_id_t trx, frame_info_t *frame)
 Callback that is called if data has been received by trx in peer search receptor state. More...
 
void peer_search_receptor_rx_cb (frame_info_t *frame)
 Callback that is called if data has been received by trx in peer search receptor state. More...
 
void peer_search_receptor_set_sub_state (trx_id_t trx, uint8_t state, void *arg)
 Function to set the sub state of state machine. More...
 
void peer_search_receptor_set_sub_state (uint8_t state, void *arg)
 Function to set the sub state of state machine. More...
 
void peer_search_receptor_task (trx_id_t trx)
 Application task handling peer search. More...
 
void peer_search_receptor_task (void)
 Application task handling peer search. More...
 
void peer_search_receptor_tx_done_cb (trx_id_t trx, retval_t status, frame_info_t *frame)
 Callback that is called once tx is done in peer search receptor state. More...
 
void peer_search_receptor_tx_done_cb (retval_t status, frame_info_t *frame)
 Callback that is called once tx is done in peer search receptor state. More...
 
static int send_peer_rsp (uint64_t *dst_addr)
 Send peer response. More...
 
static int send_peer_rsp (trx_id_t trx, uint64_t *dst_addr)
 Send peer response. More...
 
static void wait_for_conf_exit (void)
 Function to exit wait for peer search conf state. More...
 
static void wait_for_conf_exit (trx_id_t trx)
 Function to exit wait for peer search conf state. More...
 
static void wait_for_conf_init (void *arg)
 Function to initialize wait for peer search conf state. More...
 
static void wait_for_conf_init (trx_id_t trx, void *arg)
 Function to initialize wait for peer search conf state. More...
 
static void wait_for_conf_rx_cb (frame_info_t *mac_frame_info)
 Callback that is called once tx is done in wait for peer search conf state. More...
 
static void wait_for_conf_rx_cb (trx_id_t trx, frame_info_t *mac_frame_info)
 Callback that is called once tx is done in wait for peer search conf state. More...
 

Variables

static peer_state_function_t const peer_search_receptor_state_table [NUM_PEER_SEARCH_RECEPTOR_STATES]
 
static peer_state_function_t const peer_search_receptor_state_table [NUM_PEER_SEARCH_RECEPTOR_STATES]
 
static uint8_t seq_num
 
static uint8_t seq_num [NUM_TRX]
 

#define PEER_RESPONSE_TIMEOUT_IN_MICRO_SEC   (200000)

Referenced by wait_for_conf_init().

#define PEER_RESPONSE_TIMEOUT_IN_MICRO_SEC   (200000)

Referenced by wait_for_conf_init().

Enumerator
PEER_RSP_SEND 
WAIT_FOR_PEER_CONF 
PEER_SEARCH_RECEPTOR_SUCCESS 
NUM_PEER_SEARCH_RECEPTOR_STATES 
PEER_RSP_SEND 
WAIT_FOR_PEER_CONF 
PEER_SEARCH_RECEPTOR_SUCCESS 
NUM_PEER_SEARCH_RECEPTOR_STATES 
Enumerator
PEER_RSP_SEND 
WAIT_FOR_PEER_CONF 
PEER_SEARCH_RECEPTOR_SUCCESS 
NUM_PEER_SEARCH_RECEPTOR_STATES 
PEER_RSP_SEND 
WAIT_FOR_PEER_CONF 
PEER_SEARCH_RECEPTOR_SUCCESS 
NUM_PEER_SEARCH_RECEPTOR_STATES 

static void app_peer_conf_tmr_handler_cb ( void *  parameter)
static

Timer handler for supporting peer search.

Parameters
parameterpass parameters to timer handler

References print_event(), PRINT_PEER_SEARCH_FAILED, set_main_state(), and WAIT_FOR_EVENT.

Referenced by wait_for_conf_init().

static void peer_rsp_send_init ( void *  arg)
static

Application task handling peer search.

This function

  • Implements the peer search state machine.

References peer_search_receptor_arg_t::peer_ieee_addr, print_event(), PRINT_PEER_SEARCH_FAILED, send_peer_rsp(), set_main_state(), and WAIT_FOR_EVENT.

static void peer_rsp_send_init ( trx_id_t  trx,
void *  arg 
)
static

Application task handling peer search.

This function

  • Implements the peer search state machine.

References peer_search_receptor_arg_t::peer_ieee_addr, print_event(), PRINT_PEER_SEARCH_FAILED, send_peer_rsp(), set_main_state(), and WAIT_FOR_EVENT.

static void peer_rsp_send_tx_done_cb ( retval_t  status,
frame_info_t frame 
)
static

Callback that is called once tx is done in PEER_RSP_SEND state.

Parameters
statusStatus of the transmission procedure
framePointer to the transmitted frame structure

References MAC_SUCCESS, peer_search_receptor_set_sub_state(), print_event(), PRINT_PEER_SEARCH_FAILED, set_main_state(), WAIT_FOR_EVENT, and WAIT_FOR_PEER_CONF.

static void peer_rsp_send_tx_done_cb ( trx_id_t  trx,
retval_t  status,
frame_info_t frame 
)
static

Callback that is called once tx is done in PEER_RSP_SEND state.

Parameters
statusStatus of the transmission procedure
framePointer to the transmitted frame structure

References MAC_SUCCESS, peer_search_receptor_set_sub_state(), print_event(), PRINT_PEER_SEARCH_FAILED, set_main_state(), WAIT_FOR_EVENT, and WAIT_FOR_PEER_CONF.

void peer_search_receptor_exit ( trx_id_t  trx)

Function to exit peer search receptor state.

This function

  • Implements the peer search state machine.

References node_info, and node_ib_t::sub_state.

void peer_search_receptor_exit ( void  )

Function to exit peer search receptor state.

This function

  • Implements the peer search state machine.

References node_info, and node_ib_t::sub_state.

void peer_search_receptor_init ( void *  arg)
void peer_search_receptor_init ( trx_id_t  trx,
void *  arg 
)

Application task to start peer search.

Parameters
argPointer to the arguments to be carried, if any

References app_led_event(), LED_EVENT_START_PEER_SEARCH, macShortAddress, peer_search_receptor_arg_t::my_short_addr, node_info, node_ib_t::peer_short_addr, seq_num, and tal_pib_set().

void peer_search_receptor_rx_cb ( trx_id_t  trx,
frame_info_t frame 
)

Callback that is called if data has been received by trx in peer search receptor state.

Parameters
framePointer to received frame

References node_info.

void peer_search_receptor_rx_cb ( frame_info_t frame)

Callback that is called if data has been received by trx in peer search receptor state.

Parameters
framePointer to received frame

References if(), node_info, and node_ib_t::sub_state.

void peer_search_receptor_set_sub_state ( trx_id_t  trx,
uint8_t  state,
void *  arg 
)

Function to set the sub state of state machine.

Parameters
stateSub state to which the Peer search receptor to be entered
argPointer to the arguments to be carried, if any

References node_info, peer_state_function_t::peer_state_init, and node_ib_t::sub_state.

void peer_search_receptor_set_sub_state ( uint8_t  state,
void *  arg 
)

Function to set the sub state of state machine.

Parameters
stateSub state to which the Peer search receptor to be entered
argPointer to the arguments to be carried, if any

References node_info, peer_state_function_t::peer_state_init, and node_ib_t::sub_state.

Referenced by peer_rsp_send_tx_done_cb().

void peer_search_receptor_task ( trx_id_t  trx)

Application task handling peer search.

This function

  • Implements the peer search state machine.

References node_info, and peer_state_function_t::peer_state_task.

void peer_search_receptor_task ( void  )

Application task handling peer search.

This function

  • Implements the peer search state machine.

References if(), node_info, peer_state_function_t::peer_state_task, and node_ib_t::sub_state.

void peer_search_receptor_tx_done_cb ( trx_id_t  trx,
retval_t  status,
frame_info_t frame 
)

Callback that is called once tx is done in peer search receptor state.

Parameters
statusStatus of the transmission procedure
framePointer to the transmitted frame structure

References node_info.

void peer_search_receptor_tx_done_cb ( retval_t  status,
frame_info_t frame 
)

Callback that is called once tx is done in peer search receptor state.

Parameters
statusStatus of the transmission procedure
framePointer to the transmitted frame structure

References if(), node_info, and node_ib_t::sub_state.

static int send_peer_rsp ( uint64_t *  dst_addr)
static

Send peer response.

This is a unicast send to the node which had earlier send the peer request

Parameters
src_addrThe address which had been sent as payload of peer request it becomes the source address of node which sent peer rsp
seq_numSequence number of the Peer request frame

References app_payload_t::cmd_id, data, FCF_LONG_ADDR, FCF_SHORT_ADDR, node_info, peer_rsp_t::nwk_addr, app_payload_t::payload, PEER_RESPONSE, node_ib_t::peer_short_addr, seq_num, app_payload_t::seq_num, and transmit_frame().

Referenced by peer_rsp_send_init().

static int send_peer_rsp ( trx_id_t  trx,
uint64_t *  dst_addr 
)
static

Send peer response.

This is a unicast send to the node which had earlier send the peer request

Parameters
src_addrThe address which had been sent as payload of peer request it becomes the source address of node which sent peer rsp
seq_numSequence number of the Peer request frame

References app_transmit_frame(), app_payload_t::cmd_id, data, FCF_LONG_ADDR, FCF_SHORT_ADDR, node_info, peer_rsp_t::nwk_addr, app_payload_t::payload, PEER_RESPONSE, node_ib_t::peer_short_addr, seq_num, and app_payload_t::seq_num.

Referenced by peer_rsp_send_init().

static void wait_for_conf_exit ( void  )
static

Function to exit wait for peer search conf state.

This function

  • Implements the peer search state machine.

References APP_TIMER_TO_TX, and sw_timer_stop().

static void wait_for_conf_exit ( trx_id_t  trx)
static

Function to exit wait for peer search conf state.

This function

  • Implements the peer search state machine.

References APP_TIMER_TO_TX, and sw_timer_stop().

static void wait_for_conf_init ( void *  arg)
static

Function to initialize wait for peer search conf state.

This function

  • Implements the peer search state machine.

References app_peer_conf_tmr_handler_cb(), APP_TIMER_TO_TX, FUNC_PTR, NULL, PEER_RESPONSE_TIMEOUT_IN_MICRO_SEC, SW_TIMEOUT_RELATIVE, and sw_timer_start().

static void wait_for_conf_init ( trx_id_t  trx,
void *  arg 
)
static

Function to initialize wait for peer search conf state.

This function

  • Implements the peer search state machine.

References app_peer_conf_tmr_handler_cb(), APP_TIMER_TO_TX, FUNC_PTR, PEER_RESPONSE_TIMEOUT_IN_MICRO_SEC, SW_TIMEOUT_RELATIVE, and sw_timer_start().

static void wait_for_conf_rx_cb ( trx_id_t  trx,
frame_info_t mac_frame_info 
)
static

peer_state_function_t const peer_search_receptor_state_table[NUM_PEER_SEARCH_RECEPTOR_STATES]
static
Initial value:
= {
{
},
{
},
}
#define NULL
Definition: src/include/lwip/def.h:47
static void wait_for_conf_rx_cb(frame_info_t *frame)
Callback that is called once tx is done in wait for peer search conf state.
Definition: src/peer_search_receptor.c:336
static void peer_rsp_send_tx_done_cb(retval_t status, frame_info_t *frame)
Callback that is called once tx is done in PEER_RSP_SEND state.
Definition: src/peer_search_receptor.c:256
static void wait_for_conf_exit(void)
Function to exit wait for peer search conf state.
Definition: src/peer_search_receptor.c:396
static void wait_for_conf_init(void *arg)
Function to initialize wait for peer search conf state.
Definition: src/peer_search_receptor.c:317
static void peer_rsp_send_init(void *arg)
Application task handling peer search.
Definition: src/peer_search_receptor.c:239
peer_state_function_t const peer_search_receptor_state_table[NUM_PEER_SEARCH_RECEPTOR_STATES]
static
Initial value:
= {
{
},
{
},
}
static void wait_for_conf_rx_cb(trx_id_t trx, frame_info_t *frame)
Callback that is called once tx is done in wait for peer search conf state.
Definition: 2/src/peer_search_receptor.c:335
static void peer_rsp_send_tx_done_cb(trx_id_t trx, retval_t status, frame_info_t *frame)
Callback that is called once tx is done in PEER_RSP_SEND state.
Definition: 2/src/peer_search_receptor.c:255
static void wait_for_conf_exit(trx_id_t trx)
Function to exit wait for peer search conf state.
Definition: 2/src/peer_search_receptor.c:395
#define NULL
Definition: src/include/lwip/def.h:47
static void wait_for_conf_init(trx_id_t trx, void *arg)
Function to initialize wait for peer search conf state.
Definition: 2/src/peer_search_receptor.c:316
static void peer_rsp_send_init(trx_id_t trx, void *arg)
Application task handling peer search.
Definition: 2/src/peer_search_receptor.c:238
uint8_t seq_num
static
uint8_t seq_num[NUM_TRX]
static