#pragma once #include #include "eBus.h" #include "BusThread.h" #include "LogicDevice.h" #include "BusUnitClient.h" class DevBusManager : public Thread_Base { //data //DeviceBUS *m_pBusLocal; BusUnitClient *m_pLocalChannelClient; //BusThread *m_pBusLocalThread; //Logger *m_pBusLocalLog; //DeviceBUS *m_pBusEth; //2025-2-21 BusUnitClient *m_pEthChannelClient; //BusThread *m_pBusEthThread; //Logger *m_pBusEthLog; pthread_mutex_t m_Critical = PTHREAD_MUTEX_INITIALIZER; int m_EnableEth; ResDataObject m_EthRouterIp; ResDataObject m_EthConnection; ResDataObject m_LocalConnection; BusUnitClient *m_prootClient; protected: //thread virtual bool OnStartThread(); virtual bool OnEndThread(); virtual bool Exec(void); void UpdateEthConnectOption(int Enable, ResDataObject &routerIp); void AdjustEthConnection(int Enable, ResDataObject &routerIp); //internal actions bool DoRootDevPrcedure(void); bool DoLocalChannelPrcedure(void); bool DoEthChannelPrcedure(void); map m_LocalChannelDevList; map m_EthChannelDevList; void UpdateChannelList(bool Local); void ClearChannelList(bool Local); bool TryConnectChannel(bool Local); bool TryDisConnectChannel(bool Local); void InitLog(); public: DevBusManager(); virtual ~DevBusManager(); CCOS_PACKET_ROUTE GetBusIdDirection(string &BusId); bool ExecFunc(); //init functions bool LoadBusDrv(); bool UnloadBusDrv(); void NotifyChannel(bool Local, bool Connect); //interface bool SendSMPacket(ResDataObject &packet, bool Local, string &TargetbusId, unsigned long long nShareMemID); bool SendPacket(ResDataObject &packet, bool Local, string &TargetbusId, char* pBlockData = NULL, DWORD Size = 0); void UnRegistThread(DWORD Tid); }; extern DevBusManager g_BusManager;