Reciving strings via TCP
Hi everyone! I come from QSC and this is my first time working with AMX on a project and I'm afraid I need to ask for some help.
Basicly the QSC sends either "NED" or "OPP" trough a lua script, the connection is working and stable but im not sure if the AMX actually is receiving anything.
`Define_Devices
dvQsys 0:56:0
Define_Constant
Localport = 10500
Define_function startserver()
{
ip_server_open(dvQsys.Port,Localport,1)
}
Define start
Create_buffer dvQsys.Port, stringfromqsc;
startserver()
Define_Event
Data_event[dvQsys.port]
{
String:
{
if(find_string(stringfromqsc,'NED', 4)
remove_string(stringfromqsc,'NED', 4)
send_command dvKnx, 'SET=1:0'
}
}
}`
I've tried messing around with removing/adding the ".PORT" but nothing is giving results.
Answers
The DATA_EVENT parameter is the full device DPS, not just the .port
to the OP:
Also true for the 'create_buffer' command
The code you posted won't compile, so I assume it's not what you are using, but 2 other points:
the 'send_command dvKnx, 'SET=1:0'' will run every time some string comes in, not only when the 'if' statement evaluates to true. The brackets there don't match up, so not sure.
dvKnx is not defined in your posted code, but if using the usual way of naming devices dvKnx (instead of vdvKnx) it could be that you meant to use 'send_string' not 'send_command' if you are sending to a real device instead of a module (virtual device). Hard to tell.