Exemplo n.º 1
0
        private DatabaseModule()
        {
            try
            {
                string storeDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data");
                if (Directory.Exists(storeDir) == false)
                {
                    Directory.CreateDirectory(storeDir);
                }
                string F1 = storeDir;
                if (Directory.Exists(F1) == false)
                {
                    Directory.CreateDirectory(F1);
                }

                string analogDir = Path.Combine(F1, "Analog");
                if (Directory.Exists(analogDir) == false)
                {
                    Directory.CreateDirectory(analogDir);
                }

                string curveDir = Path.Combine(F1, "Curve");
                if (Directory.Exists(curveDir) == false)
                {
                    Directory.CreateDirectory(curveDir);
                }

                CurveManager.GetInstance().StoreDir = curveDir;

                AnalogDataManager.GetInstance().StoreDir = analogDir;
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 2
0
        public List <AnalogRecordGroup> QueryAnalogHistory(int analogType, int analogIndex, DateTime beginTime, DateTime endTime)
        {
            List <List <AnalogPoint> > listAll = AnalogDataManager.GetInstance().GetAnalogPoint(analogType, analogIndex, beginTime, endTime);

            int listIndex = -1;

            if (listAll != null)
            {
                List <AnalogRecordGroup> listGrp = new List <AnalogRecordGroup>();
                for (int i = 0; i < listAll.Count; i++)
                {
                    List <AnalogPoint> listPoint = listAll[i];
                    if (listPoint != null)
                    {
                        listIndex++;
                        List <AnalogRecord> listRecord = new List <AnalogRecord>();
                        for (int j = 0; j < listPoint.Count; j++)
                        {
                            listRecord.Add(new AnalogRecord(listPoint[j].Time, listPoint[j].AnalogValue));
                        }

                        listGrp.Add(new AnalogRecordGroup(listIndex, listRecord));
                    }
                }
                return(listGrp);
            }

            return(null);
        }
Exemplo n.º 3
0
        public bool Exit()
        {
            AnalogDataManager.GetInstance().Stop();

            CurveManager.GetInstance().Stop();


            return(true);
        }
Exemplo n.º 4
0
        public bool Start()
        {
            CurveManager.GetInstance().Start();


            AnalogDataManager.GetInstance().Start();


            return(true);
        }
Exemplo n.º 5
0
 public void AddAnalog(int type, int index, float analogVal, DateTime time)
 {
     AnalogDataManager.GetInstance().AddData(type, index, 0, analogVal, time);
 }
Exemplo n.º 6
0
 public void Stop()
 {
     CurveManager.GetInstance().Stop();
     AnalogDataManager.GetInstance().Stop();
 }
Exemplo n.º 7
0
 public List <DateTime> QueryAnalogTimes(int analogType, int analogIndex)
 {
     return(AnalogDataManager.GetInstance().QueryAnalogTimes(analogType, analogIndex));
 }