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) { } }
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); }
public bool Exit() { AnalogDataManager.GetInstance().Stop(); CurveManager.GetInstance().Stop(); return(true); }
public bool Start() { CurveManager.GetInstance().Start(); AnalogDataManager.GetInstance().Start(); return(true); }
public void AddAnalog(int type, int index, float analogVal, DateTime time) { AnalogDataManager.GetInstance().AddData(type, index, 0, analogVal, time); }
public void Stop() { CurveManager.GetInstance().Stop(); AnalogDataManager.GetInstance().Stop(); }
public List <DateTime> QueryAnalogTimes(int analogType, int analogIndex) { return(AnalogDataManager.GetInstance().QueryAnalogTimes(analogType, analogIndex)); }