Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // load the main libraries
- using System;
- using System.Collections;
- using System.Threading;
- using Microsoft.SPOT;
- // used for the display screen
- //using Microsoft.SPOT.Presentation;
- //using Microsoft.SPOT.Presentation.Controls;
- //using Microsoft.SPOT.Presentation.Media;
- //using Microsoft.SPOT.Touch;
- // used for the wifi networking
- using Microsoft.SPOT.Net;
- using Microsoft.SPOT.Hardware;
- using System.Net;
- using System.Net.Sockets;
- // used to access and read the http xml file
- using System.Xml;
- using System.IO;
- // used to enable the gadgeteer hardware
- //using GHI.Premium.USBHost;
- using GHI.Premium.Net;
- using Gadgeteer.Networking;
- using GT = Gadgeteer;
- using GTM = Gadgeteer.Modules;
- using Gadgeteer.Modules.Seeed;
- using Gadgeteer.Modules.GHIElectronics;
- using Gadgeteer.Modules.Music_Driver;
- namespace Gadgeteer_Weather_Crier_05
- {
- public partial class Program
- {
- // global variables
- GT.StorageDevice usbStorage;
- // are we using the old weather or shall we get the latest?
- bool oldWeather = false;
- // are we using the RISD network or are we at home?
- bool risdNet = true;
- // usb drive
- String root;
- // music file handling
- FileStream stream;
- String[] musicFiles = new String[6];
- //ArrayList musicFiles = new ArrayList();
- int currentFile = 0;
- // log file
- //StreamWriter usbLogFile;
- String logFilename = "system\\queryLog.txt";
- String audioLogFilename = "system\\audioLog.txt";
- //String preferencesFileName = "system\\preferences.txt";
- //String errorFilename = "system\\error.txt";
- // query start and close times
- int startTime = 8;
- int closeTime = 20;
- float maxWeatherReports = 6;
- // time object to control blink
- TimeSpan blinkTime = new TimeSpan(0,0,1);
- // networking socket for weird time protocol
- Socket socket;
- // create a time based event robot to trigger something
- GT.Timer timer = new GT.Timer(5000, GT.Timer.BehaviorType.RunOnce);
- // This method is run when the mainboard is powered up or reset.
- void ProgramStarted()
- {
- Debug.Print("Initializing Accelerometer Events");
- // set the calibration point (the device shouldn't be moving!)
- accelerometer.Calibrate();
- //accelerometer threshold bump method
- accelerometer.ThresholdExceeded += new Accelerometer.ThresholdExceededEventHandler(accelerometer_ThresholdExceeded);
- accelerometer.MeasurementRange = GTM.Seeed.Accelerometer.Range.TwoG;
- Debug.Print("Initializing Music Player Events");
- // music finished listening robot (who is a bit deaf!!)
- music.MusicFinished += new Music.MusicFinishedPlayingEventHandler(music_musicFinished);
- music.SetVolume(255);
- // mark the musicFiles as empty
- musicFiles[0] = "empty";
- // timer event handler
- Debug.Print("Initializing Timer Event");
- timer.Tick += new GT.Timer.TickEventHandler(timer_Tick);
- // switch the green blue leds
- multicolorLed.GreenBlueSwapped = true;
- Debug.Print("Initializing USB Drive Events");
- usbHost.USBDriveConnected += new UsbHost.USBDriveConnectedEventHandler(usbHost_USBDriveConnected);
- usbHost.USBDriveDisconnected += new UsbHost.USBDriveDisconnectedEventHandler(usbHost_USBDriveDisconnected);
- Debug.Print("Checking for USB Drive Connected Event....");
- Debug.Print("Turning on LED");
- // turn LED to red flashing
- multicolorLed.BlinkRepeatedly(GT.Color.Red, blinkTime, GT.Color.Black, blinkTime);
- Debug.Print("Program Started");
- }
- void accelerometer_ThresholdExceeded(Accelerometer sender)
- {
- Debug.Print("Bump detected!");
- // turn LED to blue
- multicolorLed.TurnBlue();
- // reset the audio queue
- currentFile = 0;
- // read the last query time and date from the log so we can make sure that we aren't exceeding our 6 per day query allowance
- // a string for the next allowed query
- String logReadFileString = readDataFile(logFilename);
- Debug.Print("Today is : " + DateTime.Now.ToString("yyMMdd"));
- Debug.Print("Reading the log file.... The next query is allowed at " + logReadFileString.Substring(logReadFileString.IndexOf(":") + 1, 2) + " hours");
- Debug.Print("The logged date is " + int.Parse(logReadFileString.Substring(0, 6)));
- if (int.Parse(DateTime.Now.ToString("HH")) > startTime
- && closeTime > int.Parse(DateTime.Now.ToString("HH"))
- )
- {
- Debug.Print("In the active time period!");
- Debug.Print("Working out what to do....");
- // if current date is more than the log date then get new report
- if ((int.Parse(DateTime.Now.ToString("yyMMdd")) > int.Parse(logReadFileString.Substring(0, 6))))
- {
- Debug.Print("New day! Getting a new weather report");
- // get the new weather report
- getXmlFromWeb();
- // get the time
- //NTPTime("time.windows.com", (-(60 * 5)));
- }
- // else if current date is equal to the log date
- // and the current time is more than or equal to the log time
- else if (int.Parse(DateTime.Now.ToString("HH")) >= int.Parse(logReadFileString.Substring(logReadFileString.IndexOf(":") + 1, 2))
- && (int.Parse(DateTime.Now.ToString("yyMMdd")) >= int.Parse(logReadFileString.Substring(0, 6)))
- )
- {
- // get a new weather report
- Debug.Print("Getting a new weather report");
- // get the new weather report
- getXmlFromWeb();
- }
- // else use existing weather report
- else
- {
- Debug.Print("Going to use an existing report");
- // if the empty marker has been overwritten
- if (musicFiles[0] != "empty")
- {
- Debug.Print("Not enough time has yet passed. Using the existing weather report.");
- // play the old weather report that already is in the memory
- playTrack();
- }
- else
- {
- Debug.Print("No musicFiles!! We must have just been turned on and off or crashed");
- // get the log entry
- // an array for the music files
- String[] audioLog = readDataFile(audioLogFilename).Split('\r');
- // what about '\n'?
- Debug.Print("audioLog.Length " + audioLog.Length);
- Debug.Print("audioLog[0] " + audioLog[0]);
- Debug.Print("audioLog[1] " + audioLog[1]);
- Debug.Print("audioLog[2] " + audioLog[2]);
- Debug.Print("audioLog[3] " + audioLog[3]);
- Debug.Print("audioLog[4] " + audioLog[4]);
- Debug.Print("audioLog[5] " + audioLog[5]);
- musicFiles[0] = audioLog[0].Trim();
- musicFiles[1] = audioLog[1].Trim();
- musicFiles[2] = audioLog[2].Trim();
- musicFiles[3] = audioLog[3].Trim();
- musicFiles[4] = audioLog[4].Trim();
- musicFiles[5] = audioLog[5].Trim();
- // reset greeting
- if (DateTime.Now.ToString("tt") == "AM")
- {
- Debug.Print("Adding: audio\\Good Morning");
- musicFiles[0] = ("audio" + Path.DirectorySeparatorChar + "goodmorning.mp3");
- }
- else if (DateTime.Now.ToString("tt") == "PM")
- {
- Debug.Print(DateTime.Now.Hour.ToString());
- if (DateTime.Now.Hour > 17)
- {
- Debug.Print("Adding: audio\\Good Evening");
- musicFiles[0] = ("audio" + Path.DirectorySeparatorChar + "goodevening.mp3");
- }
- else
- {
- Debug.Print("Adding: audio\\Good Afternoon");
- musicFiles[0] = ("audio" + Path.DirectorySeparatorChar + "goodafternoon.mp3");
- }
- }
- // play logged tracks from last query
- playTrack();
- }
- }
- }
- else
- {
- Debug.Print("Outside of the allowed time period");
- Debug.Print("You'll have to wait.....");
- Debug.Print("Resetting bump detection");
- // reset bump detection
- accelerometer.ResetThresholdDetection();
- // turn LED to blue
- multicolorLed.TurnBlue();
- }
- }
- void getXmlFromWeb()
- {
- if (oldWeather)
- {
- WebClient.GetFromWeb("http://inbetwixt.com/weather/weather.xml").ResponseReceived += new HttpRequest.ResponseHandler(Program_ResponseReceived);
- }
- else
- {
- WebClient.GetFromWeb("http://api.wunderground.com/api/yournumber/forecast/q/yourzip.xml").ResponseReceived += new HttpRequest.ResponseHandler(Program_ResponseReceived);
- }
- Debug.Print("***Waiting for response...");
- }
- void writeLogFile()
- {
- Debug.Print("Writing Log Query File");
- // create a file input writing stream
- // root comes from the usb connected method
- FileStream createdFile = File.Open(usbStorage.RootDirectory + Path.DirectorySeparatorChar + logFilename, FileMode.Create);
- StreamWriter usbLogFile = new StreamWriter(createdFile);
- String logWriteFileString = (DateTime.Now.ToString("yyMMdd") + ":" + ((int.Parse(DateTime.Now.ToString("HH")) + (int)(closeTime - startTime) / maxWeatherReports)));
- Debug.Print("Start time: " + startTime);
- for (int increment = 1; increment <= maxWeatherReports; increment++)
- {
- Debug.Print("Slot " + increment + " ends: " + (int)(startTime + ((closeTime - startTime) / maxWeatherReports) * increment));
- }
- Debug.Print("Closing time: " + closeTime);
- try
- {
- // write the line
- usbLogFile.Write(logWriteFileString);
- }
- catch (IOException e)
- {
- Debug.Print("IOException " + e);
- }
- catch (Exception e)
- {
- Debug.Print("Exception " + e);
- }
- finally
- {
- if (usbLogFile != null)
- usbLogFile.Close();
- }
- }
- void writeAudioLogFile()
- {
- Debug.Print("Writing Audio Log Query File");
- // create a file input writing stream
- // root comes from the usb connected method
- FileStream createdFile = File.Open(usbStorage.RootDirectory + Path.DirectorySeparatorChar + audioLogFilename, FileMode.Create);
- StreamWriter usbLogFile = new StreamWriter(createdFile);
- String[] logWriteFileString = new String[6];
- // first line is
- logWriteFileString[0] = musicFiles[0];
- Debug.Print(logWriteFileString[0]);
- // second line is
- logWriteFileString[1] = musicFiles[1];
- Debug.Print(logWriteFileString[1]);
- // third line is
- logWriteFileString[2] = musicFiles[2];
- Debug.Print(logWriteFileString[2]);
- // fourth line is
- logWriteFileString[3] = musicFiles[3];
- Debug.Print(logWriteFileString[3]);
- // fifth line is
- logWriteFileString[4] = musicFiles[4];
- Debug.Print(logWriteFileString[4]);
- // sixth line is
- logWriteFileString[5] = musicFiles[5];
- Debug.Print(logWriteFileString[5]);
- try
- {
- // how do you write an array in one line?
- usbLogFile.WriteLine(logWriteFileString[0]);
- usbLogFile.WriteLine(logWriteFileString[1]);
- usbLogFile.WriteLine(logWriteFileString[2]);
- usbLogFile.WriteLine(logWriteFileString[3]);
- usbLogFile.WriteLine(logWriteFileString[4]);
- usbLogFile.WriteLine(logWriteFileString[5]);
- usbLogFile.Close();
- }
- catch (IOException e)
- {
- Debug.Print("IOException " + e);
- }
- catch (Exception e)
- {
- Debug.Print("Exception " + e);
- }
- //finally
- //{
- // if (usbLogFile != null)
- // usbLogFile.Close();
- //}
- }
- String readDataFile(String dataFileName)
- {
- Debug.Print("Reading Data File " + dataFileName);
- String fileContent = "";
- if (File.Exists(usbStorage.RootDirectory + Path.DirectorySeparatorChar + logFilename))
- {
- StreamReader usbReadFile = new StreamReader(new FileStream(usbStorage.RootDirectory + Path.DirectorySeparatorChar + dataFileName, FileMode.Open, FileAccess.Read));
- fileContent = usbReadFile.ReadToEnd();
- usbReadFile.Close();
- }
- Debug.Print("Reading in: " + fileContent);
- return fileContent;
- }
- void playTrack()
- {
- // turn LED to green flashing
- multicolorLed.BlinkRepeatedly(GT.Color.Green, blinkTime, GT.Color.Black, blinkTime);
- Debug.Print("currentFile " + currentFile);
- Debug.Print("Opening track: " + (String)musicFiles[currentFile]);
- stream = usbStorage.Open((String)musicFiles[currentFile], FileMode.Open, FileAccess.Read);
- music.SetVolume(255);
- Debug.Print("Starting to play: " + (String)musicFiles[currentFile]);
- music.Play(stream);
- while (music.IsBusy)
- {
- // You can't call music.StopPlaying or set volume with this loop running.
- Thread.Sleep(10);
- }
- }
- void music_musicFinished(Music sender)
- {
- Debug.Print("Music Finished");
- // close the usb stream
- stream.Close();
- if (currentFile < musicFiles.Length - 1)
- {
- // next track
- currentFile++;
- Debug.Print("Moving to next audio track: currentFile = " + currentFile);
- playTrack();
- }
- else
- {
- // reset
- Debug.Print("Resetting bump and audio");
- accelerometer.ResetThresholdDetection();
- // turn LED to green steady (not flashing)
- multicolorLed.TurnGreen();
- }
- }
- void usbHost_USBDriveDisconnected(UsbHost sender)
- {
- Debug.Print("USB Storage Disconnected");
- //musicFiles.Clear();
- usbStorage = null;
- }
- void usbHost_USBDriveConnected(UsbHost sender, GT.StorageDevice storageDevice)
- {
- Debug.Print("USB Storage connected");
- usbStorage = storageDevice;
- root = usbStorage.RootDirectory;
- // on the usb drive there should be:
- // an 'audio' folder with all the files listed at the bottom of this page
- // and a 'system' folder with:
- // a file called preferences.txt
- // a file called queryLog.txt
- // a file called audioLog.txt
- // a file called error.txt
- // read the settings file to get:
- // audio folder name
- // system folder name
- // wifi network name and password
- // world clock location
- // timezone or gmt offset for your location
- // pointless
- //string[] rootAudioFolder = usbStorage.ListFiles("audio");
- //foreach (string fileName in rootAudioFolder)
- //{
- // Debug.Print(fileName);
- //}
- // now we have the settings
- // start the Wifi
- startWifi();
- }
- void startWifi()
- {
- // turn LED to red flashing
- multicolorLed.BlinkRepeatedly(GT.Color.Red, blinkTime, GT.Color.Black, blinkTime);
- if (!wifi_RS21.Interface.IsOpen)
- {
- wifi_RS21.Interface.Open();
- }
- if (!wifi_RS21.Interface.NetworkInterface.IsDhcpEnabled)
- {
- wifi_RS21.Interface.NetworkInterface.EnableDhcp();
- }
- GHI.Premium.Net.NetworkInterfaceExtension.AssignNetworkingStackTo(wifi_RS21.Interface);
- wifi_RS21.Interface.WirelessConnectivityChanged += new GHI.Premium.Net.WiFiRS9110.WirelessConnectivityChangedEventHandler(Interface_WirelessConnectivityChanged);
- wifi_RS21.Interface.NetworkAddressChanged += new GHI.Premium.Net.NetworkInterfaceExtension.NetworkAddressChangedEventHandler(Interface_NetworkAddressChanged);
- String networkName;
- String networkPassword;
- try
- {
- // Your router SSID needed here
- if (risdNet)
- {
- //GHI.Premium.Net.WiFiNetworkInfo[] ScanResp = wifi_RS21.Interface.Scan("RISD-MiscDevices"); //< Needs to be changed to SSID you are looking for
- networkName = "RISD-MiscDevices";
- Debug.Print("Trying RISD network");
- }
- else
- {
- // home network
- networkName = "Network Name";
- Debug.Print("Trying home network");
- }
- // wifi needs your SSID network name
- GHI.Premium.Net.WiFiNetworkInfo[] ScanResp = wifi_RS21.Interface.Scan(networkName);
- if (ScanResp != null && ScanResp.Length > 0)
- {
- // passkey needed here
- if (risdNet)
- {
- networkPassword = "RISD Password";
- }
- else
- {
- networkPassword = "Home Password";
- }
- // wifi needs the password key
- wifi_RS21.Interface.Join(ScanResp[0], networkPassword);
- Debug.Print("***Connected to network...");
- }
- else
- {
- Debug.Print("***Wireless network was not found");
- Debug.Print("Switching networks");
- // flip the network switch?
- risdNet = !risdNet;
- startWifi();
- }
- }
- catch (Exception e)
- {
- Debug.Print("!!! Exception : " + e.Message);
- }
- }
- void timer_Tick(GT.Timer timer)
- {
- //Debug.Print("Restarting Wifi");
- //startWifi();
- timer.Stop();
- Debug.Print("Retrying Time");
- if (NTPTime("time.windows.com", (-(60 * 5))))
- {
- Debug.Print("The time has been set correctly");
- // turn LED to green steady
- multicolorLed.TurnGreen();
- // reset
- Debug.Print("Starting bump detection");
- // turn on the bump detection
- accelerometer.EnableThresholdDetection(-3.0, false, false, true, true, false, false);
- }
- else
- {
- Debug.Print("The time wasn't set!");
- // no where to go from here!!
- // turn LED to red steady
- multicolorLed.TurnRed();
- // try to restart wifi
- timer.Start();
- }
- }
- void Interface_WirelessConnectivityChanged(object sender, GHI.Premium.Net.WiFiRS9110.WirelessConnectivityEventArgs e)
- {
- if (e.IsConnected)
- {
- // Add the time zone offset to the retrieved UTC Time
- // (in this example, it assumes that the time zone is GMT-6).
- // You will need to adjust TimeService.SetTimeZoneOffset value for your time zone
- //UTC -6 hours for Central Standard Time. Use -(60 * 5) for Daylight savings time.
- //You will need to change NTPTime to your Time Zone
- Debug.Print("***WirelessConnectivityChanged event!");
- Debug.Print("***Wifi Connected!");
- Debug.Print("***RSSI : " + e.NetworkInformation.RSSI.ToString());
- Debug.Print("***IP Address : " + wifi_RS21.Interface.NetworkInterface.IPAddress);
- // now we are connected
- // get the time
- // set the offset from GMT
- if (NTPTime("time.windows.com", (-(60 * 5))))
- {
- Debug.Print("The time has been set correctly");
- // turn LED to green steady
- multicolorLed.TurnGreen();
- // reset
- Debug.Print("Starting bump detection");
- // turn on the bump detection
- accelerometer.EnableThresholdDetection(-3.0, false, false, true, true, false, false);
- }
- else
- {
- Debug.Print("The time wasn't set!");
- // no where to go from here!!
- // turn LED to red steady
- multicolorLed.TurnRed();
- // try to restart wifi
- timer.Start();
- }
- }
- else
- {
- Debug.Print("***WirelessConnectivityChanged event!");
- Debug.Print("***Wifi Not Connected!");
- Debug.Print("***RSSI : " + e.NetworkInformation.RSSI.ToString());
- Debug.Print("***IP Address : " + wifi_RS21.Interface.NetworkInterface.IPAddress);
- }
- }
- bool NTPTime(string TimeServer, int GmtOffset = 0)
- {
- // check the time
- socket = null;
- try
- {
- EndPoint rep = new IPEndPoint(Dns.GetHostEntry(TimeServer).AddressList[0], 123);
- socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
- byte[] ntpData = new byte[48];
- Array.Clear(ntpData, 0, 48);
- // Set protocol version
- ntpData[0] = 0x1B;
- // Send Request
- socket.SendTo(ntpData, rep);
- if (socket.Poll(60 * 1000 * 1000, SelectMode.SelectRead)) // Waiting an answer for 60s, if nothing: timeout
- {
- socket.ReceiveFrom(ntpData, ref rep); // Receive Time
- byte offsetTransmitTime = 40;
- ulong intpart = 0;
- ulong fractpart = 0;
- for (int i = 0; i <= 3; i++) intpart = (intpart << 8) | ntpData[offsetTransmitTime + i];
- for (int i = 4; i <= 7; i++) fractpart = (fractpart << 8) | ntpData[offsetTransmitTime + i];
- ulong milliseconds = (intpart * 1000 + (fractpart * 1000) / 0x100000000L);
- socket.Close();
- DateTime dateTime = new DateTime(1900, 1, 1) + TimeSpan.FromTicks((long)milliseconds * TimeSpan.TicksPerMillisecond);
- Utility.SetLocalTime(dateTime.AddMinutes(GmtOffset));
- Debug.Print("### Time Server : " + DateTime.Now.ToString("hh tt")); // should be something like 09 AM
- //("yyyy-MM-dd hh:mm:ss tt")
- // turn LED to green flashing
- //multicolorLed.BlinkRepeatedly(GT.Color.Green, blinkTime, GT.Color.Black, blinkTime);
- return true;
- }
- else
- {
- Debug.Print("Failed to get the time");
- }
- socket.Close();
- }
- catch (Exception e)
- {
- Debug.Print("Exception " + e);
- try
- {
- socket.Close();
- }
- catch
- {
- Debug.Print("Failed to close the socket");
- }
- // turn LED to red
- multicolorLed.TurnRed();
- return false;
- }
- return false;
- }
- void Program_ResponseReceived(HttpRequest sender, HttpResponse response)
- {
- // the general format is:
- // musicFiles[0] = greeting
- // audio\Good Morning.mp3
- // musicFiles[1] = today
- // audio\Today.mp3
- // musicFiles[2] = today's forecast
- // audio\Partly Cloudy.mp3
- // musicFiles[3] = tomorrow
- // audio\Tomorrow.mp3
- // musicFiles[4] = tomorrow's forecast
- // audio\Sunny.mp3
- // musicFiles[5] = goodbye
- // check the new correct time
- // using a bizzare am pm method!!??
- if (DateTime.Now.ToString("tt") == "AM")
- {
- Debug.Print("Adding: audio\\Good Morning");
- musicFiles[0] = ("audio" + Path.DirectorySeparatorChar + "goodmorning.mp3");
- }
- else if (DateTime.Now.ToString("tt") == "PM")
- {
- Debug.Print(DateTime.Now.Hour.ToString());
- if (DateTime.Now.Hour > 17)
- {
- Debug.Print("Adding: audio\\Good Evening");
- musicFiles[0] = ("audio" + Path.DirectorySeparatorChar + "goodevening.mp3");
- }
- else
- {
- Debug.Print("Adding: audio\\Good Afternoon");
- musicFiles[0] = ("audio" + Path.DirectorySeparatorChar + "goodafternoon.mp3");
- }
- }
- XmlReader reader = XmlReader.Create(response.Stream);
- // use the simpleforecast
- // extract the conditions
- // change this to read the <icon> as there are less options and they are all known
- while (reader.Read())
- {
- switch (reader.NodeType)
- {
- case XmlNodeType.Element:
- //Debug.Print("Element: " + reader.Name);
- if (reader.Name.Equals("simpleforecast"))
- {
- reader.ReadToFollowing("forecastday");
- reader.ReadToFollowing("period");
- if (reader.ReadElementString().Equals("1"))
- {
- //reader.ReadToFollowing("conditions");
- reader.ReadToFollowing("icon");
- string todaysCondition = reader.ReadElementString();
- Debug.Print("Today's forecast is: " + todaysCondition);
- musicFiles[1] = ("audio" + Path.DirectorySeparatorChar + "today.mp3");
- musicFiles[2] = ("audio" + Path.DirectorySeparatorChar + todaysCondition + ".mp3");
- }
- reader.ReadToFollowing("forecastday");
- reader.ReadToFollowing("period");
- if (reader.ReadElementString().Equals("2"))
- {
- //reader.ReadToFollowing("conditions");
- reader.ReadToFollowing("icon");
- string tomorrowsCondition = reader.ReadElementString();
- Debug.Print("Tomorrow's forecast is: " + tomorrowsCondition);
- musicFiles[3] = ("audio" + Path.DirectorySeparatorChar + "tomorrow.mp3");
- musicFiles[4] = ("audio" + Path.DirectorySeparatorChar + tomorrowsCondition + ".mp3");
- }
- Debug.Print("Goodbye");
- musicFiles[5] = ("audio" + Path.DirectorySeparatorChar + "goodbye.mp3");
- Debug.Print("End of message construction");
- // write the time and date of the next query to the log
- // so we can check later
- // making sure we aren't exceeding our 6 per day query allowance
- writeLogFile();
- // write the current forecast in case we loose power
- // write audio files log
- writeAudioLogFile();
- }
- break;
- case XmlNodeType.EndElement:
- //Debug.Print("End of Element");
- break;
- case XmlNodeType.Attribute:
- //Debug.Print("Attribute");
- break;
- case XmlNodeType.Text:
- //Debug.Print("Text");
- break;
- }
- }
- if (music.IsBusy)
- {
- // do nothing?
- // this shouldn't ever happen
- }
- else
- {
- playTrack();
- }
- }
- void Interface_NetworkAddressChanged(object sender, EventArgs e)
- {
- Debug.Print("***NetworkDown event! (maybe?)");
- // don't we have to do something?
- // it stalls here if the network goes off
- // turn LED to red flashing
- //multicolorLed.BlinkRepeatedly(GT.Color.Red, blinkTime, GT.Color.Black, blinkTime);
- }
- }
- }
- /*
- * icon-set
- * http://www.wunderground.com/weather/api/d/docs?d=resources/icon-sets
- *
- chanceflurries - chanceflurries.gif"
- chancerain - chancerain.gif"
- chancesleet - chancesleet.gif"
- chancesleet - chancesleet.gif"
- chancesnow - chancesnow.gif"
- chancetstorms - chancetstorms.gif"
- chancetstorms - chancetstorms.gif"
- clear - clear.gif"
- cloudy - clear.gif"
- flurries - flurries.gif"
- fog - fog.gif"
- hazy - hazy.gif"
- mostlycloudy - mostlycloudy.gif"
- mostlysunny - mostlysunny.gif"
- partlycloudy - partlycloudy.gif"
- partlysunny - partlysunny.gif"
- sleet - sleet.gif"
- rain - rain.gif"
- sleet - sleet.gif"
- snow - snow.gif"
- sunny - sunny.gif"
- tstorms - tstorms.gif"
- tstorms - tstorms.gif"
- tstorms - tstorms.gif"
- cloudy - cloudy.gif"
- partlycloudy - partlycloudy.gif"
- nt_chanceflurries - chanceflurries.gif"
- nt_chancerain - chancerain.gif"
- nt_chancesleet - chancesleet.gif"
- nt_chancesleet - chancesleet.gif"
- nt_chancesnow - chancesnow.gif"
- nt_chancetstorms - chancetstorms.gif"
- nt_chancetstorms - chancetstorms.gif"
- nt_clear - clear.gif"
- nt_cloudy - clear.gif"
- nt_flurries - flurries.gif"
- nt_fog - fog.gif"
- nt_hazy - hazy.gif"
- nt_mostlycloudy - mostlycloudy.gif"
- nt_mostlysunny - mostlysunny.gif"
- nt_partlycloudy - partlycloudy.gif"
- nt_partlysunny - partlysunny.gif"
- nt_sleet - sleet.gif"
- nt_rain - rain.gif"
- nt_sleet - sleet.gif"
- nt_snow - snow.gif"
- nt_sunny - sunny.gif"
- nt_tstorms - tstorms.gif"
- nt_tstorms - tstorms.gif"
- nt_tstorms - tstorms.gif"
- nt_cloudy - cloudy.gif"
- nt_partlycloudy - partlycloudy.gif
- */
Advertisement
Add Comment
Please, Sign In to add comment