コード例 #1
0
        /// <summary>
        /// DG_CONTROL / DAT_STATUS / MSG_GET
        /// Returns the current Condition Code for the specified Source.
        /// </summary>
        /// <param name="appId">This points to a TwIdentity structure.</param>
        /// <param name="msg">The Message of the operation triplet.</param>
        /// <param name="data">The pData parameter is a pointer to the data (a variable or, more
        /// typically, a structure) that will be used according to the action specified by the operation
        /// triplet.</param>
        /// <returns>TWAIN Return Codes.</returns>
        private TwRC _StatusControlProcessRequest(TwIdentity appId, TwMSG msg, IntPtr data)
        {
            TwStatus _status = (TwStatus)Marshal.PtrToStructure(data, typeof(TwStatus));

            switch (msg)
            {
            case TwMSG.Get:
                _status.ConditionCode = this._handlers.ContainsKey(appId.Id)?this._handlers[appId.Id].ConditionCode:this.ConditionCode;
                Marshal.StructureToPtr(_status, data, true);
                this._SetConditionCode(appId, TwCC.Success);
                return(TwRC.Success);
            }
            throw new DataSourceException(TwRC.Failure, TwCC.BadProtocol);
        }
コード例 #2
0
 public TwStatus GetDataSourceManagerStatus()
 {
   TwStatus result = new TwStatus();
   TwRC rc = LibTwain32.DSMstatus(fApplicationId, IntPtr.Zero, TwDG.Control, TwDAT.Status, TwMSG.Get, result);
   return (rc == TwRC.Success) ? result : null;
 }
コード例 #3
0
 public TwStatus GetDataSourceStatus(TwIdentity dataSourceId)
 {
   TwStatus result = new TwStatus();
   TwRC rc = LibTwain32.DSstatus(fApplicationId, dataSourceId, TwDG.Control, TwDAT.Status, TwMSG.Get, result);
   return (rc == TwRC.Success) ? result : null;
 }
コード例 #4
0
 public bool GetDataSourceManagerStatus(TwStatus result)
 {
   TwRC rc = LibTwain32.DSMstatus(fApplicationId, IntPtr.Zero, TwDG.Control, TwDAT.Status, TwMSG.Get, result);
   return (bool)(rc == TwRC.Success);
 }
コード例 #5
0
        private string GetTwainStatus()
        {
            TwStatus status = new TwStatus();
            TwRC     _rc    = tw.DsmStatus(appId, IntPtr.Zero, TwDG.Control, TwDAT.Status, TwMSG.Get, status);

            switch (status.ConditionCode)
            {
            case TwCC.Success:
                return("It worked!");

            case TwCC.Bummer:
                return("Failure due to unknown causes.");

            case TwCC.LowMemory:
                return("Not enough memory to perform operation.");

            case TwCC.NoDS:
                return("No Data Source.");

            case TwCC.MaxConnections:
                return("DS is connected to max possible applications.");

            case TwCC.OperationError:
                return("DS or DSM reported error, application shouldn't.");

            case TwCC.BadCap:
                return("Unknown capability.");

            case TwCC.BadProtocol:
                return("Unrecognized MSG DG DAT combination.");

            case TwCC.BadValue:
                return("Data parameter out of range.");

            case TwCC.SeqError:
                return("DG DAT MSG out of expected sequence.");

            case TwCC.BadDest:
                return("Unknown destination Application/Source in DSM_Entry.");

            case TwCC.CapUnsupported:
                return("Capability not supported by source.");

            case TwCC.CapBadOperation:
                return("Operation not supported by capability.");

            case TwCC.CapSeqError:
                return("Capability has dependancy on other capability.");

            /* Added 1.8 */
            case TwCC.Denied:
                return("File System operation is denied (file is protected).");

            case TwCC.FileExists:
                return("Operation failed because file already exists.");

            case TwCC.FileNotFound:
                return("File not found.");

            case TwCC.NotEmpty:
                return("Operation failed because directory is not empty.");

            case TwCC.PaperJam:
                return("The feeder is jammed.");

            case TwCC.PaperDoubleFeed:
                return("The feeder detected multiple pages.");

            case TwCC.FileWriteError:
                return("Error writing the file (meant for things like disk full conditions).");

            case TwCC.CheckDeviceOnline:
                return("The device went offline prior to or during this operation.");

            default:
                return("Unknown error.");
            }
        }
コード例 #6
0
 public bool GetDataSourceStatus(TwIdentity dataSourceId, TwStatus result)
 {
   TwRC rc = LibTwain32.DSstatus(fApplicationId, dataSourceId, TwDG.Control, TwDAT.Status, TwMSG.Get, result);
   return (bool)(rc == TwRC.Success);
 }
コード例 #7
0
ファイル: Twain32.cs プロジェクト: UNIT6-open/TWAIN-Web
 /// <summary>
 /// Возвращает код состояния TWAIN.
 /// </summary>
 /// <returns></returns>
 private TwCC _GetStatus() {
     TwStatus _status=new TwStatus();
     TwRC _rc=this.DsStatus(this._appid,this._srcds,TwDG.Control,TwDAT.Status,TwMSG.Get,_status);
     return _status.ConditionCode;
 }
コード例 #8
0
 internal static extern TwRC DsmEntryStatus([In, Out] TwIdentity origin, IntPtr zeropt, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwStatus dsmstat);
コード例 #9
0
 public TwRC DsStatus([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwStatus twstatus)
 {
     return(DsEntryStatus(origin, dest, dg, dat, msg, twstatus));
 }
コード例 #10
0
 public TwRC DsmStatus([In, Out] TwIdentity origin, IntPtr zeropt, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwStatus dsmstat)
 {
     return(DsmEntryStatus(origin, zeropt, dg, dat, msg, dsmstat));
 }
コード例 #11
0
 internal static extern TwRC DsEntryStatus([In, Out] TwIdentity origin, [In] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, [In, Out] TwStatus twstatus);