Skip to content

Commit

Permalink
Merge pull request #11 from JerryYangKai/master
Browse files Browse the repository at this point in the history
change registrationid
  • Loading branch information
xinyiz1226 authored Sep 25, 2019
2 parents d4ffa49 + a91a890 commit d5ba68f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pnp/iotc_devkit/Device/main.ino
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static char *dpsIdScope = NULL;
// The symmetric key, learn more from https://docs.microsoft.com/en-us/azure/iot-dps/concepts-symmetric-key-attestation.
static char *sasKey = NULL;
// The Registration ID, learn more from https://docs.microsoft.com/en-us/azure/iot-dps/use-hsm-with-sdk.
static char *registrationId = NULL;
static char *deviceId = NULL;

// TODO: Fill in DIGITALTWIN_DEVICE_CAPABILITY_MODEL_INLINE_DATA if want to make deivce self-describing.
#define DIGITALTWIN_DEVICE_CAPABILITY_MODEL_INLINE_DATA "{}"
Expand Down Expand Up @@ -95,7 +95,7 @@ static bool parseDPSConnectionString(const char *connection_string)
const char *_globalDpsEndpoint = Map_GetValueFromKey(connection_string_values_map, IOTHUBDPS_ENDPOINT);
const char *_dpsIdScope = Map_GetValueFromKey(connection_string_values_map, IOTHUBDPS_IDSCOPE);
const char *_sasKey = Map_GetValueFromKey(connection_string_values_map, IOTHUBDPS_SYMMETRICKEY);
const char *_registrationId = Map_GetValueFromKey(connection_string_values_map, IOTHUBDPS_DEVICEID);
const char *_deviceId = Map_GetValueFromKey(connection_string_values_map, IOTHUBDPS_DEVICEID);
if (_globalDpsEndpoint)
{
mallocAndStrcpy_s(&globalDpsEndpoint, _globalDpsEndpoint);
Expand All @@ -120,17 +120,17 @@ static bool parseDPSConnectionString(const char *connection_string)
{
LogError("Couldn't find %s in connection string", IOTHUBDPS_SYMMETRICKEY);
}
if (_registrationId)
if (_deviceId)
{
mallocAndStrcpy_s(&registrationId, _registrationId);
mallocAndStrcpy_s(&deviceId, _deviceId);
}
else
{
LogError("Couldn't find %s in connection string", IOTHUBDPS_DEVICEID);
}
Map_Destroy(connection_string_values_map);

if (globalDpsEndpoint == NULL || dpsIdScope == NULL || sasKey == NULL || registrationId == NULL)
if (globalDpsEndpoint == NULL || dpsIdScope == NULL || sasKey == NULL || deviceId == NULL)
{
return false;
}
Expand Down Expand Up @@ -176,7 +176,7 @@ static bool registerDevice(bool traceOn)
return false;
}

if (prov_dev_set_symmetric_key_info(registrationId, sasKey) != 0)
if (prov_dev_set_symmetric_key_info(deviceId, sasKey) != 0)
{
LogError("prov_dev_set_symmetric_key_info failed.");
}
Expand Down

0 comments on commit d5ba68f

Please sign in to comment.