Capability Negotiation

Methods
CapGet() CapGetCurrent() CapGetDefault()
CapGetFrameBottom() CapGetFrameLeft() CapGetFrameRight()
CapGetFrameTop() CapGetHelp() CapGetLabel()
CapGetLabels() CapIfSupported() CapReset()
CapSet() CapSetFrame() GetCapItems()
GetCapItemsString() SetCapItems() SetCapItemsString()
Properties
Capability CapCurrentIndex CapCurrentValue
CapDefaultIndex CapDefaultValue CapMaxValue
CapMinValue CapNumItems CapMinValue
CapStepSize CapType CapValue
CapValueString CapValueType

Code example

function getACapability(capability){// Specify a Capability with capability
    STR_CapValueType = [
        'TWTY_INT8', 'TWTY_INT16', 'TWTY_INT32', 'TWTY_UINT8', 'TWTY_UINT16', 'TWTY_int', 'TWTY_BOOL',
        'TWTY_FIX32', 'TWTY_FRAME', 'TWTY_STR32', 'TWTY_STR64', 'TWTY_STR128', 'TWTY_STR255'];

    DWObject.SelectSource();
    DWObject.OpenSource();
    DWObject.Capability = capability; // Specify a Capability
    DWObject.<code>CapGet()</code>;
    var i, nCapType = DWObject.CapType;
    switch (nCapType) {
        case EnumDWT_CapType.TWON_ARRAY/*3*/:
            console.log('Available Values:');
            for (i = 0; i < DWObject.CapNumItems; i++) {
                if (DWObject.CapValueType > 8) /* >8 is string*/
                /*STR*/console.log( DWObject.GetCapItemsString(i));
                else
                /*NUM*/console.log(DWObject.GetCapItems(i));
            }
            break;
        case EnumDWT_CapType.TWON_ENUMERATION/*4*/:
            console.log('Available Values:');
            for (i = 0; i < DWObject.CapNumItems; i++) {
                if (DWObject.CapValueType > 8)
                /*STR*/console.log(DWObject.GetCapItemsString(i));
                else
                /*NUM*/console.log(DWObject.GetCapItems(i));
            }
            if (DWObject.CapValueType > 8) {
                console.log('Current Index = ' + DWObject.CapCurrentIndex + ' (Value: ' + DWObject.GetCapItemsString(DWObject.CapCurrentIndex) + ')');
                console.log('Default Index = ' + DWObject.CapDefaultIndex + ' (Value: ' + DWObject.GetCapItemsString(DWObject.CapDefaultIndex) + ')');
            }
            else {
                console.log('Current Index = ' + DWObject.CapCurrentIndex + ' (Value: ' + DWObject.GetCapItems(DWObject.CapCurrentIndex) + ')');
                console.log('Default Index = ' + DWObject.CapDefaultIndex + ' (Value: ' + DWObject.GetCapItems(DWObject.CapDefaultIndex) + ')');
            }
            break;
        case EnumDWT_CapType.TWON_ONEVALUE/*5*/:
            var tempValue = '';
            if (DWObject.CapValueType > 8)
            /*STR*/tempValue = DWObject.CapValueString;
            else
            /*NUM*/tempValue = DWObject.CapValue;
            /*
            * Special for BOOL
            */
            if (DWObject.CapValueType == EnumDWT_CapValueType.TWTY_BOOL) {
                if (tempValue == 0) tempValue = 'FALSE'; else tempValue = 'TRUE';
            }
            console.log('ItemType = ' + STR_CapValueType[DWObject.CapValueType]);
            console.log('Value = ' + tempValue);
            break;
        case EnumDWT_CapType.TWON_RANGE/*6*/:
            console.log('ItemType = ' + STR_CapValueType[DWObject.CapValueType]);
            console.log('Min = ' + DWObject.CapMinValue);
            console.log('Max = ' + DWObject.CapMaxValue);
            console.log('StepSize = ' + DWObject.CapStepSize);
            console.log('Default = ' + DWObject.CapDefaultValue);
            console.log('Current = ' + DWObject.CapCurrentValue);
            break;
        default: console.log('This Capability is not supported');
    }
    var supportLevel = [];
    if (DWObject.CapIfSupported(EnumDWT_MessageType.TWQC_GET)) supportLevel.push('GET');/*TWQC_GET*/
    if (DWObject.CapIfSupported(EnumDWT_MessageType.TWQC_SET)) supportLevel.push('SET');/*TWQC_SET*/
    if (DWObject.CapIfSupported(EnumDWT_MessageType.TWQC_RESET)) supportLevel.push('RESET');/*TWQC_RESET*/
    if (supportLevel.length > 0) {
        console.log('Supported operations: ');
        console.log(supportLevel.join(' / '));
    }
}

// Set A Capability
function setACapability(capability, valueToSet, indexToSet) {
    var tempValue = '', i, valueToShow;
    DWObject.SelectSource();
    DWObject.OpenSource();
    DWObject.Capability = capability;
    DWObject.<code>CapGet()</code>;
    nCapType = DWObject.CapType;
    switch (nCapType) {
        case EnumDWT_CapType.TWON_ARRAY/*3*/:
            console.log('Setting an Array is not implemented');
            break;
        case EnumDWT_CapType.TWON_ENUMERATION/*4*/:
            DWObject.CapValue = valueToSet;
            DWObject.CapCurrentIndex = indexToSet;
            DWObject.<code>CapSet()</code>;
            console.log('CapSet: ' + DWObject.ErrorString);
            DWObject.<code>CapGet()</code>;
            console.log('After Setting:');
            if (DWObject.CapValueType > 8) {
                console.log('Current Index = ' + DWObject.CapCurrentIndex + ' (Value: ' + DWObject.GetCapItemsString(DWObject.CapCurrentIndex) + ')');
                console.log('Default Index = ' + DWObject.CapDefaultIndex + ' (Value: ' + DWObject.GetCapItemsString(DWObject.CapDefaultIndex) + ')');
            }
            else {
                console.log('Current Index = ' + DWObject.CapCurrentIndex + ' (Value: ' + DWObject.GetCapItems(DWObject.CapCurrentIndex) + ')');
                console.log('Default Index = ' + DWObject.CapDefaultIndex + ' (Value: ' + DWObject.GetCapItems(DWObject.CapDefaultIndex) + ')');
            }
            break;
        case EnumDWT_CapType.TWON_ONEVALUE/*5*/:
            DWObject.CapValue = valueToSet;
            DWObject.<code>CapSet()</code>;
            console.log('CapSet: ' + DWObject.ErrorString);
            DWObject.<code>CapGet()</code>;
            console.log('Value after setting: ' + DWObject.CapValue);
            break;
        case EnumDWT_CapType.TWON_RANGE/*6*/:
            DWObject.CapCurrentValue = valueToSet;
            DWObject.<code>CapSet()</code>;
            console.log('CapSet: ' + DWObject.ErrorString);
            DWObject.<code>CapGet()</code>;
            console.log('Value after setting: ' + DWObject.CapCurrentValue);
            break;
        default: console.log('This Capability is not supported');
    }
}

Methods

CapGet()
Gets the detailed information of the capability specified by (Capability)[#Capability].
Syntax .CapGet()
Parameters None
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
CapGetCurrent()
Gets the current value of the capability specified by (Capability)[#Capability].
Syntax .CapGetCurrent()
Parameters None
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Currently this method is only valid in Windows & Mac.
CapGetDefault()
Gets the default value of the capability specified by (Capability)[#Capability].
Syntax .CapGetDefault()
Parameters None
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
CapGetFrameBottom()
Returns the value of the bottom edge of the specified frame.
Syntax .CapGetFrameBottom(index)
Parameters number optionalAsyncFailureFunc: specifies which frame to check. The index is 0-based.
Return value number
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes The default Unit is assumed to be "inches" unless it has been otherwise negotiated between the application and Data Source.
CapGetFrameLeft()
Returns the value of the Left edge of the specified frame.
Syntax .CapGetFrameLeft(index)
Parameters number optionalAsyncFailureFunc: specifies which frame to check. The index is 0-based.
Return value number
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes The default Unit is assumed to be "inches" unless it has been otherwise negotiated between the application and Data Source.
CapGetFrameLeft()
Returns the value of the Left edge of the specified frame.
Syntax .CapGetFrameLeft(index)
Parameters number optionalAsyncFailureFunc: specifies which frame to check. The index is 0-based.
Return value number
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes The default Unit is assumed to be "inches" unless it has been otherwise negotiated between the application and Data Source.
CapGetFrameRight()
Returns the value of the Right edge of the specified frame.
Syntax .CapGetFrameRight(index)
Parameters number optionalAsyncFailureFunc: specifies which frame to check. The index is 0-based.
Return value number
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes The default Unit is assumed to be "inches" unless it has been otherwise negotiated between the application and Data Source.
CapGetFrameTop()
Returns the value of the Top edge of the specified frame.
Syntax .CapGetFrameTop(index)
Parameters number optionalAsyncFailureFunc: specifies which frame to check. The index is 0-based.
Return value number
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes The default Unit is assumed to be "inches" unless it has been otherwise negotiated between the application and Data Source.
CapGetHelp()
Get help information of the capability specified by Capability.
Syntax .CapGetHelp(index)
Parameters None
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Call this method after calling CapGet() method.
CapGetLabel()
Get Label information of the capability specified by Capability.
Syntax .CapGetLabel()
Parameters None
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Call this method after calling CapGet() method.
CapGetLabels()
Get Labels information of the capability specified by Capability.
Syntax .CapGetLabels()
Parameters None
Return value boolean
Example
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Call this method after calling CapGet() method.
CapIfSupported()
Returns the Data Source's support level of the capability specified by Capability.
Syntax .CapIfSupported(messageType)
Parameters <EnumDWT_MessageType (number)> messageType
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
CapReset()
Resets the the capability specified by Capability.
Syntax .CapReset()
Parameters None
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
CapSet()
Sets the the capability specified by Capability.
Syntax .CapSet()
Parameters None
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
CapSetFrame()
Sets the values of the specified frame.
Syntax .CapSetFrame(index, left, top, right, bottom);
Parameters number index: specifies which frame to set. The index is 0-based.
number left: specifies the value of the left edge of the specified frame.
number top: specifies the value of the top edge of the specified frame.
number right: specifies the value of the right edge of the specified frame.
number bottom: specifies the value of the bottom edge of the specified frame.
Return value boolean
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes The frame is specified by values in a specific unit. The default unit is "inches" and can be configured by the property Unit
GetCapItems()
Gets the cap item value of the capability specified by Capability.
Syntax .GetCapItems(index)
Parameters number index:specifies the index of a cap item. The index is 0-based.
Return value string
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Valid only when CapType is TWON_ARRAY (3) or TWON_ENUMERATION (4).
GetCapItemsString()
Gets the cap item value of the capability specified by Capability.
Syntax .GetCapItemsString(index)
Parameters number index:specifies the index of a cap item. The index is 0-based.
Return value string
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Valid only when CapType is TWON_ARRAY (3) or TWON_ENUMERATION (4).
SetCapItems()
Sets the cap item value of the capability specified by Capability.
Syntax .SetCapItems(index, newVal)
Parameters number index:specifies the index of a cap item. The index is 0-based. number newVal:specifies the value.
Return value string
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Valid only when CapType is TWON_ARRAY (3) or TWON_ENUMERATION (4).
SetCapItemsString()
Sets the cap item value of the capability specified by Capability.
Syntax .SetCapItemsString(index, newVal)
Parameters number index:specifies the index of a cap item. The index is 0-based. number newVal:specifies the value.
Return value None
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Valid only when CapType is TWON_ARRAY (3) or TWON_ENUMERATION (4).

Properties

Capability
Specifies the capabiltiy to be negotiated with the Data Source.
Type EnumDWT_Cap (int)
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
CapCurrentIndex
Returns the index (0-based) of the current value of a capability.
Then you can find the current value by this index in GetCapItemsString() or GetCapItemsCapValueType().
Type number
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Check this property after calling CapGet().
Valid only when the capability has the CapType of TWON_ENUMERATION (4).
CapCurrentValue
Returns the current value of a capability.
Type number
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Check this property after calling CapGet().
Valid only when the capability has the CapType of TWON_RANGE (6).
CapDefaultIndex
Returns the index (0-based, read-only) of the default value of a capability. Then you can find the default value by this index in GetCapItemsString or GetCapItems.
Type number
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Check this property after calling CapGet().
Valid only when the capability has the CapType of TWON_ENUMERATION (4).
Default value reflects the Data Source's power-on value. It can NOT be set.
CapDefaultValue
Returns the default value of a capability.
Type number
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Check this property after calling CapGet().
Valid only when the capability has the CapType of TWON_RANGE (6).
Default value reflects the Data Source's power-on value. It can NOT be set.
CapMaxValue
Returns the maximum value of a capability.
Type number
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Check this property after calling CapGet().
Valid only when the capability has the CapType of TWON_RANGE (6).
Default value reflects the Data Source's power-on value. It can NOT be set.
CapMinValue
Returns the Minimum value of a capability.
Type number
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Check this property after calling CapGet().
Valid only when the capability has the CapType of TWON_RANGE (6).
Default value reflects the Data Source's power-on value. It can NOT be set.
CapNumItems
Returns or sets the number of values of capability.
Type number
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Check this property after calling CapGet().
Set this property before calling CapSet().
Valid only when the capability has the CapType of TWON_ARRAY (3) or TWON_ENUMERATION (4).
CapStepSize
Returns or sets the step size of the values of a capability.
Type number
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Check this property after calling CapGet(). Set this property before calling CapSet().
Valid only when the capability has the CapType of TWON_RANGE (6).
CapType
Returns or sets the type of capability container used to exchange capability information between application and source.
Type EnumDWT_CapType (number)
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Set CapType when you try to set a capability with CapSet(). Check CapType after you read a capability by CapGet().
CapValue
Returns or sets the value of the capability specified by Capability.
Type number
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes Set CapType when you try to set a capability with CapSet(). Check CapType after you read a capability by CapGet().
To check a capability, read this property after calling CapGet() method. When setting a capability, set this property before calling CapSet() to actually set the value.
Valid only when the capability has the CapType of TWON_ONEVALUE (5).
Use this property to get/set a capability that has a value type of number or even Boolean (1 means 'true', 0 means 'false'). For string type, use CapValueString instead.
CapValueString
Returns or sets the string value of a capability specified by Capability.
Type string
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes To check a capability, read this property after calling CapGet() method. When setting a capability, set this property before calling CapSet() to actually set the value.
Valid only when the capability has the CapType of TWON_ONEVALUE (5).
Use this property to get/set a capability that has a value type of string, otherwise, use CapValue instead.
CapValueType
Returns or sets the value type for reading the value of a capability.
Type EnumDWT_CapValueType (number)
Accessors Get Set
Availability
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
✓ | v1.0 ✓ | v10.0 ✓ | v11.0
Usage notes When you try to read a capability value, check CapValueType after you call CapGet().
Valid only when the capability has the CapType of TWON_ONEVALUE (5).
When you try to write a capability value, set CapValueType before you call CapSet().

results matching ""

    No results matching ""

    results matching ""

      No results matching ""