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

How to read Feature Report?

Started by moelski, December 19, 2009, 06:58:48 pm

Previous topic - Next topic

moelski

Hi Roman,

This code works fine for sending a feature report.
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

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

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

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

Hi Roman,

got it finally working. Thx for the information!

Greetz
   Dominik