BatteryUnitLogic.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #pragma once
  2. #ifndef BATTERYUNITLOGIC_EXPORTS
  3. #ifdef _WIN64
  4. #ifdef _DEBUG
  5. #pragma comment(lib, "BatteryUnitLogicX64D.lib")
  6. #else
  7. #pragma comment(lib, "BatteryUnitLogicX64.lib")
  8. #endif
  9. #else
  10. #ifdef _DEBUG
  11. #pragma comment(lib, "BatteryUnitLogicD.lib")
  12. #else
  13. #pragma comment(lib, "BatteryUnitLogic.lib")
  14. #endif
  15. #endif
  16. #endif
  17. #ifdef BATTERYUNITLOGIC_EXPORTS
  18. #define BATTERYUNITLOGIC_API __declspec(dllexport)
  19. #else
  20. #define BATTERYUNITLOGIC_API __declspec(dllimport)
  21. #endif
  22. #include "LogicDevice.h"
  23. #include "DIOSLogicDeviceStructure.h"
  24. typedef enum Charge_State {
  25. POWER_DC,
  26. POWER_AC,
  27. }CHARGE_STATE;
  28. class BATTERYUNITLOGIC_API Battery_LogicDevice : public LogicDevice
  29. {
  30. public:
  31. Battery_LogicDevice(void);
  32. virtual ~Battery_LogicDevice(void);
  33. //get device type
  34. virtual bool SYSTEM_CALL GetDeviceType(GUID &DevType);
  35. //get device resource
  36. virtual RET_STATUS SYSTEM_CALL GetDeviceResource(ResDataObject PARAM_OUT *pDeviceResource);
  37. //ResourceCommand Request In and Response Out
  38. virtual RET_STATUS SYSTEM_CALL Request(ResDataObject PARAM_IN *pRequest, ResDataObject PARAM_OUT *pResponse);
  39. //notify to lower layer
  40. virtual RET_STATUS SYSTEM_CALL CmdToLogicDev(ResDataObject PARAM_IN *pCmd);
  41. //errors,warnings
  42. void SetErrorInfo(int errCode, char *pErrInfo);
  43. void SetWarningInfo(int warningCode, char *pWarningInfo);
  44. //Data Access
  45. public:
  46. BaseJsonDataObject<unsigned int>* m_nRemain_Power_value;//剩余电量值
  47. BaseJsonDataObject<unsigned int>* m_nRemain_Power_State;//剩余电量对应的状态
  48. BaseJsonDataObject<unsigned int>* m_nChargeState;//是否处于充电状态
  49. //ResDataObject m_ResSerial;//电池序列号,以后可能有用
  50. public:
  51. virtual RET_STATUS Charging();//给电池充电
  52. virtual bool Support_Charging();
  53. void LogInfo(string string);
  54. void LogWarn(string string);
  55. void LogError(string string);
  56. public:
  57. unsigned int m_nPowerWarnThreshold;
  58. unsigned int m_nPowerErrorThreshold;
  59. bool SetPowerError(unsigned int nValue);
  60. bool SetPowerWarn(unsigned int nValue);
  61. virtual bool SetRemainPowerValue(unsigned int nValue, int & nStatus);
  62. virtual bool SetRemainPowerState(unsigned int nState);
  63. virtual bool SetChargState(unsigned int nState);
  64. virtual RET_STATUS DATA_ACTION GetPowerValue(unsigned int & nValue);
  65. };