public void setTime()
        {
            int smallestTime = times.Min();                                         //get the smallest time

            minutes = (smallestTime - ExtraFunctions.getUnixTime()) / 60;           //calculate minutes until next

            if (minutes <= 0)                                                       //correction for if negative..
            {
                minutes = 0;
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            //set urls for RTD data
            //String vehiclePositionUrl = "http://www.rtd-denver.com/google_sync/VehiclePosition.pb";
            String tripUrl = "http://www.rtd-denver.com/google_sync/TripUpdate.pb";
            //get vehicle positions data from RTD.

            //FeedMessage vehiclePositionFeed = getData(vehiclePositionUrl);
            FeedMessage tripFeed = getData(tripUrl);

            Stop stop_inst = new Stop();
            Trip trip_inst = new Trip();

            //print the data from vehicle positions.
            //printAllVehiclePositions(vehiclePositionFeed);
            //printTrips(tripFeed);
            //printVP_for_stop(feed2, "23103");
            //ExtraFunctions.VehiclePosition_ByStop(vehiclePositionFeed, "22730");
            String stopNumber = "12850";
            String all        = "all";

            //List<FeedEntity> tripsForStop = ExtraFunctions.StoreTrip_ByStop(tripFeed, stopNumber);
            //ExtraFunctions.PrintTrips_ByStop(tripsForStop, all);
            //Console.WriteLine(ExtraFunctions.getUnixTime());
            String     data = "This string also came from C#";
            SerialPort sp   = new SerialPort("COM7", 9600, Parity.None, 8, StopBits.One);

            sp.Open();
            sp.Write(data);
            Console.WriteLine("Data Sent!");
            sp.Close();

            List <FeedEntity> tripsForStop = ExtraFunctions.StoreTrip_ByStop(tripFeed, stopNumber);

            //TimeFunctions.GetAllTimes(tripsForStop,stopNumber);
            ExtraFunctions.PrintTrips_ByStop(tripsForStop, stopNumber);
            Console.WriteLine(ExtraFunctions.getUnixTime());


            Console.WriteLine("Press any key to continue");
            Console.ReadLine();
        }//end of main