[IOT-2710] improve pstat logging 77/22777/2
authorNathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
Wed, 11 Oct 2017 05:25:45 +0000 (22:25 -0700)
committerNathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
Thu, 12 Oct 2017 15:13:55 +0000 (15:13 +0000)
Help debug issue where CTT Updates /pstat.dos = SRESET and
tm is not being correctly set by IUT.

Change-Id: I2b598b21e3dd30c27b165ff7cdd033727d5b0858
Signed-off-by: Nathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
resource/csdk/security/src/deviceonboardingstate.c
resource/csdk/security/src/pstatresource.c

index f620fc1..0f73481 100644 (file)
@@ -410,8 +410,8 @@ static bool EnterRESET()
     VERIFY_SUCCESS(TAG, OC_STACK_OK == SetPstatRownerId(&THE_NIL_UUID), ERROR);
 
     // Set pstat.isop = FALSE
-    // Set pstat.cm RESET and unset TAKE_OWNER
-    // Unset pstat.tm and set TAKE_OWNER
+    // Set pstat.cm RESET, and unset TAKE_OWNER
+    // Unset pstat.tm RESET, and set TAKE_OWNER
     // Set pstat.dos.s to RESET
     VERIFY_SUCCESS(TAG,
         EnterStateGeneric(false, true, false, false, true, DOS_RESET),
@@ -442,8 +442,8 @@ static bool EnterSRESET()
     bool ret = false;
 
     // Set pstat.isop = FALSE
-    // Set pstat.cm RESET and unset TAKE_OWNER
-    // Unset pstat.tm and unset TAKE_OWNER
+    // Set pstat.cm RESET, and unset TAKE_OWNER
+    // Unset pstat.tm RESET, and unset TAKE_OWNER
     // Set pstat.dos.s to RESET
     VERIFY_SUCCESS(TAG,
         EnterStateGeneric(false, true, false, false, false, DOS_SRESET),
index 1d8bb67..e027665 100644 (file)
@@ -208,7 +208,7 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat,
             pstatMapSize++;
         }
     }
-    OIC_LOG_V(INFO, TAG, "%s: creating pstat CBOR payload with %d Properties.",
+    OIC_LOG_V(INFO, TAG, "%s: creating pstat CBOR payload with %zu Properties.",
         __func__, pstatMapSize - PSTAT_EMPTY_MAP_SIZE);
 
     // Top Level Pstat Map
@@ -218,7 +218,7 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat,
     // dos Property
     if (propertiesToInclude[PSTAT_DOS])
     {
-        OIC_LOG_V(DEBUG, TAG, "%s: including dos Property.", __func__);
+        OIC_LOG_V(DEBUG, TAG, "%s: including dos Property (s = %d).", __func__, pstat->dos.state);
         // Device Onboarding State Property tag
         cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_DOS_NAME,
             strlen(OIC_JSON_DOS_NAME));
@@ -250,7 +250,7 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat,
     // isop Property
     if (propertiesToInclude[PSTAT_ISOP])
     {
-        OIC_LOG_V(DEBUG, TAG, "%s: including isop Property.", __func__);
+        OIC_LOG_V(DEBUG, TAG, "%s: including isop Property (isop = %s).", __func__, (pstat->isOp ? "true" : "false"));
         cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_ISOP_NAME,
             strlen(OIC_JSON_ISOP_NAME));
         VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding ISOP Name Tag.");
@@ -261,7 +261,7 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat,
     // cm Property
     if (propertiesToInclude[PSTAT_CM])
     {
-        OIC_LOG_V(DEBUG, TAG, "%s: including cm Property.", __func__);
+        OIC_LOG_V(DEBUG, TAG, "%s: including cm Property (cm = %d).", __func__, pstat->cm);
         cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_CM_NAME,
             strlen(OIC_JSON_CM_NAME));
         VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding CM Name Tag.");
@@ -272,7 +272,7 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat,
     // tm Property
     if (propertiesToInclude[PSTAT_TM])
     {
-        OIC_LOG_V(DEBUG, TAG, "%s: including tm Property.", __func__);
+        OIC_LOG_V(DEBUG, TAG, "%s: including tm Property (tm = %d).", __func__, pstat->tm);
         cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_TM_NAME,
             strlen(OIC_JSON_TM_NAME));
         VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding TM Name Tag.");
@@ -283,7 +283,7 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat,
     // om Property
     if (propertiesToInclude[PSTAT_OM])
     {
-        OIC_LOG_V(DEBUG, TAG, "%s: including om Property.", __func__);
+        OIC_LOG_V(DEBUG, TAG, "%s: including om Property (om = %d).", __func__, pstat->om);
         cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_OM_NAME,
             strlen(OIC_JSON_OM_NAME));
         VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding OM Name Tag.");
@@ -294,7 +294,7 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat,
     // sm Property
     if (propertiesToInclude[PSTAT_SM])
     {
-        OIC_LOG_V(DEBUG, TAG, "%s: including sm Property.", __func__);
+        OIC_LOG_V(DEBUG, TAG, "%s: including sm Property (sm = %d).", __func__, pstat->sm[0]);
         cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_SM_NAME,
             strlen(OIC_JSON_SM_NAME));
         VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding SM Name Tag.");
@@ -310,6 +310,7 @@ OCStackResult PstatToCBORPayloadPartial(const OicSecPstat_t *pstat,
             strlen(OIC_JSON_ROWNERID_NAME));
         VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding ROwner Id Tag.");
         ret = ConvertUuidToStr(&pstat->rownerID, &strUuid);
+        OIC_LOG_V(DEBUG, TAG, "%s: rowneruuid = %s.", __func__, strUuid);
         VERIFY_SUCCESS(TAG, OC_STACK_OK == ret , ERROR);
         cborEncoderResult = cbor_encode_text_string(&pstatMap, strUuid, strlen(strUuid));
         VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborEncoderResult, "Failed Adding ROwner Id Value.");