// 下列 ifdef 块是创建使从 DLL 导出更简单的 // 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 TEMPERATUREDPC_EXPORTS // 符号编译的。在使用此 DLL 的 // 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将 // TEMPERATUREDPC_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的 // 符号视为是被导出的。 #pragma once #ifndef TEMPERATUREDPC_EXPORTS #ifdef _WIN64 #ifdef _DEBUG #pragma comment(lib, "TemperatureDPCX64D.lib") #else #pragma comment(lib, "TemperatureDPCX64.lib") #endif #else #ifdef _DEBUG #pragma comment(lib, "TemperatureDPCD.lib") #else #pragma comment(lib, "TemperatureDPC.lib") #endif #endif #endif #ifdef TEMPERATUREDPC_EXPORTS #define TEMPERATURE_API __declspec(dllexport) #else #define TEMPERATURE_API __declspec(dllimport) #endif #include "DPC.h" #include "DiosThread.h" #include "TemperatureOem.h" #include "SerialSCF.h" extern "C" TEMPERATURE_API DPC* GetDPC(); extern "C" TEMPERATURE_API void ReleaseDPC(DPC *p); class TEMPERATURE_API TemperatureDPC : public DPC { std::string *m_pWorkpath; public: void LogInfo(string string); void LogWarn(string string); void LogError(string string); public: TemperatureDPC(void); virtual ~TemperatureDPC(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: Temperature_Oem *m_pTemperatureFPD; HMODULE m_DllFileHandle; //ResDataObject m_ConfigObj; };