Download NHK English news podcast automatically. XML Parser "spxml" is used. This application requires mpod mother board. See also http://mbed.org/users/geodenx/notebook/mpod/
Dependencies: BlinkLed HTTPClient EthernetInterface FatFileSystemCpp MSCFileSystem spxml mbed-rtos mbed
Fork of mpod_nhk_english by
Download NHK English news podcast automatically.
XML Parser "spxml" is used.
This application requires mpod mother board.
See also http://mbed.org/users/geodenx/notebook/mpod/
Diff: main.cpp
- Revision:
- 7:ad9fcf0e1bc5
- Parent:
- 6:84749589b532
- Child:
- 8:a9541e8897f5
--- a/main.cpp Fri Aug 24 17:00:07 2012 +0000 +++ b/main.cpp Sat Sep 01 04:09:48 2012 +0000 @@ -13,12 +13,11 @@ EthernetInterface eth; HTTPClient http; MSCFileSystem usb("usb"); -BlinkLed led1(LED1, 0.02); -BlinkLed led2(LED2, 0.2); +BlinkLed led3(LED1, 0.02); +BlinkLed led4(LED2, 0.2); BlinkLed ethGreen(p26, 0.02); BlinkLed ethYellow(p25, 0.2); DigitalOut fsusb30s(p9); -Timer timer; const char* rssUrl = "http://www3.nhk.or.jp/rj/podcast/rss/english.xml"; const char* rssPath = "/usb/english.xml"; @@ -30,6 +29,10 @@ printf("mpod NHK English news Downloader with spxml\n"); printf("===========================================\n\n"); + // Indicate downloading + led4.startBlink(); + ethYellow.startBlink(); + // FSUSB30 switches to HSD1 (mbed) printf("USB host was switched to HSD1(mbed).\n\n"); fsusb30s = 0; // HSD1 @@ -171,8 +174,10 @@ printf("\nUSB host was switched to HSD2(External Device).\n"); fsusb30s = 1; // HSD2 - // blink LED - led1.startBlink(); + // Indicate finish downloading + led4.finishBlink(); + ethYellow.finishBlink(); + led3.startBlink(); ethGreen.startBlink(); while(true){} @@ -180,13 +185,7 @@ int GetFile(const char *path, const char *url) { - led2.startBlink(); - ethYellow.startBlink(); - printf("\nGetting %s\n", url); - - timer.stop(); - timer.reset(); - timer.start(); + printf("Getting %s -> %s\n", url, path); HTTPFile file(path); HTTPResult retGet = http.get(url, &file); @@ -197,10 +196,5 @@ } file.clear(); - timer.stop(); - printf("timer.read_ms(): %d\n", timer.read_ms()); - - led2.finishBlink(); - ethYellow.finishBlink(); return (0); }