Digi XBee(R) ANSI C Host Library
Files | Data Structures | Macros | Functions | Variables

Files

file  zcl_commissioning.h
 Header for ZCL Commissioning Cluster.
 
file  zcl_commissioning.c
 Implementation of ZCL Commissioning Cluster.
 

Data Structures

struct  zcl_comm_startup_param_t
 
struct  zcl_comm_state_t
 
struct  zcl_comm_startup_attr_t
 
struct  zcl_comm_restart_device_cmd_t
 
struct  zcl_comm_save_startup_param_t
 
struct  zcl_comm_restore_startup_param_t
 
struct  zcl_comm_reset_startup_param_t
 

Macros

#define ZCL_CLUST_COMMISSIONING   0x0015
 
#define ZCL_CLUST_ENTRY_COMMISSIONING_SERVER
 
#define ZCL_COMM_GLOBAL_EPID   ZCL64_INIT( 0x0050C277, 0x10000000 )
 
#define ZCL_COMM_ATTR_SHORT_ADDRESS   0x0000
 
#define ZCL_COMM_ATTR_EXTENDED_PANID   0x0001
 
#define ZCL_COMM_ATTR_PANID   0x0002
 
#define ZCL_COMM_ATTR_CHANNEL_MASK   0x0003
 
#define ZCL_COMM_ATTR_PROTOCOL_VERSION   0x0004
 
#define ZCL_COMM_ATTR_STACK_PROFILE   0x0005
 
#define ZCL_COMM_ATTR_STARTUP_CONTROL   0x0006
 
#define ZCL_COMM_ATTR_TRUST_CTR_ADDR   0x0010
 
#define ZCL_COMM_ATTR_TRUST_CTR_MASTER_KEY   0x0011
 
#define ZCL_COMM_ATTR_NETWORK_KEY   0x0012
 
#define ZCL_COMM_ATTR_USE_INSECURE_JOIN   0x0013
 
#define ZCL_COMM_ATTR_PRECONFIG_LINK_KEY   0x0014
 
#define ZCL_COMM_ATTR_NETWORK_KEY_SEQ_NUM   0x0015
 
#define ZCL_COMM_ATTR_NETWORK_KEY_TYPE   0x0016
 
#define ZCL_COMM_ATTR_NETWORK_MGR_ADDR   0x0017
 
#define ZCL_COMM_ATTR_SCAN_ATTEMPTS   0x0020
 
#define ZCL_COMM_ATTR_TIME_BTWN_SCANS   0x0021
 
#define ZCL_COMM_ATTR_REJOIN_INTERVAL   0x0022
 
#define ZCL_COMM_ATTR_MAX_REJOIN_INTERVAL   0x0023
 
#define ZCL_COMM_ATTR_INDIRECT_POLL_RATE   0x0030
 
#define ZCL_COMM_ATTR_PARENT_RETRY_THRESHOLD   0x0031
 
#define ZCL_COMM_ATTR_CONCENTRATOR_FLAG   0x0040
 
#define ZCL_COMM_ATTR_CONCENTRATOR_RADIUS   0x0041
 
#define ZCL_COMM_ATTR_CONCENTRATOR_DISC_TIME   0x0042
 
#define ZCL_COMM_CMD_RESTART_DEVICE   0x00
 
#define ZCL_COMM_CMD_SAVE_STARTUP_PARAM   0x01
 
#define ZCL_COMM_CMD_RESTORE_STARTUP_PARAM   0x02
 
#define ZCL_COMM_CMD_RESET_STARTUP_PARAM   0x03
 
#define ZCL_COMM_CMD_RESTART_DEVICE_RESP   0x00
 
#define ZCL_COMM_CMD_SAVE_STARTUP_PARAM_RESP   0x01
 
#define ZCL_COMM_CMD_RESTORE_STARTUP_PARAM_RESP   0x02
 
#define ZCL_COMM_CMD_RESET_STARTUP_PARAM_RESP   0x03
 

Functions

int zcl_comm_response (const wpan_envelope_t FAR *envelope, uint_fast8_t status)
 Send response to a Commissioning Server Cluster request.
 
int zcl_comm_restart_device (wpan_envelope_t FAR *envelope, const zcl_comm_restart_device_cmd_t *parameters)
 Send a "Restart Device" command to the ZCL Commissioning Cluster. More...
 
int zcl_comm_reset_parameters (wpan_envelope_t FAR *envelope, const zcl_comm_reset_startup_param_t *parameters)
 Send a "Reset Startup Parameters" command to the ZCL Commissioning Cluster. More...
 
void zcl_comm_sas_init (zcl_comm_startup_param_t *parameters)
 
int zcl_comm_clust_handler (const wpan_envelope_t FAR *envelope, void FAR *context)
 
void zcl_comm_factory_reset (uint16_t ms_delay)
 Perform a locally-triggered factory reset to default SAS. More...
 
int _zcl_comm_startup_control_set (const zcl_attribute_full_t FAR *attribute, zcl_attribute_write_rec_t *rec)
 Limit values of startup_control based on firmware type (e.g., some firmwares can't be ZCL_COMM_STARTUP_COORDINATOR). More...
 
int _zcl_comm_command_build (wpan_envelope_t FAR *envelope, zcl_header_nomfg_t *header)
 Common function used by zcl_comm_restart_device and zcl_comm_reset_parameters. More...
 
int _zcl_comm_command_send (wpan_envelope_t FAR *envelope)
 Common function used by zcl_comm_restart_device and zcl_comm_reset_parameters. More...
 
int rand_range (int range)
 
bool_t zcl_comm_sas_is_valid (const zcl_comm_state_t FAR *comm)
 Partial implementation of a function to validate a Startup Attribute Set before trying to use it. More...
 

Variables

const zcl64_t zcl_comm_global_epid
 
zcl_comm_state_t zcl_comm_state
 
const zcl_comm_startup_param_t zcl_comm_default_sas
 
const zcl_comm_startup_attr_t zcl_comm_startup_attributes
 
const zcl_attribute_tree_t zcl_comm_startup_attribute_tree []
 
const zcl64_t zcl_comm_global_epid = ZCL_COMM_GLOBAL_EPID
 
zcl_comm_state_t zcl_comm_state = { { 0 } }
 
const zcl_comm_startup_attr_t zcl_comm_startup_attributes
 
const zcl_attribute_tree_t zcl_comm_startup_attribute_tree []
 

Detailed Description

Macro Definition Documentation

#define ZCL_CLUST_ENTRY_COMMISSIONING_SERVER
Value:
{ ZCL_CLUST_COMMISSIONING, &zcl_comm_clust_handler, \
zcl_comm_startup_attribute_tree, WPAN_CLUST_FLAG_SERVER }
#define WPAN_CLUST_FLAG_SERVER
alias name for input cluster (uses ZCL terminology)
Definition: aps.h:234

Function Documentation

int _zcl_comm_command_build ( wpan_envelope_t FAR envelope,
zcl_header_nomfg_t header 
)

Common function used by zcl_comm_restart_device and zcl_comm_reset_parameters.

Fills in frame_control and sequence of header. Fills in cluster_id and payload of envelope. Fills in source_endpoint and profile_id of envelope if necessary.

Caller needs to fill in envelope->length and header->command

References _zcl_comm_command_send(), EINVAL, wpan_endpoint_table_entry_t::endpoint, FAR, wpan_endpoint_table_entry_t::profile_id, WPAN_CLUST_FLAG_CLIENT, wpan_endpoint_next_trans(), wpan_endpoint_of_cluster(), wpan_endpoint_of_envelope(), ZCL_FRAME_CLIENT_TO_SERVER, ZCL_FRAME_DISABLE_DEF_RESP, ZCL_FRAME_GENERAL, and ZCL_FRAME_TYPE_CLUSTER.

Referenced by zcl_comm_reset_parameters(), zcl_comm_response(), and zcl_comm_restart_device().

int _zcl_comm_command_send ( wpan_envelope_t FAR envelope)

Common function used by zcl_comm_restart_device and zcl_comm_reset_parameters.

sends the envelope and then resets the payload and length before returning

References wpan_envelope_send().

Referenced by _zcl_comm_command_build(), zcl_comm_reset_parameters(), and zcl_comm_restart_device().

int _zcl_comm_startup_control_set ( const zcl_attribute_full_t FAR attribute,
zcl_attribute_write_rec_t rec 
)

Limit values of startup_control based on firmware type (e.g., some firmwares can't be ZCL_COMM_STARTUP_COORDINATOR).

Parameters
[in]attributeshould be a pointer to zcl_comm_startup_attributes.startup_control
[in,out]recvalue from write request

See zcl_attribute_write_fn() for calling convention.

References zcl_attribute_write_rec_t::buffer, zcl_attribute_write_rec_t::flags, zcl_attribute_write_rec_t::status, WPAN_IEEE_ADDR_ALL_ZEROS, ZCL_ATTR_WRITE_FLAG_ASSIGN, ZCL_ATTRIB_FLAG_FULL, ZCL_ATTRIB_FLAG_NONE, ZCL_ATTRIB_FLAG_RAW, ZCL_ATTRIB_FLAG_READONLY, ZCL_ATTRIB_FLAG_WRITEONLY, ZCL_ATTRIBUTE_END_OF_LIST, ZCL_COMM_FLAG_COORDINATOR_OK, ZCL_COMM_FLAG_ENDDEV_OK, ZCL_COMM_FLAG_ROUTER_OK, ZCL_TYPE_IEEE_ADDR, and ZCL_TYPE_SECURITY_KEY.

void zcl_comm_factory_reset ( uint16_t  ms_delay)

Perform a locally-triggered factory reset to default SAS.

Parameters
[in]ms_delayinitiate reset after ms_delay milliseconds

References zcl_comm_state_t::restart_ms, ZCL_COMM_FLAG_DELAYED_RESTART, ZCL_COMM_FLAG_FACTORY_RESET, and ZCL_COMM_FLAG_INSTALL.

int zcl_comm_reset_parameters ( wpan_envelope_t FAR envelope,
const zcl_comm_reset_startup_param_t parameters 
)

Send a "Reset Startup Parameters" command to the ZCL Commissioning Cluster.

Parameters
[in,out]envelopePartial envelope used to send the request. Caller must set dev, ieee_address, network_address, profile_id, source_endpoint, dest_endpoint and (optionally) options. On return, payload and length are cleared, and cluster_id is set to ZCL_CLUST_COMMISSIONING.

If source_endpoint is 0, function will search the endpoint table for a Commissioning Client Cluster and set the envelope's source_endpoint and profile_id.

Parameters
[in]parametersParameters for the Reset Startup Parameters command or NULL for default settings (reset current parameters only).
Return values
0request sent
-EINVALcouldn't find source endpoint in endpoint table, or some other error in parameter passed to function
!0error trying to send request

References _zcl_comm_command_build(), _zcl_comm_command_send(), and EINVAL.

int zcl_comm_restart_device ( wpan_envelope_t FAR envelope,
const zcl_comm_restart_device_cmd_t parameters 
)

Send a "Restart Device" command to the ZCL Commissioning Cluster.

Parameters
[in,out]envelopePartial envelope used to send the request. Caller must set dev, ieee_address, network_address, profile_id, source_endpoint, dest_endpoint and (optionally) options. On return, payload and length are cleared, and cluster_id is set to ZCL_CLUST_COMMISSIONING.

If source_endpoint is 0, function will search the endpoint table for a Commissioning Client Cluster and set the envelope's source_endpoint and profile_id.

Parameters
[in]parametersParameters for the Restart Device command or NULL for default settings (save changes and restart without delay/jitter).
Return values
0request sent
-EINVALcouldn't find source endpoint in endpoint table, or some other error in parameter passed to function
!0error trying to send request

References _zcl_comm_command_build(), and _zcl_comm_command_send().

bool_t zcl_comm_sas_is_valid ( const zcl_comm_state_t FAR comm)

Partial implementation of a function to validate a Startup Attribute Set before trying to use it.

Parameters
[in]commStartup Attribute Set to test.
Return values
TRUEStartup Attribute Set is valid
FALSEStartup Attribute Set is invalid and cannot be used
Todo:
add more tests to this function

References FAR, memcheck(), PRIu32, WPAN_NET_ADDR_COORDINATOR, ZCL_CMD_MATCH, ZCL_COMM_FLAG_DELAYED_RESTART, ZCL_COMM_FLAG_FACTORY_RESET, ZCL_COMM_FLAG_INSTALL, zcl_comm_response(), and zcl_general_command().

Variable Documentation

const zcl_attribute_tree_t zcl_comm_startup_attribute_tree[]
Initial value:
=
{ { ZCL_MFG_NONE, &zcl_comm_startup_attributes.short_address, NULL } }