Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 16 additions & 28 deletions MXChip/AZ3166/app/azure_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,47 +29,35 @@ typedef enum
// Azure IoT Dynamic Provisioning Service
// Define this to use the DPS service, otherwise direct IoT Hub
// ----------------------------------------------------------------------------
// #define ENABLE_DPS
//#define ENABLE_DPS

// ----------------------------------------------------------------------------
// Azure IoT DPS Self-Signed X509Certificate
// Define this to connect to DPS or Iot Hub using a self-signed X509
/// certificate
// Define this to connect to DPS or Iot Hub using a X509 certificate
// ----------------------------------------------------------------------------
// #define ENABLE_X509

// ----------------------------------------------------------------------------
// Azure IoT Device ID
// Make sure this is the same as the Device ID on the corresponding IoT Hub
// NOTE: To be used only when ENABLE_DPS is NOT defined
// Azure IoT Hub connection config
// IOT_HUB_HOSTNAME: The Azure IoT Hub hostname
// IOT_HUB_DEVICE_ID: The Azure IoT Hub device id
// ----------------------------------------------------------------------------
#define IOT_DEVICE_ID ""
#define IOT_HUB_HOSTNAME ""
#define IOT_HUB_DEVICE_ID ""

// ----------------------------------------------------------------------------
// Azure IoT SAS Key
// The SAS key generated by configuring an IoT Hub device or DPS individual
// enrollment
// NOTE: To be used only when ENABLE_X509 is not defined
// ----------------------------------------------------------------------------
#define IOT_PRIMARY_KEY ""

// ----------------------------------------------------------------------------
// Azure IoT Hub Hostname
// The Hostname found on your IoT Hub Overview page
// NOTE: To be used only when ENABLE_DPS is not defined
// Azure IoT DPS connection config
// IOT_DPS_ID_SCOPE: The DPS ID Scope
// IOT_DPS_REGISTRATION_ID: The DPS device Registration Id
// ----------------------------------------------------------------------------
#define IOT_HUB_HOSTNAME ""
#define IOT_DPS_ID_SCOPE ""
#define IOT_DPS_REGISTRATION_ID ""

// ----------------------------------------------------------------------------
// Azure IoT DPS config
// DPS connection information
// IOT_DPS_ENDPOINT is always "global.azure-devices-provisioning.net"
// IOT_DPS_ID_SCOPE can be found on your DPS Overview page
// IOT_DPS_REGISTRATION ID is the title of your individual enrollment
// containing your SAS key or X509 certificate
// Azure IoT device SAS key
// The SAS key generated by configuring an IoT Hub device or DPS individual
// enrollment
// ----------------------------------------------------------------------------
#define IOT_DPS_ENDPOINT "global.azure-devices-provisioning.net"
#define IOT_DPS_ID_SCOPE ""
#define IOT_DPS_REGISTRATION_ID ""
#define IOT_DEVICE_SAS_KEY ""

#endif // _AZURE_CONFIG_H
7 changes: 5 additions & 2 deletions MXChip/AZ3166/app/azure_device_x509_cert_config.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* Copyright (c) Microsoft Corporation.
Licensed under the MIT License. */

#ifndef _AZURE_DEVICE_X509_CERT_CONFIG_H
#define _AZURE_DEVICE_X509_CERT_CONFIG_H

Expand All @@ -6,13 +9,13 @@
// Replace {0x00} with your formatted output from OpenSSL and xxd here
// ----------------------------------------------------------------------------
const unsigned char iot_x509_device_cert[] = {0x00};
unsigned int iot_x509_device_cert_len = sizeof(iot_x509_device_cert);
unsigned int iot_x509_device_cert_len = sizeof(iot_x509_device_cert);

// ----------------------------------------------------------------------------
// Azure IoT X509 Device Private Key
// Replace {0x00} with your formatted output from OpenSSL and xxd here
// ----------------------------------------------------------------------------
unsigned char iot_x509_private_key[] = {0x00};
unsigned char iot_x509_private_key[] = {0x00};
const unsigned int iot_x509_private_key_len = sizeof(iot_x509_private_key);

#endif
7 changes: 3 additions & 4 deletions MXChip/AZ3166/app/legacy/mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,9 @@ UINT azure_iot_mqtt_entry(NX_IP* ip_ptr, NX_PACKET_POOL* pool_ptr, NX_DNS* dns_p
pool_ptr,
dns_ptr,
time_get,
IOT_DPS_ENDPOINT,
IOT_DPS_ID_SCOPE,
IOT_DPS_REGISTRATION_ID,
IOT_PRIMARY_KEY,
IOT_DEVICE_SAS_KEY,
IOT_MODEL_ID);
#else
// Create Azure MQTT for Hub
Expand All @@ -146,8 +145,8 @@ UINT azure_iot_mqtt_entry(NX_IP* ip_ptr, NX_PACKET_POOL* pool_ptr, NX_DNS* dns_p
dns_ptr,
time_get,
IOT_HUB_HOSTNAME,
IOT_DEVICE_ID,
IOT_PRIMARY_KEY,
IOT_HUB_DEVICE_ID,
IOT_DEVICE_SAS_KEY,
IOT_MODEL_ID);
#endif

Expand Down
26 changes: 9 additions & 17 deletions MXChip/AZ3166/app/nx_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ static UINT append_device_telemetry_accelerometer(NX_AZURE_IOT_JSON_WRITER* json
lsm6dsl_data.acceleration_mg[1],
2) ||
nx_azure_iot_json_writer_append_property_with_double_value(json_writer,
(UCHAR*)TELEMETRY_ACCELEROMETERY,
sizeof(TELEMETRY_ACCELEROMETERY) - 1,
(UCHAR*)TELEMETRY_ACCELEROMETERZ,
sizeof(TELEMETRY_ACCELEROMETERZ) - 1,
lsm6dsl_data.acceleration_mg[2],
2))
{
Expand All @@ -186,21 +186,13 @@ static UINT append_device_telemetry_gyroscope(NX_AZURE_IOT_JSON_WRITER* json_wri
(UCHAR*)TELEMETRY_GYROSCOPEX,
sizeof(TELEMETRY_GYROSCOPEX) - 1,
lsm6dsl_data.angular_rate_mdps[0],
2))
{
return NX_NOT_SUCCESSFUL;
}

if (nx_azure_iot_json_writer_append_property_with_double_value(json_writer,
2) ||
nx_azure_iot_json_writer_append_property_with_double_value(json_writer,
(UCHAR*)TELEMETRY_GYROSCOPEY,
sizeof(TELEMETRY_GYROSCOPEY) - 1,
lsm6dsl_data.angular_rate_mdps[1],
2))
{
return NX_NOT_SUCCESSFUL;
}

if (nx_azure_iot_json_writer_append_property_with_double_value(json_writer,
2) ||
nx_azure_iot_json_writer_append_property_with_double_value(json_writer,
(UCHAR*)TELEMETRY_GYROSCOPEZ,
sizeof(TELEMETRY_GYROSCOPEZ) - 1,
lsm6dsl_data.angular_rate_mdps[2],
Expand Down Expand Up @@ -345,7 +337,7 @@ UINT azure_iot_nx_client_entry(
(UCHAR*)iot_x509_private_key,
iot_x509_private_key_len);
#else
status = azure_iot_nx_client_sas_set(&azure_iot_nx_client, IOT_PRIMARY_KEY);
status = azure_iot_nx_client_sas_set(&azure_iot_nx_client, IOT_DEVICE_SAS_KEY);
#endif
if (status != NX_SUCCESS)
{
Expand All @@ -354,9 +346,9 @@ UINT azure_iot_nx_client_entry(
}

#ifdef ENABLE_DPS
azure_iot_nx_client_dps_create(&azure_iot_nx_client, IOT_DPS_ENDPOINT, IOT_DPS_ID_SCOPE, IOT_DPS_REGISTRATION_ID);
azure_iot_nx_client_dps_create(&azure_iot_nx_client, IOT_DPS_ID_SCOPE, IOT_DPS_REGISTRATION_ID);
#else
azure_iot_nx_client_hub_create(&azure_iot_nx_client, IOT_HUB_HOSTNAME, IOT_DEVICE_ID);
azure_iot_nx_client_hub_create(&azure_iot_nx_client, IOT_HUB_HOSTNAME, IOT_HUB_DEVICE_ID);
#endif
if (status != NX_SUCCESS)
{
Expand Down
4 changes: 2 additions & 2 deletions MXChip/AZ3166/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ To connect the MXCHIP DevKit to Azure, you'll modify a configuration file for Wi
|Constant name|Value|
|-------------|-----|
|`IOT_HUB_HOSTNAME` |{*Your Iot hub hostName value*}|
|`IOT_DEVICE_ID` |{*Your deviceID value*}|
|`IOT_PRIMARY_KEY` |{*Your primaryKey value*}|
|`IOT_HUB_DEVICE_ID` |{*Your deviceID value*}|
|`IOT_DEVICE_SAS_KEY` |{*Your primaryKey value*}|

1. Save and close the file.

Expand Down
46 changes: 17 additions & 29 deletions Microchip/ATSAME54-XPRO/app/azure_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// 0 - BME280 sensor is not present
// 1 - BME280 sensor is present
// ----------------------------------------------------------------------------
#define __SENSOR_BME280__ 0
#define __SENSOR_BME280__ 1

// ----------------------------------------------------------------------------
// Azure IoT Hub Connection Transport
Expand All @@ -20,47 +20,35 @@
// Azure IoT Dynamic Provisioning Service
// Define this to use the DPS service, otherwise direct IoT Hub
// ----------------------------------------------------------------------------
// #define ENABLE_DPS
//#define ENABLE_DPS

// ----------------------------------------------------------------------------
// Azure IoT DPS Self-Signed X509Certificate
// Define this to connect to DPS or Iot Hub using a self-signed X509
/// certificate
// Define this to connect to DPS or Iot Hub using a X509 certificate
// ----------------------------------------------------------------------------
// #define ENABLE_X509

// ----------------------------------------------------------------------------
// Azure IoT Device ID
// Make sure this is the same as the Device ID on the corresponding IoT Hub
// NOTE: To be used only when ENABLE_DPS is NOT defined
// Azure IoT Hub connection config
// IOT_HUB_HOSTNAME: The Azure IoT Hub hostname
// IOT_HUB_DEVICE_ID: The Azure IoT Hub device id
// ----------------------------------------------------------------------------
#define IOT_DEVICE_ID ""
#define IOT_HUB_HOSTNAME ""
#define IOT_HUB_DEVICE_ID ""

// ----------------------------------------------------------------------------
// Azure IoT SAS Key
// The SAS key generated by configuring an IoT Hub device or DPS individual
// enrollment
// NOTE: To be used only when ENABLE_X509 is not defined
// ----------------------------------------------------------------------------
#define IOT_PRIMARY_KEY ""

// ----------------------------------------------------------------------------
// Azure IoT Hub Hostname
// The Hostname found on your IoT Hub Overview page
// NOTE: To be used only when ENABLE_DPS is not defined
// Azure IoT DPS connection config
// IOT_DPS_ID_SCOPE: The DPS ID Scope
// IOT_DPS_REGISTRATION_ID: The DPS device Registration Id
// ----------------------------------------------------------------------------
#define IOT_HUB_HOSTNAME ""
#define IOT_DPS_ID_SCOPE ""
#define IOT_DPS_REGISTRATION_ID ""

// ----------------------------------------------------------------------------
// Azure IoT DPS config
// DPS connection information
// IOT_DPS_ENDPOINT is always "global.azure-devices-provisioning.net"
// IOT_DPS_ID_SCOPE can be found on your DPS Overview page
// IOT_DPS_REGISTRATION ID is the title of your individual enrollment
// containing your SAS key or X509 certificate
// Azure IoT device SAS key
// The SAS key generated by configuring an IoT Hub device or DPS individual
// enrollment
// ----------------------------------------------------------------------------
#define IOT_DPS_ENDPOINT "global.azure-devices-provisioning.net"
#define IOT_DPS_ID_SCOPE ""
#define IOT_DPS_REGISTRATION_ID ""
#define IOT_DEVICE_SAS_KEY ""

#endif // _AZURE_CONFIG_H
7 changes: 5 additions & 2 deletions Microchip/ATSAME54-XPRO/app/azure_device_x509_cert_config.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* Copyright (c) Microsoft Corporation.
Licensed under the MIT License. */

#ifndef _AZURE_DEVICE_X509_CERT_CONFIG_H
#define _AZURE_DEVICE_X509_CERT_CONFIG_H

Expand All @@ -6,13 +9,13 @@
// Replace {0x00} with your formatted output from OpenSSL and xxd here
// ----------------------------------------------------------------------------
const unsigned char iot_x509_device_cert[] = {0x00};
unsigned int iot_x509_device_cert_len = sizeof(iot_x509_device_cert);
unsigned int iot_x509_device_cert_len = sizeof(iot_x509_device_cert);

// ----------------------------------------------------------------------------
// Azure IoT X509 Device Private Key
// Replace {0x00} with your formatted output from OpenSSL and xxd here
// ----------------------------------------------------------------------------
unsigned char iot_x509_private_key[] = {0x00};
unsigned char iot_x509_private_key[] = {0x00};
const unsigned int iot_x509_private_key_len = sizeof(iot_x509_private_key);

#endif
7 changes: 3 additions & 4 deletions Microchip/ATSAME54-XPRO/app/legacy/mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,9 @@ UINT azure_iot_mqtt_entry(NX_IP* ip_ptr, NX_PACKET_POOL* pool_ptr, NX_DNS* dns_p
pool_ptr,
dns_ptr,
time_get,
IOT_DPS_ENDPOINT,
IOT_DPS_ID_SCOPE,
IOT_DPS_REGISTRATION_ID,
IOT_PRIMARY_KEY,
IOT_DEVICE_SAS_KEY,
IOT_MODEL_ID);
#else
// Create Azure MQTT for Hub
Expand All @@ -142,8 +141,8 @@ UINT azure_iot_mqtt_entry(NX_IP* ip_ptr, NX_PACKET_POOL* pool_ptr, NX_DNS* dns_p
dns_ptr,
time_get,
IOT_HUB_HOSTNAME,
IOT_DEVICE_ID,
IOT_PRIMARY_KEY,
IOT_HUB_DEVICE_ID,
IOT_DEVICE_SAS_KEY,
IOT_MODEL_ID);
#endif

Expand Down
6 changes: 3 additions & 3 deletions Microchip/ATSAME54-XPRO/app/nx_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ UINT azure_iot_nx_client_entry(
(UCHAR*)iot_x509_private_key,
iot_x509_private_key_len);
#else
status = azure_iot_nx_client_sas_set(&azure_iot_nx_client, IOT_PRIMARY_KEY);
status = azure_iot_nx_client_sas_set(&azure_iot_nx_client, IOT_DEVICE_SAS_KEY);
#endif
if (status != NX_SUCCESS)
{
Expand All @@ -218,9 +218,9 @@ UINT azure_iot_nx_client_entry(
}

#ifdef ENABLE_DPS
azure_iot_nx_client_dps_create(&azure_iot_nx_client, IOT_DPS_ENDPOINT, IOT_DPS_ID_SCOPE, IOT_DPS_REGISTRATION_ID);
azure_iot_nx_client_dps_create(&azure_iot_nx_client, IOT_DPS_ID_SCOPE, IOT_DPS_REGISTRATION_ID);
#else
azure_iot_nx_client_hub_create(&azure_iot_nx_client, IOT_HUB_HOSTNAME, IOT_DEVICE_ID);
azure_iot_nx_client_hub_create(&azure_iot_nx_client, IOT_HUB_HOSTNAME, IOT_HUB_DEVICE_ID);
#endif
if (status != NX_SUCCESS)
{
Expand Down
4 changes: 2 additions & 2 deletions Microchip/ATSAME54-XPRO/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ To connect the Microchip E54 to Azure, you'll modify a configuration file for Az
|Constant name|Value|
|-------------|-----|
|`IOT_HUB_HOSTNAME` |{*Your Iot hub hostName value*}|
|`IOT_DEVICE_ID` |{*Your deviceID value*}|
|`IOT_PRIMARY_KEY` |{*Your primaryKey value*}|
|`IOT_HUB_DEVICE_ID` |{*Your deviceID value*}|
|`IOT_DEVICE_SAS_KEY` |{*Your primaryKey value*}|

1. Save and close the file.

Expand Down
44 changes: 16 additions & 28 deletions NXP/MIMXRT1050-EVKB/app/azure_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,35 @@
// Azure IoT Dynamic Provisioning Service
// Define this to use the DPS service, otherwise direct IoT Hub
// ----------------------------------------------------------------------------
// #define ENABLE_DPS
//#define ENABLE_DPS

// ----------------------------------------------------------------------------
// Azure IoT DPS Self-Signed X509Certificate
// Define this to connect to DPS or Iot Hub using a self-signed X509
/// certificate
// Define this to connect to DPS or Iot Hub using a X509 certificate
// ----------------------------------------------------------------------------
// #define ENABLE_X509

// ----------------------------------------------------------------------------
// Azure IoT Device ID
// Make sure this is the same as the Device ID on the corresponding IoT Hub
// NOTE: To be used only when ENABLE_DPS is NOT defined
// Azure IoT Hub connection config
// IOT_HUB_HOSTNAME: The Azure IoT Hub hostname
// IOT_HUB_DEVICE_ID: The Azure IoT Hub device id
// ----------------------------------------------------------------------------
#define IOT_DEVICE_ID ""
#define IOT_HUB_HOSTNAME ""
#define IOT_HUB_DEVICE_ID ""

// ----------------------------------------------------------------------------
// Azure IoT SAS Key
// The SAS key generated by configuring an IoT Hub device or DPS individual
// enrollment
// NOTE: To be used only when ENABLE_X509 is not defined
// ----------------------------------------------------------------------------
#define IOT_PRIMARY_KEY ""

// ----------------------------------------------------------------------------
// Azure IoT Hub Hostname
// The Hostname found on your IoT Hub Overview page
// NOTE: To be used only when ENABLE_DPS is not defined
// Azure IoT DPS connection config
// IOT_DPS_ID_SCOPE: The DPS ID Scope
// IOT_DPS_REGISTRATION_ID: The DPS device Registration Id
// ----------------------------------------------------------------------------
#define IOT_HUB_HOSTNAME ""
#define IOT_DPS_ID_SCOPE ""
#define IOT_DPS_REGISTRATION_ID ""

// ----------------------------------------------------------------------------
// Azure IoT DPS config
// DPS connection information
// IOT_DPS_ENDPOINT is always "global.azure-devices-provisioning.net"
// IOT_DPS_ID_SCOPE can be found on your DPS Overview page
// IOT_DPS_REGISTRATION ID is the title of your individual enrollment
// containing your SAS key or X509 certificate
// Azure IoT device SAS key
// The SAS key generated by configuring an IoT Hub device or DPS individual
// enrollment
// ----------------------------------------------------------------------------
#define IOT_DPS_ENDPOINT "global.azure-devices-provisioning.net"
#define IOT_DPS_ID_SCOPE ""
#define IOT_DPS_REGISTRATION_ID ""
#define IOT_DEVICE_SAS_KEY ""

#endif // _AZURE_CONFIG_H
Loading