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
#1
Hi guys,

Arylic is a brand creating audio amplifiers, pre-amplifiers and streamers. It is pretty widely used due to its cost-effective price. It has multiple ways for integration into 3rd party systems, which include:

TCP API:  TCP API – Arylic Audio TCP API Interface
HTTP API:  HTTP API – Arylic Audio HTTP API

We have made a working script for integration via HTTP API - if someone is interested I could post it here. Maybe it would be possible to get an example for integration via TCP API? Some of the newer Arylic devices does not support HTTP API anymore while continuing support for TCP API.

Many thanks in advance!
Reply
#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


Forum Jump: