Exemplo n.º 1
0
/** Transfers the image or cancels the transfer depending on the state of the TWAIN system
 */
void TwainIface::TransferImage()
{
    TW_IMAGEINFO info;
    bool bContinue=true;

    while(bContinue)
    {
        if(GetImageInfo(info))
        {
            int permission = ShouldTransfer(info);

            switch(permission)
            {
                case TWCPP_CANCELTHIS:
                    bContinue=EndTransfer();
                    break;

                case TWCPP_CANCELALL:
                    CancelTransfer();
                    bContinue=false;
                    break;

                case TWCPP_DOTRANSFER:
                    bContinue=GetImage(info);
                    break;
            }
        }
    }
}
Exemplo n.º 2
0
/*
Trasnfers the image or cancels the transfer depending on the state of the
TWAIN system
*/
void CTwain::TransferImage()
{
TW_IMAGEINFO info;
BOOL bContinue=TRUE;
	while(bContinue)
	{
		if(GetImageInfo(info))
		{
			int permission;
			permission = ShouldTransfer(info);
			switch(permission)
			{
			case TWCPP_CANCELTHIS:
					bContinue=EndTransfer();
					break;
			case TWCPP_CANCELALL:
					CancelTransfer();
					bContinue=FALSE;
					break;
			case TWCPP_DOTRANSFER:
					bContinue=GetImage(info);
					break;
			}
		}
	}
}
Exemplo n.º 3
0
/*
Calls TWAIN to actually get the image
*/
BOOL CTwain::GetImage(TW_IMAGEINFO& info)
{
HANDLE hBitmap;
	CallTwainProc(&m_AppId,&m_Source,DG_IMAGE,DAT_IMAGENATIVEXFER,MSG_GET,&hBitmap);
	switch(m_returnCode)
	{
	case TWRC_XFERDONE:
		TRACE("********** GetImage --> TWRC_XFERDONE ************\n");
			CopyImage(hBitmap,info);
			break;
	case TWRC_CANCEL:
		TRACE("GetImage --> TWRC_CANCEL.\n");
			break;
	case TWRC_FAILURE:
		TRACE("********** GetImage --> TWRC_FAILURE ************\n");
			CancelTransfer();
			return FALSE;
	default:
		TRACE("GetImage --> default.\n");
		break;
	}
	GlobalFree(hBitmap);

	TRACE("********** GetImage --> done ************\n");
	return EndTransfer();
}
Exemplo n.º 4
0
/** Calls TWAIN to actually get the image */
bool KSaneWidgetPrivate::GetImage(TW_IMAGEINFO& info)
{
    TW_MEMREF pdata;
    CallTwainProc(&m_AppId, &m_Source, DG_IMAGE, DAT_IMAGENATIVEXFER, MSG_GET, &pdata);

    switch(m_returnCode)
    {
        case TWRC_XFERDONE:
            //qDebug()<< "GetImage:TWRC_XFERDONE";
            ImageData(pdata, info);
            break;

        case TWRC_CANCEL:
            //qDebug()<< "GetImage:TWRC_CANCEL";
            break;

        case TWRC_FAILURE:
            //qDebug()<< "GetImage:TWRC_FAILURE";
            CancelTransfer();
            return false;
            break;
    }

    GlobalFree(pdata);
    return EndTransfer();
}
Exemplo n.º 5
0
/*
Trasnfers the image or cancels the transfer depending on the state of the
TWAIN system
*/
void CTwain::TransferImage()
{
	TW_IMAGEINFO info;
	BOOL bContinue = TRUE;
	int nScanStatus = 0;		//扫描结束时状态,1--正常扫描结束
	TRACE("********** TransferImage ************\n");
	while(bContinue)
	{
		if (GetImageInfo(info) && _bTwainContinue)		//GetImageInfo(info)
		{
			int permission;
			permission = ShouldTransfer(info);
			switch(permission)
			{
			case TWCPP_CANCELTHIS:
				TRACE("************ TransferImage--> TWCPP_CANCELTHIS. 1 ************\n");
					bContinue=EndTransfer();
					nScanStatus = -1;
					TRACE("************ TransferImage--> TWCPP_CANCELTHIS.2 ************\n");
					break;
			case TWCPP_CANCELALL:
				TRACE("************ TransferImage--> TWCPP_CANCELALL. 1 ************\n");
					CancelTransfer();
					bContinue=FALSE;
					nScanStatus = -2;
					TRACE("************ TransferImage--> TWCPP_CANCELALL. 2 ************\n");
					break;
			case TWCPP_DOTRANSFER:
				TRACE("********** TransferImage --> TWCPP_DOTRANSFER ************\n");
					bContinue=GetImage(info);
					if (!_bHasNextPic)
						nScanStatus = 1;
					else
						nScanStatus = 2; 
					break;
			default:
				TRACE("************ TransferImage--> default. ************\n");
				bContinue = FALSE;
				nScanStatus = -3;
				break;
			}
		}
		else
		{
			TRACE("************ TransferImage --> GetImageInfo failed or m_bContinue = false *************\n");
			nScanStatus = -4;
			EndTransfer();
			bContinue = FALSE;
		}
	}
	TRACE("******* 扫描完成 ***********\n");
	ScanDone(nScanStatus);
}
Exemplo n.º 6
0
void COPPController::HandleError(TBool aAbort)
    {
    TRACE_ERROR((_L( "[oppreceiveservice] COPPController:HandleError" )));
    iReceivingFailed = ETrue;
    iShowRecvCompleteDialog = EFalse;
    if( iObexTransferState == ETransferPut || (!aAbort && iObexTransferState == ETransferPutDiskError) )
        {        
        CancelTransfer();
        if(iMediaType == ESrcsMediaBT)
            {
            TRAP_IGNORE(
                    LaunchFailureDialogL();
                    );
Exemplo n.º 7
0
/*
Calls TWAIN to actually get the image
*/
BOOL CTwain::GetImage(TW_IMAGEINFO& info)
{
HANDLE hBitmap;
	CallTwainProc(&m_AppId,&m_Source,DG_IMAGE,DAT_IMAGENATIVEXFER,MSG_GET,&hBitmap);
	switch(m_returnCode)
	{
	case TWRC_XFERDONE:
			CopyImage(hBitmap,info);
			break;
	case TWRC_CANCEL:
			break;
	case TWRC_FAILURE:
			CancelTransfer();
			return FALSE;

	}
	GlobalFree(hBitmap);
	return EndTransfer();
}
Exemplo n.º 8
0
/** Calls TWAIN to actually get the image
 */
bool TwainIface::GetImage(TW_IMAGEINFO& info)
{
    TW_MEMREF pdata;
    CallTwainProc(&m_AppId, &m_Source, DG_IMAGE, DAT_IMAGENATIVEXFER, MSG_GET, &pdata);

    switch(m_returnCode)
    {
        case TWRC_XFERDONE:
            CopyImage(pdata, info);
            break;

        case TWRC_CANCEL:
            break;

        case TWRC_FAILURE:
            CancelTransfer();
            return false;
            break;
    }

    GlobalFree(pdata);
    return EndTransfer();
}
Exemplo n.º 9
0
/* ===================================================================*/
LDD_TDeviceData* DMA1_InitChannel(LDD_TDeviceData *DeviceDataPtr, DMA1_TChnInit *ChIntPtr, LDD_TUserData *UserDataPtr)
{
  uint32_t                         LogChnNum      = ChIntPtr->ChnNum;
  DMA1_TChnDevData                *ChnDevDataPtr;
  DMA1_TChnDevConst const         *ChnDevConstPtr;
  DMA1_TTCD                       *TCDPtr;
  uint8_t                         PhyChnNum;

  ChnDevDataPtr  = &((DMA1_TDeviceData *)DeviceDataPtr)->ChnDevData[LogChnNum];
  ChnDevConstPtr = &(DMA1_DevConst.ChnDevConst[LogChnNum]);
  TCDPtr         = ChnDevConstPtr->TCDPtr;
  PhyChnNum = ChnDevConstPtr->PhyChnNum;
  DMA_PDD_EnablePeripheralRequest(DMA_BASE_PTR, PhyChnNum, PDD_DISABLE); /* Disable channel peripheral request (in the DMAMUX) */
  CancelTransfer(ChnDevConstPtr);                          /* Cancel transfer (if pending) */
  *TCDPtr = ChIntPtr->TCD;                                 /* Initialize channel TCD (channel registers) */
  ChnDevDataPtr->ChnDevConstPtr = ChnDevConstPtr;          /* Remember channel constants address */
  ChnDevDataPtr->TCDPtr = TCDPtr;                          /* Remember channel TCD address */
  ChnDevDataPtr->UserDataPtr = UserDataPtr;                /* Remember channel User data pointer */
  ChnDevDataPtr->Events = ChIntPtr->Events;                /* Initialize events */
  DMA_PDD_EnableErrorInterrupt(DMA_BASE_PTR, PhyChnNum);
  DMAMUX_PDD_SetChannelSource(DMAMUX_BASE_PTR, PhyChnNum, ChIntPtr->MUX_CHCFG_Reg); /* Set channel peripheral request (in the DMAMUX) */
  return ChnDevDataPtr;
}