-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #672 from SignalK/definition_in_cpp
Move function definitions from header to cpp file
- Loading branch information
Showing
2 changed files
with
24 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "position.h" | ||
|
||
#include "ArduinoJson.h" | ||
|
||
namespace sensesp { | ||
|
||
void convertFromJson(JsonVariantConst src, Position &dst) { | ||
dst.longitude = src["longitude"].as<double>(); | ||
dst.latitude = src["latitude"].as<double>(); | ||
|
||
if (src.containsKey("altitude")) { | ||
dst.altitude = src["altitude"].as<float>(); | ||
} | ||
} | ||
|
||
bool canConvertFromJson(JsonVariantConst src, const Position &) { | ||
return src.containsKey("latitude") && src.containsKey("longitude"); | ||
} | ||
|
||
} // namespace sensesp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters