// 下列 ifdef 块是创建使从 DLL 导出更简单的 // 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 BATTERYDPC_EXPORTS // 符号编译的。在使用此 DLL 的 // 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将 // BATTERYDPC_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的 // 符号视为是被导出的。 #pragma once #ifndef BATTERYDPC_EXPORTS #ifdef _WIN64 #ifdef _DEBUG #pragma comment(lib, "BatteryDPCX64D.lib") #else #pragma comment(lib, "BatteryDPCX64.lib") #endif #else #ifdef _DEBUG #pragma comment(lib, "BatteryDPCD.lib") #else #pragma comment(lib, "BatteryDPC.lib") #endif #endif #endif #ifdef BATTERYDPC_EXPORTS #define BATTERYDPC_API __declspec(dllexport) #else #define BATTERYDPC_API __declspec(dllimport) #endif #include "DPC.h" #include "DiosThread.h" #include "BatteryOem.h" #include "SerialSCF.h" extern "C" BATTERYDPC_API DPC* GetDPC(); extern "C" BATTERYDPC_API void ReleaseDPC(DPC *p); class BATTERYDPC_API BatteryDPC : public DPC { std::string *m_pWorkpath; public: void LogInfo(string string); void LogWarn(string string); void LogError(string string); public: BatteryDPC(void); virtual ~BatteryDPC(void); virtual bool DpcEntry(ResDataObject &Configuration); virtual ResDataObject GetConnectionType(); virtual bool Connect(ResDataObject &Connection); virtual bool Probe(ResDataObject &HardwareInfo); virtual bool OnNotify(HANDLE ExitNotify); virtual bool SetWorkPath(const char *pWorkPath); virtual PVOID LoadLogicDevices(); virtual void UnloadLogicDevices(PVOID p); virtual bool DisConnect(); bool SendBySCF(char chChannelID, bool bStatus); //friend class SyncGen_OemDevice; //friend class ThreeAxisGyr_Oem; //friend class SyncSwitch_OemDevice; private: bool CharArrToDec(char*p,int nLength,DWORD dwRetValue); int ChartoInt(char uc); int CalChecksum(const char * cCmd, int nCmdSize); bool FormatCmd(char *cCmd, int &nSize); bool CmdtoString(const char * cCmd, int nCmdSize, string &strCmd); static PACKET_RET EventCallback(const char * pRecData, DWORD nLength, DWORD & PacketLength); typedef SCF* (*GetSCF)(); GetSCF getSCF; typedef void(*ReleaseSCF)(SCF *p); ReleaseSCF releaseSCF; SCFPacket *m_pSendPacket; SCFPacket *m_pReceivePacket; SCF *m_pSCFInstance; private: Battery_Oem *m_pBatteryFPD; HMODULE m_DllFileHandle; //ResDataObject m_ConfigObj; };