123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- #pragma once
- // 下列 ifdef 块是创建使从 DLL 导出更简单的
- // 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 DEVICEBUS_EXPORTS
- // 符号编译的。在使用此 DLL 的
- // 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
- // DEVICEBUS_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
- // 符号视为是被导出的。
- #ifndef DEVICEBUS_EXPORTS
- #ifdef _WIN64
- #ifdef _DEBUG
- #pragma comment(lib, "DeviceBusX64D.lib")
- #else
- #pragma comment(lib, "DeviceBusX64.lib")
- #endif
- #else
- #ifdef _DEBUG
- #pragma comment(lib, "DeviceBusD.lib")
- #else
- #pragma comment(lib, "DeviceBus.lib")
- #endif
- #endif
- #endif
- #ifdef DEVICEBUS_EXPORTS
- #define DEVICEBUS_API __declspec(dllexport)
- #else
- #define DEVICEBUS_API __declspec(dllimport)
- #endif
- #include "DiosThread.h"
- #include "ResDataObject.h"
- #include "ErrorInfoObject.h"
- #define DIOS_HW_CHANNEL (80000)
- #define DIOS_HW_COM_BUSID ("Dios.Hw.Dev.Bus")
- class DEVICEBUS_API DeviceBUS : public ErrorInfoObject
- {
- protected:
- bool m_Connected;
- Work_Thread *m_pPacketReceiveThread;//for receive packet
- public:
- PVOID m_pP2PModule;
- DeviceBUS(void);
- virtual ~DeviceBUS(void);
- void SetReceiveThread(Work_Thread *pThread);
- virtual bool Connect(ResDataObject &connection);//assume there will be a lots various connections
- virtual void DisConnect();
- virtual bool IsConnected();
- virtual void Quit();
- virtual void SetLogPath(const char *pPath);
- virtual bool SendSMPacket(const char *pTargetID, const char *pContext, unsigned long long nShareMemID);
- virtual bool SendRawPacket(const char *pTargetID, const char *pContext, DWORD ChannelId);
- virtual bool SendPacket(const char *pTargetID, const char *pContext, const char *pBlock = NULL, DWORD BlockSize = 0);
- virtual void PacketArrived(ResDataObject &packet);
- virtual void BlobDataArrived(const char *pMsg, unsigned char *pBlockData, DWORD BlockDataLen);
- virtual void InitP2P(const char *pszIp, const char *pszLocalBusId, bool AsServer);
- virtual void UnRegistThread(DWORD Tid);
- };
|