Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
TrainStat.cpp@0:a59f55690685, 2015-06-26 (annotated)
- Committer:
- takashikojo
- Date:
- Fri Jun 26 09:35:34 2015 +0000
- Revision:
- 0:a59f55690685
- Child:
- 1:26a0a9220f01
TransStat class
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| takashikojo | 0:a59f55690685 | 1 | #include <mbed.h> |
| takashikojo | 0:a59f55690685 | 2 | #include <string> |
| takashikojo | 0:a59f55690685 | 3 | #include "TrainStat.h" |
| takashikojo | 0:a59f55690685 | 4 | #include "tokyoMetro.h" |
| takashikojo | 0:a59f55690685 | 5 | |
| takashikojo | 0:a59f55690685 | 6 | TrainStat::TrainStat() { |
| takashikojo | 0:a59f55690685 | 7 | source = TOKYO_METRO ; |
| takashikojo | 0:a59f55690685 | 8 | TMetro_initLine() ; |
| takashikojo | 0:a59f55690685 | 9 | } ; |
| takashikojo | 0:a59f55690685 | 10 | |
| takashikojo | 0:a59f55690685 | 11 | TrainStat::~TrainStat(){ } ; |
| takashikojo | 0:a59f55690685 | 12 | |
| takashikojo | 0:a59f55690685 | 13 | bool TrainStat::setLine(string line) |
| takashikojo | 0:a59f55690685 | 14 | { |
| takashikojo | 0:a59f55690685 | 15 | switch(source) { |
| takashikojo | 0:a59f55690685 | 16 | case YAHOO_TRAIN: |
| takashikojo | 0:a59f55690685 | 17 | return false ; |
| takashikojo | 0:a59f55690685 | 18 | case TOKYO_METRO: |
| takashikojo | 0:a59f55690685 | 19 | TMetro_setLine(line) ; |
| takashikojo | 0:a59f55690685 | 20 | break ; |
| takashikojo | 0:a59f55690685 | 21 | default: |
| takashikojo | 0:a59f55690685 | 22 | return false ; |
| takashikojo | 0:a59f55690685 | 23 | } |
| takashikojo | 0:a59f55690685 | 24 | return true ; |
| takashikojo | 0:a59f55690685 | 25 | } |
| takashikojo | 0:a59f55690685 | 26 | bool TrainStat::getStat() |
| takashikojo | 0:a59f55690685 | 27 | { |
| takashikojo | 0:a59f55690685 | 28 | switch(source) { |
| takashikojo | 0:a59f55690685 | 29 | case YAHOO_TRAIN: |
| takashikojo | 0:a59f55690685 | 30 | return false ; |
| takashikojo | 0:a59f55690685 | 31 | case TOKYO_METRO: |
| takashikojo | 0:a59f55690685 | 32 | TMetro_query("datapoints", "odpt:TrainInformation", recvBuff, sizeof(recvBuff)) ; |
| takashikojo | 0:a59f55690685 | 33 | return TMetro_getStat(recvBuff) ; |
| takashikojo | 0:a59f55690685 | 34 | default: |
| takashikojo | 0:a59f55690685 | 35 | return false ; |
| takashikojo | 0:a59f55690685 | 36 | } |
| takashikojo | 0:a59f55690685 | 37 | } |