Einzelnen Beitrag anzeigen

ljmarkus

Registriert seit: 14. Apr 2007
Ort: Göttingen
46 Beiträge
 
Delphi 7 Personal
 
#12

Re: UDP Empfangen / ArtNet / ArtDMX

  Alt 23. Nov 2007, 23:20
Ich habe es heute Nachmittag dann so gelöst. Is glaube ich nicht die schönste und beste Sache, aber funktioniert.

Delphi-Quellcode:
procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
  ABinding: TIdSocketHandle);

var i: Word;
    Universe: Word;
    Opcode: Word;
    x: string;
    p: PChar;

begin

AData.Position:=0;
SetLength(x,AData.Size);
AData.ReadBuffer(x[1],AData.Size);

p := PChar(x);

Opcode := PWord(p+8)^; // Opcode auswerten
if Opcode = 20480 then // wenn ArtDMX data packet dann an Universe weiterleiten
  begin
    edit2.Text := 'ArtDMX data packet (0x5000)';
    Universe := PWord(p+14)^; // Universe
    if Universe = 0 then for i := 0 to 511 do DMXOutBuffer0[i] := PByte(p+18+i)^; // Universe 0
    if Universe = 1 then for i := 0 to 511 do DMXOutBuffer1[i] := PByte(p+18+i)^; // Universe 1
    if Universe = 2 then for i := 0 to 511 do DMXOutBuffer2[i] := PByte(p+18+i)^; // Universe 2
    if Universe = 3 then for i := 0 to 511 do DMXOutBuffer3[i] := PByte(p+18+i)^; // Universe 3
    if Universe = 4 then for i := 0 to 511 do DMXOutBuffer4[i] := PByte(p+18+i)^; // Universe 4
    if Universe = 5 then for i := 0 to 511 do DMXOutBuffer5[i] := PByte(p+18+i)^; // Universe 5
    if Universe = 6 then for i := 0 to 511 do DMXOutBuffer6[i] := PByte(p+18+i)^; // Universe 6
    if Universe = 7 then for i := 0 to 511 do DMXOutBuffer7[i] := PByte(p+18+i)^; // Universe 7
    if Universe = 8 then for i := 0 to 511 do DMXOutBuffer8[i] := PByte(p+18+i)^; // Universe 8
    if Universe = 9 then for i := 0 to 511 do DMXOutBuffer9[i] := PByte(p+18+i)^; // Universe 9
    if Universe = 10 then for i := 0 to 511 do DMXOutBuffer10[i] := PByte(p+18+i)^; // Universe 10
    if Universe = 11 then for i := 0 to 511 do DMXOutBuffer11[i] := PByte(p+18+i)^; // Universe 11
    if Universe = 12 then for i := 0 to 511 do DMXOutBuffer12[i] := PByte(p+18+i)^; // Universe 12
    if Universe = 13 then for i := 0 to 511 do DMXOutBuffer13[i] := PByte(p+18+i)^; // Universe 13
    if Universe = 14 then for i := 0 to 511 do DMXOutBuffer14[i] := PByte(p+18+i)^; // Universe 14
    if Universe = 15 then for i := 0 to 511 do DMXOutBuffer15[i] := PByte(p+18+i)^; // Universe 15
  end;

end;
lg, Markus
  Mit Zitat antworten Zitat