Author Topic: How to read Feature Report?  (Read 1967 times)

moelski

  • Full Member
  • ***
  • Posts: 122
    • View Profile
How to read Feature Report?
« on: December 19, 2009, 08:58:48 pm »
Hi Roman,

This code works fine for sending a feature report.
Code: [Select]
var s,s2:string;
    len:integer;
begin
//  s := '00'+#0#1#0+'1';

  s := #0 +   // Report ID
       #0 +   // SET (0) GET (1)
       #1 +   // RAM (0) FLASH (1)
       #1 +   // 0x1
       #1 +   // 0x1
       #0 +   // 0x0
       #4;    // LED Mode 1 = ON
  len := Length(s);
  SetLength(s2,  nrHid1.FeatureReportLength);
  CopyMemory(@s2[1], @s[1], len);
  nrHid1.WriteFeature(@s2[1], nrHid1.FeatureReportLength);
end;

But how can I read the answer (Feature IN report) of the device? It seems to me that OnAfterReceive don´t get this data ?!

Could you give me a short example, please?

btw: I want to read the data from this sensor:
http://www.toradex.com/@api/deki/files/619/=Oak_Lux_Datasheet.pdf
http://www.toradex.com/@api/deki/files/89/=Oak_ProgrammingGuide_V0100.pdf

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: How to read Feature Report?
« Reply #1 on: December 20, 2009, 05:03:53 am »
Hello

Please note that if you use the latest version of Delphi the string type is UNICOODE.

You can declare s and s2 ad AnsiString and try again.

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.

moelski

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: How to read Feature Report?
« Reply #2 on: December 20, 2009, 07:23:24 am »
Hi Roman,

Unicode is not the problem. I´m using D2007  ;)

And the code I posted worked for me - as far as I change settings on the device.
But if I want to read settings from the device nothing is sent to the computer.

So I wonder if OnAfterReceive is also for receiving Feature IN Reports (from device to PC).

Greetz Dominik

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: How to read Feature Report?
« Reply #3 on: December 20, 2009, 06:09:44 pm »
Hello

You can try the following method:
function TnrHid.ReadFeature(const pcReport: pointer; const ReportSize: cardinal): boolean;

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.

moelski

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: How to read Feature Report?
« Reply #4 on: December 21, 2009, 07:55:28 am »
Hi Roman,

got it finally working. Thx for the information!

Greetz
   Dominik