![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
adfa
Dependencies: 4DGL-uLCD-SE NetServices mbed spxml
Fork of weather by
Revision 7:92cbee5144d7, committed 2016-04-29
- Comitter:
- agamemaker
- Date:
- Fri Apr 29 05:53:09 2016 +0000
- Parent:
- 6:714ce05307c2
- Commit message:
- done
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 714ce05307c2 -r 92cbee5144d7 main.cpp --- a/main.cpp Fri Apr 29 03:45:26 2016 +0000 +++ b/main.cpp Fri Apr 29 05:53:09 2016 +0000 @@ -78,30 +78,31 @@ SP_XmlHandle rootHandle( parser.getDocument()->getRootElement() ); SP_XmlElementNode * child2 = rootHandle.getChild( "results" ).getChild( "channel" ) .toElement(); - + //lcd.printf(BigBuf); - + if ( child2 ) { parseWeather(child2, "Atlanta"); //parses XML "current-conditions" info } - + if ( NULL != parser.getError() ) { lcd.printf( "\n error: %s\n", parser.getError() ); } return 0; } -int traffic() +int traffic(char * traff_domain_name) { completed = false; //char traff_domain_name[512] = "http://www.mapquestapi.com/traffic/v1/incidents?key=Vz3y4TYfSQa8b1iUJUv9N6meA9GAAhBH&callback=handleIncidentsResponse&boundingBox=33.977698,-84.662833,33.520957,-84.113516&filters=construction,incidents&inFormat=kvp&outFormat=xml"; - char traff_domain_name[512] = "https://www.mapquestapi.com/directions/v2/route?key=ZoiBJSzSoqfdNiLD0Z9kZdw4uAN5QUQW&from=710%20Culworth%20Manor%2CAlpharetta%2CGA&to=855%20West%20Peachtree%20St%2CAtlanta%2CCGA&outFormat=xml"; + //char traff_domain_name[512] = "https://www.mapquestapi.com/directions/v2/route?key=ZoiBJSzSoqfdNiLD0Z9kZdw4uAN5QUQW&from=710%20Culworth%20Manor%2CAlpharetta%2CGA&to=855%20West%20Peachtree%20St%2CAtlanta%2CCGA&outFormat=xml"; char *tstartXML = "<realTime>"; //RSS XML start title char *tendXML = "</realTime>"; //RSS XML end title char *tsptr; //Start Pointer char *teptr; //End Pointer - char time[4]; + char time[4] = ""; int i=0,j=0; + //time = "0000"; HTTPStream stream; char BigBuf[2048 + 1] = {0}; stream.readNext((byte*)BigBuf, 2048); //Point to buffer for the first read @@ -127,6 +128,7 @@ //lcd.putc(tsptr[i+j]); time[i+j] = tsptr[i+j]; other.putc(tsptr[i+j]); + wait(.25); } } wait(5); @@ -152,7 +154,22 @@ int main() { - + lcd.printf("Reading\n"); + char in[512]; + char url[512]; + int i = 0; + bool flag = false; + while(!flag) { + in[i] = other.getc(); + //other.putc(url[i]); + flag = in[i] == '^'; + i++; + } + in[i-1] = NULL; + sprintf(url, "%s&outFormat=xml", in); + lcd.printf("url:%s\n", url); + wait(5); + lcd.cls(); lcd.locate(0,5); lcd.printf("net setup"); lcd.locate(0,5); @@ -162,6 +179,6 @@ return -1; } lcd.printf("net ok "); - traffic(); + traffic(url); weather(); } \ No newline at end of file