using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EMDServer.Common;
using System.Timers;
using System.Diagnostics;

namespace EMDServer.Core.Devices
{
    public class PowerMeter : Device
    {
        #region Class variables
        // ----------------------------------------
        //private Timer dispatcher;
        // ----------------------------------------
        #endregion

        #region Public Methods
        // ----------------------------------------
        /// <summary>
        /// Creates a new instance of the class
        /// </summary>
        /// <param name="id">int id of the PowerMeter</param>
        /// <param name="gateway">iEMDConnection interface to the PowerMeter</param>
        public PowerMeter(int id, iEMDConnection gateway)
            : base(id, Constants.EMD_DEVICE_TYPE.POWER_METER, gateway)
        {
        //   initTimer();    
        }

        ///// <summary>
        ///// Starts the timer which sends the value of the powermeter
        ///// periodically to the connected display
        ///// </summary>
        //public void startPowerValueRequest()
        //{
        //    dispatcher.Start();
        //}

        ///// <summary>
        ///// Stops the power value interval sending
        ///// </summary>
        //public void stopPowerValueRequest()
        //{
        //    dispatcher.Stop();
        //}
        // ----------------------------------------
        #endregion

        #region Private methods
        // ----------------------------------------
        //private void initTimer()
        //{
        //    dispatcher = new Timer(Constants.EMD_DEVICE_POWERMETER_POWER_VALUE_REQUEST_TIMER_INTERVAL);
        //    dispatcher.Elapsed += new ElapsedEventHandler(dispatcher_Elapsed);
        //}

        ///// <summary>
        ///// Sends a get power value request to the power meter hardware
        ///// </summary>
        //private void getPowerValueFromHw()
        //{
        //    // mc.send
        //    if (this.mainController != null)
        //    {
        //        Command c = new Command((byte)deviceId, (byte)Constants.EMD_COMMAND.GET_POWER_VALUE, deviceValue);
        //        this.mainController.sendCommand(c);

        //        Debug.WriteLine("POWERMETER - Get powermeter value from hardware...");
        //    }
        //}
        // ----------------------------------------
        #endregion

        #region Eventhandler
        // ----------------------------------------
        //private void dispatcher_Elapsed(object sender, ElapsedEventArgs e)
        //{
        //    getPowerValueFromHw();
        //}
        // ----------------------------------------
        #endregion
    }
}
