mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-13 05:53:06 +01:00
change api for getBoatDataValues
This commit is contained in:
@@ -334,6 +334,11 @@ bool GwBoatData::isValid(String name){
|
||||
if (it == values.end()) return false;
|
||||
return it->second->isValid();
|
||||
}
|
||||
GwBoatItemBase* GwBoatData::getBase(String name){
|
||||
auto it=values.find(name);
|
||||
if (it == values.end()) return NULL;
|
||||
return it->second;
|
||||
}
|
||||
double GwBoatData::getDoubleValue(String name,double defaultv){
|
||||
auto it=values.find(name);
|
||||
if (it == values.end()) return defaultv;
|
||||
|
||||
@@ -71,7 +71,7 @@ class GwBoatItemBase{
|
||||
virtual void refresh(unsigned long ts=0){uls(ts);}
|
||||
virtual double getDoubleValue()=0;
|
||||
String getName(){return name;}
|
||||
String getFormat(){return format;}
|
||||
const String & getFormat() const{return format;}
|
||||
};
|
||||
class GwBoatData;
|
||||
template<class T> class GwBoatItem : public GwBoatItemBase{
|
||||
@@ -208,6 +208,7 @@ class GwBoatData{
|
||||
template<class T> T getDataWithDefault(T defaultv, GwBoatItemNameProvider *provider);
|
||||
bool isValid(String name);
|
||||
double getDoubleValue(String name,double defaultv);
|
||||
GwBoatItemBase *getBase(String name);
|
||||
String toJson() const;
|
||||
String toString();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user