I'm hitting a snag with firewalls and security as it seems data is coming back via UDP instead of the original connection.
So far, the code I'm using would not give the precision sensor value, but rather the generic voltage SensorValue instead. I've traced this down to the actual SensorValue I want coming back in a UDP packet which is being blocked by the firewall.
Below code is what I'm currently using. It's part of a function called with the computer name which has the Phidget itself (I need to poll multiple workstations hence a function).
Code: Select all
VoltageInput voltageInput0 = new VoltageInput();
VoltageInput voltageInput1 = new VoltageInput();
voltageInput0.IsRemote = true;
voltageInput1.IsRemote = true;
voltageInput0.ServerName = wksName;
voltageInput1.ServerName = wksName;
voltageInput0.Channel = 0;
voltageInput1.Channel = 1;
voltageInput0.Open(Phidget.DefaultTimeout);
voltageInput1.Open(Phidget.DefaultTimeout);
Thread.Sleep(5000); // for testing purposes
voltageInput0.SensorType = Phidget22.VoltageSensorType.PN_1135;
voltageInput1.SensorType = Phidget22.VoltageSensorType.PN_1135;
batt0 = voltageInput0.SensorValue;
batt1 = voltageInput1.SensorValue;
log.Debug("Voltage: " + batt0 + " - " + batt1);
I can capture the packet with the data via Wireshark, below is what I see in the UDP stream, my missing precision voltage data (12.38V for Channel0 and 12.396V for Channel1).
Code: Select all
}}*.......0IHP......5....F{"v":0,"s":1,"f":1,"p":115,"I":1742552895792,"O":31885837736710,"X":0,"c":4,"e":{
"0":{"t":"g","v":1.238000e+01},
"UnitInfo.unit":{"t":"d","v":12},
"UnitInfo name":{"t":"s","v":"volt"},
"UnitInfo.symbol":{"t":"s","v":"V"}
}}+.......0IHP......7....F{"v":0,"s":1,"f":1,"p":115,"I":1742552979472,"O":72089479875664646,"X":1,"c":4,"e":{
"0":{"t":"g","v":1.239600e+01},
"UnitInfo.unit":{"t":"d","v":12},
"UnitInfo name":{"t":"s","v":"volt"},
"UnitInfo.symbol":{"t":"s","v":"V"}
}},.......
Another possibility is limiting the UDP port range used for the reply, again I don't see this documented so is this possible?