Main Page

Download U3 DAPI COM wrapper

U3 Device API (U3 DAPI) for .NET

Latest News:

31 Dec 2007: The First pre-beta version of COM wrapper is available.
The following functions are wrapped in this version:
Installation:
Download COM wrapper and unzip it.
Then use 'register library.cmd' to register u3dapi_com.dll.
Before registering COM wrapper you have to place u3dapi10.dll to the same folder.
We can't distribute u3dapi10.dll, sorry.
After registering com wrapper, add reference to the u3dapi_com.dll to your project.
Short description:
Use dapiConnect instead of dapiCreateSession and dapiRegisterCallback.
And dapiDisconnect instead of dapiDestroySession and dapiUnregisterCallback.
These two functions encapsulates all manipulations with sessions ans callbacks.

Use dapiQueryDeviceInformation(DeviceHandle) to get information about device.
And dapiQueryDeviceCapability to know what capabilities are supported by device.

The following functions can be used to get device information, after calling dapiQueryDeviceInformation

   GetSerialNumber()
   GetUniqueID()
   GetVendorString()
   GetProductString()
   GetFWVersion()
   GetVendorID()
   GetDeviceSize()

Device handle can be retreived from events. The COM wrapper fires the following events:

   OnDeviceConnect(hDevice)
   OnDeviceDisconnect(hDevice)
   OnDeviceUpdate(hDevice)
   OnDeviceLogin(hDevice)
   OnDeviceLogout(hDevice)
   OnDeviceWriteProtectOn(hDevice)
   OnDeviceWriteProtectOff(hDevice)
   OnDeviceReconnect(hDevice)
   OnDeviceNewConfig(hDevice)
ScreenShot of CSharp Client:
ScreenShot of CSharp Client
Usage Example:
        using System;
        using System.Collections.Generic;
        using System.ComponentModel;
        using System.Data;
        using System.Drawing;
        using System.Text;
        using System.Windows.Forms;

        using u3dapiLib;

        namespace u3dapiCSharpClient{


            public partial class Form1 : Form{

                CDapiLibClass dapiLib;
                int DeviceHandle;

                // form constructor
                public Form1(){
                    InitializeComponent();

                    // create instance of COM Wrapper
                    dapiLib = new CDapiLibClass();

                    // subscribe to OnDeviceConnect event
                    dapiLib.OnDeviceConnect += new _ICDapiLibEvents_OnDeviceConnectEventHandler(dapiLib_OnDeviceConnect);

                    // connect to DAPI Lib
                    dapiLib.dapiConnect();

                    // set up combobox
                    cbDeviceCapability.SelectedIndex = 0;
                }

                public void dapiLib_OnDeviceConnect(int n){

                    DeviceHandle = n;

                    // query device information
                    dapiLib.dapiQueryDeviceInformation(DeviceHandle);
                    
                    // obtain values from COM wrapper
                    String sSerialNumber = (String)dapiLib.GetSerialNumber();
                    String sUniqueID = (String)dapiLib.GetUniqueID();
                    String sVendorString = (String)dapiLib.GetVendorString();
                    String sProductString = (String)dapiLib.GetProductString();
                    String sFWVersion = (String)dapiLib.GetFWVersion();
                    long nVendorID = dapiLib.GetVendorID();
                    long nDeviceSize = dapiLib.GetDeviceSize();

                    // filling GUI controls
                    edSerialNumber.Text = sSerialNumber;
                    edUniqueID.Text = sUniqueID;
                    edVendorString.Text = sVendorString;
                    edProductString.Text = sProductString;
                    edFirmwareVersion.Text = sFWVersion;
                    edVendorID.Text = nVendorID.ToString();
                    edDeviceSize.Text = nDeviceSize.ToString();
                }

                private void btnTestDeviceCapability_Click(object sender, EventArgs e){

                    TDev_Capability dc = (TDev_Capability)cbDeviceCapability.SelectedIndex;

                    if (1 == dapiLib.dapiQueryDeviceCapability(DeviceHandle, dc))
                        MessageBox.Show("Capability is supported");
                    else
                        MessageBox.Show("Capability is unsupported");
                }
            }
        }