This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Panasonic projector IP control
#5
Code:
function tcpsend(data, ip, port)
  local sock, res, err

  sock = require('socket').tcp()
  sock:settimeout(5)

  res, err = sock:connect(ip, port or 20554)
  
  if res then
    res, err = sock:receive(5)

    if res == 'PJ_OK' then
      sock:send('PJREQ')
      res, err = sock:receive(5)

      if res == 'PJACK' then
        sock:send(data)
        res, err = sock:receive(6)
      else
        alert('invalid/no ack: ' .. tostring(res))  
      end
    else
      alert('invalid/no init: ' .. tostring(res))  
    end
  else
    alert('connect failed: ' .. tostring(err))
  end

  sock:close()

  return res, err
end

cmdon = string.char(0x21, 0x89, 0x01, 0x52, 0x43, 0x37, 0x33, 0x30, 0x35, 0x0A)
cmdoff = string.char(0x21, 0x89, 0x01, 0x52, 0x43, 0x37, 0x33, 0x30, 0x36, 0x0A)

res, err = tcpsend(cmdon, '192.168.1.111')
Reply


Messages In This Thread
Panasonic projector IP control - by leonidas - 23.04.2018, 07:35
RE: Panasonic projector IP control - by admin - 23.04.2018, 09:56
RE: Panasonic projector IP control - by admin - 26.04.2018, 12:30

Forum Jump: