本文整理汇总了C++中CNodeConManager::StartAdresClaimProc方法的典型用法代码示例。如果您正苦于以下问题:C++ CNodeConManager::StartAdresClaimProc方法的具体用法?C++ CNodeConManager::StartAdresClaimProc怎么用?C++ CNodeConManager::StartAdresClaimProc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNodeConManager
的用法示例。
在下文中一共展示了CNodeConManager::StartAdresClaimProc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vReinitAdresClaimProc
void CNetworkMgmt::vReinitAdresClaimProc(DWORD dwClient)
{
CNodeConManager* pNodConMgr = pouGetConMagrObj(dwClient);
if (pNodConMgr != NULL)
{
BYTE byPreferedAdres = byGetUnclaimedAddress();
pNodConMgr->StartAdresClaimProc(byPreferedAdres);
}
}
示例2: StartAdresClaimProc
HRESULT CNetworkMgmt::StartAdresClaimProc(void)
{
//Give a random delay to start
HRESULT hResult = S_OK;
UINT unRandomWait = rand() % sg_unTO_RESPONSE;
Sleep(unRandomWait);
static BYTE byPreferedAdres = 0;
for (int i = 0; i < m_nConMgrCnt; i++)
{
CNodeConManager* pNodConMgr = m_ConMgrArr[i];
if (pNodConMgr != NULL)
{
byPreferedAdres = pNodConMgr->m_byPrefAddress;
if (bIsAddressClaimed(byPreferedAdres) == TRUE)
{
byPreferedAdres = byGetUnclaimedAddress(i);
}
hResult |= pNodConMgr->StartAdresClaimProc(byPreferedAdres);
}
}
return hResult;
}
示例3: lCreateNodeConManager
LONG CNetworkMgmt::lCreateNodeConManager(char* pacNodeName,
UINT64 un64ECUName,
BYTE byPrefAdres,
DWORD& dwClientId)
{
VALIDATE_POINTER_RETURN_VAL(m_pIDIL_CAN, S_FALSE);
LONG lResult = S_OK;
CNodeConManager* pNodeConMgr = NULL;
//Search the array if node is already present
pNodeConMgr = pouGetConMagrObj(pacNodeName);
if (pNodeConMgr != NULL)
{
lResult = ERR_CLIENT_EXISTS;
dwClientId = pNodeConMgr->m_dwClientID;
}
//If no. of node reached limit
else if(m_nConMgrCnt == DEF_MAX_SIMULATED_NODE)
{
lResult = ALLOWED_NOMORE;
}
//Create new node
if (lResult == S_OK)
{
//Find the first available position in the Array. There will
//be empty places in beween due to deletion
int nEmptyPos = 0;
for (int i = 0; i < DEF_MAX_SIMULATED_NODE; i++)
{
if (m_ConMgrArr[i] == NULL)
{
nEmptyPos = i;
break;
}
}
if ( _tcscmp(pacNodeName, J1939_MONITOR_NODE) == 0 )
{
pNodeConMgr = new CMonitorNode(nEmptyPos, pacNodeName, un64ECUName, byPrefAdres);
}
else
{
//Provide its position in array and its PGN
pNodeConMgr = new CNodeConManager(nEmptyPos, pacNodeName, un64ECUName, byPrefAdres);
}
if (pNodeConMgr != NULL)
{
m_ConMgrArr[nEmptyPos] = pNodeConMgr;
m_nConMgrCnt++;
HRESULT hResult = S_FALSE;
// Connection manager is created. Proceed with rest of the procedures
if ( _tcscmp(pacNodeName, J1939_MONITOR_NODE) == 0 )
{
hResult = m_pIDIL_CAN->DILC_RegisterClient(TRUE, dwClientId,
CAN_MONITOR_NODE);
m_dwCANMonitorNodeClientId = dwClientId;
if (hResult == ERR_CLIENT_EXISTS)
{
hResult = S_OK;
}
}
else
{
hResult = m_pIDIL_CAN->DILC_RegisterClient(TRUE, dwClientId,
pacNodeName);
}
//ASSERT(hResult == S_OK);
if ((hResult == S_OK) || (hResult == ERR_CLIENT_EXISTS))
{
CBaseCANBufFSE* pouBuffer = pNodeConMgr->pouGetBuf();
hResult = m_pIDIL_CAN->DILC_ManageMsgBuf(MSGBUF_ADD, dwClientId, pouBuffer);
ASSERT(hResult == S_OK);
if (hResult == S_OK)
{
pNodeConMgr->m_dwClientID = dwClientId;
m_ouReadCANMsg.AddEventHandle(pouBuffer->hGetNotifyingEvent(), (BYTE)nEmptyPos);
}
//Join this node to network if started.
if (m_bOnline == TRUE)
{
pNodeConMgr->vActivate();
BYTE byPrefAddress = pNodeConMgr->m_byPrefAddress;
if ((byPrefAddress >= ADDRESS_NULL) || (bIsAddressClaimed(byPrefAddress) == TRUE))
{
byPrefAddress = byGetUnclaimedAddress();
}
pNodeConMgr->StartAdresClaimProc(byPrefAddress);
}
}
}
else
{
ASSERT(FALSE);
}
}
return lResult;
}