// Read Pstat resource from PS
uint8_t *data = NULL;
size_t size = 0;
+ OicUuid_t emptyUuid = {.id={0}};
ret = GetSecureVirtualDatabaseFromPS(OIC_JSON_PSTAT_NAME, &data, &size);
// If database read failed
if (OC_STACK_OK != ret)
}
if (data)
{
- OicUuid_t emptyUuid = {.id={0}};
-
// Read ACL resource from PS
ret = CBORPayloadToPstat(data, size, &gPstat);
OICFree(data);
-
- //In case of PStat's device id is empty, fill the device id as doxm's device id.
- if(memcmp(&gPstat->deviceID, &emptyUuid, sizeof(OicUuid_t)) == 0)
- {
- OicUuid_t doxmUuid = {.id={0}};
- if(OC_STACK_OK == GetDoxmDeviceID(&doxmUuid))
- {
- memcpy(&gPstat->deviceID, &doxmUuid, sizeof(OicUuid_t));
- }
- }
}
/*
* If SVR database in persistent storage got corrupted or
}
VERIFY_NON_NULL(TAG, gPstat, FATAL);
+ //In case of Pstat's device id is empty, fill the device id as doxm's device id.
+ if(0 == memcmp(&gPstat->deviceID, &emptyUuid, sizeof(OicUuid_t)))
+ {
+ OicUuid_t doxmUuid = {.id={0}};
+ if(OC_STACK_OK == GetDoxmDeviceID(&doxmUuid))
+ {
+ memcpy(&gPstat->deviceID, &doxmUuid, sizeof(OicUuid_t));
+ }
+ }
+
// Instantiate 'oic.sec.pstat'
ret = CreatePstatResource();