using System;
using System.Collections.Generic;
using System.Text;
using mxdev_csif;

namespace WatchDog
{
    class Program
    {
        static void Main(string[] args)
        {
            IntPtr fd; // Handle to device, obtain from mxwdg_open
            ulong time;

            // starts watchdog timer
            time = 10;
            fd = mxdev.mxwdg_open(time);

            while (true)
            {
                Console.WriteLine("Press \"ENTER\" in 10 seconds");
                Console.WriteLine("'q' to exit");
                if ('q' == Console.Read())
                    break;

                // refresh watchdog timer
                mxdev.mxwdg_refresh(fd);
            }

            // stops watchdog timer
            mxdev.mxwdg_close(fd);
        }
    }
}
