Author Topic: Two non-trivial questions  (Read 3293 times)

Max

  • Newbie
  • *
  • Posts: 5
    • View Profile
Two non-trivial questions
« on: February 24, 2009, 01:33:03 pm »
Hi guys! I am a new user and I really like these nrCommlib but I have two questions for you :)

I am trying the trial version of nrCommlib for USB with Borland C++ Builder 5, and I have these questions to ask:

1) I always get the error "Device is not selected"  when I try to connect to a device using TnrUSB at design time or runtime. What do I have to do?  ???

2) I think there are several methods (in TnrUSB and other Usb components) not documented yet, I need your help in order to know them all :-\  The link http://www.deepsoftware.com/nrcomm/help/index.html doesn't work and in the usb examples I've found only few TnrUsb methods...

I need your help...  ;)

Thanks

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Two non-trivial questions
« Reply #1 on: February 24, 2009, 05:24:22 pm »
Hello

1) You can TnrDeviceBox control together TnrUsb for select needed USB device. You can try to look the following demo projects:
Demos\USBDeviceDemoBCB\usbdevicedemo.bpr
Demos\USBPipeDemo\usbpipedemo.dpr

You should set TnrUsb.DeviceIndex property to target device before open it.
Also the following method can be useful for select device by its Vendo and product ID's:
TnrUsb.DeviceIndexOf(VendorId, ProductId : dword):integer;

Please note that TnrUsb uses Microsoft WinUSB driver. It should be installed on target devices before opening them.

2) After installation nrComm Lib the context help (F1) should be available in Delphi/C++Builder IDE.
There are several demo projects that can help you to find useful information.
And we provide tech support over email for registered user.

Thank you for information about dead link. We will fix it asap.

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Max

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Two non-trivial questions
« Reply #2 on: February 25, 2009, 10:02:38 am »
Thank you very much, I have another 'simply' question about first question. I put TnrDeviceBox and TnrUsb controls on a form, then (at runtime) I selected the device with this C++ code:

Code: [Select]
        TnrUSB *USB= nrUSB1;
TnrUSBPipePair *USBPipe= nrUSBPipePair1;
TnrDeviceBox *DevBox= nrDeviceBox1;
               
USB->DeviceIndexOf(0x..., 0x...);
USB->DeviceIndex= DevBox->ItemIndex;

       USB->Active= true;

but still I get the same error "Device not selected" at runtime. Where is my mistake? Do I forget something?
The WinUsbDriver is installed and working.

Thank you again.


Hello

1) You can TnrDeviceBox control together TnrUsb for select needed USB device. You can try to look the following demo projects:
Demos\USBDeviceDemoBCB\usbdevicedemo.bpr
Demos\USBPipeDemo\usbpipedemo.dpr

You should set TnrUsb.DeviceIndex property to target device before open it.
Also the following method can be useful for select device by its Vendo and product ID's:
TnrUsb.DeviceIndexOf(VendorId, ProductId : dword):integer;

Please note that TnrUsb uses Microsoft WinUSB driver. It should be installed on target devices before opening them.



Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Two non-trivial questions
« Reply #3 on: February 25, 2009, 12:46:57 pm »
Hello

Plese try something like this

Code: [Select]
USB->DeviceIndex = USB->DeviceIndexOf(0x..., 0x...);
Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Max

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Two non-trivial questions
« Reply #4 on: February 25, 2009, 01:05:23 pm »
I'm sorry Roman, it doesn't work  :-[
I'll try other combinations...


Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Two non-trivial questions
« Reply #5 on: February 25, 2009, 01:14:03 pm »
Do you see your device in USBDevice demo?
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Max

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Two non-trivial questions
« Reply #6 on: February 25, 2009, 01:16:57 pm »
Yes I see it and I can install the WinUsb driver with the "Install driver" button.
I am also able to see the name of other devices connected to my computer at design time with the TnrDeviceBox on the form.

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Two non-trivial questions
« Reply #7 on: February 25, 2009, 06:49:01 pm »
Hello

I have checked. The DeviceIndexOf() method works ok.
Possible your device list is empty.

Please try to call Update() method for refresh the device list before call DeviceIndexOf().

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Max

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Two non-trivial questions
« Reply #8 on: February 26, 2009, 08:55:30 am »
I'm sorry, the device list is not empty. I put a TnrDeviceBox component on the form (along with TnrUSBDeriver and TnrUsb Vcl component): I can see the devices connected to my pc in the TnrDeviceBox at design time. If I change the property DeviceIndex in the TnrUsb component at design time  I can see the name of the new device selected in TnrDeviceBox (it works well) but if I try to make TnrUsb active (with the corresponding property "Active") I get the error "Device not selectd" again.
I think I am doing some mistakes I don't understand yet :(

Thank for your patience and help Roman.