-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathApplication.vb
More file actions
48 lines (32 loc) · 1.26 KB
/
Application.vb
File metadata and controls
48 lines (32 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Imports System.Net
Imports ArtNet.Packets
Imports ArtNet.Sockets
Module Module1
Public Sub Main()
Dim artnet = New ArtNetSocket()
artnet.EnableBroadcast = True
Console.WriteLine(artnet.BroadcastAddress.ToString())
artnet.Open(IPAddress.Parse("127.0.0.1"), IPAddress.Parse("255.255.255.0"))
Dim _dmxData As Byte() = New Byte(510) {}
AddHandler artnet.NewPacket, AddressOf ProcessPacket
Console.ReadLine()
End Sub
Private _dmxData As Byte() = New Byte(510) {}
Private Sub ProcessPacket(sender As Object, e As NewPacketEventArgs(Of ArtNetPacket))
If (e.Packet.OpCode = ArtNet.Enums.ArtNetOpCodes.Dmx) Then
Dim packet = TryCast(e.Packet, ArtNet.Packets.ArtNetDmxPacket)
Console.Clear()
If packet.DmxData Is _dmxData Then
Console.WriteLine("New Packet")
Dim i As Integer = 0
While i < packet.DmxData.Length
If packet.DmxData(i) <> 0 Then
Console.WriteLine(i + " = " + packet.DmxData(i))
End If
i = i + 1
End While
_dmxData = packet.DmxData
End If
End If
End Sub
End Module