| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #pragma once
- #include <functional>
- #include <thread>
- #include "SCF.hpp"
- #include "SyncEvent.hpp"
- //-----------------------------------------------------------------------------
- // DiosConnect
- //-----------------------------------------------------------------------------
- namespace nsSCF = DIOS::Dev::Communication;
- namespace DIOS::Dev::Communication
- {
- #define CMD_LEN_MAX 1024
- // Linux兼容类型定义
- using DWORD = unsigned long;
- using tbDataFun = std::function <void(const char* Packet, const DWORD Length)>;
- class DiosConnect
- {
- public:
- DiosConnect(int millisecond = 200);
- ~DiosConnect();
- void Prepare(std::string DllName);
- bool Connect(std::string strProfile, tPacketPredate Pr, _SCF_Transfertype TransferType, DWORD msTimeOut);
- bool Run(tbDataFun Dequeue);
- bool DecodePack(bool action);
- void Disconnect();
- bool isConnected();
- bool TryReconnect();
- bool isActDecodeFun{ true };
- nsSCF::SCF m_SCF; //�����շ���������
- protected:
- SyncEvent::Auto m_NewPacket; //��������ͬ���¼�
- //HANDLE m_DataThread; //���������߳�
- tbDataFun m_tbFunction; //�������ݻص�����
- int m_iWaitSCFTimeOut; //��������ʱ����
- std::string m_tConnectParam; //���Ӳ���
- tPacketPredate m_tCallbackFun;
- std::thread::id m_TID; //ThreadID
- };
- }
|