opened
EventReplay
username_0
@username_1 I've had a nose @ code and the manual, I have a couple of observations.

I think Login is being set to true early by matching IN16 from copyright message, therfore password warning will not be triggered.
You are sending the command "I" and I don't think the response returns "IN16" for your data-match, could be "Vid" based on manual.

Heartbeat: By using "!" your creating a variable data-match (for gui status interaction, debug) makes no sense, Just change to "I" if you changed to "Vid" as advised above.

These changes should then give a true status indication in the gui.

Hope that makes sense.
I think Login & Heartbeat need a tweak!
issue
created
JeffreyDavidsz
username_1
Yes this module was made quickly based on an other Extron module, I've changed some stuff (like remove a function within a function) and let it test it. Those extron modules need some extra attention.
comment
created
EventReplay
username_0
@username_1  "Those extron modules need some extra attention." What can I do to be of some help? I'm sure you'd rather be dealing with more important modules!
Should the heartbeat function be expressed as you've done for IN1604 to be correct coding? It does seem to be working fine for SMX & DXP.
I'll run my eyes over all Extron Modules.
comment
created
JeffreyDavidsz
username_1
Well the function in a function could be placed separate. But to be honest I don't remember, I'll need to see the code again.
comment
created
EventReplay
username_0
@username_1 I've tested heartbeat with SMX, function placed seperate, don't see any difference in functionality but I guess does make sense for function to be before setinterval!
I am however now a little confused as the IN1604 dosen't appear to have a LAN port! The IN1606 & IN1608 do. Given what the manual is saying for 06/08 here is what I think the instance.prototype.incomingData should be.
`instance.prototype.incomingData = function(data) {
	var self = this;
	debug(data);

	// Match part of the copyright response from unit when a connection is made.
	if (self.login === false && data.match("Extron Electronics")) {
		self.status(self.STATUS_WARNING,'Logging in');
	// Send Info request which should reply with Scaler setup, eg: "Vid3 Aud3 Typ6 Std0 Blk0 Hrtxxx.x Vrtxxx.x"
		self.socket.write("I"+ "\n");
	}

	if (self.login === false && data.match("Password:")) {
		self.log('error', "expected no password");
		self.status(self.STATUS_ERROR, 'expected no password');
	}

	// Match part of expected Info request response from unit.
	else if (self.login === false && data.match(/Vid/)) {
		self.login = true;
		self.status(self.STATUS_OK);
		debug("logged in");
	}
	// Heatbeat to keep connection alive
	function heartbeat() {
		self.login = false;
		self.status(self.STATUS_WARNING,'Checking Connection');
		self.socket.write("I"+ "\n"); // should reply with Scaler setup, eg: "Vid3 Aud3 Typ6 Std0 Blk0 Hrtxxx.x Vrtxxx.x"
		debug("Checking Connection");
	}

	if (self.login === true) {
		clearInterval(self.heartbeat_interval);
		var beat_period = 180; // Seconds
		self.heartbeat_interval = setInterval(heartbeat, beat_period * 1000);
	}
	else {
		debug("data nologin", data);
	}
};
`
comment
created
JeffreyDavidsz
username_1
Regarding to password, that indeed was skipped on purpose. Sending `!` was just a polling request. I've changed the stuff, will send a email to the original requester
comment
closed
JeffreyDavidsz
username_1
issue