DBInterface.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*************************************************************
  2. /* Copyright (C), 2008-2010, StoneU Tech. Co., Ltd.
  3. /* 文件名: DBInterface.h
  4. /* 作者: Jesse
  5. /* 创建日期: 2010-08-02
  6. /* 版本号: V1.0
  7. /* 描述: 实现多种数据库的支持
  8. /* 其它:
  9. /* 主要类模块: CDBInterface
  10. /* 历史修改记录:
  11. 作者 时间 版本 描述
  12. Jesse 10/08/02 1.0 创建这个模块
  13. ***************************************************************/
  14. #ifndef _DB_INTERFACE_H
  15. #define _DB_INTERFACE_H
  16. #include "kernel.h"
  17. namespace DBInterface
  18. {
  19. const int MAX_DB_TYPE = 255;
  20. /*************************************************
  21. /* 类名
  22. /* {
  23. /* 构造函数;
  24. /* 析构函数;
  25. /* 提供全局访问函数;
  26. /* 静态类指针变量;
  27. /* 数据库类型成员变量;
  28. /*
  29. /* }
  30. **************************************************/
  31. class CDBInterface
  32. {
  33. public:
  34. CDBInterface()
  35. {
  36. };
  37. ~CDBInterface()
  38. {
  39. };
  40. void Release();
  41. // 静态成员函数,提供全局访问的接口
  42. static CDBInterface* GetInstancePtr();
  43. // 设置数据库类型
  44. void SetDBType(char *pDBType);
  45. //得到时间计划
  46. INT GetDatePlan( int nPlanType, CHAR *pPlanID, unsigned char nBufDate[7][24] );
  47. //得到时间计划
  48. INT GetDatePlan( int nPlanType, CHAR *pUid, int nVarID, unsigned char nBufDate[7][24] );
  49. //获取变量
  50. INT GetVarInfo();
  51. // 获取设备资料
  52. INT GetDevInfo();
  53. //获取指定驱动ID的驱动名称
  54. INT GetDriverName( int nDriverID, CString &sDriverName );
  55. //获取指定驱动ID和厂家ID的厂家名称
  56. INT GetFactoryName( int nDriverID, int nFactoryID, CString &sFactoryName );
  57. //获取指定驱动ID,厂家ID和设备类型ID的名称
  58. INT GetDevicesName( int nDriverID, int nFactoryID, int nDevicesID,CString &spDevicesName );
  59. private:
  60. static CDBInterface* m_pDBInterface;
  61. char m_chDBType[MAX_DB_TYPE];
  62. bool FindDriverIsExist( CDevice* pDev,int iCommunicateType,int iAddr );
  63. bool FindVarIsExist( CAnalog *pBaseVar );
  64. CString GetInvalidMessage( CString sVarName,int iInitValue,int iMinValue,int iMaxValue,int iLowerValue,int iUpperValue,int iNormalValue,int iWarningLevel,int iIdentifyTime );//得到不合法的变量问题
  65. };
  66. };
  67. #endif