Exemple #1
0
        // Interval - in milliseconds, duration - in seconds, save - decide whether to save data mined or not
        public DataMiner(string ip, int port, float interval, float duration, bool save = false)
        {
            Debug.WriteLine(ip + ',' + port.ToString() + ',' + interval.ToString() + ',' + duration.ToString());
            // Initialize client & data
            requester = new DataRequester(ip, port);
            float logs_per_second = (1 / (interval / 1000));

            Debug.WriteLine("Logs per second: " + logs_per_second.ToString());
            int logs = (int)(duration * logs_per_second);

            Debug.WriteLine("Logs to be written: " + logs.ToString());

            // Data
            this.save = save;
            if (save)
            {
                data             = new double[logs][];
                dataReadyTrigger = new System.Threading.ManualResetEvent(false);
            }

            // Reset timer counters
            timerCounter  = 0;
            timerLimit    = logs;
            this.interval = interval;

            // Initialize listeners
            tickListeners = new List <Action <double[]> >();
            notifyTick    = false;
            notifyDone    = false;
        }
 private FacadeModel()
 {
     fileManager   = new FileManager();
     dataRequester = new DataRequester();
     syncLock      = new object();
 }