コード例 #1
0
void 
CNdasAutoRegister::NdasHeartbeatReceived(const NDAS_DEVICE_HEARTBEAT_DATA* Data)
{
	const NDAS_DEVICE_ID& deviceId = Data->NdasDeviceId;
	
	ACCESS_MASK autoRegAccess = m_data.GetAutoRegAccess(deviceId);
	if (!autoRegAccess) 
	{
		return;
	}

	//
	// If already registered, do nothing
	//
	CComPtr<INdasDevice> pNdasDevice;
	HRESULT hr = pGetNdasDevice(deviceId, &pNdasDevice);
	if (SUCCEEDED(hr))
	{
		//
		// NdasDevice is already registered.
		// Ignore the registration
		//
		return;
	}

	::NdasLogEventInformation(
		EVT_NDASSVC_INFO_AUTOREG_NDAS_DEVICE_FOUND,
		NULL, 
		0, 
		sizeof(deviceId), 
		NULL, 
		&deviceId);
	
	(VOID) AddToQueue(deviceId, autoRegAccess);
}
コード例 #2
0
ファイル: ndasobjs.cpp プロジェクト: JanD1943/ndas4windows
CNdasUnitDevicePtr
pGetNdasUnitDevice(const NDAS_DEVICE_ID_EX& device, DWORD unitNo)
{
	CNdasDevicePtr pDevice = pGetNdasDevice(device);
	if (CNdasDeviceNullPtr == pDevice) 
	{
		return CNdasUnitDeviceNullPtr;
	}
	return pDevice->GetUnitDevice(unitNo);
}
コード例 #3
0
ファイル: ndasobjs.cpp プロジェクト: JanD1943/ndas4windows
CNdasUnitDevicePtr 
pGetNdasUnitDevice(DWORD SlotNo, DWORD UnitNo)
{
	CNdasDevicePtr pDevice = pGetNdasDevice(SlotNo);
	if (CNdasDeviceNullPtr == pDevice) 
	{
		return CNdasUnitDeviceNullPtr;
	}
	return pDevice->GetUnitDevice(UnitNo);
}
コード例 #4
0
VOID 
CNdasAutoRegister::Update(ximeta::CSubject* pChangedSubject)
{
	const CNdasDeviceHeartbeatListener& listener = m_service.GetDeviceHeartbeatListener();
	const CNdasDeviceHeartbeatListener* pListener = &listener;

	//
	// Ignore other than subscribed heartbeat listener
	//

	if (pListener == pChangedSubject) {

		NDAS_DEVICE_HEARTBEAT_DATA hbData;

		pListener->GetHeartbeatData(&hbData);

		NDAS_DEVICE_ID deviceId = {0};
		::CopyMemory(&deviceId, hbData.remoteAddr.Node, sizeof(deviceId));

		ACCESS_MASK autoRegAccess = m_data.GetAutoRegAccess(deviceId);
		if (!autoRegAccess) 
		{
			return;
		}

		//
		// If already registered, do nothing
		//
		CNdasDevicePtr pDevice = pGetNdasDevice(deviceId);
		if (0 != pDevice.get()) 
		{
			return;
		}

		::NdasLogEventInformation(
			EVT_NDASSVC_INFO_AUTOREG_NDAS_DEVICE_FOUND,
			NULL, 
			0, 
			sizeof(deviceId), 
			NULL, 
			&deviceId);
		
		(VOID) AddToQueue(deviceId, autoRegAccess);
	}
}