Reputation: 81
I'm building a .NET WinForms application to send serial commands over TCP/UDP to networked televisions on the same network. NEC (manufacturer) have created a tool called PD Comms that does just this and works very well, however it is too complex for end users. My interface will have a single button that sends all the necessary power/volume/input selection commands to all the TVs.
The issue I'm having is getting the TVs to accept my data stream. I believe the issue is to do with how I'm sending the data to the panel. As a trial, I've been working with a simple power on command to one of the four TVs. My application successfully opens a network stream when connected to the network so there is no issue with the IP address / port which I have inputted. My code to send this command is below.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim client As New TcpClient("10.71.208.61", 7142)
Dim dataStream As NetworkStream = client.GetStream()
Dim commandData() As Byte = {1, 30, 41, 30, 41, 30, 43, 2, 43, 32, 30, 33, 44, 36, 30, 30, 30, 31, 3, 73, 0D}
dataStream.Write(commandData, 0, commandData.Length)
client.Close()
End Sub
I believe the line where I assign data to the commandData byte array is incorrect. The command goes through without any errors and establishes a connection with the panel. It seems as though it is sending the code successfully but the TV is simply not responding (turning on) which suggests the data I'm sending is not in the correct format. The byte data I'm using is the direct output from NEC's PD Comms Tool.
Upvotes: 0
Views: 4124
Reputation: 81
In case this issue catches anyone else... it was just with the way I was representing data types. Correct formatting is:
Dim commandData() As Byte = {&H30, &H30, "&H5F", &H64, &H31, "&H0D"}
Upvotes: 0
Reputation: 1180
Use a tool like Wireshark to examine and compare the TCP/UDP packets sent by the NEC tool, and those sent by your code.
Upvotes: 1