Hello! I’m trying to create a TCP connection plugin to my MT-VIKI 16x16 HDMI Matrix Switch. When I run the simulator in the designer, I get this error: “No public methods with the specified arguments were found.” Just to clarify, I’ve only included 2 commands (SW 3 7 and SW 4 7), as I’m testing and simply trying to get it to work. My first time using TCP, as everything else has primarily been IR. Any ideas as to what my issue is?
TCP connection to the switch is raw text, and the switch format is SW Input Output1 Output2 etc.
plugin.Name = "Viki";
plugin.OnChangeRequest = onChangeRequest;
plugin.OnConnect = onConnect;
plugin.OnDisconnect = onDisconnect;
plugin.OnPoll = onPoll;
plugin.OnSynchronizeDevices = onSynchronizeDevices;
plugin.PollingInterval = 250;
plugin.DefaultSettings = { "Host": "192.168.1.6", "Port": "8080" };
var deviceId = "1";
var socket = new TCPClient();
var commands = {
"SwitchIn3Out7" : "SW 3 7",
"SwitchIn4Out7" : "SW 4 7",
}
function onChangeRequest(device, attribute, value) {
if (attribute != "MediaCommand")
throw "Invalid attribute";
var command = commands[value];
if (!command)
throw "Invalid command";
socket.send(command);
}
function onConnect() {
socket.connect(plugin.Settings["Host"], parseInt(plugin.Settings["Port"]));
var device = plugin.Devices[deviceId];
if (device != null) {
device.SupportedMediaCommands = Object.keys(commands);
}
}
function onDisconnect() {
socket.close();
}
function onPoll() {
}
function onSynchronizeDevices() {
var device = new Device();
device.Id = deviceId;
device.DisplayName = "Viki";
device.Capabilities = ["MediaControl"];
device.Attributes = [];
plugin.Devices[deviceId] = device;
}
Thank you for the help!