nRF5 SDK v16.0.0
Macros | Typedefs | Enumerations | Functions | Variables
Node Configuration Service

Node Configuration Service module. More...

Macros

#define BLE_UUID_NODE_CFG_SERVICE   0x7799
 
#define BLE_UUID_NCFGS_SSID_CHAR   0x77A9
 
#define BLE_UUID_NCFGS_KEYS_STORE_CHAR   0x77B9
 
#define BLE_UUID_NCFGS_CTRLPT_CHAR   0x77C9
 
#define APP_GATTERR_NOT_CONFIGURED   BLE_GATT_STATUS_ATTERR_APP_BEGIN + 1
 
#define APP_GATTERR_UNKNOWN_OPCODE   BLE_GATT_STATUS_ATTERR_APP_BEGIN + 2
 
#define APP_GATTERR_INVALID_ATTR_VALUE   BLE_GATT_STATUS_ATTERR_APP_BEGIN + 3
 
#define NCFGS_SSID_MIN_LEN   6
 
#define NCFGS_SSID_MAX_LEN   16
 
#define NCFGS_KEYS_MAX_LEN   16
 
#define NCFGS_IDENTITY_DATA_MAX_LEN   8
 
#define NCFGS_CTRLP_OPCODE_LEN   1
 
#define NCFGS_CTRLP_DELAY_LEN   4
 
#define NCFGS_CTRLP_DURATION_LEN   4
 
#define NCFGS_CTRLP_STATE_ON_FAILURE_LEN   1
 
#define NCFGS_CTRLP_ALL_BUT_ID_DATA_LEN
 
#define NCFGS_CTRLP_VALUE_LEN
 
#define HTONL(val)
 

Typedefs

typedef void(* ble_ncfgs_evt_handler_t )(ble_ncfgs_data_t *ncfgs_data)
 Node Configuration Service event handler type.
 

Enumerations

enum  ble_ncfgs_opcode_t {
  NCFGS_OPCODE_GOTO_JOINING_MODE = 0x01,
  NCFGS_OPCODE_GOTO_CONFIG_MODE = 0x02,
  NCFGS_OPCODE_GOTO_IDENTITY_MODE = 0x03
}
 Node Configuration Service control point opcode values.
 
enum  ble_ncfgs_state_t {
  NCFGS_STATE_IDLE = 0x00,
  NCFGS_STATE_SSID_WRITTEN = 0x01,
  NCFGS_STATE_KEYS_STORE_WRITTEN = 0x02
}
 Node Configuration Service configuration states.
 
enum  state_on_failure_t {
  NCFGS_SOF_NO_CHANGE = 0x00,
  NCFGS_SOF_PWR_OFF = 0x01,
  NCFGS_SOF_CONFIG_MODE = 0x02
}
 Node Configuration Service state-on-failure values.
 

Functions

struct __attribute__ ((__packed__))
 Structure for storing keys received from the peer. More...
 
void ble_ncfgs_ble_evt_handler (const ble_evt_t *p_ble_evt)
 Function for handling BLE events. More...
 
uint32_t ble_ncfgs_init (ble_ncfgs_evt_handler_t ble_ncfgs_cb)
 Function for initializing the Node Configuration Service module. More...
 

Variables

 keys_store_t
 
 ssid_store_t
 
 id_data_store_t
 
 ble_ncfgs_ctrlp_value_t
 
 ble_ncfgs_data_t
 

Detailed Description

Node Configuration Service module.

The Node Configuration Service allows configuration of the node during commissioning. During initialization it adds the Node Configuration Service and the corresponding characteristics to the BLE GATT database. It decodes and checks the received values and then passes them to the parent module.

Macro Definition Documentation

#define APP_GATTERR_INVALID_ATTR_VALUE   BLE_GATT_STATUS_ATTERR_APP_BEGIN + 3

ATT Error: Invalid attribute value.

#define APP_GATTERR_NOT_CONFIGURED   BLE_GATT_STATUS_ATTERR_APP_BEGIN + 1

ATT Error: Node configuration incomplete.

#define APP_GATTERR_UNKNOWN_OPCODE   BLE_GATT_STATUS_ATTERR_APP_BEGIN + 2

ATT Error: Unknown opcode.

#define HTONL (   val)
Value:
((((uint32_t) (val) & 0xff000000) >> 24) | \
(((uint32_t) (val) & 0x00ff0000) >> 8) | \
(((uint32_t) (val) & 0x0000ff00) << 8) | \
(((uint32_t) (val) & 0x000000ff) << 24))
#define NCFGS_CTRLP_ALL_BUT_ID_DATA_LEN
Value:
NCFGS_CTRLP_DELAY_LEN + \
NCFGS_CTRLP_DURATION_LEN + \
NCFGS_CTRLP_STATE_ON_FAILURE_LEN)

Ctrlp: Total length of all values except identity data.

#define NCFGS_CTRLP_DELAY_LEN   4

Ctrlp: Length of action delay value.

#define NCFGS_CTRLP_DURATION_LEN   4

Ctrlp: Length of next mode duration value.

#define NCFGS_CTRLP_OPCODE_LEN   1

Ctrlp: Opcode value length.

#define NCFGS_CTRLP_STATE_ON_FAILURE_LEN   1

Ctrlp: Length of state-on-failure value.

#define NCFGS_CTRLP_VALUE_LEN
Value:
NCFGS_CTRLP_DELAY_LEN + \
NCFGS_CTRLP_DURATION_LEN + \
NCFGS_CTRLP_STATE_ON_FAILURE_LEN + \
NCFGS_IDENTITY_DATA_MAX_LEN)

Ctrlp: Total length of all values.

#define NCFGS_IDENTITY_DATA_MAX_LEN   8

Identity data maximum length.

#define NCFGS_KEYS_MAX_LEN   16

Keys maximum length.

#define NCFGS_SSID_MAX_LEN   16

SSID maximum length.

#define NCFGS_SSID_MIN_LEN   6

SSID minimum length.

Function Documentation

struct __attribute__ ( (__packed__)  )
read

Structure for storing keys received from the peer.

Structure for storing Node Configuration Service characteristic values.

Structure for control point value.

Structure for storing the identity data from the peer.

Structure for storing the SSID received from the peer.

< Keys maximum length.

< SSID maximum length.

< Identity data maximum length.

void ble_ncfgs_ble_evt_handler ( const ble_evt_t p_ble_evt)

Function for handling BLE events.

This function must be called from the BLE stack event dispatcher to handle BLE events that are relevant for the Node Configuration Service module. It propagates an event to the parent layer if the Control Point characteristic was successfully written.

Parameters
[in]p_ble_evtBLE stack event.
uint32_t ble_ncfgs_init ( ble_ncfgs_evt_handler_t  ble_ncfgs_cb)

Function for initializing the Node Configuration Service module.

Interface for the Commissioning module to create a GATT database to allow for node configuration.

Parameters
[in]ble_ncfgs_cbFunction to be called in case of an error.
Return values
NRF_SUCCESSIf initialization was successful. Otherwise, a propagated error code is returned.

Documentation feedback | Developer Zone | Subscribe | Updated