+ * Checks if device can change state to Ready for Normal Operation.
+ */
+static OCEntityHandlerResult ValidateReadyForNOP(const OicSecPstat_t *pstat)
+{
+ OIC_LOG_V(DEBUG, TAG, "%s: IN", __func__);
+
+ const OicSecDoxm_t *doxm = GetDoxmResourceData();
+ OicUuid_t rowneruuid;
+
+ if (!doxm)
+ {
+ OIC_LOG(WARNING, TAG, "DOXM is NULL");
+ return OC_EH_NOT_ACCEPTABLE;
+ }
+
+ if (!doxm->owned)
+ {
+ OIC_LOG(WARNING, TAG, "Can't change state to Ready for Normal Operation: the device is unowned");
+ return OC_EH_NOT_ACCEPTABLE;
+ }
+
+ if (IsNilUuid(&doxm->owner))
+ {
+ OIC_LOG(WARNING, TAG, "Can't change state to Ready for Normal Operation: the device owner is NIL");
+ return OC_EH_INTERNAL_SERVER_ERROR;
+ }
+
+ if (IsNilUuid(&doxm->deviceID))
+ {
+ OIC_LOG(WARNING, TAG,
+ "Can't change state to Ready for Normal Operation: the device owner ID is NIL");
+ return OC_EH_INTERNAL_SERVER_ERROR;
+ }
+
+ if (IsNilUuid(&doxm->rownerID))
+ {
+ OIC_LOG(WARNING, TAG, "Can't change state to Ready for Normal Operation: the doxm rowner is NIL");
+ return OC_EH_INTERNAL_SERVER_ERROR;
+ }
+
+
+ if (IsNilUuid(&pstat->rownerID))
+ {
+ OIC_LOG(WARNING, TAG, "Can't change state to Ready for Normal Operation: the pstat rowner is NIL");
+ return OC_EH_INTERNAL_SERVER_ERROR;
+ }
+
+ memset(&rowneruuid, 0, sizeof(OicUuid_t));
+ if (OC_STACK_OK != GetAclRownerId(&rowneruuid))
+ {
+ OIC_LOG(WARNING, TAG, "Can't change state to Ready for Normal Operation: can't get acl");
+ return OC_EH_INTERNAL_SERVER_ERROR;
+ }
+
+ if (IsNilUuid(&rowneruuid))
+ {
+ OIC_LOG(WARNING, TAG, "Can't change state to Ready for Normal Operation: the acl rowner is NIL");
+ return OC_EH_INTERNAL_SERVER_ERROR;
+ }
+
+ memset(&rowneruuid, 0, sizeof(OicUuid_t));
+ if (OC_STACK_OK != GetCredRownerId(&rowneruuid))
+ {
+ OIC_LOG(WARNING, TAG, "Can't change state to Ready for Normal Operation: can't get cred");
+ return OC_EH_INTERNAL_SERVER_ERROR;
+ }
+
+ if (IsNilUuid(&rowneruuid))
+ {
+ OIC_LOG(WARNING, TAG, "Can't change state to Ready for Normal Operation: the cred rowner is NIL");
+ return OC_EH_INTERNAL_SERVER_ERROR;
+ }
+
+ OIC_LOG_V(DEBUG, TAG, "%s: OUT", __func__);
+
+ return OC_EH_OK;
+
+}
+
+/**