←Select platform

ResetDeviceEventCapability Method

Summary
Resets CAP_DEVICEEVENT capability to default values.

Syntax
C#
C++/CLI
Python
public void ResetDeviceEventCapability( 
   TwainCapability deviceCap 
) 
public: 
void ResetDeviceEventCapability(  
   TwainCapability^ deviceCap 
)  
def ResetDeviceEventCapability(self,deviceCap): 

Parameters

deviceCap
Contains the capability values to reset

Remarks

This method will reset CAP_DEVICEEVENT capability to defaults values. To get CAP_DEVICEEVENT capability values, call GetDeviceEventCapability method, and to set the CAP_DEVICEEVENT values, call SetDeviceEventCapability method.

Example
C#
using Leadtools; 
using Leadtools.Twain; 
 
 
public void GetDeviceEventCapabilityExample(IntPtr parent) 
{ 
   TwainSession session = new TwainSession(); 
   session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None); 
 
   try 
   { 
      TwainCapability twnCap = session.GetDeviceEventCapability(); 
      if (twnCap.Information.Type == TwainCapabilityType.DeviceEvent) 
      { 
         int count = twnCap.ArrayCapability.Count; 
         for (int i = 0; i < count; i++) 
         { 
            TwainCapabilityValue capValue = (TwainCapabilityValue)twnCap.ArrayCapability.GetValue(i); 
            switch (capValue) 
            { 
               case TwainCapabilityValue.DeviceEventCheckBattery: 
                  MessageBox.Show("Device event checks the battery"); 
                  break; 
               case TwainCapabilityValue.DeviceEventCheckResolution: 
                  MessageBox.Show("Device event checks the resolution"); 
                  break; 
               case TwainCapabilityValue.DeviceEventDeviceReady: 
                  MessageBox.Show("Device event is ready"); 
                  break; 
            } 
         } 
 
         TwainCapability cap = new TwainCapability(); 
         cap.Information.Type = TwainCapabilityType.DeviceEvent; 
         cap.Information.ContainerType = TwainContainerType.Array; 
 
         cap.ArrayCapability.Count = 5; 
         cap.ArrayCapability.ItemType = TwainItemType.Uint16; 
         cap.ArrayCapability.SetValue(0, TwainCapabilityValue.DeviceEventDeviceReady); 
         cap.ArrayCapability.SetValue(1, TwainCapabilityValue.DeviceEventCheckDeviceOnline); 
         cap.ArrayCapability.SetValue(2, TwainCapabilityValue.DeviceEventCheckBattery); 
         cap.ArrayCapability.SetValue(3, TwainCapabilityValue.DeviceEventCheckPowerSupply); 
         cap.ArrayCapability.SetValue(4, TwainCapabilityValue.DeviceEventCheckResolution); 
 
         session.SetDeviceEventCapability(cap); 
         MessageBox.Show("DeviceEvent is changed successfully"); 
         session.ResetDeviceEventCapability(twnCap); 
         MessageBox.Show("DeviceEvent is reset to default values successfully"); 
      } 
   } 
   catch 
   { } 
 
   session.Shutdown(); 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Twain Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.