⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rfidreaderinstanceobject.cpp

📁 270的linux说明
💻 CPP
📖 第 1 页 / 共 4 页
字号:
	if ( m_bOpened )
	{
		if ( m_pImpl )
		{
			Intel::Mobile::BaseAPI::InstanceObject* pAPI_Instance = reinterpret_cast<Intel::Mobile::BaseAPI::InstanceObject*>(m_pImpl);
			if ( pAPI_Instance )
			{
				TRYBLOCK {
					IntelMobileString wsParams = "0";
					wsParams.append(FIRST_SPLITTER);
					
					vector<BYTE> vecData;
					DWORD dwCount = (DWORD)Data.GetSize();

					for ( int i = 0; i < Data.GetSize(); i++ )
					{
						BYTE byte = Data.GetAt(i);
						vecData.push_back(byte);
					}
					wsParams.append(CStringHelper::Param2Str(vecData));

					IntelMobileChar* infoString = pAPI_Instance->InvokeMethod( "WriteUserData", (IntelMobileChar *)wsParams.c_str() );
					IntelMobileString wsRtn = infoString;
					delete[] infoString;

					CStringHelper::Str2Param( wsRtn, bRet );
				} CATCHBLOCK
			}
			else
				THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteUserData");
		}
		else
			THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteUserData");
	}
	else
	{
		THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteUserData");
	}

	return bRet;	
}

bool RfidReaderInstance::WriteUserData(StringObject TagId, ByteArray& Data)
{
	bool bRet = false;
	if ( m_bOpened )
	{
		if ( m_pImpl )
		{
			Intel::Mobile::BaseAPI::InstanceObject* pAPI_Instance = reinterpret_cast<Intel::Mobile::BaseAPI::InstanceObject*>(m_pImpl);
			if ( pAPI_Instance )
			{
				TRYBLOCK {
					IntelMobileString wsParams = "1";
					wsParams.append(FIRST_SPLITTER);
					wsParams.append(TagId.GetValue());
					wsParams.append(FIRST_SPLITTER);
					vector<BYTE> vecData;
					DWORD dwCount = (DWORD)Data.GetSize();

					for ( int i = 0; i < Data.GetSize(); i++ )
					{
						BYTE byte = Data.GetAt(i);
						vecData.push_back(byte);
					}
					wsParams.append(CStringHelper::Param2Str(vecData));

					IntelMobileChar* infoString = pAPI_Instance->InvokeMethod( "WriteUserData", (IntelMobileChar *)wsParams.c_str() );
					IntelMobileString wsRtn = infoString;
					delete[] infoString;

					CStringHelper::Str2Param( wsRtn, bRet );
				} CATCHBLOCK
			}
			else
				THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteUserData");
		}
		else
			THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteUserData");
	}
	else
	{
		THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteUserData");
	}
	return bRet;	
}

bool RfidReaderInstance::WriteUserData(StringObject TagId, StringObject Password, ByteArray& Data)
{
	bool bRet = false;
	if ( m_bOpened )
	{
		if ( m_pImpl )
		{
			Intel::Mobile::BaseAPI::InstanceObject* pAPI_Instance = reinterpret_cast<Intel::Mobile::BaseAPI::InstanceObject*>(m_pImpl);
			if ( pAPI_Instance )
			{
				TRYBLOCK {
					IntelMobileString wsParams = "2";
					wsParams.append(FIRST_SPLITTER);
					wsParams.append(TagId.GetValue());
					wsParams.append(FIRST_SPLITTER);
					wsParams.append(Password.GetValue());
					wsParams.append(FIRST_SPLITTER);
					vector<BYTE> vecData;
					DWORD dwCount = (DWORD)Data.GetSize();

					for ( int i = 0; i < Data.GetSize(); i++ )
					{
						BYTE byte = Data.GetAt(i);
						vecData.push_back(byte);
					}
					wsParams.append(CStringHelper::Param2Str(vecData));

					IntelMobileChar* infoString = pAPI_Instance->InvokeMethod( "WriteUserData", (IntelMobileChar *)wsParams.c_str() );
					IntelMobileString wsRtn = infoString;
					delete[] infoString;

					CStringHelper::Str2Param( wsRtn, bRet );
				} CATCHBLOCK
			}
			else
				THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteUserData");
		}
		else
			THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteUserData");
	}
	else
	{
		THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteUserData");
	}
	return bRet;	
}

bool RfidReaderInstance::EraseUserData()
{
	bool bRet = false;
	if ( m_bOpened )
	{
		if ( m_pImpl )
		{
			Intel::Mobile::BaseAPI::InstanceObject* pAPI_Instance = reinterpret_cast<Intel::Mobile::BaseAPI::InstanceObject*>(m_pImpl);
			if ( pAPI_Instance )
			{
				TRYBLOCK {
					IntelMobileString wsParams = "0";

					IntelMobileChar* infoString = pAPI_Instance->InvokeMethod( "EraseUserData", (IntelMobileChar *)wsParams.c_str() );
					IntelMobileString wsRtn = infoString;
					delete[] infoString;

					CStringHelper::Str2Param( wsRtn, bRet );
				} CATCHBLOCK
			}
			else
				THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "EraseUserData");
		}
		else
			THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "EraseUserData");
	}
	else
	{
		THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "EraseUserData");
	}
	return bRet;
}
bool RfidReaderInstance::EraseUserData(StringObject TagId)
{
	bool bRet = false;
	if ( m_bOpened )
	{
		if ( m_pImpl )
		{
			Intel::Mobile::BaseAPI::InstanceObject* pAPI_Instance = reinterpret_cast<Intel::Mobile::BaseAPI::InstanceObject*>(m_pImpl);
			if ( pAPI_Instance )
			{
				TRYBLOCK {
					IntelMobileString wsParams = "1";
					wsParams.append(FIRST_SPLITTER);
					wsParams.append(TagId.GetValue());

					IntelMobileChar* infoString = pAPI_Instance->InvokeMethod( "EraseUserData", (IntelMobileChar *)wsParams.c_str() );
					IntelMobileString wsRtn = infoString;
					delete[] infoString;

					CStringHelper::Str2Param( wsRtn, bRet );
				} CATCHBLOCK
			}
			else
				THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "EraseUserData");
		}
		else
			THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "EraseUserData");
	}
	else
	{
		THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "EraseUserData");
	}
	return bRet;
}

bool RfidReaderInstance::EraseUserData(StringObject TagId, StringObject Password)
{
	bool bRet = false;
	if ( m_bOpened )
	{
		if ( m_pImpl )
		{
			Intel::Mobile::BaseAPI::InstanceObject* pAPI_Instance = reinterpret_cast<Intel::Mobile::BaseAPI::InstanceObject*>(m_pImpl);
			if ( pAPI_Instance )
			{
				TRYBLOCK {
					IntelMobileString wsParams = "2";
					wsParams.append(FIRST_SPLITTER);
					wsParams.append(TagId.GetValue());
					wsParams.append(FIRST_SPLITTER);
					wsParams.append(Password.GetValue());

					IntelMobileChar* infoString = pAPI_Instance->InvokeMethod( "EraseUserData", (IntelMobileChar *)wsParams.c_str() );
					IntelMobileString wsRtn = infoString;
					delete[] infoString;

					CStringHelper::Str2Param( wsRtn, bRet );
				} CATCHBLOCK
			}
			else
				THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "EraseUserData");
		}
		else
			THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "EraseUserData");
	}
	else
	{
		THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "EraseUserData");
	}
	return bRet;
}

bool RfidReaderInstance::WriteTagId(StringObject NewTagId)
{
	bool bRet = false;
	if ( m_bOpened )
	{
		if ( m_pImpl )
		{
			Intel::Mobile::BaseAPI::InstanceObject* pAPI_Instance = reinterpret_cast<Intel::Mobile::BaseAPI::InstanceObject*>(m_pImpl);
			if ( pAPI_Instance )
			{
				TRYBLOCK {
					IntelMobileString wsParams = NewTagId.GetValue();
					IntelMobileChar* infoString = pAPI_Instance->InvokeMethod( "WriteTagId", (IntelMobileChar *)wsParams.c_str() );
					IntelMobileString wsRtn = infoString;
					delete[] infoString;

					CStringHelper::Str2Param( wsRtn, bRet );
				} CATCHBLOCK
			}
			else
				THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteTagId");
		}
		else
			THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteTagId");
	}
	else
	{
		THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteTagId");
	}
	return bRet;
}

bool RfidReaderInstance::ReadEpc(StringObject* EpcId)
{
	bool bRet = false;
	if ( m_bOpened )
	{
		if ( m_pImpl )
		{
			Intel::Mobile::BaseAPI::InstanceObject* pAPI_Instance = reinterpret_cast<Intel::Mobile::BaseAPI::InstanceObject*>(m_pImpl);
			if ( pAPI_Instance )
			{
				TRYBLOCK {
					IntelMobileString wsParams = "0";
					IntelMobileChar* infoString = pAPI_Instance->InvokeMethod( "ReadEpc", (IntelMobileChar *)wsParams.c_str() );
					IntelMobileString wsRtn = infoString;
					delete[] infoString;

					vector<IntelMobileString> wsVec;
					CStringHelper::Str2ParamVect(wsRtn, wsVec, FIRST_SPLITTER);

					int j = 0;
					for ( vector<IntelMobileString>::iterator itr = wsVec.begin();
						itr != wsVec.end();
						itr ++, j++ )
					{
						if ( 0 == j )
						{
							CStringHelper::Str2Param(*itr, bRet);
						}
						else if ( 1 == j )
						{
							*EpcId = itr->c_str();
						}
						else
						{
							throw "Returned string unmatched.";
						}
					}
				} CATCHBLOCK
			}
			else
				THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "ReadEpc");
		}
		else
			THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "ReadEpc");
	}
	else
	{
		THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "ReadEpc");
	}
	return bRet;
}

bool RfidReaderInstance::ReadEpc(StringObject TagId, StringObject* EpcId)
{
	bool bRet = false;
	if ( m_bOpened )
	{
		if ( m_pImpl )
		{
			Intel::Mobile::BaseAPI::InstanceObject* pAPI_Instance = reinterpret_cast<Intel::Mobile::BaseAPI::InstanceObject*>(m_pImpl);
			if ( pAPI_Instance )
			{
				TRYBLOCK {
					IntelMobileString wsParams = "1";
					wsParams.append(FIRST_SPLITTER);
					wsParams.append(TagId.GetValue());

					IntelMobileChar* infoString = pAPI_Instance->InvokeMethod( "ReadEpc", (IntelMobileChar *)wsParams.c_str() );
					IntelMobileString wsRtn = infoString;
					delete[] infoString;

					vector<IntelMobileString> wsVec;
					CStringHelper::Str2ParamVect(wsRtn, wsVec, FIRST_SPLITTER);

					int j = 0;
					for ( vector<IntelMobileString>::iterator itr = wsVec.begin();
						itr != wsVec.end();
						itr ++, j++ )
					{
						if ( 0 == j )
						{
							CStringHelper::Str2Param(*itr, bRet);
						}
						else if ( 1 == j )
						{
							*EpcId = itr->c_str();
						}
						else
						{
							throw "Returned string unmatched.";
						}
					}
				} CATCHBLOCK
			}
			else
				THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "ReadEpc");
		}
		else
			THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "ReadEpc");
	}
	else
	{
		THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "ReadEpc");
	}
	return bRet;
}

bool RfidReaderInstance::WriteEpc(StringObject EpcId)
{
	bool bRet = false;
	if ( m_bOpened )
	{
		if ( m_pImpl )
		{
			Intel::Mobile::BaseAPI::InstanceObject* pAPI_Instance = reinterpret_cast<Intel::Mobile::BaseAPI::InstanceObject*>(m_pImpl);
			if ( pAPI_Instance )
			{
				TRYBLOCK {
					IntelMobileString wsParams = "0";
					wsParams.append(FIRST_SPLITTER);
					wsParams.append(EpcId.GetValue());

					IntelMobileChar* infoString = pAPI_Instance->InvokeMethod( "WriteEpc", (IntelMobileChar *)wsParams.c_str() );
					IntelMobileString wsRtn = infoString;
					delete[] infoString;

					CStringHelper::Str2Param( wsRtn, bRet );
				} CATCHBLOCK
			}
			else
				THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteEpc");
		}
		else
			THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteEpc");
	}
	else
	{
		THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteEpc");
	}
	return bRet;
}

bool RfidReaderInstance::WriteEpc(StringObject TagId, StringObject EpcId)
{
	bool bRet = false;
	if ( m_bOpened )
	{
		if ( m_pImpl )
		{
			Intel::Mobile::BaseAPI::InstanceObject* pAPI_Instance = reinterpret_cast<Intel::Mobile::BaseAPI::InstanceObject*>(m_pImpl);
			if ( pAPI_Instance )
			{
				TRYBLOCK {
					IntelMobileString wsParams = "1";
					wsParams.append(FIRST_SPLITTER);
					wsParams.append(TagId.GetValue());
					wsParams.append(FIRST_SPLITTER);
					wsParams.append(EpcId.GetValue());

					IntelMobileChar* infoString = pAPI_Instance->InvokeMethod( "WriteEpc", (IntelMobileChar *)wsParams.c_str() );
					IntelMobileString wsRtn = infoString;
					delete[] infoString;

					CStringHelper::Str2Param( wsRtn, bRet );
				} CATCHBLOCK
			}
			else
				THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteEpc");
		}
		else
			THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteEpc");
	}
	else
	{
		THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "WriteEpc");
	}
	return bRet;
}

bool RfidReaderInstance::ReadTagField(StringObject FieldName, ByteArray* FieldValue)
{
	bool bRet = false;
	if ( m_bOpened )
	{
		if ( m_pImpl )
		{
			Intel::Mobile::BaseAPI::InstanceObject* pAPI_Instance = reinterpret_cast<Intel::Mobile::BaseAPI::InstanceObject*>(m_pImpl);
			if ( pAPI_Instance )
			{
				TRYBLOCK {
					IntelMobileString wsParams = "0";
					wsParams.append(FIRST_SPLITTER);
					wsParams.append(FieldName.GetValue());

					IntelMobileChar* infoString = pAPI_Instance->InvokeMethod( "ReadTagField", (IntelMobileChar *)wsParams.c_str() );
					IntelMobileString wsRtn = infoString;
					delete[] infoString;

					vector<IntelMobileString> wsVec;
					CStringHelper::Str2ParamVect(wsRtn, wsVec, FIRST_SPLITTER);

					int j = 0;
					for ( vector<IntelMobileString>::iterator itr = wsVec.begin();
						itr != wsVec.end();
						itr ++, j++ )
					{
						if ( 0 == j )
						{
							CStringHelper::Str2Param(*itr, bRet);
						}
						else if ( 1 == j )
						{
							vector<BYTE> vecFieldValue;
							CStringHelper::Str2Param(*itr, vecFieldValue);
							for ( vector<BYTE>::iterator itr = vecFieldValue.begin();
								itr != vecFieldValue.end();
								itr ++ )
							{
								BYTE byte = *itr;
								FieldValue->Insert(byte);
							}
						}
						else
						{
							throw "Returned string unmatched.";
						}
					}
				} CATCHBLOCK
			}
			else
				THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "ReadTagField");
		}
		else
			THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "ReadTagField");
	}
	else
	{
		THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "ReadTagField");
	}
	return bRet;
}

bool RfidReaderInstance::ReadTagField(StringObject TagId, StringObject FieldName, ByteArray* FieldValue)
{
	bool bRet = false;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -