BlueSync - BLE Time Sync for Zephyr
High-precision time synchronization for BLE Mesh networks
Loading...
Searching...
No Matches
bs_state_machine.h File Reference
#include "bluesync.h"
Include dependency graph for bs_state_machine.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bs_sm_handlers
 Struct defining the callbacks of the state machine. More...
 

Enumerations

enum  bs_sm_state_t {
  BS_NONE_STATE = 0 , BS_SCAN_WAIT_FOR_SYNC = 1 , BS_SYNC = 2 , BS_UPDATE = 3 ,
  BS_ADV = 4 , BS_STOP = 5 , BS_COUNT = 6
}
 Type definition representing the states. More...
 
enum  bs_sm_event_t {
  EVENT_NONE = 0 , EVENT_INIT = 1 , EVENT_NEW_SYNC_RCV = 2 , EVENT_SYNC_EXPIRED = 3 ,
  EVENT_UPDATE_SUCCESS = 4 , EVENT_UPDATE_FAILED = 5 , EVENT_ADV_EXPIRED = 6 , EVENT_NEW_NET_SYNC = 7 ,
  EVENT_COUNT = 8
}
 Type definition representing the events. More...
 

Functions

void bs_state_machine_run (bs_sm_event_t event)
 Annonce an event to the state machine.
 
void bs_state_machine_init (struct bs_sm_handlers *handlers)
 Init the state machine by passing the list of callbacks.
 
void bs_state_machine_set_role (bluesync_role_t role)
 Indicate the role to the state machine.
 
bluesync_role_t bs_state_machine_get_role ()
 Get the node role.
 
bs_sm_state_t bs_state_machine_get_state ()
 Get the current state.
 

Variables

struct bs_sm_handlersbs_sm_handlers
 This struct is implemented in the bluesync.c file.
 

Enumeration Type Documentation

◆ bs_sm_event_t

Type definition representing the events.

Enumerator
EVENT_NONE 
EVENT_INIT 
EVENT_NEW_SYNC_RCV 
EVENT_SYNC_EXPIRED 
EVENT_UPDATE_SUCCESS 
EVENT_UPDATE_FAILED 
EVENT_ADV_EXPIRED 
EVENT_NEW_NET_SYNC 
EVENT_COUNT 

Definition at line 47 of file bs_state_machine.h.

◆ bs_sm_state_t

Type definition representing the states.

Enumerator
BS_NONE_STATE 
BS_SCAN_WAIT_FOR_SYNC 
BS_SYNC 
BS_UPDATE 
BS_ADV 
BS_STOP 
BS_COUNT 

Definition at line 33 of file bs_state_machine.h.

Function Documentation

◆ bs_state_machine_get_role()

bluesync_role_t bs_state_machine_get_role ( )

Get the node role.

Returns
bluesync_role_t

Definition at line 184 of file bs_state_machine.c.

◆ bs_state_machine_get_state()

bs_sm_state_t bs_state_machine_get_state ( )

Get the current state.

Returns
bs_sm_state_t

Definition at line 188 of file bs_state_machine.c.

◆ bs_state_machine_init()

void bs_state_machine_init ( struct bs_sm_handlers handlers)

Init the state machine by passing the list of callbacks.

Parameters
handlers

Definition at line 152 of file bs_state_machine.c.

◆ bs_state_machine_run()

void bs_state_machine_run ( bs_sm_event_t  event)

Annonce an event to the state machine.

Parameters
event

Definition at line 107 of file bs_state_machine.c.

◆ bs_state_machine_set_role()

void bs_state_machine_set_role ( bluesync_role_t  role)

Indicate the role to the state machine.

Parameters
role

Definition at line 160 of file bs_state_machine.c.

Variable Documentation

◆ bs_sm_handlers

This struct is implemented in the bluesync.c file.