do
{
- *observationId = OCGetRandomByte();
+ do
+ {
+ *observationId = OCGetRandomByte();
+ } while (0 == *observationId); //Make sure *observationId is not 0
// Check if observation Id already exists
resObs = GetObserverUsingId (*observationId);
} while (NULL != resObs);
obsNode->devAddr = *devAddr;
obsNode->resource = resHandle;
+#ifdef WITH_PRESENCE
if ((strcmp(resUri, OC_RSRVD_PRESENCE_URI) == 0))
{
obsNode->TTL = 0;
}
else
+#endif
{
obsNode->TTL = GetTicks(MAX_OBSERVER_TTL_SECONDS * MILLISECONDS_PER_SECOND);
}