Astarte Device SDK ESP32
ESP32 device SDK for the Astarte platform
astarte_pairing.h File Reference

Astarte pairing functions. More...

#include "astarte.h"
#include <string.h>
Include dependency graph for astarte_pairing.h:

Go to the source code of this file.

Data Structures

struct  astarte_pairing_config_t
 

Functions

struct astarte_pairing_config __attribute__ ((deprecated("Please use astarte_pairing_config_t")))
 
astarte_err_t astarte_pairing_get_credentials_secret (const astarte_pairing_config_t *config, char *out, size_t length)
 get the credentials secret. More...
 
astarte_err_t astarte_pairing_register_device (const astarte_pairing_config_t *config)
 register a device. More...
 
astarte_err_t astarte_pairing_get_mqtt_v1_credentials (const astarte_pairing_config_t *config, const char *csr, char *out, size_t length)
 obtain a new Astarte MQTT v1 certificate. More...
 
astarte_err_t astarte_pairing_get_mqtt_v1_broker_url (const astarte_pairing_config_t *config, char *out, size_t length)
 get the Astarte MQTT v1 broker URL. More...
 

Variables

const char * base_url
 
const char * jwt
 
const char * realm
 
const char * hw_id
 
const char * credentials_secret
 

Detailed Description

Astarte pairing functions.

Function Documentation

◆ astarte_pairing_get_credentials_secret()

astarte_err_t astarte_pairing_get_credentials_secret ( const astarte_pairing_config_t *  config,
char *  out,
size_t  length 
)

get the credentials secret.

Get the credentials secret from NVS. If it isn't present, register the device to obtain it, save it and return it.

Parameters
configA struct containing the pairing configuration.
outA pointer to an allocated string which the credentials secret will be written to.
lengthThe length of the out buffer.
Returns
The status code, ASTARTE_OK if successful, otherwise an error code is returned.

◆ astarte_pairing_get_mqtt_v1_broker_url()

astarte_err_t astarte_pairing_get_mqtt_v1_broker_url ( const astarte_pairing_config_t *  config,
char *  out,
size_t  length 
)

get the Astarte MQTT v1 broker URL.

Get the URL of the broker which the device will connect to.

Parameters
configA struct containing the pairing configuration.
outA pointer to an allocated string where the URL will be written.
lengthThe length of the out buffer.
Returns
The status code, ASTARTE_OK if successful, otherwise an error code is returned.

◆ astarte_pairing_get_mqtt_v1_credentials()

astarte_err_t astarte_pairing_get_mqtt_v1_credentials ( const astarte_pairing_config_t *  config,
const char *  csr,
char *  out,
size_t  length 
)

obtain a new Astarte MQTT v1 certificate.

Call Pairing API to obtain a new Astarte MQTT v1 certificate.

Parameters
configA struct containing the pairing configuration.
csrA PEM encoded NULL-terminated string containing the CSR
outA pointer to an allocated buffer where the certificat will be written.
lengthThe length of the out buffer.
Returns
The status code, ASTARTE_OK if successful, otherwise an error code is returned.

◆ astarte_pairing_register_device()

astarte_err_t astarte_pairing_register_device ( const astarte_pairing_config_t *  config)

register a device.

Perform a device registration as agent.

Parameters
configA struct containing the pairing configuration.
Returns
The status code, ASTARTE_OK if successful, otherwise an error code is returned.