123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #pragma once
- #ifndef BATTERYUNITLOGIC_EXPORTS
- #ifdef _WIN64
- #ifdef _DEBUG
- #pragma comment(lib, "BatteryUnitLogicX64D.lib")
- #else
- #pragma comment(lib, "BatteryUnitLogicX64.lib")
- #endif
- #else
- #ifdef _DEBUG
- #pragma comment(lib, "BatteryUnitLogicD.lib")
- #else
- #pragma comment(lib, "BatteryUnitLogic.lib")
- #endif
- #endif
- #endif
- #ifdef BATTERYUNITLOGIC_EXPORTS
- #define BATTERYUNITLOGIC_API __declspec(dllexport)
- #else
- #define BATTERYUNITLOGIC_API __declspec(dllimport)
- #endif
- #include "LogicDevice.h"
- #include "DIOSLogicDeviceStructure.h"
- typedef enum Charge_State {
- POWER_DC,
- POWER_AC,
- }CHARGE_STATE;
- class BATTERYUNITLOGIC_API Battery_LogicDevice : public LogicDevice
- {
-
- public:
- Battery_LogicDevice(void);
- virtual ~Battery_LogicDevice(void);
- //get device type
- virtual bool SYSTEM_CALL GetDeviceType(GUID &DevType);
- //get device resource
- virtual RET_STATUS SYSTEM_CALL GetDeviceResource(ResDataObject PARAM_OUT *pDeviceResource);
- //ResourceCommand Request In and Response Out
- virtual RET_STATUS SYSTEM_CALL Request(ResDataObject PARAM_IN *pRequest, ResDataObject PARAM_OUT *pResponse);
- //notify to lower layer
- virtual RET_STATUS SYSTEM_CALL CmdToLogicDev(ResDataObject PARAM_IN *pCmd);
- //errors,warnings
- void SetErrorInfo(int errCode, char *pErrInfo);
- void SetWarningInfo(int warningCode, char *pWarningInfo);
- //Data Access
- public:
- BaseJsonDataObject<unsigned int>* m_nRemain_Power_value;//剩余电量值
- BaseJsonDataObject<unsigned int>* m_nRemain_Power_State;//剩余电量对应的状态
- BaseJsonDataObject<unsigned int>* m_nChargeState;//是否处于充电状态
- //ResDataObject m_ResSerial;//电池序列号,以后可能有用
- public:
- virtual RET_STATUS Charging();//给电池充电
- virtual bool Support_Charging();
- void LogInfo(string string);
- void LogWarn(string string);
- void LogError(string string);
- public:
- unsigned int m_nPowerWarnThreshold;
- unsigned int m_nPowerErrorThreshold;
- bool SetPowerError(unsigned int nValue);
- bool SetPowerWarn(unsigned int nValue);
- virtual bool SetRemainPowerValue(unsigned int nValue, int & nStatus);
- virtual bool SetRemainPowerState(unsigned int nState);
- virtual bool SetChargState(unsigned int nState);
- virtual RET_STATUS DATA_ACTION GetPowerValue(unsigned int & nValue);
- };
|