d3d9: Also copy the AutoDepthStencilFormat field in GetPresentParameters().
[wine] / dlls / sane.ds / ds_ctrl.c
1 /*
2  * Copyright 2000 Corel Corporation
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #include "config.h"
20
21 #ifdef HAVE_UNISTD_H
22 # include <unistd.h>
23 #endif
24 #include <stdlib.h>
25 #include "twain.h"
26 #include "sane_i.h"
27 #include "wine/debug.h"
28
29 WINE_DEFAULT_DEBUG_CHANNEL(twain);
30
31 /* DG_CONTROL/DAT_CAPABILITY/MSG_GET */
32 TW_UINT16 SANE_CapabilityGet (pTW_IDENTITY pOrigin, TW_MEMREF pData)
33 {
34     TW_UINT16 twRC = TWRC_SUCCESS, twCC = TWCC_SUCCESS;
35     pTW_CAPABILITY pCapability = (pTW_CAPABILITY) pData;
36
37     TRACE("DG_CONTROL/DAT_CAPABILITY/MSG_GET\n");
38
39     if (activeDS.currentState < 4 || activeDS.currentState > 7)
40     {
41         twRC = TWRC_FAILURE;
42         activeDS.twCC = TWCC_SEQERROR;
43     }
44     else
45     {
46         twCC = SANE_SaneCapability (pCapability, MSG_GET);
47         twRC = (twCC == TWCC_SUCCESS)?TWRC_SUCCESS:TWRC_FAILURE;
48         activeDS.twCC = twCC;
49     }
50
51     return twRC;
52 }
53
54 /* DG_CONTROL/DAT_CAPABILITY/MSG_GETCURRENT */
55 TW_UINT16 SANE_CapabilityGetCurrent (pTW_IDENTITY pOrigin, TW_MEMREF pData)
56 {
57     TW_UINT16 twRC = TWRC_SUCCESS, twCC = TWCC_SUCCESS;
58     pTW_CAPABILITY pCapability = (pTW_CAPABILITY) pData;
59
60     TRACE("DG_CONTROL/DAT_CAPABILITY/MSG_GETCURRENT\n");
61
62     if (activeDS.currentState < 4 || activeDS.currentState > 7)
63     {
64         twRC = TWRC_FAILURE;
65         activeDS.twCC = TWCC_SEQERROR;
66     }
67     else
68     {
69         twCC = SANE_SaneCapability (pCapability, MSG_GETCURRENT);
70         twRC = (twCC == TWCC_SUCCESS)?TWRC_SUCCESS:TWRC_FAILURE;
71         activeDS.twCC = twCC;
72     }
73
74     return twRC;
75 }
76
77 /* DG_CONTROL/DAT_CAPABILITY/MSG_GETDEFAULT */
78 TW_UINT16 SANE_CapabilityGetDefault (pTW_IDENTITY pOrigin, TW_MEMREF pData)
79 {
80     TW_UINT16 twRC = TWRC_SUCCESS, twCC = TWCC_SUCCESS;
81     pTW_CAPABILITY pCapability = (pTW_CAPABILITY) pData;
82
83     TRACE("DG_CONTROL/DAT_CAPABILITY/MSG_GETDEFAULT\n");
84
85     if (activeDS.currentState < 4 || activeDS.currentState > 7)
86     {
87         twRC = TWRC_FAILURE;
88         activeDS.twCC = TWCC_SEQERROR;
89     }
90     else
91     {
92         twCC = SANE_SaneCapability (pCapability, MSG_GETDEFAULT);
93         twRC = (twCC == TWCC_SUCCESS)?TWRC_SUCCESS:TWRC_FAILURE;
94         activeDS.twCC = twCC;
95     }
96
97     return twRC;
98 }
99
100 /* DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT */
101 TW_UINT16 SANE_CapabilityQuerySupport (pTW_IDENTITY pOrigin,
102                                         TW_MEMREF pData)
103 {
104     TW_UINT16 twRC = TWRC_SUCCESS, twCC = TWCC_SUCCESS;
105     pTW_CAPABILITY pCapability = (pTW_CAPABILITY) pData;
106
107     TRACE("DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT\n");
108
109     if (activeDS.currentState < 4 || activeDS.currentState > 7)
110     {
111         twRC = TWRC_FAILURE;
112         activeDS.twCC = TWCC_SEQERROR;
113     }
114     else
115     {
116         twCC = SANE_SaneCapability (pCapability, MSG_QUERYSUPPORT);
117         twRC = (twCC == TWCC_SUCCESS)?TWRC_SUCCESS:TWRC_FAILURE;
118         activeDS.twCC = twCC;
119     }
120
121     return twRC;
122 }
123
124 /* DG_CONTROL/DAT_CAPABILITY/MSG_RESET */
125 TW_UINT16 SANE_CapabilityReset (pTW_IDENTITY pOrigin, 
126                                  TW_MEMREF pData)
127 {
128     TW_UINT16 twRC = TWRC_SUCCESS, twCC = TWCC_SUCCESS;
129     pTW_CAPABILITY pCapability = (pTW_CAPABILITY) pData;
130
131     TRACE("DG_CONTROL/DAT_CAPABILITY/MSG_RESET\n");
132
133     if (activeDS.currentState < 4 || activeDS.currentState > 7)
134     {
135         twRC = TWRC_FAILURE;
136         activeDS.twCC = TWCC_SEQERROR;
137     }
138     else
139     {
140         twCC = SANE_SaneCapability (pCapability, MSG_RESET);
141         twRC = (twCC == TWCC_SUCCESS)?TWRC_SUCCESS:TWRC_FAILURE;
142         activeDS.twCC = twCC;
143     }
144
145     return twRC;
146 }
147
148 /* DG_CONTROL/DAT_CAPABILITY/MSG_SET */
149 TW_UINT16 SANE_CapabilitySet (pTW_IDENTITY pOrigin, 
150                                TW_MEMREF pData)
151 {
152     TW_UINT16 twRC = TWRC_SUCCESS, twCC = TWCC_SUCCESS;
153     pTW_CAPABILITY pCapability = (pTW_CAPABILITY) pData;
154
155     TRACE ("DG_CONTROL/DAT_CAPABILITY/MSG_SET\n");
156
157     if (activeDS.currentState != 4)
158     {
159         twRC = TWRC_FAILURE;
160         activeDS.twCC = TWCC_SEQERROR;
161     }
162     else
163     {
164         twCC = SANE_SaneCapability (pCapability, MSG_SET);
165         twRC = (twCC == TWCC_SUCCESS)?TWRC_SUCCESS:TWRC_FAILURE;
166         activeDS.twCC = twCC;
167     }
168     return twRC;
169 }
170
171 /* DG_CONTROL/DAT_CUSTOMDSDATA/MSG_GET */
172 TW_UINT16 SANE_CustomDSDataGet (pTW_IDENTITY pOrigin, 
173                                 TW_MEMREF pData)
174 {
175     FIXME ("stub!\n");
176
177     return TWRC_FAILURE;
178 }
179
180 /* DG_CONTROL/DAT_CUSTOMDSDATA/MSG_SET */
181 TW_UINT16 SANE_CustomDSDataSet (pTW_IDENTITY pOrigin, 
182                                  TW_MEMREF pData)
183 {
184     FIXME ("stub!\n");
185
186     return TWRC_FAILURE;
187 }
188
189 /* DG_CONTROL/DAT_FILESYSTEM/MSG_AUTOMATICCAPTUREDIRECTORY */
190 TW_UINT16 SANE_AutomaticCaptureDirectory (pTW_IDENTITY pOrigin,
191                                            
192                                            TW_MEMREF pData)
193 {
194     FIXME ("stub!\n");
195
196     return TWRC_FAILURE;
197 }
198
199 /* DG_CONTROL/DAT_FILESYSTEM/MSG_CHANGEDIRECTORY */
200 TW_UINT16 SANE_ChangeDirectory (pTW_IDENTITY pOrigin, 
201                                  TW_MEMREF pData)
202 {
203     FIXME ("stub!\n");
204
205     return TWRC_FAILURE;
206 }
207
208 /* DG_CONTROL/DAT_FILESYSTEM/MSG_COPY */
209 TW_UINT16 SANE_FileSystemCopy (pTW_IDENTITY pOrigin, 
210                                 TW_MEMREF pData)
211 {
212     FIXME ("stub!\n");
213
214     return TWRC_FAILURE;
215 }
216
217 /* DG_CONTROL/DAT_FILESYSTEM/MSG_CREATEDIRECTORY */
218 TW_UINT16 SANE_CreateDirectory (pTW_IDENTITY pOrigin, 
219                                  TW_MEMREF pData)
220 {
221     FIXME ("stub!\n");
222
223     return TWRC_FAILURE;
224 }
225
226 /* DG_CONTROL/DAT_FILESYSTEM/MSG_DELETE */
227 TW_UINT16 SANE_FileSystemDelete (pTW_IDENTITY pOrigin, 
228                                   TW_MEMREF pData)
229 {
230     FIXME ("stub!\n");
231
232     return TWRC_FAILURE;
233 }
234
235 /* DG_CONTROL/DAT_FILESYSTEM/MSG_FORMATMEDIA */
236 TW_UINT16 SANE_FormatMedia (pTW_IDENTITY pOrigin, 
237                              TW_MEMREF pData)
238 {
239     FIXME ("stub!\n");
240
241     return TWRC_FAILURE;
242 }
243
244 /* DG_CONTROL/DAT_FILESYSTEM/MSG_GETCLOSE */
245 TW_UINT16 SANE_FileSystemGetClose (pTW_IDENTITY pOrigin, 
246                                     TW_MEMREF pData)
247 {
248     FIXME ("stub!\n");
249
250     return TWRC_FAILURE;
251 }
252
253 /* DG_CONTROL/DAT_FILESYSTEM/MSG_GETFIRSTFILE */
254 TW_UINT16 SANE_FileSystemGetFirstFile (pTW_IDENTITY pOrigin,
255                                         
256                                         TW_MEMREF pData)
257 {
258     FIXME ("stub!\n");
259
260     return TWRC_FAILURE;
261 }
262
263 /* DG_CONTROL/DAT_FILESYSTEM/MSG_GETINFO */
264 TW_UINT16 SANE_FileSystemGetInfo (pTW_IDENTITY pOrigin, 
265                                    TW_MEMREF pData)
266 {
267     FIXME ("stub!\n");
268
269     return TWRC_FAILURE;
270 }
271
272 /* DG_CONTROL/DAT_FILESYSTEM/MSG_GETNEXTFILE */
273 TW_UINT16 SANE_FileSystemGetNextFile (pTW_IDENTITY pOrigin,
274                                        
275                                        TW_MEMREF pData)
276 {
277     FIXME ("stub!\n");
278
279     return TWRC_FAILURE;
280 }
281
282 /* DG_CONTROL/DAT_FILESYSTEM/MSG_RENAME */
283 TW_UINT16 SANE_FileSystemRename (pTW_IDENTITY pOrigin, 
284                                   TW_MEMREF pData)
285 {
286     FIXME ("stub!\n");
287
288     return TWRC_FAILURE;
289 }
290
291 /* DG_CONTROL/DAT_EVENT/MSG_PROCESSEVENT */
292 TW_UINT16 SANE_ProcessEvent (pTW_IDENTITY pOrigin, 
293                               TW_MEMREF pData)
294 {
295     TW_UINT16 twRC = TWRC_NOTDSEVENT;
296     pTW_EVENT pEvent = (pTW_EVENT) pData;
297     MSG *pMsg = pEvent->pEvent;
298
299     TRACE("DG_CONTROL/DAT_EVENT/MSG_PROCESSEVENT  msg 0x%x, wParam 0x%lx\n", pMsg->message, pMsg->wParam);
300
301     activeDS.twCC = TWCC_SUCCESS;
302     if (pMsg->message == activeDS.windowMessage && activeDS.windowMessage)
303     {
304         twRC = TWRC_DSEVENT;
305         pEvent->TWMessage = pMsg->wParam;
306     }
307     else
308         pEvent->TWMessage = MSG_NULL;  /* no message to the application */
309
310     if (activeDS.currentState < 5 || activeDS.currentState > 7)
311     {
312         twRC = TWRC_FAILURE;
313         activeDS.twCC = TWCC_SEQERROR;
314     }
315
316     return twRC;
317 }
318
319 /* DG_CONTROL/DAT_PASSTHRU/MSG_PASSTHRU */
320 TW_UINT16 SANE_PassThrough (pTW_IDENTITY pOrigin, 
321                              TW_MEMREF pData)
322 {
323     FIXME ("stub!\n");
324
325     return TWRC_FAILURE;
326 }
327
328 /* DG_CONTROL/DAT_PENDINGXFERS/MSG_ENDXFER */
329 TW_UINT16 SANE_PendingXfersEndXfer (pTW_IDENTITY pOrigin, 
330                                      TW_MEMREF pData)
331 {
332     TW_UINT16 twRC = TWRC_SUCCESS;
333     pTW_PENDINGXFERS pPendingXfers = (pTW_PENDINGXFERS) pData;
334
335     TRACE("DG_CONTROL/DAT_PENDINGXFERS/MSG_ENDXFER\n");
336
337     if (activeDS.currentState != 6 && activeDS.currentState != 7)
338     {
339         twRC = TWRC_FAILURE;
340         activeDS.twCC = TWCC_SEQERROR;
341     }
342     else
343     {
344         if (pPendingXfers->Count != 0)
345         {
346             pPendingXfers->Count --;
347             activeDS.currentState = 6;
348         }
349         else
350         {
351             activeDS.currentState = 5;
352             /* Notify the application that it can close the data source */
353             if (activeDS.windowMessage)
354                 PostMessageA(activeDS.hwndOwner, activeDS.windowMessage, MSG_CLOSEDSREQ, 0);
355         }
356         twRC = TWRC_SUCCESS;
357         activeDS.twCC = TWCC_SUCCESS;
358     }
359
360     return twRC;
361 }
362
363 /* DG_CONTROL/DAT_PENDINGXFERS/MSG_GET */
364 TW_UINT16 SANE_PendingXfersGet (pTW_IDENTITY pOrigin, 
365                                  TW_MEMREF pData)
366 {
367     TW_UINT16 twRC = TWRC_SUCCESS;
368     pTW_PENDINGXFERS pPendingXfers = (pTW_PENDINGXFERS) pData;
369
370     TRACE("DG_CONTROL/DAT_PENDINGXFERS/MSG_GET\n");
371
372     if (activeDS.currentState < 4 || activeDS.currentState > 7)
373     {
374         twRC = TWRC_FAILURE;
375         activeDS.twCC = TWCC_SEQERROR;
376     }
377     else
378     {
379         /* FIXME: we shouldn't return 1 here */
380         pPendingXfers->Count = 1;
381         twRC = TWRC_SUCCESS;
382         activeDS.twCC = TWCC_SUCCESS;
383     }
384
385     return twRC;
386 }
387
388 /* DG_CONTROL/DAT_PENDINGXFERS/MSG_RESET */
389 TW_UINT16 SANE_PendingXfersReset (pTW_IDENTITY pOrigin, 
390                                    TW_MEMREF pData)
391 {
392     TW_UINT16 twRC = TWRC_SUCCESS;
393     pTW_PENDINGXFERS pPendingXfers = (pTW_PENDINGXFERS) pData;
394
395     TRACE("DG_CONTROL/DAT_PENDINGXFERS/MSG_RESET\n");
396
397     if (activeDS.currentState != 6)
398     {
399         twRC = TWRC_FAILURE;
400         activeDS.twCC = TWCC_SEQERROR;
401     }
402     else
403     {
404         pPendingXfers->Count = 0;
405         activeDS.currentState = 5;
406         twRC = TWRC_SUCCESS;
407         activeDS.twCC = TWCC_SUCCESS;
408     }
409
410     return twRC;
411 }
412
413 /* DG_CONTROL/DAT_PENDINGXFERS/MSG_STOPFEEDER */
414 TW_UINT16 SANE_PendingXfersStopFeeder (pTW_IDENTITY pOrigin,
415                                         TW_MEMREF pData)
416 {
417     FIXME ("stub!\n");
418
419     return TWRC_FAILURE;
420 }
421
422 /* DG_CONTROL/DAT_SETUPFILEXFER/MSG_GET */
423 TW_UINT16 SANE_SetupFileXferGet (pTW_IDENTITY pOrigin, 
424                                   TW_MEMREF pData)
425 {
426     FIXME ("stub!\n");
427
428     return TWRC_FAILURE;
429 }
430
431 /* DG_CONTROL/DAT_SETUPXFER/MSG_GETDEFAULT */
432 TW_UINT16 SANE_SetupFileXferGetDefault (pTW_IDENTITY pOrigin, 
433                                          TW_MEMREF pData)
434 {
435     FIXME ("stub!\n");
436
437     return TWRC_FAILURE;
438 }
439
440
441 /* DG_CONTROL/DAT_SETUPFILEXFER/MSG_RESET */
442 TW_UINT16 SANE_SetupFileXferReset (pTW_IDENTITY pOrigin, 
443                                     TW_MEMREF pData)
444 {
445     FIXME ("stub!\n");
446
447     return TWRC_FAILURE;
448 }
449
450 /* DG_CONTROL/DAT_SETUPFILEXFER/MSG_SET */
451 TW_UINT16 SANE_SetupFileXferSet (pTW_IDENTITY pOrigin, 
452                                   TW_MEMREF pData)
453 {
454     FIXME ("stub!\n");
455
456     return TWRC_FAILURE;
457 }
458
459 /* DG_CONTROL/DAT_SETUPFILEXFER2/MSG_GET */
460 TW_UINT16 SANE_SetupFileXfer2Get (pTW_IDENTITY pOrigin, 
461                                    TW_MEMREF pData)
462 {
463     FIXME ("stub!\n");
464
465     return TWRC_FAILURE;
466 }
467
468 /* DG_CONTROL/DAT_SETUPFILEXFER2/MSG_GETDEFAULT */
469 TW_UINT16 SANE_SetupFileXfer2GetDefault (pTW_IDENTITY pOrigin, 
470                                          TW_MEMREF pData)
471 {
472     FIXME ("stub!\n");
473
474     return TWRC_FAILURE;
475 }
476
477 /* DG_CONTROL/DAT_SETUPFILEXFER2/MSG_RESET */
478 TW_UINT16 SANE_SetupFileXfer2Reset (pTW_IDENTITY pOrigin, 
479                                   TW_MEMREF pData)
480 {
481     FIXME ("stub!\n");
482
483     return TWRC_FAILURE;
484 }
485
486 /* DG_CONTROL/DAT_SETUPFILEXFER2/MSG_SET */
487 TW_UINT16 SANE_SetupFileXfer2Set (pTW_IDENTITY pOrigin, 
488                                   TW_MEMREF pData)
489 {
490     FIXME ("stub!\n");
491
492     return TWRC_FAILURE;
493 }
494
495 /* DG_CONTROL/DAT_SETUPMEMXFER/MSG_GET */
496 TW_UINT16 SANE_SetupMemXferGet (pTW_IDENTITY pOrigin, 
497                                   TW_MEMREF pData)
498 {
499 #ifndef SONAME_LIBSANE
500     return TWRC_FAILURE;
501 #else
502     pTW_SETUPMEMXFER  pSetupMemXfer = (pTW_SETUPMEMXFER)pData;
503
504     TRACE("DG_CONTROL/DAT_SETUPMEMXFER/MSG_GET\n");
505     if (activeDS.sane_param_valid)
506     {
507         pSetupMemXfer->MinBufSize = activeDS.sane_param.bytes_per_line;
508         pSetupMemXfer->MaxBufSize = activeDS.sane_param.bytes_per_line * 8;
509         pSetupMemXfer->Preferred = activeDS.sane_param.bytes_per_line * 2;
510     }
511     else
512     {
513         /* Guessing */
514         pSetupMemXfer->MinBufSize = 2000;
515         pSetupMemXfer->MaxBufSize = 8000;
516         pSetupMemXfer->Preferred = 4000;
517     }
518
519     return TWRC_SUCCESS;
520 #endif
521 }
522
523 /* DG_CONTROL/DAT_STATUS/MSG_GET */
524 TW_UINT16 SANE_GetDSStatus (pTW_IDENTITY pOrigin, 
525                              TW_MEMREF pData)
526 {
527     pTW_STATUS pSourceStatus = (pTW_STATUS) pData;
528
529     TRACE ("DG_CONTROL/DAT_STATUS/MSG_GET\n");
530     pSourceStatus->ConditionCode = activeDS.twCC;
531     /* Reset the condition code */
532     activeDS.twCC = TWCC_SUCCESS;
533     return TWRC_SUCCESS;
534 }
535
536 /* DG_CONTROL/DAT_USERINTERFACE/MSG_DISABLEDS */
537 TW_UINT16 SANE_DisableDSUserInterface (pTW_IDENTITY pOrigin,
538                                         TW_MEMREF pData)
539 {
540     TW_UINT16 twRC = TWRC_SUCCESS;
541
542     TRACE ("DG_CONTROL/DAT_USERINTERFACE/MSG_DISABLEDS\n");
543
544     if (activeDS.currentState != 5)
545     {
546         twRC = TWRC_FAILURE;
547         activeDS.twCC = TWCC_SEQERROR;
548     }
549     else
550     {
551         activeDS.currentState = 4;
552         twRC = TWRC_SUCCESS;
553         activeDS.twCC = TWCC_SUCCESS;
554     }
555
556     return twRC;
557 }
558
559 /* DG_CONTROL/DAT_USERINTERFACE/MSG_ENABLEDS */
560 TW_UINT16 SANE_EnableDSUserInterface (pTW_IDENTITY pOrigin,
561                                        TW_MEMREF pData)
562 {
563     TW_UINT16 twRC = TWRC_SUCCESS;
564     pTW_USERINTERFACE pUserInterface = (pTW_USERINTERFACE) pData;
565
566     TRACE ("DG_CONTROL/DAT_USERINTERFACE/MSG_ENABLEDS\n");
567
568     if (activeDS.currentState != 4)
569     {
570         twRC = TWRC_FAILURE;
571         activeDS.twCC = TWCC_SEQERROR;
572         FIXME("sequence error %d\n", activeDS.currentState);
573     }
574     else
575     {
576         activeDS.hwndOwner = pUserInterface->hParent;
577         if (! activeDS.windowMessage)
578             activeDS.windowMessage = RegisterWindowMessageA("SANE.DS ACTIVITY MESSAGE");
579         if (pUserInterface->ShowUI)
580         {
581             BOOL rc;
582             activeDS.currentState = 5; /* Transitions to state 5 */
583                 FIXME("showing UI\n");
584             rc = DoScannerUI();
585             pUserInterface->ModalUI = TRUE;
586             if (!rc)
587             {
588                 if (activeDS.windowMessage)
589                     PostMessageA(activeDS.hwndOwner, activeDS.windowMessage, MSG_CLOSEDSREQ, 0);
590             }
591 #ifdef SONAME_LIBSANE
592             else
593             {
594                 psane_get_parameters (activeDS.deviceHandle, &activeDS.sane_param);
595                 activeDS.sane_param_valid = TRUE;
596             }
597 #endif
598         }
599         else
600         {
601             /* no UI will be displayed, so source is ready to transfer data */
602             activeDS.currentState = 6; /* Transitions to state 6 directly */
603             if (activeDS.windowMessage)
604                 PostMessageA(activeDS.hwndOwner, activeDS.windowMessage, MSG_XFERREADY, 0);
605         }
606
607         twRC = TWRC_SUCCESS;
608         activeDS.twCC = TWCC_SUCCESS;
609     }
610
611     return twRC;
612 }
613
614 /* DG_CONTROL/DAT_USERINTERFACE/MSG_ENABLEDSUIONLY */
615 TW_UINT16 SANE_EnableDSUIOnly (pTW_IDENTITY pOrigin, 
616                                 TW_MEMREF pData)
617 {
618     TW_UINT16 twRC = TWRC_SUCCESS;
619
620     TRACE("DG_CONTROL/DAT_USERINTERFACE/MSG_ENABLEDSUIONLY\n");
621
622     if (activeDS.currentState != 4)
623     {
624         twRC = TWRC_FAILURE;
625         activeDS.twCC = TWCC_SEQERROR;
626     }
627     else
628     {
629         /* FIXME: we should replace xscanimage with our own UI */
630         system ("xscanimage");
631         activeDS.currentState = 5;
632         twRC = TWRC_SUCCESS;
633         activeDS.twCC = TWCC_SUCCESS;
634     }
635
636     return twRC;
637 }
638
639 /* DG_CONTROL/DAT_XFERGROUP/MSG_GET */
640 TW_UINT16 SANE_XferGroupGet (pTW_IDENTITY pOrigin, 
641                               TW_MEMREF pData)
642 {
643     FIXME ("stub!\n");
644
645     return TWRC_FAILURE;
646 }
647
648 /* DG_CONTROL/DAT_XFERGROUP/MSG_SET */
649 TW_UINT16 SANE_XferGroupSet (pTW_IDENTITY pOrigin, 
650                                   TW_MEMREF pData)
651 {
652     FIXME ("stub!\n");
653
654     return TWRC_FAILURE;
655 }