Simple Weather Service
Fix code formatting.
This commit is contained in:
parent
e5b73212f6
commit
6f83a3bade
|
@ -29,19 +29,12 @@ namespace {
|
|||
enum class MessageType : uint8_t { CurrentWeather, Forecast, Unknown };
|
||||
|
||||
uint64_t ToUInt64(const uint8_t* data) {
|
||||
return data[0] +
|
||||
(data[1] << 8) +
|
||||
(data[2] << 16) +
|
||||
(data[3] << 24) +
|
||||
(static_cast<uint64_t>(data[4]) << 32) +
|
||||
(static_cast<uint64_t>(data[5]) << 48) +
|
||||
(static_cast<uint64_t>(data[6]) << 48) +
|
||||
(static_cast<uint64_t>(data[7]) << 56);
|
||||
return data[0] + (data[1] << 8) + (data[2] << 16) + (data[3] << 24) + (static_cast<uint64_t>(data[4]) << 32) +
|
||||
(static_cast<uint64_t>(data[5]) << 48) + (static_cast<uint64_t>(data[6]) << 48) + (static_cast<uint64_t>(data[7]) << 56);
|
||||
}
|
||||
|
||||
int16_t ToInt16(const uint8_t* data) {
|
||||
return data[0] +
|
||||
(data[1] << 8);
|
||||
return data[0] + (data[1] << 8);
|
||||
}
|
||||
|
||||
SimpleWeatherService::CurrentWeather CreateCurrentWeather(const uint8_t* dataBuffer) {
|
||||
|
@ -63,8 +56,7 @@ namespace {
|
|||
const uint8_t nbDaysInBuffer = dataBuffer[10];
|
||||
const uint8_t nbDays = std::min(SimpleWeatherService::MaxNbForecastDays, nbDaysInBuffer);
|
||||
for (int i = 0; i < nbDays; i++) {
|
||||
days[i] = SimpleWeatherService::Forecast::Day {
|
||||
ToInt16(&dataBuffer[11 + (i * 5)]),
|
||||
days[i] = SimpleWeatherService::Forecast::Day {ToInt16(&dataBuffer[11 + (i * 5)]),
|
||||
ToInt16(&dataBuffer[13 + (i * 5)]),
|
||||
SimpleWeatherService::Icons {dataBuffer[15 + (i * 5)]}};
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace Pinetime {
|
|||
};
|
||||
|
||||
using Location = std::array<char, 33>; // 32 char + \0 (end of string)
|
||||
|
||||
struct CurrentWeather {
|
||||
CurrentWeather(uint64_t timestamp,
|
||||
int16_t temperature,
|
||||
|
|
Loading…
Reference in a new issue