using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GcDevicePc.Common;
using GcDevicePc.IniParam;
using GcDevicePc.GCBuffer;
using System.Net;

namespace GcDevicePc
{
    class globaldata
    {
        public struct DeviceInfo
        {
            public string ModuleName;
            public string MacAddr;
            public string IpAddr;
            public string Netmask;
            public string Gateway;
            public bool bActive;
        };
        public static DeviceInfo m_DeviceInfo;
        public static ArrayList DeviceList = new ArrayList();

        public static bool StartNetwork = false;
        public static bool OffLinkMode = false;

       // public static bool TCPDataRestart = false;

        //辅助工具使用的HMI List
        public static ArrayList hHMIList = new ArrayList();

        public static int device_index =0;     //总共探测出的设备数目
        public static int current_device;   //当前使用的设备号

        public static AppInit m_appinit = new AppInit();

        public const string remoteFolder = "\\Hard Disk2\\";
      //  public const string remoteFolder = "\\Storage Card\\";
        public const string exeremoteFolder = "\\Hard Disk\\";
        public const string updateremoteFolder = "\\Hard Disk2\\仪器状态\\";
      //  public const string exeremoteFolder = "\\Storage Card\\";

        public static string connection_ip = "";  //当前连接IP
        //端口
        public static ushort datamodbusport = 502;  //modbus端口
        public static ushort udpport = 233;         //UDP端口
        public static ushort fileserverport = 911;  //文件传输端口
        //Modbus地址
        public static ushort tempstart = 100;
        public static ushort statusstart = 124;
        public static ushort valusstatus = 16;
        public static ushort detstatus = 3;
        public static ushort hmistatus = 144;
        public static ushort errortatus = 36;


        //public static string DataFolder;    //数据保存目录
        //public static string RunFolder;     //当前程序运行目录
        //public static string MethodFolder;  //当前方法目录
        //public static string StatusFolder;  //当前状态目录
        //public static string subStatusFolder;  //当前状态目录
        //public static string RunTabFolder;  //当前运行表目录

        //public static string cur_MethodName;  //当前方法名
        //public static string cur_OpenMethodName;  //当前方法名
        //public static string cur_StatusName;  //当前状态名
        //public static string cur_RunTab;      //当前运行表名
        //public static string cur_DataName;      //保存数据文件名
        public static string show_MethodName;  //显示方法名

        public static int CurrentVersion;  //当前版本(是否显示用户界面)

        public static string UserName;//用户名
        public static string UserPwd;//密码

        public static int Foreign;//对外通信
        public static bool ZbDataSave;//zb数据保存
        public static string AppName;//应用程序名称
        //public static bool system_Statue;  //系统开启状态
        //public static ushort work_Statue;  //系统工作状态
        //public static ushort RunType = 0;  //运行类型  0 打开运行  1 智能运行 2 批处理


        public static ushort MethodRun_Statue;  //方法运行状态
        public static ushort RunTime_Now;  //运行时间
        public static ushort RunTotal_Now;  //运行总时间

        public static CProfileDevice m_profileMethod = new CProfileDevice();//方法的一些Ini文件参数
      //  public static CProfileDevice new_profileMethod = new CProfileDevice(); //新建方法
        public static MethodConfig m_configDlg = new MethodConfig();
        ///////////////////////////////////////////////////////////////////////////////////
        ///                            新全局buffer                                     ///
        ///                                                                             ///    
        ///                                                                             ///                    
        ///////////////////////////////////////////////////////////////////////////////////
        //用于侧边栏显示的Buffer
        public static DPBuffer m_dpbuffer = new DPBuffer();
        public static HMIBuffer m_hmibuffer = new HMIBuffer();
        public static PCBuffer m_pcbuffer = new PCBuffer();
        public static SignalBuffer m_signalbuffer = new SignalBuffer();

        public static bool IsShowPower = false;//暂时判断是否显示功率

        //
        public static HWConfig m_hwconfig = new HWConfig();

        public static long channel_A = 0;
        public static long channel_B = 0;
        public static long channel_C = 0;

        public static ArrayList channelA_A = new ArrayList();
        public static ArrayList channelA_B = new ArrayList();
        public static ArrayList channelA_C = new ArrayList();

        public static ArrayList channelB_A = new ArrayList();
        public static ArrayList channelB_B = new ArrayList();
        public static ArrayList channelB_C = new ArrayList();

        //public static RingBufferManager m_rsbuffer = new RingBufferManager(100000);

        public static bool OS_STOP = false;

        public static int check_link = 0;

        public static bool IsStopOs = false;
        ///////////////////////////////////////////////////////////////////////////////////
        //public static CProfileDevice open_profileMethod = new CProfileDevice();
        //public static MethodConfig open_configDlg = new MethodConfig();

        public static bool newfile = false;
        public static bool createfile = false;

        public static bool usable = false;

      //  public static Modbus m_modbus = new Modbus();
        //public static UInt32 starttimer = 0x7FFFFFFF; //开始时间
        //public static bool startimerIsSet = false;
        // public static int savetimer; //开始时间
        public static UInt32 starttimer = 0x7FFFFFFF; //开始时间
        public static bool startimerIsSet = false;
        public static bool startimerIsSet1 = false;
        public static bool startimerIsSet2 = false;
        public static bool startimerIsSet3 = false;
        //public static int[] channel1_timer = new int[30];
        //public static float[] channel1_data = new float[30];

        //public struct Channel_XY
        //{
        //    public int ctimer;
        //    public float cdata;
        //};

        //public static Channel_XY Channel1_Port;
        //public static ArrayList Draw_Port = new ArrayList();

        //Flag
        //public static bool startflag = false;
        //public static bool startclear = false;
        //public static bool stopflag = false;
        //public static bool cancelflag = false;

        //public static bool startflag = false;    //开始按键的标志位
        //public static bool startclear = false;   //清除开始按键之前的数据
        //public static bool stopflag = false;      //停止按键的标志位
        //public static bool cancelflag = false;   //取消按键的标志位

        public static GCModbus global_moudbus = new GCModbus();


        public static bool startflag = false;    //开始按键的标志位
        public static bool startclear = false;   //清除开始按键之前的数据
        public static bool startclear1 = false;   //清除开始按键之前的数据
        public static bool startclear2 = false;   //清除开始按键之前的数据
        public static bool startclear3 = false;   //清除开始按键之前的数据
        public static bool stopflag = false;      //停止按键的标志位
        public static bool cancelflag = false;   //取消按键的标志位
        public static bool cancelflag1 = false;   //取消按键的标志位
        public static bool cancelflag2 = false;   //取消按键的标志位
        public static bool cancelflag3 = false;   //取消按键的标志位


        public static int TYPE_TCD = 0;
        public static int TYPE_FID = 1;
        public static int TYPE_ECD = 2;
        public static int TYPE_FPD = 3;
        public static int TYPE_PID = 4;

        //////////////////////////////////////////////////////////////////////////////////////////////////////////////
        /// 
        public static String DeviceNo;              //HMI编号
        public static String DeviceName;            //HMI名字
        public static IPAddress myIpaddr;


        //public static AppInit m_appinit = new AppInit();    //程序初始化


        //public static HWConfig m_hwconfig = new HWConfig(); //全局硬件配置
    }
}
