#include #include #include #define SCF_API #include "SCF.Define.hpp" namespace CCOS { namespace Dev { namespace Communication { namespace Detail { class SCFDetail; // 内部实现真正功能的 SCF } //----------------------------------------------------------------------------- // SCF //----------------------------------------------------------------------------- class SCF_API SCF { private: std::shared_ptr m_SCFDetail; public: SCF (); ~SCF (); public: SCF (const SCF & from) = default; //SCF (SCF && from) = default; //SCF & operator = (SCF && from) = default; SCF & operator = (const SCF & from) = default; public: operator bool () const { return bool(m_SCFDetail); } public: static SCF FromDLL (const char * DllName); public: int Connect (std::string strProfile, tPacketPredate Pr, _SCF_Transfertype TransferType, DWORD msTimeOut); void Disconnect (); bool isConnected () const; bool DecodePack(bool action); public: class SCF_API IO { friend SCF; std::shared_ptr m_SCFDetail; private: IO (std::shared_ptr SCF, int msTimeOut); public: ~IO (); public: IO & SendPacket (const char * Packet, DWORD length, DWORD msTimeOut, int&retLength); IO & ReceivePacket (char * Packet, DWORD length, DWORD msTimeOut, int& retLength); }; public: IO Lock (int msTimeOut); std::function OnPassiveDisconnected; public: class SCF_API tQueue { friend SCF; private: tQueue () = default; std::shared_ptr m_SCFDetail; public: bool isEmpty () const; int GetNbOfPackt () const; // void Clear (); int Enqueue (const char * Packet, DWORD length); int Dequeue (char * Packet, DWORD length, DWORD msTimeOut); std::function OnNewPacket; } Queue; }; } } }