Get weather Information
WeatherInfo.cpp@3:6618936f930a, 2015-11-22 (annotated)
- Committer:
- takashikojo
- Date:
- Sun Nov 22 08:50:49 2015 +0000
- Revision:
- 3:6618936f930a
- Parent:
- 2:76b812680942
Serial terminal macro
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
takashikojo | 0:6d53d6d34ac3 | 1 | #include <mbed.h> |
takashikojo | 0:6d53d6d34ac3 | 2 | #include <string> |
takashikojo | 0:6d53d6d34ac3 | 3 | #include "WeatherInfo.h" |
takashikojo | 0:6d53d6d34ac3 | 4 | #include "WeatherHacks.h" |
takashikojo | 0:6d53d6d34ac3 | 5 | |
takashikojo | 0:6d53d6d34ac3 | 6 | WeatherInfo::WeatherInfo(enum WeatherInfoSource s) { |
takashikojo | 0:6d53d6d34ac3 | 7 | source = s ; |
takashikojo | 0:6d53d6d34ac3 | 8 | WH_init() ; |
takashikojo | 0:6d53d6d34ac3 | 9 | } ; |
takashikojo | 0:6d53d6d34ac3 | 10 | |
takashikojo | 0:6d53d6d34ac3 | 11 | WeatherInfo::~WeatherInfo(){ } ; |
takashikojo | 0:6d53d6d34ac3 | 12 | |
takashikojo | 1:8655f1720450 | 13 | void WeatherInfo::setBuff(char *buff, int size) |
takashikojo | 1:8655f1720450 | 14 | { |
takashikojo | 1:8655f1720450 | 15 | recvBuff = buff ; |
takashikojo | 1:8655f1720450 | 16 | recvSize = size ; |
takashikojo | 1:8655f1720450 | 17 | } |
takashikojo | 1:8655f1720450 | 18 | |
takashikojo | 2:76b812680942 | 19 | bool WeatherInfo::getInfo(char *hiTemp, char *loTemp, char *prec) |
takashikojo | 0:6d53d6d34ac3 | 20 | { |
takashikojo | 0:6d53d6d34ac3 | 21 | switch(source) { |
takashikojo | 0:6d53d6d34ac3 | 22 | case WEATHER_HACKS: |
takashikojo | 2:76b812680942 | 23 | WH_getInfo(recvBuff, recvSize, hiTemp, loTemp, prec) ; |
takashikojo | 0:6d53d6d34ac3 | 24 | break ; |
takashikojo | 0:6d53d6d34ac3 | 25 | default: |
takashikojo | 0:6d53d6d34ac3 | 26 | return false ; |
takashikojo | 0:6d53d6d34ac3 | 27 | } |
takashikojo | 0:6d53d6d34ac3 | 28 | return true ; |
takashikojo | 0:6d53d6d34ac3 | 29 | } |