Author Topic: Someone got a working HID example for C++ Builder?  (Read 2568 times)

ReidarS

  • Newbie
  • *
  • Posts: 7
    • View Profile
Someone got a working HID example for C++ Builder?
« on: March 25, 2011, 04:35:08 pm »
I'm struggling to get the HID demo BCB working, I can get it to receive data, but it doesn't seem to send any data. Tried other HID terminals, all are working well (including compiled version of HID demo found on deepsoftware.com). So there should not be anything wrong with my HID device. I have tried sending data in many ways, can't get it to work no matter what I try.

If anyone has working  C++ builder source code I would appreciate it very much...



Reidar

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Someone got a working HID example for C++ Builder?
« Reply #1 on: March 25, 2011, 04:51:57 pm »
Hello

Possible problem in default char size in CB209. It uses unicode chars and strings by default.
We will check HIDDemoBCB and correct it in the next release.

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.

ReidarS

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Someone got a working HID example for C++ Builder?
« Reply #2 on: March 25, 2011, 05:21:23 pm »
Interesting, I will check this...

What would be the correct encoding?

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Someone got a working HID example for C++ Builder?
« Reply #3 on: March 25, 2011, 05:33:06 pm »

You need operate with single byte chars (strings or arrays of hid reports).
Something like AnsiChar, PAnsiChar instead String, Char, PChar etc.
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Someone got a working HID example for C++ Builder?
« Reply #4 on: March 25, 2011, 05:54:30 pm »
We have tested current HIDDemoBCB.
It works correctly with unicode version of CBuilder 2010

You need fill report Id and data correctly and following code works fine without any changes.

    AnsiString s;
    // prepare data string and place Report ID into first byte
    s = (AnsiString) ((Char) eID->Value) + Edit1->Text;
    // send HID report
    nrHid1->SendString(s);
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

ReidarS

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Someone got a working HID example for C++ Builder?
« Reply #5 on: March 25, 2011, 09:06:13 pm »

When I use the HID demo and receive data from the device I get the following response:

HID Report is received: 65 bytes 00 31 31 31 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 AB AB AB AB EE EE EE 00 00 00 00 FB 3A 33 00 05 00 0D AD F0 66 00 00 00 00 00 00 00 00 AB AB AB

But the response should be this:

0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

In some way the response get corrupted. And I still can not send something out....

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Someone got a working HID example for C++ Builder?
« Reply #6 on: March 26, 2011, 03:55:34 am »
Hello

You tell that compiled version HIDDemo from our site works correctly.

Pleas show me what do you send from compiled HIDDemo and what it receives.

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.