Skip to content

Commit

Permalink
Merge pull request #1687 from FIWARE/dds/discovery
Browse files Browse the repository at this point in the history
Dds/discovery
  • Loading branch information
kzangeli authored Oct 7, 2024
2 parents f8eea76 + 6bf6290 commit bfb4759
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
11 changes: 6 additions & 5 deletions src/lib/orionld/dbModel/dbModelAttributePublishedAtLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ extern "C"
//
// dbModelAttributePublishedAtLookup -
//
double dbModelAttributePublishedAtLookup(KjNode* dbAttrP)
int64_t dbModelAttributePublishedAtLookup(KjNode* dbAttrP)
{
kjTreeLog2(dbAttrP, "dbAttr", StDds);

KjNode* publishedAtP = kjLookup(dbAttrP, "publishedAt");
KjNode* publishedAtObjectP = kjLookup(dbAttrP, "publishedAt");
KjNode* publishedAtValueP = (publishedAtObjectP != NULL)? kjLookup(publishedAtObjectP, "value") : NULL;

if (publishedAtP != NULL)
return publishedAtP->value.f;
if (publishedAtValueP != NULL)
return publishedAtValueP->value.i;

return 0;
return -1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ extern "C"
//
// dbModelAttributePublishedAtLookup -
//
extern double dbModelAttributePublishedAtLookup(KjNode* dbAttrP);
extern int64_t dbModelAttributePublishedAtLookup(KjNode* dbAttrP);

#endif // SRC_LIB_ORIONLD_DBMODEL_DBMODELATTRIBUTEPUBLISHEDATLOOKUP_H_
4 changes: 2 additions & 2 deletions src/lib/orionld/dds/ddsNotification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extern "C"
//
// ddsNotification -
//
void ddsNotification(const char* typeName, const char* topicName, const char* json, double publishTime)
void ddsNotification(const char* typeName, const char* topicName, const char* json, int64_t publishTime)
{
KT_T(StDdsNotification, "Got a notification on %s:%s (json: %s)", typeName, topicName, json);

Expand Down Expand Up @@ -110,7 +110,7 @@ void ddsNotification(const char* typeName, const char* topicName, const char* js

kjChildAdd(attrNodeP, participantIdNodeP);

KjNode* publishedAt = kjFloat(orionldState.kjsonP, "publishedAt", publishTime);
KjNode* publishedAt = kjInteger(orionldState.kjsonP, "publishedAt", publishTime);
kjChildAdd(attrNodeP, publishedAt);

//
Expand Down
2 changes: 1 addition & 1 deletion src/lib/orionld/dds/ddsNotification.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
//
// ddsNotification -
//
extern void ddsNotification(const char* typeName, const char* topicName, const char* json, double publishTime);
extern void ddsNotification(const char* typeName, const char* topicName, const char* json, int64_t publishTime);

#endif // SRC_LIB_ORIONLD_DDS_DDSNOTIFICATION_H_
2 changes: 1 addition & 1 deletion src/lib/orionld/serviceRoutines/orionldPutAttribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ bool orionldPutAttribute(void)
//
// This can happen during startup, during the discovery phase of DDS.
//
double publishedAt = dbModelAttributePublishedAtLookup(dbAttrP);
int64_t publishedAt = dbModelAttributePublishedAtLookup(dbAttrP);
if (publishedAt > orionldState.ddsPublishTime)
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion test/functionalTest/cases/0000_dds/dds_notifications.test
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Date: REGEX(.*)
05. Query the broker for all its entities, see all four
=======================================================
HTTP/1.1 200 OK
Content-Length: 1438
Content-Length: REGEX(.*)
Content-Type: application/json
Date: REGEX(.*)
Link: <https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-contextREGEX(.*)
Expand Down
4 changes: 2 additions & 2 deletions test/functionalTest/ftClient/ftClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ extern KjNode* ddsDumpArray;
//
// ddsNotification -
//
static void ddsNotification(const char* typeName, const char* topicName, const char* json, double publishTime)
static void ddsNotification(const char* typeName, const char* topicName, const char* json, int64_t publishTime)
{
KT_T(StDdsDump, "Got a notification on %s:%s (json: %s)", typeName, topicName, json);

#if 0
KT_T(StDdsDump, "Need to check the publishTime (%f) to perhaps discard", publishTime);
KT_T(StDdsDump, "Need to check the publishTime (%lld) to perhaps discard", publishTime);

if (ddsDumpArray == NULL)
{
Expand Down

0 comments on commit bfb4759

Please sign in to comment.