Exemple #1
0
int CMFPI::N_AfterReadRawData(HRESULT hResult, LPVOID lpBuffer)
{
    LPLFSIDCCARDDATA *lppCardData = (LPLFSIDCCARDDATA *)((LPLFSRESULT)lpBuffer);

    if(LFS_SUCCESS == hResult)
	{
		if(lppCardData == NULL)
		{
            emit DeviceError();
			LOGERROR("%s,SP数据为空。",__FUNCTION__);
            Alarm("07000002");
			return -1;
		}

        QString str = (char *)lppCardData[0]->data;
        int index = str.indexOf('|');
		if(index != -1)
            m_FingerData = str.mid(index+1,str.length()-index-1);
		else
			m_FingerData = str;

        if(LFS_IDC_CHIP == lppCardData[0]->data_source)
		{
            emit DataAcquired(m_FingerData);
            LOGINFO("%s,事件:DataAcquired(%s)",__FUNCTION__,m_FingerData.toStdString().c_str());
		}
        else if(LFS_IDC_TRACK1 == lppCardData[0]->data_source)
		{
            emit IdentifyComplete(m_FingerData);
            LOGINFO("%s,事件:IdentifyComplete(%s),len = %d",__FUNCTION__,m_FingerData.mid(0,200).toStdString().c_str(),m_FingerData.length());
		}
	}
    else if(LFS_ERR_CANCELED == hResult && LFS_IDC_TRACK1 == m_Tracks)
	{
        emit IdentifyCancelled();
		LOGINFO("%s,事件:IdentifyCancelled()",__FUNCTION__);
	}
    else if(LFS_SUCCESS != hResult && LFS_IDC_TRACK1 == m_Tracks )
	{
        emit IdentifyFailed();
		LOGINFO("%s,事件:IdentifyFailed,错误码:hResult = %d",__FUNCTION__,hResult);
	}
    else if (LFS_ERR_CANCELED == hResult && ((LFS_IDC_CHIP && m_Tracks) == LFS_IDC_CHIP))// 添加 AcquireDataCancelled 事件,
	{
        emit AcquireDataCancelled();
		LOGINFO("%s,事件:AcquireDataCancelled",__FUNCTION__);
	}
    else if (LFS_SUCCESS != hResult && ((LFS_IDC_CHIP && m_Tracks) == LFS_IDC_CHIP) )//添加 DataAcquireFailed 事件
	{
        emit DataAcquireFailed();
		LOGINFO("%s,事件:DataAcquireFailed,错误码:hResult = %d",__FUNCTION__,hResult);
	}
	/*	else
	{
	DeviceError();
	LOGERROR("%s,执行错误,错误码:hResult = %d",__FUNCTION__,hResult);
	}	*/  

	return hResult;
}
Exemple #2
0
//取消当前正在执行的命令
int CMFPI::N_Cancel(WORD requestID)
{
    int ret = m_apiCtrl.LFSCancelAsyncRequest(0);
    if(LFS_SUCCESS!=ret)
	{
        emit DeviceError();
		LOGERROR("%s,执行错误,错误码:%d",__FUNCTION__,ret);
        Alarm("07000000");
	}

	return ret;
}
ConnInterface::Ptr ConnInterface::open_url(std::string url, int baudrate)
{

	/* Based on code found here:
	 * http://stackoverflow.com/questions/2616011/easy-way-to-parse-a-url-in-c-cross-platform
	 */

	const std::string proto_end("://");
	std::string proto;
	std::string host;
	std::string path;
	std::string query;

	auto proto_it = std::search(
			url.begin(), url.end(),
			proto_end.begin(), proto_end.end());
	if (proto_it == url.end()) {
		// looks like file path
//		ROS_DEBUG_NAMED("conn", "URL: %s: looks like file path", url.c_str());
        return url_parse_serial(url, baudrate, "");
	}

	// copy protocol
	proto.reserve(std::distance(url.begin(), proto_it));
	std::transform(url.begin(), proto_it,
			std::back_inserter(proto),
			std::ref(tolower));

	// copy host
	std::advance(proto_it, proto_end.length());
	auto path_it = std::find(proto_it, url.end(), '/');
	std::transform(proto_it, path_it,
			std::back_inserter(host),
			std::ref(tolower));

	// copy path, and query if exists
	auto query_it = std::find(path_it, url.end(), '?');
	path.assign(path_it, query_it);
	if (query_it != url.end())
		++query_it;
	query.assign(query_it, url.end());

//	ROS_DEBUG_NAMED("conn", "URL: %s: proto: %s, host: %s, path: %s, query: %s",
//			url.c_str(), proto.c_str(), host.c_str(), path.c_str(), query.c_str());


    if (proto == "serial")
        return url_parse_serial(path, baudrate, query);
	else
		throw DeviceError("url", "Unknown URL type");
}