Z-Wave Protocol Controller Reference
zwave_s0_sm.c File Reference

S0 Bootstrapping state machine. More...

#include <ctimer.h>
#include <stddef.h>
#include <string.h>
#include "zwave_s0_sm.h"
#include "sl_log.h"
#include "ZW_classcmd.h"
#include "zwave_s0_internal.h"
#include "zwave_s0_transport.h"
#include "zwave_s0_network.h"
#include "s2_keystore.h"
#include "s2_classcmd.h"
#include "zwave_helper_macros.h"
Include dependency graph for zwave_s0_sm.c:

Classes

struct  s0_transition_t
 
struct  s0_sm_t
 

Macros

#define LOG_TAG   "zwave_s0_sm"
 
#define S0_INCLUSION_TIMER   10 * CLOCK_SECOND
 
#define ELEM_COUNT(ARRAY)   (sizeof(ARRAY) / (sizeof(ARRAY[0])))
 
#define S0_KEY_LENGTH   16
 
#define UNUSED(x)   x = x;
 

Enumerations

enum  s0_bootstrap_event_t {
  EV_S0_BOOTSTRAPPING_START , EV_S0_SCHEME_REPORT_RECEIVED , EV_S0_SEND_KEY_SET , EV_S0_NET_KEY_VERIFY_RECEIVED ,
  EV_S0_SEND_SCHEME_INHERIT , EV_S0_WAS_NOT_CONTROLLER , EV_S0_WRONG_SCHEME_REPORT , EV_S0_BOOTSTRAP_ABORT ,
  EV_S0_TIMEOUT
}
 
enum  s0_action_t {
  S0_SEND_SCHEME_GET_ACTION , S0_SCHEME_REPORT_RECV_ACTION , S0_SEND_KEY_SET_ACTION , S0_NET_KEY_VERIFY_RECEIVED_ACTION ,
  S0_SEND_SCHEME_INHERIT_ACTION , S0_2SCHEME_REPORT_RECEIVED_ACTION , S0_BOOTSTRAP_ABORT_ACTION , S0_NO_ACTION
}
 

Functions

const char * s0_event_name (s0_bootstrap_event_t ev)
 
const char * s0_incl_state_name (s0_bootstrap_state_t state)
 
const char * s0_action_name (s0_action_t action)
 
void s0_scheme_report_received (const uint8_t scheme, zwave_node_id_t from_node)
 This function is used to notify the S0 Inclusion state machine that S0 Scheme report frame was received. More...
 
void s0_handle_net_key_verify ()
 
static void s0_sm_process_event (uint16_t evt)
 
static void reset_s0_sm ()
 
static void s0_abort_bootstrap ()
 
static void s0_timeout (void *data)
 
static void s0_send_data_callback (uint8_t status, const zwapi_tx_report_t *tx_info, void *user)
 
static sl_status_t s0_bootstrap_frames_generic_send (zwave_controller_encapsulation_scheme_t en, const uint8_t *frame, uint8_t frame_len)
 
static sl_status_t s0_send_scheme_inherit ()
 
static sl_status_t s0_send_key_set ()
 
static sl_status_t s0_send_scheme_get ()
 
void s0_bootstrapping_start (const zwave_controller_connection_info_t *conn, uint8_t is_controller)
 Start the S0 add node process. More...
 
void s0_network_key_verify_received (zwave_node_id_t from_node)
 This function is used to notify the S0 Inclusion state machine that S0 network key verify frame was received. More...
 
void s0_set_callback (s0_on_bootstrapping_complete_cb cb)
 Set callback function for the S0 bootstrap. This callback function is copied internally into S0 and called when S0 bootstrap is complete. More...
 
s0_bootstrap_state_t get_s0_sm_state ()
 Get the state of S0 Bootstrap state machine. More...
 
void s0_bootstrapping_stop ()
 Stop the S0 bootstrapping timers. More...
 

Variables

static s0_on_bootstrapping_complete_cb s0_on_bootstrapping_complete_callback = NULL
 
s0_sm_t s0_sm
 
static const s0_transition_t s0_transition_table []
 

Detailed Description

S0 Bootstrapping state machine.

License

Copyright 2021 Silicon Laboratories Inc. www.silabs.com

The licensor of this software is Silicon Laboratories Inc. Your use of this software is governed by the terms of Silicon Labs Master Software License Agreement (MSLA) available at www.silabs.com/about-us/legal/master-software-license-agreement. This software is distributed to you in Source Code format and is governed by the sections of the MSLA applicable to Source Code.

Macro Definition Documentation

◆ ELEM_COUNT

#define ELEM_COUNT (   ARRAY)    (sizeof(ARRAY) / (sizeof(ARRAY[0])))

◆ LOG_TAG

#define LOG_TAG   "zwave_s0_sm"

◆ S0_INCLUSION_TIMER

#define S0_INCLUSION_TIMER   10 * CLOCK_SECOND

◆ S0_KEY_LENGTH

#define S0_KEY_LENGTH   16

◆ UNUSED

#define UNUSED (   x)    x = x;

Enumeration Type Documentation

◆ s0_action_t

Enumerator
S0_SEND_SCHEME_GET_ACTION 
S0_SCHEME_REPORT_RECV_ACTION 
S0_SEND_KEY_SET_ACTION 
S0_NET_KEY_VERIFY_RECEIVED_ACTION 
S0_SEND_SCHEME_INHERIT_ACTION 
S0_2SCHEME_REPORT_RECEIVED_ACTION 
S0_BOOTSTRAP_ABORT_ACTION 
S0_NO_ACTION 

◆ s0_bootstrap_event_t

Enumerator
EV_S0_BOOTSTRAPPING_START 
EV_S0_SCHEME_REPORT_RECEIVED 
EV_S0_SEND_KEY_SET 
EV_S0_NET_KEY_VERIFY_RECEIVED 
EV_S0_SEND_SCHEME_INHERIT 
EV_S0_WAS_NOT_CONTROLLER 
EV_S0_WRONG_SCHEME_REPORT 
EV_S0_BOOTSTRAP_ABORT 
EV_S0_TIMEOUT 

Function Documentation

◆ reset_s0_sm()

static void reset_s0_sm ( )
static
Here is the caller graph for this function:

◆ s0_abort_bootstrap()

static void s0_abort_bootstrap ( )
static
Here is the caller graph for this function:

◆ s0_action_name()

const char * s0_action_name ( s0_action_t  action)
Here is the caller graph for this function:

◆ s0_bootstrap_frames_generic_send()

static sl_status_t s0_bootstrap_frames_generic_send ( zwave_controller_encapsulation_scheme_t  en,
const uint8_t *  frame,
uint8_t  frame_len 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ s0_event_name()

const char * s0_event_name ( s0_bootstrap_event_t  ev)
Here is the caller graph for this function:

◆ s0_handle_net_key_verify()

void s0_handle_net_key_verify ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ s0_incl_state_name()

const char * s0_incl_state_name ( s0_bootstrap_state_t  state)
Here is the caller graph for this function:

◆ s0_send_data_callback()

static void s0_send_data_callback ( uint8_t  status,
const zwapi_tx_report_t tx_info,
void *  user 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ s0_send_key_set()

static sl_status_t s0_send_key_set ( )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ s0_send_scheme_get()

static sl_status_t s0_send_scheme_get ( )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ s0_send_scheme_inherit()

static sl_status_t s0_send_scheme_inherit ( )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ s0_sm_process_event()

static void s0_sm_process_event ( uint16_t  evt)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ s0_timeout()

static void s0_timeout ( void *  data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ s0_on_bootstrapping_complete_callback

s0_on_bootstrapping_complete_cb s0_on_bootstrapping_complete_callback = NULL
static

◆ s0_sm

s0_sm_t s0_sm

◆ s0_transition_table

const s0_transition_t s0_transition_table[]
static