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

📄 rfidreaderinstanceobject.cpp

📁 270的linux说明
💻 CPP
📖 第 1 页 / 共 4 页
字号:

					CStringHelper::Str2Param( wsRtn, bRet );
				} CATCHBLOCK
			}
			else
				THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "PermanentlyUnlockTag");
		}
		else
			THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "PermanentlyUnlockTag");
	}
	else
	{
		THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "PermanentlyUnlockTag");
	}
	return bRet;
}
bool RfidReaderInstance::PermanentlyUnlockTag(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( "PermanentlyUnlockTag", (IntelMobileChar *)wsParams.c_str() );
					IntelMobileString wsRtn = infoString;
					delete[] infoString;

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

bool RfidReaderInstance::KillTag()
{
	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( "KillTag", (IntelMobileChar *)wsParams.c_str() );
					IntelMobileString wsRtn = infoString;
					delete[] infoString;

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

bool RfidReaderInstance::KillTag(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( "KillTag", (IntelMobileChar *)wsParams.c_str() );
					IntelMobileString wsRtn = infoString;
					delete[] infoString;

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

bool RfidReaderInstance::KillTag(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( "KillTag", (IntelMobileChar *)wsParams.c_str() );
					IntelMobileString wsRtn = infoString;
					delete[] infoString;

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

bool RfidReaderInstance::SetTagPassword(StringObject NewPassword)
{
	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(NewPassword.GetValue());

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

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

bool RfidReaderInstance::SetTagPassword(StringObject TagId, StringObject NewPassword)
{
	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(NewPassword.GetValue());

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

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

bool RfidReaderInstance::RemoveTagPassword(StringObject OldPassword)
{
	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(OldPassword.GetValue());

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

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

bool RfidReaderInstance::RemoveTagPassword(StringObject TagId, StringObject OldPassword)
{
	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(OldPassword.GetValue());
					wsParams.append(FIRST_SPLITTER);
					wsParams.append(TagId.GetValue());

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

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

bool RfidReaderInstance::ChangeTagPassword(StringObject OldPassword, StringObject NewPassword)
{
	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(OldPassword.GetValue());
					wsParams.append(FIRST_SPLITTER);
					wsParams.append(NewPassword.GetValue());

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

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

bool RfidReaderInstance::ChangeTagPassword(StringObject TagId, StringObject OldPassword, StringObject NewPassword)
{
	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(OldPassword.GetValue());
					wsParams.append(FIRST_SPLITTER);
					wsParams.append(NewPassword.GetValue());

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

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

bool RfidReaderInstance::QuietTag(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 = TagId.GetValue();

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

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

bool RfidReaderInstance::Open()
{
	bool bRet = true;
	if ( !m_bOpened )
	{
		bRet = false;
		if ( m_pImpl )
		{
			Intel::Mobile::BaseAPI::InstanceObject* pAPI_Instance = reinterpret_cast<Intel::Mobile::BaseAPI::InstanceObject*>(m_pImpl);
			if ( pAPI_Instance )
			{
				TRYBLOCK {
					DWORD dwProcessId = GetCurrentProcessId();
					IntelMobileString wsParams = CStringHelper::Param2Str(dwProcessId);

					IntelMobileChar* infoString = pAPI_Instance->InvokeMethod( "Open", (IntelMobileChar *)wsParams.c_str() );
					IntelMobileString wsRtn = infoString;
					delete[] infoString;
					CStringHelper::Str2Param( wsRtn, bRet );
					if ( bRet )
					{
						m_bOpened = true;
					}
				} CATCHBLOCK
			}
			else
				THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "Open");
		}
		else
			THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "Open");
	}

	if ( bRet )
	{
		m_nOpenCount++;
	}
	return bRet;
}

bool RfidReaderInstance::Close()
{
	bool bRet = true;

	if ( m_bOpened )
	{
		m_nOpenCount--;
		if ( 0 == m_nOpenCount )
		{
			m_nOpenCount = 1;
			bRet = false;

			if ( m_pImpl )
			{
				Intel::Mobile::BaseAPI::InstanceObject* pAPI_Instance = reinterpret_cast<Intel::Mobile::BaseAPI::InstanceObject*>(m_pImpl);
				if ( pAPI_Instance )
				{
					TRYBLOCK {
						DWORD dwProcessId = GetCurrentProcessId();
						IntelMobileString wsParams = CStringHelper::Param2Str(dwProcessId);

						IntelMobileChar* infoString = pAPI_Instance->InvokeMethod( "Close", (IntelMobileChar *)wsParams.c_str() );
						IntelMobileString wsRtn = infoString;
						delete[] infoString;
						CStringHelper::Str2Param( wsRtn, bRet );
						if ( bRet )
						{
							m_bOpened = false;
							m_nOpenCount = 0;
						}
					} CATCHBLOCK
				}
				else
					THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "Close");
			}
			else
				THROWNE("Intel::Mobile::Rfid::RfidReaderInstance", "Close");
		}
	}
	return bRet;
}

bool RfidReaderInstance::CheckInstance()
{
	if (!m_bOpened)		// have not opened
	{
		throw Intel::Mobile::Base::IntelMobileException("Function Open() should be called before accessing the device.","RfidReaderInstance", "", "", "");
	}
	return true;
}

namespace Intel
{
	namespace Mobile
	{
		namespace Rfid
		{
#define UCHAR unsigned char
			GENERATE_VECTOROBJECT(UCHAR);
			GENERATE_VECTOROBJECT(TagInfo);
		}
	}
}

⌨️ 快捷键说明

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