Ejemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        public Controller()
        {
            this.errorLogger = new LedErrorLogger(LED_ERROR_PIN);

#if !EMULATOR
            // check for SD presence
            this.CheckSD();
#endif

            // create sensors instances
            this.dataLogger = new SDDataLogger(SD_DATA_LOGGING);
            this.anemometer = new Anemometer(ANEMOMETER_PIN);
            this.sht1x      = new SHT1X(SHT1X_DATA_PIN, SHT1X_CLK_PIN, SHT1X.Voltage.Vdd_3_5V);
            this.ldr        = new Ldr(LDR_ANALOG_CHANNEL, LDR_ADC_RESOLUTION, LDR_LOAD_RESISTOR);

            // RTC
            this.rtc = Rtc.Instance;

            // configure and create Web Server
            MicroWebServerConfig uWebServerConfig =
                new MicroWebServerConfig {
                Backlog         = WS_BACKLOG,
                HttpPort        = WS_HTTP_PORT,
                MaxWorkerThread = WS_MAX_WORKER_THREAD,
                WebRoot         = SD_WEBROOT
            };

            this.uWebServer = new MicroWebServer(uWebServerConfig);
        }
Ejemplo n.º 2
0
        public void Open()
        {
            // create root data directory if doesn't exist
            if (!Directory.Exists(this.dirPath))
            {
                Directory.CreateDirectory(this.dirPath);
            }

            this.rtc = Rtc.Instance;

            // create file path for data logging
            string filePath = this.dirPath + this.rtc.GetDateTime().Date.ToString(FILE_NAME_FORMAT) + FILE_EXT;

            // open the file in append mode or create it
            if (this.fs == null)
            {
                this.fs = new FileStream(filePath, FileMode.Append, FileAccess.Write, FileShare.Read);
                this.tw = new StreamWriter(this.fs);
            }

            this.isOpen = true;
        }
Ejemplo n.º 3
0
        public void Open()
        {
            // create root data directory if doesn't exist
            if (!Directory.Exists(this.dirPath))
                Directory.CreateDirectory(this.dirPath);

            this.rtc = Rtc.Instance;

            // create file path for data logging
            string filePath = this.dirPath + this.rtc.GetDateTime().Date.ToString(FILE_NAME_FORMAT) + FILE_EXT;

            // open the file in append mode or create it
            if (this.fs == null)
            {
                this.fs = new FileStream(filePath, FileMode.Append, FileAccess.Write, FileShare.Read);
                this.tw = new StreamWriter(this.fs);
            }

            this.isOpen = true;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        public Controller()
        {
            this.errorLogger = new LedErrorLogger(LED_ERROR_PIN);

            #if !EMULATOR
            // check for SD presence
            this.CheckSD();
            #endif

            // create sensors instances
            this.dataLogger = new SDDataLogger(SD_DATA_LOGGING);
            this.anemometer = new Anemometer(ANEMOMETER_PIN);
            this.sht1x = new SHT1X(SHT1X_DATA_PIN, SHT1X_CLK_PIN, SHT1X.Voltage.Vdd_3_5V);
            this.ldr = new Ldr(LDR_ANALOG_CHANNEL, LDR_ADC_RESOLUTION, LDR_LOAD_RESISTOR);

            // RTC
            this.rtc = Rtc.Instance;

            // configure and create Web Server
            MicroWebServerConfig uWebServerConfig =
                new MicroWebServerConfig {
                    Backlog = WS_BACKLOG,
                    HttpPort = WS_HTTP_PORT,
                    MaxWorkerThread = WS_MAX_WORKER_THREAD,
                    WebRoot = SD_WEBROOT
                };

            this.uWebServer = new MicroWebServer(uWebServerConfig);
        }