|
|
@ -77,6 +77,13 @@ void SimpleWeatherService::SetCurrentWeather(uint64_t timestamp, int16_t tempera
|
|
|
|
printf("currentWeather: timestamp=%d, temperature=%d, icon=%d\n", currentWeather->timestamp, currentWeather->temperature, currentWeather->iconId);
|
|
|
|
printf("currentWeather: timestamp=%d, temperature=%d, icon=%d\n", currentWeather->timestamp, currentWeather->temperature, currentWeather->iconId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SimpleWeatherService::SetForecast(uint64_t timestamp, std::array<SimpleWeatherService::Forecast::Day, SimpleWeatherService::MaxNbForecastDays> days) {
|
|
|
|
|
|
|
|
forecast = SimpleWeatherService::Forecast {timestamp, SimpleWeatherService::MaxNbForecastDays, days};
|
|
|
|
|
|
|
|
for (int i = 0; i < SimpleWeatherService::MaxNbForecastDays; i++) {
|
|
|
|
|
|
|
|
printf("forecast: day=%d. min=%d, max=%d icon=%d\n", i, days[i].minTemperature, days[i].maxTemperature, days[i].iconId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int SimpleWeatherService::OnCommand(struct ble_gatt_access_ctxt* ctxt) {
|
|
|
|
int SimpleWeatherService::OnCommand(struct ble_gatt_access_ctxt* ctxt) {
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
@ -115,3 +122,17 @@ bool SimpleWeatherService::CurrentWeather::operator==(const SimpleWeatherService
|
|
|
|
this->maxTemperature == other.maxTemperature && this->minTemperature == other.maxTemperature &&
|
|
|
|
this->maxTemperature == other.maxTemperature && this->minTemperature == other.maxTemperature &&
|
|
|
|
std::strcmp(this->location.data(), other.location.data()) == 0;
|
|
|
|
std::strcmp(this->location.data(), other.location.data()) == 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool SimpleWeatherService::Forecast::Day::operator==(const SimpleWeatherService::Forecast::Day& other) const {
|
|
|
|
|
|
|
|
return this->iconId == other.iconId &&
|
|
|
|
|
|
|
|
this->maxTemperature == other.maxTemperature && this->minTemperature == other.maxTemperature;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool SimpleWeatherService::Forecast::operator==(const SimpleWeatherService::Forecast& other) const {
|
|
|
|
|
|
|
|
for (int i = 0; i < this->nbDays; i++) {
|
|
|
|
|
|
|
|
if (this->days[i] != other.days[i]) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return this->timestamp == other.timestamp && this->nbDays == other.nbDays;
|
|
|
|
|
|
|
|
}
|
|
|
|