Morse Micro IoT SDK  2.12.3
dpp.c File Reference

Detailed Description

DPP example application.

This example demonstrates DPP provisioning in both Push Button and QR Code Enrollee modes.

The mode is selected via the dpp.mode config key:

  • "pb" (default) - Push Button mode
  • "qr" - QR Code Enrollee mode

For QR mode, a DER-encoded P-256 bootstrap private key may be provisioned at dpp.bootstrap_key. If not set, a fresh key pair is generated automatically and the DPP URI is printed on startup so it can be provided to a configurator.

Note
It is assumed that you have followed the steps in the Getting Started guide and are therefore familiar with how to build, flash, and monitor an application using the MM-IoT-SDK framework.

Definition in file dpp.c.

#include <stdio.h>
#include <string.h>
#include "mmutils.h"
#include "mmosal.h"
#include "mmwlan.h"
#include "mmconfig.h"
#include "mm_app_common.h"
Include dependency graph for dpp.c:

Go to the source code of this file.

Macros

#define DPP_TIMEOUT_MS   (200 * 1000)
 Timeout in milliseconds to wait for DPP provisioning to complete. More...
 
#define DPP_URI_MAX_LEN   256
 Maximum length of the DPP URI string. More...
 

Functions

static const char * mmwlan_dpp_pb_result_to_string (enum mmwlan_dpp_pb_result result)
 Convert a DPP push button result code to its string representation. More...
 
static const char * mmwlan_dpp_auth_failure_reason_to_string (enum mmwlan_dpp_auth_failure_reason reason)
 Convert a DPP authentication failure reason to its string representation. More...
 
static const char * mmwlan_dpp_conf_failure_reason_to_string (enum mmwlan_dpp_conf_failure_reason reason)
 Convert a DPP configuration failure reason to its string representation. More...
 
static void dpp_store_credentials (const struct mmwlan_dpp_cb_args *dpp_event, struct mmosal_semb *semb)
 Store received DPP credentials to mmconfig and signal completion. More...
 
static void dpp_event_handler (const struct mmwlan_dpp_cb_args *dpp_event, void *arg)
 DPP event handler. More...
 
void app_init (void)
 Main entry point to the application. More...
 

Macro Definition Documentation

◆ DPP_TIMEOUT_MS

#define DPP_TIMEOUT_MS   (200 * 1000)

Timeout in milliseconds to wait for DPP provisioning to complete.

Definition at line 35 of file dpp.c.

◆ DPP_URI_MAX_LEN

#define DPP_URI_MAX_LEN   256

Maximum length of the DPP URI string.

Definition at line 38 of file dpp.c.

Function Documentation

◆ app_init()

void app_init ( void  )

Main entry point to the application.

This will be invoked in a thread once operating system and hardware initialization has completed. It may return, but it does not have to.

Definition at line 231 of file dpp.c.

◆ dpp_event_handler()

static void dpp_event_handler ( const struct mmwlan_dpp_cb_args dpp_event,
void *  arg 
)
static

DPP event handler.

Parameters
dpp_eventReference to dpp event argument structure.
argUser argument - pointer to completion semaphore.

Definition at line 152 of file dpp.c.

◆ dpp_store_credentials()

static void dpp_store_credentials ( const struct mmwlan_dpp_cb_args dpp_event,
struct mmosal_semb *  semb 
)
static

Store received DPP credentials to mmconfig and signal completion.

Parameters
dpp_eventReference to dpp event argument structure.
sembSemaphore to signal on completion.

Definition at line 119 of file dpp.c.

◆ mmwlan_dpp_auth_failure_reason_to_string()

static const char * mmwlan_dpp_auth_failure_reason_to_string ( enum mmwlan_dpp_auth_failure_reason  reason)
static

Convert a DPP authentication failure reason to its string representation.

Parameters
reasonThe enumeration value of type mmwlan_dpp_auth_failure_reason to be converted.
Returns
A constant string describing the reason. If the input is not a recognized enumeration value, the string "Unknown" is returned.

Definition at line 72 of file dpp.c.

◆ mmwlan_dpp_conf_failure_reason_to_string()

static const char * mmwlan_dpp_conf_failure_reason_to_string ( enum mmwlan_dpp_conf_failure_reason  reason)
static

Convert a DPP configuration failure reason to its string representation.

Parameters
reasonThe enumeration value of type mmwlan_dpp_conf_failure_reason to be converted.
Returns
A constant string describing the reason. If the input is not a recognized enumeration value, the string "Unknown" is returned.

Definition at line 97 of file dpp.c.

◆ mmwlan_dpp_pb_result_to_string()

static const char * mmwlan_dpp_pb_result_to_string ( enum mmwlan_dpp_pb_result  result)
static

Convert a DPP push button result code to its string representation.

Parameters
resultThe enumeration value of type mmwlan_dpp_pb_result to be converted.
Returns
A constant string describing the result. If the input is not a recognized enumeration value, the string "Unknown Result" is returned.

Definition at line 48 of file dpp.c.