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
- Committer:
- takashikojo
- Date:
- 2015-06-27
- Revision:
- 1:26a0a9220f01
- Parent:
- 0:a59f55690685
- Child:
- 2:58e7fabcba89
File content as of revision 1:26a0a9220f01:
#include <mbed.h>
#include <string>
#include "TrainStat.h"
#include "tokyoMetro.h"
#include "yahooTrain.h"
TrainStat::TrainStat(enum infoSource s) {
        source = s ;
        TMetro_initLine() ;
        YahooT_initLine() ;
} ;
 
TrainStat::~TrainStat(){ } ;
bool TrainStat::setLine(string line)
{
    switch(source) {
    case YAHOO_TRAIN: 
        YahooT_setLine(line) ; 
        break ;
    case TOKYO_METRO:
        TMetro_setLine(line) ; 
        break ;
    default:
        return false ;
    }
    return true ;
}
bool TrainStat::getStat()
{
    switch(source) {
    case YAHOO_TRAIN: 
        YahooT_query("area/4/", recvBuff, sizeof(recvBuff)) ;
        return  YahooT_getStat(recvBuff) ;
    case TOKYO_METRO:
        TMetro_query("datapoints", "odpt:TrainInformation", recvBuff, sizeof(recvBuff)) ;
        return TMetro_getStat(recvBuff) ;
    default:
        return false ;
    }
}