Logic Machine Forum
Epson projector tcp / ip control help - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Epson projector tcp / ip control help (/showthread.php?tid=2821)



Epson projector tcp / ip control help - shiney2512 - 02.09.2020

hi,

i having trouble connecting to an epson tw9400 projector via tcp /ip,  i've been able get to PJ Link working (turning the projector on/ off), but i require extra commands that the PJ link doesn't support (lens control, key functions.etc) 

the projector requires a handshake to enable ESC/VP.net before it will accept commands, i've been able to verify connection to the projector via the Hercules setup utility below,

this is the instructions on how to connect to the projector via ESC/VP.net, i've also attached the ESC/VP command list below

But i haven't been able to make a connection via the logicmachine 

the handshake is -  [i]ESC/VP.net<DLE><ETX><NUL><NUL><NUL><NUL>[/i]  or HEX = 45 53 43 2F 56 50 2E 6E 65 74 10 03 00 00 00 00

and this where i'm at the moment, i've modified the Pj Link script,  changing the port to 3629, but i'm not sure how to implement the handshake into the script?

any help would be much appreciated


Code:
require('socket')

value = event.getvalue()

ip = '192.168.1.64'
port = 3629

if value == 255 then
  cmd = 'PWR ON<CR>' --Power On

end

if value == 250 then
  cmd = 'PWR OFF<CR>'  --Power Off
end

sock = socket.tcp()
sock:settimeout(1)

res, err = sock:connect(ip, port)

if res then
  res, err = sock:send(cmd)

  if res then
    alert('Send OK')
  else
    alert('Send failed: %s', tostring(err))
  end
else
  alert('Connect failed: %s', tostring(err))
end



RE: Epson projector tcp / ip control help - admin - 02.09.2020

You can convert hex char codes to a string like this:
Code:
hs = string.char(0x45, 0x53, 0x43, 0x2F, 0x56, 0x50, 0x2E, 0x6E, 0x65, 0x74, 0x10, 0x03, 0x00, 0x00, 0x00, 0x00)

Then you need to send it before the actual command:
Code:
res, err = sock:send(hs)
res, err = sock:send(cmd)

Note that anything between <> is not a string value but an ASCII character name, so 'PWR OFF<CR>' should actually be 'PWR OFF\r'


RE: Epson projector tcp / ip control help - shiney2512 - 02.09.2020

(02.09.2020, 11:43)admin Wrote: You can convert hex char codes to a string like this:
Code:
hs = string.char(0x45, 0x53, 0x43, 0x2F, 0x56, 0x50, 0x2E, 0x6E, 0x65, 0x74, 0x10, 0x03, 0x00, 0x00, 0x00, 0x00)

Then you need to send it before the actual command:
Code:
res, err = sock:send(hs)
res, err = sock:send(cmd)

Note that anything between <> is not a string value but an ASCII character name, so 'PWR OFF<CR>' should actually be 'PWR OFF\r'


Awesome - thank you very much for you help! Big Grin Big Grin