Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/lib/profiles/data-management/Current/MessageDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,17 @@ DataElement::Parser::ParseData(nl::Weave::TLV::TLVReader & aReader, int aDepth)
break;
}

case nl::Weave::TLV::kTLVType_FloatingPointNumber:
{
double value_fp;

err = aReader.Get(value_fp);
SuccessOrExit(err);

PRETTY_PRINT_SAMELINE("%lf, ", value_fp);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may run into problems on platforms where printf doesn't support float.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can add the feature flag on it? WEAVE_CONFIG_SUPPORT_FLOAT_PRINT?

break;
}

case nl::Weave::TLV::kTLVType_Boolean:
{
bool value_b;
Expand Down
8 changes: 4 additions & 4 deletions src/test-apps/MockSinkTraits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ TestATraitDataSink::SetLeafData(PropertyPathHandle aLeafHandle, TLVReader &aRead
err = aReader.Get(tax);
SuccessOrExit(err);

WeaveLogDetail(DataManagement, "<< ta_x %d", tax);
WeaveLogDetail(DataManagement, "<< ta_x %lf", tax);
break;

case TestATrait::kPropertyHandle_TaI_Value:
Expand Down Expand Up @@ -1012,7 +1012,7 @@ WEAVE_ERROR TestATraitDataSink::GetLeafData(PropertyPathHandle aLeafHandle, uint
err = aWriter.Put(aTagToWrite, tax);
SuccessOrExit(err);

WeaveLogDetail(DataManagement, ">> ta_x %d", tax);
WeaveLogDetail(DataManagement, ">> ta_x %lf", tax);
break;

case TestATrait::kPropertyHandle_TaI_Value:
Expand Down Expand Up @@ -2336,7 +2336,7 @@ TestATraitUpdatableDataSink::SetLeafData(PropertyPathHandle aLeafHandle, TLVRead
err = aReader.Get(tax);
SuccessOrExit(err);

WeaveLogDetail(DataManagement, "<< ta_x %d", tax);
WeaveLogDetail(DataManagement, "<< ta_x %lf", tax);
break;

case TestATrait::kPropertyHandle_TaI_Value:
Expand Down Expand Up @@ -2590,7 +2590,7 @@ WEAVE_ERROR TestATraitUpdatableDataSink::GetLeafData(PropertyPathHandle aLeafHan
err = aWriter.Put(aTagToWrite, tax);
SuccessOrExit(err);

WeaveLogDetail(DataManagement, ">> ta_x %d", tax);
WeaveLogDetail(DataManagement, ">> ta_x %lf", tax);
break;

case TestATrait::kPropertyHandle_TaI_Value:
Expand Down
4 changes: 2 additions & 2 deletions src/test-apps/MockSinkTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class TestATraitUpdatableDataSink : public MockTraitUpdatableDataSink
bool tav;
char taw[20];
// boxed float
int16_t tax;
double tax;

bool nullified_path[Schema::Nest::Test::Trait::TestATrait::kPropertyHandle_TaJ_Value_SaB];
uint32_t mTestCounter = 0;
Expand Down Expand Up @@ -320,7 +320,7 @@ class TestATraitDataSink : public MockTraitDataSink, public MockTraitDataSourceD
bool tav;
char taw[20];
// boxed float
int16_t tax;
double tax;

bool nullified_path[Schema::Nest::Test::Trait::TestATrait::kPropertyHandle_TaJ_Value_SaB];
};
Expand Down
6 changes: 3 additions & 3 deletions src/test-apps/MockSourceTraits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ TestATraitDataSource::TestATraitDataSource():
tat = 1000;
tau = -1000;
tav = true;
tax = 800;
tax = 800.1;

for (size_t i = 0; i < 4; i++) {
tai_map[i] = 100 + i;
Expand Down Expand Up @@ -1061,7 +1061,7 @@ TestATraitDataSource::SetLeafData(PropertyPathHandle aLeafHandle, TLVReader &aRe
err = aReader.Get(tax);
SuccessOrExit(err);

WeaveLogDetail(DataManagement, "<< ta_x %d", tax);
WeaveLogDetail(DataManagement, "<< ta_x %lf", tax);
break;

case TestATrait::kPropertyHandle_TaI_Value:
Expand Down Expand Up @@ -1302,7 +1302,7 @@ WEAVE_ERROR TestATraitDataSource::GetLeafData(PropertyPathHandle aLeafHandle, ui
err = aWriter.Put(aTagToWrite, tax);
SuccessOrExit(err);

WeaveLogDetail(DataManagement, ">> ta_x %d", tax);
WeaveLogDetail(DataManagement, ">> ta_x %lf", tax);
break;

case TestATrait::kPropertyHandle_TaI_Value:
Expand Down
2 changes: 1 addition & 1 deletion src/test-apps/MockSourceTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class TestATraitDataSource :
bool tav;
char *taw = "boxedstring";
// boxed float
int16_t tax;
double tax;

bool nullified_path[Schema::Nest::Test::Trait::TestATrait::kPropertyHandle_TaJ_Value_SaB];

Expand Down