Exemple #1
0
        private void btnOpenDevice_Click(object sender, RoutedEventArgs e)
        {
            int deviceId = DeviceId;

            ClearLeft();
            PrintLeft("Device ID: {0} - status: {1}\n", deviceId, CH341NativeFunctions.CH341OpenDevice(deviceId));

            byte[]        bArr     = new byte[100];
            StringBuilder sb       = new StringBuilder("", 256);
            int           ioLength = 100;

            CH341NativeFunctions.CH341GetInput(deviceId, bArr);
            PrintLeft("Status: {0}\n", bArr.GetString());

            CH341NativeFunctions.CH341GetConfigDescr(deviceId, sb, ref ioLength);
            PrintLeft("Config description: {0}\n", bArr.GetString());

            CH341NativeFunctions.CH341GetDeviceDescr(deviceId, sb, ref ioLength);
            PrintLeft("Device description: {0}\n", bArr.GetString());
            object obj = CH341NativeFunctions.CH341GetDeviceName(deviceId);

            //PrintLeft("Device name: {0}\n", sb.ToString());

            PrintLeft("Driver version: {0}\n", CH341NativeFunctions.CH341GetDrvVersion());
        }