procedure TForm1.Button1Click(Sender: TObject);
var
eineVar:
string;
laenge:integer;
//device:pusb_device;
//messageVal:array [0..1]of byte ;
//answerVal: array[0..10] of byte;
buffer:
packed array [0..1024]
of char;
//res: PChar;//array[0..10] of char;
//zeiger :res;
aFan:RecFans;
aString:
string;
sizeOfFan:Word;
I: Integer;
begin
// Hier wird laenge definiert //
laenge := 11;
sizeOfFan:= SizeOf(aFan);
// in RTC_open_ID werden die DLL Funktionen aufgerufen
RTC_open_id(VENDORID,PRODUCTID);
// Hier stimmt laenge nicht mehr //
ShowMessage('
Länge: '+IntToStr(laenge));
if usb_handle =
Nil then
begin
showmessage('
can''
t open usb device');
exit;
// result := -1;
end;
for I := 0
to 10
do
begin
usb_control_msg(usb_handle,UVC_In,7,3,0,buffer[0],11,1000);
end;
if usb_control_msg(usb_handle,UVC_In,7,3,0,buffer[0],11,1000) <0
then
begin
//se
if usb_control_msg(usb_handle,UVC_In,7,3,0,buffer[0],11,1000) <0
then
begin
showmessage('
Fehler control_message'+ usb_strerror());
end
else
begin
aString:=buffer;
ShowMessage(aString);
end;
end
else
begin
aString:=buffer;
ShowMessage(aString);
end;
if usb_control_msg(usb_handle,UVC_In,2,0,0,aFan,sizeOfFan,1000) <0
then
begin
//se
if usb_control_msg(usb_handle,UVC_In,2,0,0,aFan,SizeOf(aFan),1000) <0
then
begin
showmessage('
Fehler control_message'+ usb_strerror());
end
else
begin
aString:=buffer;
// ^aFan:=buffer;
ShowMessage(IntToStr(aFan.speed));
end;
end
else
begin
aString:=buffer;
ShowMessage(IntToStr(aFan.speed));
end;
if usb_control_msg(usb_handle,UVC_Out,3,80,1,buffer[0],0,1000) <0
then
begin
end
else
begin
aString:=buffer;
ShowMessage(IntToStr(aFan.speed));
end;
end;