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.

pj talk
#4
I am one step further, but not there yet

- communication works, but command is probably not correct because I get a weird response

my user script
Code:
-------------------------------------- -- Author:         Nicky Wessels -- Last Modified:     24/04/2016 -- -- Change Log: -- 24/04/2016        Intial Version -------------------------------------- -- IP of the projector PROJECTOR_IP = '192.168.0.20' PROJECTOR_PORT = '53484' -- Power ON -- 'h01 h00 hA9 h17 h2F h00 h00 h00 h3F h9A' SONYPJ_CMD_ON = string.char(0x01, 0x00, 0xA9, 0x17, 0x2F, 0x00, 0x00, 0x00, 0x3F, 0x9A) -- Power Off -- 'h01 h00 hA9 h17 h2E h00 h00 h00 h3F h9A' SONYPJ_CMD_OFF = string.char(0x01, 0x00, 0xA9, 0x17, 0x2E, 0x00, 0x00, 0x00, 0x3F, 0x9A) -- change input s-video -- 'h01 h00 ha9 h00 h01 h00 h00 h01 h01 h9a' SONYPJ_SET_SVIDEO = string.char(0x01, 0x00, 0xA9, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x9A) -- funtion to send basic commands to the receiver function sonypj_send_cmd(cmd, ip, port)     require 'socket.http'  response_tbl = { }  -- fill up optional parameters  if (ip == nil) then    ip = PROJECTOR_IP  end  if (port == nil) then    port = PROJECTOR_PORT  end  response_tbl['ip']=ip  response_tbl['port']=port  response_tbl['cmd']=cmd  -- Send command to projector     sock = socket.tcp()     sock:settimeout(3)     result, err = sock:connect(ip, port)  response_tbl['result']=result     if result then      result, err = sock:send(cmd)       response_tbl['result']=result    response_tbl['error']=error    -- Check response from projector         if result then        alert('send OK')      else        alert('send failed: ' .. tostring(err), response_tbl)      end     else      alert('connect failed: ' .. tostring(err), response_tbl)     end     sock:close()    return response_tbl end
my trigger script
Code:
require 'user.sony_pjtalk' -- object mapped to this event must have its data type set bStatus = event.getvalue() -- get the status of the projector if (bStatus) then  status_tbl = sonypj_send_cmd(SONYPJ_CMD_ON) else     status_tbl = sonypj_send_cmd(SONYPJ_CMD_OFF) end   log('status',status_tbl)

the response that I get for all commands

Code:
* arg: 2  * table:   [error]    * function: builtin#19   [ip]    * string: 192.168.0.20   [result]    * number: 10   [cmd]    * string: 
Reply


Messages In This Thread
pj talk - by npinguin - 24.04.2016, 16:56
RE: pj talk - by admin - 24.04.2016, 17:09
RE: pj talk - by npinguin - 24.04.2016, 18:29
RE: pj talk - by npinguin - 24.04.2016, 19:44
RE: pj talk - by Erwin van der Zwart - 24.04.2016, 22:02
RE: pj talk - by npinguin - 25.04.2016, 17:13
RE: pj talk - by npinguin - 30.11.2017, 14:43
RE: pj talk - by admin - 30.11.2017, 18:38
RE: pj talk - by npinguin - 30.11.2017, 19:13

Forum Jump: