2002-03-21 03:58:39 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2000 Corel Corporation
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-21 03:58:39 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
2006-05-08 20:05:42 +02:00
|
|
|
#include "sane_i.h"
|
2002-03-21 03:58:39 +01:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(twain);
|
|
|
|
|
|
|
|
/* DG_CONTROL/DAT_CAPABILITY/MSG_GET */
|
2006-05-08 20:05:42 +02:00
|
|
|
TW_UINT16 SANE_CapabilityGet (pTW_IDENTITY pOrigin, TW_MEMREF pData)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
|
|
|
TW_UINT16 twRC = TWRC_SUCCESS, twCC = TWCC_SUCCESS;
|
|
|
|
pTW_CAPABILITY pCapability = (pTW_CAPABILITY) pData;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2002-03-21 03:58:39 +01:00
|
|
|
TRACE("DG_CONTROL/DAT_CAPABILITY/MSG_GET\n");
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-05-08 20:05:42 +02:00
|
|
|
if (activeDS.currentState < 4 || activeDS.currentState > 7)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
|
|
|
twRC = TWRC_FAILURE;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = TWCC_SEQERROR;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-08 20:05:42 +02:00
|
|
|
twCC = SANE_SaneCapability (pCapability, MSG_GET);
|
2002-03-21 03:58:39 +01:00
|
|
|
twRC = (twCC == TWCC_SUCCESS)?TWRC_SUCCESS:TWRC_FAILURE;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = twCC;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return twRC;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DG_CONTROL/DAT_CAPABILITY/MSG_GETCURRENT */
|
2006-05-08 20:05:42 +02:00
|
|
|
TW_UINT16 SANE_CapabilityGetCurrent (pTW_IDENTITY pOrigin, TW_MEMREF pData)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
|
|
|
TW_UINT16 twRC = TWRC_SUCCESS, twCC = TWCC_SUCCESS;
|
|
|
|
pTW_CAPABILITY pCapability = (pTW_CAPABILITY) pData;
|
|
|
|
|
|
|
|
TRACE("DG_CONTROL/DAT_CAPABILITY/MSG_GETCURRENT\n");
|
|
|
|
|
2006-05-08 20:05:42 +02:00
|
|
|
if (activeDS.currentState < 4 || activeDS.currentState > 7)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
|
|
|
twRC = TWRC_FAILURE;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = TWCC_SEQERROR;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-08 20:05:42 +02:00
|
|
|
twCC = SANE_SaneCapability (pCapability, MSG_GETCURRENT);
|
2002-03-21 03:58:39 +01:00
|
|
|
twRC = (twCC == TWCC_SUCCESS)?TWRC_SUCCESS:TWRC_FAILURE;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = twCC;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2002-03-21 03:58:39 +01:00
|
|
|
|
|
|
|
return twRC;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DG_CONTROL/DAT_CAPABILITY/MSG_GETDEFAULT */
|
2006-05-08 20:05:42 +02:00
|
|
|
TW_UINT16 SANE_CapabilityGetDefault (pTW_IDENTITY pOrigin, TW_MEMREF pData)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
|
|
|
TW_UINT16 twRC = TWRC_SUCCESS, twCC = TWCC_SUCCESS;
|
|
|
|
pTW_CAPABILITY pCapability = (pTW_CAPABILITY) pData;
|
|
|
|
|
|
|
|
TRACE("DG_CONTROL/DAT_CAPABILITY/MSG_GETDEFAULT\n");
|
|
|
|
|
2006-05-08 20:05:42 +02:00
|
|
|
if (activeDS.currentState < 4 || activeDS.currentState > 7)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
|
|
|
twRC = TWRC_FAILURE;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = TWCC_SEQERROR;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-08 20:05:42 +02:00
|
|
|
twCC = SANE_SaneCapability (pCapability, MSG_GETDEFAULT);
|
2002-03-21 03:58:39 +01:00
|
|
|
twRC = (twCC == TWCC_SUCCESS)?TWRC_SUCCESS:TWRC_FAILURE;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = twCC;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return twRC;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT */
|
2006-05-08 20:05:42 +02:00
|
|
|
TW_UINT16 SANE_CapabilityQuerySupport (pTW_IDENTITY pOrigin,
|
|
|
|
TW_MEMREF pData)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
2009-02-02 23:12:55 +01:00
|
|
|
TW_UINT16 twRC = TWRC_SUCCESS, twCC = TWCC_SUCCESS;
|
|
|
|
pTW_CAPABILITY pCapability = (pTW_CAPABILITY) pData;
|
2002-03-21 03:58:39 +01:00
|
|
|
|
2009-02-02 23:12:55 +01:00
|
|
|
TRACE("DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT\n");
|
|
|
|
|
|
|
|
if (activeDS.currentState < 4 || activeDS.currentState > 7)
|
|
|
|
{
|
|
|
|
twRC = TWRC_FAILURE;
|
|
|
|
activeDS.twCC = TWCC_SEQERROR;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
twCC = SANE_SaneCapability (pCapability, MSG_QUERYSUPPORT);
|
|
|
|
twRC = (twCC == TWCC_SUCCESS)?TWRC_SUCCESS:TWRC_FAILURE;
|
|
|
|
activeDS.twCC = twCC;
|
|
|
|
}
|
|
|
|
|
|
|
|
return twRC;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* DG_CONTROL/DAT_CAPABILITY/MSG_RESET */
|
2006-05-08 20:05:42 +02:00
|
|
|
TW_UINT16 SANE_CapabilityReset (pTW_IDENTITY pOrigin,
|
2002-03-21 03:58:39 +01:00
|
|
|
TW_MEMREF pData)
|
|
|
|
{
|
|
|
|
TW_UINT16 twRC = TWRC_SUCCESS, twCC = TWCC_SUCCESS;
|
|
|
|
pTW_CAPABILITY pCapability = (pTW_CAPABILITY) pData;
|
|
|
|
|
|
|
|
TRACE("DG_CONTROL/DAT_CAPABILITY/MSG_RESET\n");
|
|
|
|
|
2006-05-08 20:05:42 +02:00
|
|
|
if (activeDS.currentState < 4 || activeDS.currentState > 7)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
|
|
|
twRC = TWRC_FAILURE;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = TWCC_SEQERROR;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-08 20:05:42 +02:00
|
|
|
twCC = SANE_SaneCapability (pCapability, MSG_RESET);
|
2002-03-21 03:58:39 +01:00
|
|
|
twRC = (twCC == TWCC_SUCCESS)?TWRC_SUCCESS:TWRC_FAILURE;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = twCC;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return twRC;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DG_CONTROL/DAT_CAPABILITY/MSG_SET */
|
2006-05-08 20:05:42 +02:00
|
|
|
TW_UINT16 SANE_CapabilitySet (pTW_IDENTITY pOrigin,
|
2002-03-21 03:58:39 +01:00
|
|
|
TW_MEMREF pData)
|
|
|
|
{
|
|
|
|
TW_UINT16 twRC = TWRC_SUCCESS, twCC = TWCC_SUCCESS;
|
|
|
|
pTW_CAPABILITY pCapability = (pTW_CAPABILITY) pData;
|
|
|
|
|
|
|
|
TRACE ("DG_CONTROL/DAT_CAPABILITY/MSG_SET\n");
|
|
|
|
|
2006-05-08 20:05:42 +02:00
|
|
|
if (activeDS.currentState != 4)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
|
|
|
twRC = TWRC_FAILURE;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = TWCC_SEQERROR;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-08 20:05:42 +02:00
|
|
|
twCC = SANE_SaneCapability (pCapability, MSG_SET);
|
2009-02-23 23:25:26 +01:00
|
|
|
if (twCC == TWCC_CHECKSTATUS)
|
|
|
|
{
|
|
|
|
twCC = TWCC_SUCCESS;
|
|
|
|
twRC = TWRC_CHECKSTATUS;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
twRC = (twCC == TWCC_SUCCESS)?TWRC_SUCCESS:TWRC_FAILURE;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = twCC;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
return twRC;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DG_CONTROL/DAT_EVENT/MSG_PROCESSEVENT */
|
2006-05-08 20:05:42 +02:00
|
|
|
TW_UINT16 SANE_ProcessEvent (pTW_IDENTITY pOrigin,
|
2002-03-21 03:58:39 +01:00
|
|
|
TW_MEMREF pData)
|
|
|
|
{
|
2009-02-09 20:02:28 +01:00
|
|
|
TW_UINT16 twRC = TWRC_NOTDSEVENT;
|
2002-03-21 03:58:39 +01:00
|
|
|
pTW_EVENT pEvent = (pTW_EVENT) pData;
|
2009-02-09 20:02:28 +01:00
|
|
|
MSG *pMsg = pEvent->pEvent;
|
2002-03-21 03:58:39 +01:00
|
|
|
|
2022-02-17 07:12:15 +01:00
|
|
|
TRACE("DG_CONTROL/DAT_EVENT/MSG_PROCESSEVENT msg 0x%x, wParam 0x%Ix\n", pMsg->message, pMsg->wParam);
|
2002-03-21 03:58:39 +01:00
|
|
|
|
2009-02-09 20:02:28 +01:00
|
|
|
activeDS.twCC = TWCC_SUCCESS;
|
2017-11-14 22:14:11 +01:00
|
|
|
pEvent->TWMessage = MSG_NULL; /* no message to the application */
|
2009-02-09 20:02:28 +01:00
|
|
|
|
|
|
|
if (activeDS.currentState < 5 || activeDS.currentState > 7)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
2009-02-09 20:02:28 +01:00
|
|
|
twRC = TWRC_FAILURE;
|
|
|
|
activeDS.twCC = TWCC_SEQERROR;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return twRC;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DG_CONTROL/DAT_PENDINGXFERS/MSG_ENDXFER */
|
2006-05-08 20:05:42 +02:00
|
|
|
TW_UINT16 SANE_PendingXfersEndXfer (pTW_IDENTITY pOrigin,
|
2002-03-21 03:58:39 +01:00
|
|
|
TW_MEMREF pData)
|
|
|
|
{
|
|
|
|
TW_UINT16 twRC = TWRC_SUCCESS;
|
|
|
|
pTW_PENDINGXFERS pPendingXfers = (pTW_PENDINGXFERS) pData;
|
|
|
|
|
|
|
|
TRACE("DG_CONTROL/DAT_PENDINGXFERS/MSG_ENDXFER\n");
|
|
|
|
|
2006-05-08 20:05:42 +02:00
|
|
|
if (activeDS.currentState != 6 && activeDS.currentState != 7)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
|
|
|
twRC = TWRC_FAILURE;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = TWCC_SEQERROR;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-05 20:25:58 +01:00
|
|
|
pPendingXfers->Count = -1;
|
|
|
|
activeDS.currentState = 6;
|
2021-10-27 15:27:52 +02:00
|
|
|
if (SANE_CALL( start_device, NULL ))
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
2021-10-27 15:27:52 +02:00
|
|
|
pPendingXfers->Count = 0;
|
|
|
|
activeDS.currentState = 5;
|
|
|
|
/* Notify the application that it can close the data source */
|
|
|
|
SANE_Notify(MSG_CLOSEDSREQ);
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
twRC = TWRC_SUCCESS;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = TWCC_SUCCESS;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return twRC;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DG_CONTROL/DAT_PENDINGXFERS/MSG_GET */
|
2006-05-08 20:05:42 +02:00
|
|
|
TW_UINT16 SANE_PendingXfersGet (pTW_IDENTITY pOrigin,
|
2002-03-21 03:58:39 +01:00
|
|
|
TW_MEMREF pData)
|
|
|
|
{
|
|
|
|
TW_UINT16 twRC = TWRC_SUCCESS;
|
|
|
|
pTW_PENDINGXFERS pPendingXfers = (pTW_PENDINGXFERS) pData;
|
|
|
|
|
|
|
|
TRACE("DG_CONTROL/DAT_PENDINGXFERS/MSG_GET\n");
|
|
|
|
|
2006-05-08 20:05:42 +02:00
|
|
|
if (activeDS.currentState < 4 || activeDS.currentState > 7)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
|
|
|
twRC = TWRC_FAILURE;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = TWCC_SEQERROR;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-05 20:25:58 +01:00
|
|
|
pPendingXfers->Count = -1;
|
2021-10-27 15:27:52 +02:00
|
|
|
if (SANE_CALL( start_device, NULL ))
|
|
|
|
pPendingXfers->Count = 0;
|
2002-03-21 03:58:39 +01:00
|
|
|
twRC = TWRC_SUCCESS;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = TWCC_SUCCESS;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return twRC;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DG_CONTROL/DAT_PENDINGXFERS/MSG_RESET */
|
2006-05-08 20:05:42 +02:00
|
|
|
TW_UINT16 SANE_PendingXfersReset (pTW_IDENTITY pOrigin,
|
2002-03-21 03:58:39 +01:00
|
|
|
TW_MEMREF pData)
|
|
|
|
{
|
|
|
|
TW_UINT16 twRC = TWRC_SUCCESS;
|
|
|
|
pTW_PENDINGXFERS pPendingXfers = (pTW_PENDINGXFERS) pData;
|
|
|
|
|
|
|
|
TRACE("DG_CONTROL/DAT_PENDINGXFERS/MSG_RESET\n");
|
|
|
|
|
2006-05-08 20:05:42 +02:00
|
|
|
if (activeDS.currentState != 6)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
|
|
|
twRC = TWRC_FAILURE;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = TWCC_SEQERROR;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pPendingXfers->Count = 0;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.currentState = 5;
|
2002-03-21 03:58:39 +01:00
|
|
|
twRC = TWRC_SUCCESS;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = TWCC_SUCCESS;
|
2021-10-27 15:27:52 +02:00
|
|
|
SANE_CALL( cancel_device, NULL );
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return twRC;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DG_CONTROL/DAT_SETUPMEMXFER/MSG_GET */
|
2006-05-08 20:05:42 +02:00
|
|
|
TW_UINT16 SANE_SetupMemXferGet (pTW_IDENTITY pOrigin,
|
2002-03-21 03:58:39 +01:00
|
|
|
TW_MEMREF pData)
|
|
|
|
{
|
2006-02-21 15:41:07 +01:00
|
|
|
pTW_SETUPMEMXFER pSetupMemXfer = (pTW_SETUPMEMXFER)pData;
|
|
|
|
|
|
|
|
TRACE("DG_CONTROL/DAT_SETUPMEMXFER/MSG_GET\n");
|
2021-10-27 13:25:00 +02:00
|
|
|
if (activeDS.frame_params.bytes_per_line)
|
2006-02-21 15:41:07 +01:00
|
|
|
{
|
2021-10-27 13:25:00 +02:00
|
|
|
pSetupMemXfer->MinBufSize = activeDS.frame_params.bytes_per_line;
|
|
|
|
pSetupMemXfer->MaxBufSize = activeDS.frame_params.bytes_per_line * 8;
|
|
|
|
pSetupMemXfer->Preferred = activeDS.frame_params.bytes_per_line * 2;
|
2006-02-21 15:41:07 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Guessing */
|
|
|
|
pSetupMemXfer->MinBufSize = 2000;
|
|
|
|
pSetupMemXfer->MaxBufSize = 8000;
|
|
|
|
pSetupMemXfer->Preferred = 4000;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TWRC_SUCCESS;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* DG_CONTROL/DAT_STATUS/MSG_GET */
|
2006-05-08 20:05:42 +02:00
|
|
|
TW_UINT16 SANE_GetDSStatus (pTW_IDENTITY pOrigin,
|
2002-03-21 03:58:39 +01:00
|
|
|
TW_MEMREF pData)
|
|
|
|
{
|
|
|
|
pTW_STATUS pSourceStatus = (pTW_STATUS) pData;
|
|
|
|
|
|
|
|
TRACE ("DG_CONTROL/DAT_STATUS/MSG_GET\n");
|
2006-05-08 20:05:42 +02:00
|
|
|
pSourceStatus->ConditionCode = activeDS.twCC;
|
|
|
|
/* Reset the condition code */
|
|
|
|
activeDS.twCC = TWCC_SUCCESS;
|
|
|
|
return TWRC_SUCCESS;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* DG_CONTROL/DAT_USERINTERFACE/MSG_DISABLEDS */
|
2006-05-08 20:05:42 +02:00
|
|
|
TW_UINT16 SANE_DisableDSUserInterface (pTW_IDENTITY pOrigin,
|
|
|
|
TW_MEMREF pData)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
|
|
|
TW_UINT16 twRC = TWRC_SUCCESS;
|
|
|
|
|
|
|
|
TRACE ("DG_CONTROL/DAT_USERINTERFACE/MSG_DISABLEDS\n");
|
|
|
|
|
2006-05-08 20:05:42 +02:00
|
|
|
if (activeDS.currentState != 5)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
|
|
|
twRC = TWRC_FAILURE;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = TWCC_SEQERROR;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.currentState = 4;
|
2002-03-21 03:58:39 +01:00
|
|
|
twRC = TWRC_SUCCESS;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = TWCC_SUCCESS;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return twRC;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DG_CONTROL/DAT_USERINTERFACE/MSG_ENABLEDS */
|
2006-05-08 20:05:42 +02:00
|
|
|
TW_UINT16 SANE_EnableDSUserInterface (pTW_IDENTITY pOrigin,
|
|
|
|
TW_MEMREF pData)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
|
|
|
TW_UINT16 twRC = TWRC_SUCCESS;
|
|
|
|
pTW_USERINTERFACE pUserInterface = (pTW_USERINTERFACE) pData;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2002-03-21 03:58:39 +01:00
|
|
|
TRACE ("DG_CONTROL/DAT_USERINTERFACE/MSG_ENABLEDS\n");
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-05-08 20:05:42 +02:00
|
|
|
if (activeDS.currentState != 4)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
|
|
|
twRC = TWRC_FAILURE;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = TWCC_SEQERROR;
|
2009-03-06 19:44:44 +01:00
|
|
|
WARN("sequence error %d\n", activeDS.currentState);
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.hwndOwner = pUserInterface->hParent;
|
2002-03-21 03:58:39 +01:00
|
|
|
if (pUserInterface->ShowUI)
|
|
|
|
{
|
2006-03-22 20:34:22 +01:00
|
|
|
BOOL rc;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.currentState = 5; /* Transitions to state 5 */
|
|
|
|
rc = DoScannerUI();
|
2009-02-09 20:02:32 +01:00
|
|
|
pUserInterface->ModalUI = TRUE;
|
2006-03-22 20:34:22 +01:00
|
|
|
if (!rc)
|
|
|
|
{
|
2017-11-14 22:14:11 +01:00
|
|
|
SANE_Notify(MSG_CLOSEDSREQ);
|
2006-03-22 20:34:22 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-27 13:25:00 +02:00
|
|
|
get_sane_params( &activeDS.frame_params );
|
2006-03-22 20:34:22 +01:00
|
|
|
}
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* no UI will be displayed, so source is ready to transfer data */
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.currentState = 6; /* Transitions to state 6 directly */
|
2017-11-14 22:14:11 +01:00
|
|
|
SANE_Notify(MSG_XFERREADY);
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2002-03-21 03:58:39 +01:00
|
|
|
twRC = TWRC_SUCCESS;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = TWCC_SUCCESS;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return twRC;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DG_CONTROL/DAT_USERINTERFACE/MSG_ENABLEDSUIONLY */
|
2006-05-08 20:05:42 +02:00
|
|
|
TW_UINT16 SANE_EnableDSUIOnly (pTW_IDENTITY pOrigin,
|
2002-03-21 03:58:39 +01:00
|
|
|
TW_MEMREF pData)
|
|
|
|
{
|
|
|
|
TW_UINT16 twRC = TWRC_SUCCESS;
|
|
|
|
|
|
|
|
TRACE("DG_CONTROL/DAT_USERINTERFACE/MSG_ENABLEDSUIONLY\n");
|
|
|
|
|
2006-05-08 20:05:42 +02:00
|
|
|
if (activeDS.currentState != 4)
|
2002-03-21 03:58:39 +01:00
|
|
|
{
|
|
|
|
twRC = TWRC_FAILURE;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = TWCC_SEQERROR;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.currentState = 5;
|
2002-03-21 03:58:39 +01:00
|
|
|
twRC = TWRC_SUCCESS;
|
2006-05-08 20:05:42 +02:00
|
|
|
activeDS.twCC = TWCC_SUCCESS;
|
2002-03-21 03:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return twRC;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DG_CONTROL/DAT_XFERGROUP/MSG_GET */
|
2006-05-08 20:05:42 +02:00
|
|
|
TW_UINT16 SANE_XferGroupGet (pTW_IDENTITY pOrigin,
|
2002-03-21 03:58:39 +01:00
|
|
|
TW_MEMREF pData)
|
|
|
|
{
|
|
|
|
FIXME ("stub!\n");
|
|
|
|
|
|
|
|
return TWRC_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DG_CONTROL/DAT_XFERGROUP/MSG_SET */
|
2006-05-08 20:05:42 +02:00
|
|
|
TW_UINT16 SANE_XferGroupSet (pTW_IDENTITY pOrigin,
|
2002-03-21 03:58:39 +01:00
|
|
|
TW_MEMREF pData)
|
|
|
|
{
|
|
|
|
FIXME ("stub!\n");
|
|
|
|
|
|
|
|
return TWRC_FAILURE;
|
|
|
|
}
|