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.

Arylic integration via TCP API
#2
Here's an example of sending commands:
Code:
function encodeuint32(value)
  local bytes = {}

  for i = 1, 4 do
    bytes[ i ] = bit.band(value, 0xFF)
    value = bit.rshift(value, 8)
  end

  return string.char(unpack(bytes))
end

function encode(cmd)
  if #cmd > 11 then
    cmd = cmd .. '&'
  end

  local csum = 0
  for i = 1, #cmd do
    csum = csum + cmd:byte(i)
  end

  return
    string.char(0x18, 0x96, 0x18, 0x20) ..
    encodeuint32(#cmd) ..
    encodeuint32(csum) ..
    string.char(0x00):rep(8) ..
    cmd
end

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

res, err = sock:connect('192.168.1.1', 8899)
if res then
  data = encode('MCU+VOL+050')
  sock:send(data)

  log('send ok')
else
  log('connection failed', err)
end

sock:close()

For full integration the response must be parsed. Since the device can only handle a single TCP connection you will need a resident script that handles both sending commands and receiving status message from the device.
Reply


Messages In This Thread
Arylic integration via TCP API - by MantasJ - 18.02.2026, 15:34
RE: Arylic integration via TCP API - by admin - 19.02.2026, 12:17

Forum Jump: