Esempio n. 1
0
        //notify event handler
        public static void OnComplete(object sender, EventArgs e)
        {
            Console.Write("Download done, ");
            DataGrabber dse = (DataGrabber)sender;

            Console.WriteLine("time took : {0}", dse.LinkTime());
        }
Esempio n. 2
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject currentState;
        int        size = stateWrapper.transform.childCount;

        for (int i = 0; i < size; i++)
        {
            states.Add(stateWrapper.transform.GetChild(i).name, i);
            stateWrapper.transform.GetChild(i).localPosition += new Vector3(0, -stateWrapper.transform.GetChild(i).localPosition.y, 0);
            currentState = Instantiate(rectTransform, stateWrapper.transform.GetChild(i));
            currentState.transform.localPosition = new Vector3(0, 0, 0);
        }
        Debug.Log("I am running!");
        DataGrabber test = new DataGrabber("direct-volt-292119", "bigquery-public-data", "covid19_open_data", "covid19_open_data");

        test.AddSelect("date");
        test.AddSelect("country_code");
        test.AddSelect("subregion1_name");
        test.AddSelect("location_geometry");
        test.AddSelect("cumulative_confirmed");
        test.AddSelect("cumulative_deceased");
        test.AddWhere("date > \"2020-01-20\""); //Originally 2020-09-01
        test.AddWhere("date < \"2020-10-10\""); //Originally 2020-09-30
        test.AddWhere("subregion2_code IS NULL");
        test.AddWhere("subregion1_name IS NOT NULL");
        test.AddWhere("country_code = \"US\"");
        test.AddWhere("cumulative_deceased IS NOT NULL");
        data = test.GetData();
        for (int i = 0; i < test.GetDataSize(); i++)
        {
            StateData currentData = (StateData)data[i];
            Debug.Log(currentData.ToString());
        }
    }
Esempio n. 3
0
        /// <summary>
        /// Opens the selected device controller and prepares for sampling
        /// </summary>
        public void Open()
        {
            Close();

            switch (this.Settings.ControllerType)
            {
            case ControllerTypes.Serial:
                Controller = new SerialController(this.Settings.SerialPortName, this.Settings.BaudRate, System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One);
                break;

            case ControllerTypes.Test:
                Controller = new TestController("Test Controller", new Test.LaTestDevice());
                break;

            default:
                throw new NotImplementedException("Unknown controller");
            }

            grabber                   = new DataGrabber(Controller, this.Settings.SamplingRate, this.Settings.SamplingChannels, this.Settings.SamplingTime, this.Settings.SamplingMode, this.Settings.SamplingCompression);
            grabber.OnComplete       += grabber_Complete;
            grabber.OnProgress       += grabber_Progress;
            grabber.OnError          += grabber_Error;
            grabber.OnConsoleMessage += grabber_ConsoleMessage;
            grabber.Open();
        }
Esempio n. 4
0
 /// <summary>
 /// Closes the device controller, if it is open
 /// </summary>
 public void Close()
 {
     if (grabber != null)
     {
         grabber.Close();
         grabber = null;
     }
 }
Esempio n. 5
0
 private void btnStop_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         InitCoreLogic();
         grabber = null;
     }
     catch (Exception ex)
     {
         RaiseErorrMessageBox("Failed to stop the program.", "Failure");
     }
 }
Esempio n. 6
0
 private void btnStart_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (!File.Exists(txtBoxToInputExcel.Text) || !Directory.Exists(txtBoxToHtmlReport.Text))
         {
             throw new FileNotFoundException();
         }
         using (grabber = new DataGrabber())
         {
             grabber.Run(txtBoxToInputExcel.Text, txtBoxToHtmlReport.Text);
         }
     }
     catch (Exception ex)
     {
         RaiseErorrMessageBox(!string.IsNullOrEmpty(ex.Message) ? ex.Message : "Check if all file specified.", "Failure");
     }
 }
Esempio n. 7
0
        public static void Main(string[] args)
        {
            var trackingSettings = new TrackingSettings();
            var config           = new ConfigurationBuilder()
                                   .SetBasePath(Directory.GetCurrentDirectory())
                                   .AddJsonFile("settings.json", false, true)
                                   .AddJsonFile("settings.Development.json", optional: true)
                                   .Build();

            config.GetSection("Tracking").Bind(trackingSettings);
            var grabber = new DataGrabber(trackingSettings.GoogleApiKey);

            var bottomLeftCorner = new Coordinate(48.860606, 24.595572);
            var topRightCorner   = new Coordinate(48.985076, 24.793446);
            var steps            = trackingSettings.Steps;
            var points           = PointsProvider.SelectPoints(new Coordinate(48.860606, 24.595572), new Coordinate(48.985076, 24.793446), 20);

            var places = new List <PlaceInformation>();

            foreach (var point in points)
            {
                Console.WriteLine($"lat: {point.X,10}, lng: {point.Y,10}, rad:{point.Z,10}");
                var collectedData = grabber.Collect(point.X, point.Y, (int)(point.Z * 1000));
                if (collectedData.Count == 60)
                {
                    Console.WriteLine("********* To many data exist for this point *********");
                }

                places.AddRange(collectedData);
            }

            Console.WriteLine($"*Total point loaded: {places.Count}**");
            var busStops = places.ConvertAll(PlaceInformationToBusStop).Distinct(new PlaceIdEqualityComparer()).ToList();

            Console.WriteLine($"*Total point without duplicates: {busStops.Count}**");

            var context = new BusStopContext(config.GetConnectionString("DefaultConnection"));

            context.AddRange(busStops);
            context.SaveChanges();
            Console.WriteLine($"Done!");
        }
Esempio n. 8
0
 private void OnEnable()
 {
     grabberTarget      = target as DataGrabber <T, U>;
     gSheetsMinerTarget = grabberTarget.GetComponent <GSheetsMiner>();
 }