Logo
DSR GreenBOSS  1.1.0
Data Structures | Typedefs | Functions
Commissioning Internals

Data Structures

struct  zb_comm_page_header_s
 Commissioning page structure in NVM. More...
 

Typedefs

typedef struct zb_comm_page_header_s zb_comm_page_header_t
 Commissioning page structure in NVM. More...
 

Functions

zb_int16_t zb_commissioned_index (void)
 Returns channel index, which was used on the previous commissioning stage. More...
 
zb_ret_t zb_commission_prepare (zb_uint32_t seq_number, const gboss_device_config_t *device_config, zb_uint8_t *buffer, zb_uint8_t *buffer_length)
 Prepares a commissioning packet. More...
 
zb_uint32_t zgpd_get_seq_number (void)
 Retrieves next MAC sequential number for a packet to be sent and saves it to non-volatile memory. More...
 
zb_uint32_t zgpd_lookup_seq_number (void)
 Looks up for the next MAC sequential number for a packet to be sent without persisting to non-volatile memory. More...
 

Detailed Description

Typedef Documentation

§ zb_comm_page_header_t

Commissioning page structure in NVM.

A single flash page is used to store the commissioning information of the following available types:

  • Unidirectional,
  • Bidirectional battery-less,
  • Bidirectional battery-powered.

The structure of the commissioning page is consistent across all types of commissioning, even if certain parts are unused for a specific commissioning type.

The page consists of a fixed size part and the rest of the page is used to store index in the current channels array.

To forget commissioning info (== decommission) just erase the page. It is supposed that the flash is erased to ~0.

All data structures in the commissioning page are word-aligned. Use 32 bits even where 8 or 16 bits are enough.

Function Documentation

§ zb_commissioned_index()

zb_int16_t zb_commissioned_index ( void  )

Returns channel index, which was used on the previous commissioning stage.

The function should be used by application to determine the channel group, which should be used for communication.

Note
Calling this function automatically saves last used index for commissioning as a current working index. Any subsequent calls will return the same value until #zb_commission_get_next_index() will be called for another commissioning.
Returns
zb_int16_t Current channel index

§ zb_commission_prepare()

zb_ret_t zb_commission_prepare ( zb_uint32_t  seq_number,
const gboss_device_config_t device_config,
zb_uint8_t buffer,
zb_uint8_t buffer_length 
)

Prepares a commissioning packet.

This function prepares a commissioning packet according to given parameters and device configuration. The function uses it's own statically allocated buffer for the packet. User application should not try to free the returned memory.

Parameters
seq_numberPacket's sequence number
device_configGPD configuration block
bufferBuffer to be used for payload
buffer_lengthReturned buffer length
Returns
zb_ret_t RET_OK if the commissioning packet was successfully formed, RET_ERROR otherwise

References gboss_device_config_s::cluster_cli_cnt, gboss_device_config_s::cluster_list_cli, gboss_device_config_s::cluster_list_srv, gboss_device_config_s::cluster_srv_cnt, gboss_device_config_s::cmd_list, and gboss_device_config_s::cmd_list_count.

§ zgpd_get_seq_number()

zb_uint32_t zgpd_get_seq_number ( void  )

Retrieves next MAC sequential number for a packet to be sent and saves it to non-volatile memory.

The function provides generation of a very long sequence of the incrementing numbers. Due to limitations of energy and flash memory characteristics the own data structure is used to minimize memory erasing.

Note
This function performs write operation in non-volatile memory. Once in 1024 attempts one memory sector has to be erased. In this case next MAC sequence number will be returned, however, there might not be enough power to send a packet over the air.
Returns
zb_uint32_t generated sequence number

References TRACE_MSG.

Referenced by gboss_unidir_commissioning_step().

§ zgpd_lookup_seq_number()

zb_uint32_t zgpd_lookup_seq_number ( void  )

Looks up for the next MAC sequential number for a packet to be sent without persisting to non-volatile memory.

The function provides generation of a very long sequence of the incrementing numbers. Due to limitations of energy and flash memory characteristics own data structure used to minimize memory erasing.

Returns
zb_uint32_t generated sequence number

References TRACE_MSG.