亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? opcdrvitem.cpp

?? 基于Intellution開發(fā)包的開發(fā)的OPC服務(wù)器
?? CPP
?? 第 1 頁 / 共 3 頁
字號:

			// Get the number of characters to read. It is in the Signal Cond slot
			m_wNumElements = (WORD)atoi((char *)LPCTSTR(strStringLength));

			// Initialize the read data with an empty buffer.
			CString	szEmpty;
			szEmpty.Empty();
			m_vReturnedData.vt = VT_BSTR;
			m_vReturnedData.bstrVal = szEmpty.AllocSysString();
		}
		else	// either analog or digital
		{
			// Parse out the string
			//
			HRESULT	hr = ParseItemIDOptions(strTmpID,
											strSignalCond,
											strLowEGU,
											strHighEGU,
											strHardwareOptions);
			m_wNumElements = 1;
		}
	}
	else if (EGU_X == m_EguRec.type)
	{
		// The user only entered "DRIVER:IOADDRESS", but the requested datatype
		// is string, so default the number of characters to read.
		//
		m_wNumElements			= g_wStringLength;

		// Initialize the read data with an empty buffer.
		CString	szEmpty;
		szEmpty.Empty();
		m_vReturnedData.vt = VT_BSTR;
		m_vReturnedData.bstrVal = szEmpty.AllocSysString();
	}
	else
	{
		// The user did not type the fields for SIGNAL,LOEGU,HIEGU,HWOPT, so set
		// the defaults.
		//
		strSignalCond		= g_strDefaultSignalConditioning;
		strLowEGU			= g_strDefaultLoEGU;
		strHighEGU			= g_strDefaultHiEGU;
		strHardwareOptions	= g_strDefaultHardwareOptions;
		m_wNumElements		= 1;
	}

	//
	// Save the Lo and Hi EGUs in the EGUREC member
	//
	if (EGU_A == m_EguRec.type)
	{
		//
		// This is an analog point
		//

		// Save away the LO EGU
		m_EguRec.urec.arec.lo = (float)atof((char *)LPCTSTR(strLowEGU));

		// Save away the span (High EGU - Lo EGU)
		m_EguRec.urec.arec.span = 
				(float)atof((char *)LPCTSTR(strHighEGU)) - m_EguRec.urec.arec.lo;
		
		// Save away the digits right of the decimal point
		if ((nIndex = strLowEGU.FindOneOf(g_psDecimalPoint)) == -1)
		{
			m_EguRec.urec.arec.ef = 0;
		}
		else
		{
			m_EguRec.urec.arec.ef = strLowEGU.GetLength() - (nIndex - 1);
		}
	}
	else if (EGU_D == m_EguRec.type)
	{
		//
		// This is a digital point
		//

		// Save away the OPEN contact string
		strcpy(m_EguRec.urec.drec.open, strLowEGU);

		// Save away the CLOSED contact string
		strcpy(m_EguRec.urec.drec.open, strHighEGU);

		// Clear out the signal cond for digital
		strSignalCond.Empty();
	}
	else
	{
		//
		// This is an ASCII point
		//
		
		// Make sure the read string isn't too big for ASCII.
		//
		if (m_wNumElements > MAX_STRING_LENGTH)
		{
			return OPC_E_INVALIDITEMID;
		}

		// Clear out the signal cond and hardware options
		strSignalCond.Empty();
		strHardwareOptions.Empty();
	}

	// 
	// Validate SIGNAL_COND through NIO for analog types only
	//
	memset(&IoStat, 0, sizeof(IOSTAT));
	nio_psig(&IoStat, &m_IovSpec, &m_EguRec, (char *)LPCTSTR(strSignalCond));

	if(IoStat.iostatus != FE_OK)
	{
		strMsg.Format("OPC DLL: Invalid signal conditioning passed to nio_psig() (%s)", strSignalCond);
		m_pParentGroup->m_pParentServer->SendMessageToDriver(strMsg, MSG_DEBUG);

		// The item id is not syntactically valid, so return an error
		return OPC_E_INVALIDITEMID; 
	}

	// 
	// Validate HARDWARE_OPTS
	// This will override the requested datatype set above!
	//
	memset(&IoStat, 0, sizeof(IOSTAT));
	//mvs11272000 - Check for Hardware options if not string NOT empty
	if (!strHardwareOptions.IsEmpty())
	{
		nio_popt(&IoStat, &m_IovSpec, &m_EguRec, (char *)LPCTSTR(strHardwareOptions));
		if(IoStat.iostatus != FE_OK)
		{
			strMsg.Format("OPC DLL: Invalid hardware options passed to nio_popt() (%s)", strHardwareOptions);
			m_pParentGroup->m_pParentServer->SendMessageToDriver(strMsg, MSG_DEBUG);

			// The item id is not syntactically valid, so return an error
			return OPC_E_INVALIDITEMID;
		}
	}

	// Copy other Itemdef info to Item object
	// (Note Blob stuff is not supported/required)
	//
	m_hServerItemHandle	= OPCHandle;
	m_hClientItemHandle	= pItemDef->hClient;
	this->SetActive(pItemDef->bActive);

	// Set ITEM RESULT
	//
	pItemResult->hServer				= m_hServerItemHandle;
	pItemResult->vtCanonicalDataType	= m_vtCanonical;
	pItemResult->dwAccessRights			= OPC_WRITEABLE | OPC_READABLE;
	pItemResult->pBlob					= NULL;
	pItemResult->dwBlobSize				= 0;

	// Do this last!
	// Mark data as 'changed' for OnDataChange
	//
	MarkAsChanged(OPC_ODC_ANY);

	return S_OK;
}


////////////////////////////////////////////////////////////////
// SetActive()
//
// Sets the active state for the item. If the item is going
// active and this is a 7x driver, then it will call the Start()
// method through the 7x driver's OLE Automation interface.
//
// Returns:
//	void
//
////////////////////////////////////////////////////////////////
void COPCDrvItem::SetActive(BOOL bSet)
{
	// Lock it
	this->Lock();

	m_bActive = bSet;

	// If going to active then also queue an OnDataChange
	// else if going inactive then clear DataChange
	//
	if (FALSE == m_bActive) 
	{
		ClearChanged(OPC_ODC_ANY);
		this->UnLock();
		return;
	}

	MarkAsChanged(OPC_ODC_ANY);

	if (TRUE == g_bAutoStart)
	{
		short nRunning = 0;

		// We just put an Item active, so if the driver is not running,
		// start it.
		//
		m_pParentGroup->m_pParentServer->m_pIDriver->get_Running(&nRunning);
		if (0 == nRunning)
		{
			m_pParentGroup->m_pParentServer->m_pIDriver->Start();
		}
	}

	// UnLock it
	this->UnLock();
}


////////////////////////////////////////////////////////////////
// GetActive()
//
// Returns the active state of the item.
//
// NOTE: This is an inline function defined in OpcDrv.h!!!
//
////////////////////////////////////////////////////////////////
//BOOL COPCDrvItem::GetActive(void)
//{
//	return m_bActive;
//}


////////////////////////////////////////////////////////////////
// SetHandle()
//
// Sets the client handle for the item.
//
// Returns:
//	void
//
////////////////////////////////////////////////////////////////
void COPCDrvItem::SetHandle(OPCHANDLE OPCClientHandle)
{
	m_hClientItemHandle = OPCClientHandle;
}


////////////////////////////////////////////////////////////////
// GetHandle()
//
// Returns the client handle for the item.
//
// Returns:
//	OPCHANDLE	-	Client handle for this item.
//
////////////////////////////////////////////////////////////////
OPCHANDLE COPCDrvItem::GetHandle(void)
{
	return m_hClientItemHandle;
}


////////////////////////////////////////////////////////////////
// SetDataType()
//
// This method allows the client to change the requested data
// type. It will compare the new datatype with the canonical to
// make sure that it is a valid change. For example, if we are
// getting back floats from the server, then it wouldn't be valid
// to change it to a date.
//
// Returns:
//	HRESULT	-	S_OK if the function was successful.
//			-	E_FAIL if the function failed.
//
////////////////////////////////////////////////////////////////
HRESULT COPCDrvItem::SetDatatype(VARTYPE	vtNewRequested,
								 BOOL		bInit)			/* = FALSE */
{
	VARIANT			vTemp;
	COPCDrvServer	*pServer = m_pParentGroup->m_pParentServer;


	// If this call didn't come from the initialize routine, then
	// we can't change from a string to analog and vice versa during
	// runtime
	//
	if (!bInit)
	{
		if (((VT_BSTR == vtNewRequested) && (VT_BSTR != m_vtRequested)) ||
			((VT_BSTR != vtNewRequested) && (VT_BSTR == m_vtRequested)))
		{
			return E_FAIL;
		}
	}

	// First, let's make sure that the driver supports this
	// datatype
	//
	if (!pServer->IsDataTypeSupported(vtNewRequested))
	{
		return E_FAIL;
	}

	// Inititialize the Variant for use
	//
	VariantInit(&vTemp);

	// Build up a temp variant that we can send to VariantChangeType()
	// for validation.
	//
	if (FAILED(VariantCopy(&vTemp, &m_vReturnedData)))
	{
		return E_FAIL;
	}

	// Change the temp type to see if it is a valid change
	//
	if (FAILED(VariantChangeType(&vTemp, &vTemp, 0, vtNewRequested)))
	{
		return E_FAIL;
	}

	// Ok, the change worked, so save the new requested datatype and
	// figure out the new NIO block type and canonical datatype.
	//
	Lock();

	m_vtRequested = vtNewRequested;
	GetNIOBlockType(m_vtRequested);

	UnLock();

	return S_OK;
}


////////////////////////////////////////////////////////////////
// GetDataType()
//
////////////////////////////////////////////////////////////////
VARTYPE COPCDrvItem::GetDatatype(void)
{
	return m_vtRequested;
}


////////////////////////////////////////////////////////////////
// Clone()
// 
// Clone an item
// (this is similar to a copy constructor)
//
// Returns:
//	COPCDrvItem*	-	Pointer to the newly cloned item.
//
////////////////////////////////////////////////////////////////
COPCDrvItem *COPCDrvItem::Clone(COPCDrvGroup	*pParentGroup)
{
	COPCDrvItem *pNewItem = new COPCDrvItem(pParentGroup);
	if (NULL == pNewItem)
	{
		return NULL;
	}

	// Copy over all the data
	//
	*pNewItem = *this;

	// Set the new group inactive and give it a unique server handle. 
	// This is per the OPC spec!! Everything else gets copied.
	//
	pNewItem->m_bActive				= FALSE;
	pNewItem->m_hServerItemHandle	= (OPCHANDLE)pNewItem;

	return pNewItem;
}


////////////////////////////////////////////////////////////////
// IAGet()
// 
// Fill in an OPCITEMATTRIBUTE
// This is similar to IAClone() in itemutil.cpp
// Caller should delete contents of the IA 
// using IAFree()
//
// Returns:
//	void
//
////////////////////////////////////////////////////////////////
void COPCDrvItem::IAGet(OPCITEMATTRIBUTES *pItemAttrib)
{
	if (NULL == pItemAttrib)
	{
		return;
	}

	// Note Blob and EUInfo not supported at present

	//
	// the easy stuff...
	//
	pItemAttrib->bActive				= m_bActive;
	pItemAttrib->hServer				= m_hServerItemHandle;
	pItemAttrib->hClient				= m_hClientItemHandle;
	pItemAttrib->dwAccessRights			= OPC_READABLE | OPC_WRITEABLE;
	pItemAttrib->dwBlobSize				= 0;				// not supported
	pItemAttrib->pBlob					= NULL;
	pItemAttrib->vtRequestedDataType	= m_vtRequested;
	pItemAttrib->vtCanonicalDataType	= m_vtCanonical;
	pItemAttrib->dwEUType				= OPC_NOENUM;		// not supported
	pItemAttrib->vEUInfo.vt				= VT_EMPTY;

	// jra 012299
	// Verify that the pointers are good before cloning

	// strings...
	// Use local memory
	//
	if (m_szAccessPath)
	{
		pItemAttrib->szAccessPath = WSTRClone(m_szAccessPath, NULL);
		if (NULL == pItemAttrib->szAccessPath)
		{
			// Return some kind of error?
		}
	}

	if (m_szItemID)
	{
		pItemAttrib->szItemID = WSTRClone(m_szItemID, NULL);
		if (NULL == pItemAttrib->szItemID)
		{
			// Return some kind of error?
		}
	}
}


////////////////////////////////////////////////////////////////
// GetValue()
//
// Get Item Value from cache.
//
// Returns:
//	HRESULT	-	S_OK if the function was successful.
//			-	E_FAIL if the function failed.
//			-	E_POINTER if the function was passed a bad 
//				pointer value.
// 
////////////////////////////////////////////////////////////////
HRESULT COPCDrvItem::GetValue(OPCDATASOURCE		dwSource, 
							  VARIANT			*pvData, 
							  WORD				*pwQuality, 
							  FILETIME			*pftTime)
{
	// Sanity checks...
	//
	if (NULL == pvData)
	{
		return E_POINTER;
	}

	// If this is a device read, then get the data.
	//
	if (OPC_DS_DEVICE == dwSource)
	{
		ReadValue();
	}

	Lock();

	// First handle Quality...
	//
	if (pwQuality) 
	{
		switch(dwSource)
		{
		case OPC_DS_CACHE:
			// The OPC spec states that if either the item or device are
			// not active for CACHE reads, then the quality should reflect
			// that state.
			//
			if(m_bActive) 
			{
				*pwQuality = m_wQuality;
			}
			else 
			{
				((QUALITY_STATE *)pwQuality)->nQuality = QUALITY_BAD;
				((QUALITY_STATE *)pwQuality)->nSubStatus = SS_OUT_OF_SERVICE;
			}
			break;

		case OPC_DS_DEVICE:
			*pwQuality = m_wQuality;
			break;
		}
	}

	// Then the Timestamp...
	//
	if (pftTime) 
	{
		*pftTime = m_ftLastReadTime;
	}

	// Then the Data...
	//
	VariantCopy(pvData, &m_vReturnedData);

	UnLock();
	return S_OK;
}


////////////////////////////////////////////////////////////////
// SetValue()
//
// Writes a value to the driver for an item. Used for synch 
// writes.
//
// Returns:
//	HRESULT	-	S_OK if the function was successful.
//			-	E_FAIL if the function failed.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美高清视频一二三区| 日本强好片久久久久久aaa| 国产欧美一区二区精品忘忧草| 91精品国产一区二区人妖| 6080亚洲精品一区二区| 欧美精品色综合| 日韩视频在线你懂得| 日韩一区二区免费在线观看| 91精品国产综合久久国产大片| 3751色影院一区二区三区| 在线播放/欧美激情| 91.com视频| 精品日本一线二线三线不卡| 亚洲精品一区二区精华| 久久精品综合网| 国产精品久久久99| 亚洲欧美日韩中文播放 | 精品国产一二三| 精品国产在天天线2019| 国产亚洲视频系列| 中文字幕在线不卡| 亚洲线精品一区二区三区 | 成人自拍视频在线| 日韩精品综合一本久道在线视频| 91精品蜜臀在线一区尤物| 精品乱人伦小说| 欧美激情一区二区三区全黄| 亚洲三级小视频| 亚洲成人免费观看| 久久99国产精品免费| 成人高清免费观看| 在线观看免费亚洲| 日韩欧美精品三级| 欧美激情在线看| 亚洲在线免费播放| 久久99精品久久久久久| 国产69精品久久久久毛片| av电影在线观看一区| 欧美日韩国产经典色站一区二区三区| 欧美高清dvd| 国产色产综合色产在线视频| 亚洲乱码国产乱码精品精的特点| 五月天国产精品| 国产精品一区二区视频| 欧洲一区在线电影| 精品国产乱码久久久久久久| 亚洲天堂网中文字| 免费在线一区观看| 国产91在线观看| 欧美剧情片在线观看| 久久午夜国产精品| 亚洲国产日韩综合久久精品| 国产另类ts人妖一区二区| 91成人免费在线| 久久久久成人黄色影片| 亚洲一区二区精品久久av| 国产一区二区中文字幕| 欧美日韩在线电影| 日本一区二区综合亚洲| 日本人妖一区二区| 色综合久久久久综合| 日韩免费一区二区三区在线播放| 亚洲欧洲制服丝袜| 国产精品18久久久久久久久久久久| 欧美亚洲综合久久| 国产精品久久久久影院亚瑟| 看片的网站亚洲| 91国偷自产一区二区三区观看 | 亚洲一区二区在线播放相泽 | 精品久久久久一区二区国产| 一区二区三区精密机械公司| 成人污污视频在线观看| 日韩欧美不卡一区| 亚洲图片自拍偷拍| 91在线免费看| 国产精品视频你懂的| 蜜臀久久久99精品久久久久久| 在线影院国内精品| 国产精品免费av| 国产一区二区三区黄视频| 欧美精品电影在线播放| 亚洲午夜免费视频| 色琪琪一区二区三区亚洲区| 国产蜜臀97一区二区三区| 韩国v欧美v亚洲v日本v| 日韩视频一区二区三区| 五月综合激情网| 在线观看免费视频综合| 亚洲裸体在线观看| 99精品视频在线观看免费| 国产婷婷一区二区| 国产一区二区三区四区在线观看| 69久久夜色精品国产69蝌蚪网| 午夜不卡av在线| 在线不卡a资源高清| 亚洲va欧美va人人爽| 欧美日韩一区不卡| 婷婷夜色潮精品综合在线| 欧美日韩视频在线第一区 | 91免费国产在线观看| 亚洲国产精品ⅴa在线观看| 国产黄色精品视频| 亚洲国产精品t66y| a亚洲天堂av| 亚洲激情av在线| 在线日韩一区二区| 亚洲国产色一区| 6080国产精品一区二区| 日本欧美一区二区| 欧美成人精品高清在线播放| 蜜桃传媒麻豆第一区在线观看| 欧美一级高清片| 极品美女销魂一区二区三区| 精品国产一二三| 国产精品一区二区免费不卡 | 亚洲激情自拍偷拍| 欧美色图在线观看| 青青青伊人色综合久久| 日韩精品资源二区在线| 国产成人在线观看免费网站| 国产欧美精品一区二区色综合| 国产69精品一区二区亚洲孕妇| 国产精品国产自产拍高清av| 91亚洲资源网| 亚洲第一成人在线| 日韩久久久精品| 粉嫩高潮美女一区二区三区| 最新热久久免费视频| 欧美三级电影一区| 另类小说图片综合网| 国产日产精品一区| 在线中文字幕一区二区| 奇米在线7777在线精品| 国产亚洲一区字幕| 色婷婷av一区| 青青草97国产精品免费观看无弹窗版 | 欧美精品亚洲二区| 国产剧情av麻豆香蕉精品| 国产精品久久久久久亚洲伦| 精品视频全国免费看| 精品一区二区精品| 亚洲欧美经典视频| 在线电影院国产精品| 国产剧情av麻豆香蕉精品| 一区二区三区中文字幕| 日韩欧美高清一区| 91免费版在线| 久久精品国产亚洲高清剧情介绍 | 麻豆国产精品777777在线| 国产欧美日韩精品在线| 欧美日韩国产高清一区二区三区 | 狠狠色丁香婷综合久久| 亚洲婷婷在线视频| 精品国产乱子伦一区| 色综合久久六月婷婷中文字幕| 蜜臀久久99精品久久久画质超高清 | 国产精品你懂的| 欧美一区二区三区精品| 99精品黄色片免费大全| 六月丁香婷婷色狠狠久久| 亚洲欧美日韩国产手机在线| 精品国偷自产国产一区| 在线免费观看视频一区| 国产成人欧美日韩在线电影| 日韩精品一二三区| 综合欧美一区二区三区| 26uuu色噜噜精品一区二区| 在线观看国产精品网站| 国产麻豆精品theporn| 五月激情综合婷婷| 日韩美女视频一区| 久久精品综合网| 91精品国产综合久久福利软件| 91在线视频播放地址| 国产高清在线观看免费不卡| 污片在线观看一区二区| 亚洲免费观看高清完整版在线观看| 久久亚洲欧美国产精品乐播| 欧美视频一区二区三区在线观看| 成人动漫精品一区二区| 精品无码三级在线观看视频| 天堂va蜜桃一区二区三区| 亚洲精品午夜久久久| 中文字幕中文字幕一区| 国产亚洲美州欧州综合国| 日韩一区二区三区精品视频| 欧美日韩一区二区在线视频| 91丨porny丨中文| 成人动漫一区二区三区| 国产精品白丝jk白祙喷水网站 | 欧美一级在线观看| 欧美三日本三级三级在线播放| 97久久久精品综合88久久| 国产成人av网站| 国产真实乱对白精彩久久| 久久成人精品无人区| 另类小说视频一区二区| 久久成人久久爱| 国产在线不卡一卡二卡三卡四卡| 日本v片在线高清不卡在线观看|