• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 

Someone got a working HID example for C++ Builder?

Started by ReidarS, March 25, 2011, 01:35:08 pm

Previous topic - Next topic

ReidarS

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

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

Interesting, I will check this...

What would be the correct encoding?

Roman Novgorodov


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

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


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

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.