Home AMX User Forum NetLinx Studio

Tandberg XML Advance Command Line Interface

Given this:
?-? hides all value elements
?--" hides all sub-elements

Command Example:
xstatus call 1 --
*s Call 1 (status=Synced, type=Vtlph, protocol=H323,
direction=Outgoing):
*s/end

Will this work?
DATA_EVENT[dvTAND]		//Tandberg Event
{
    ONLINE:
    {
	SEND_COMMAND dvTAND,"'TSET BAUD 38400,N,8,1 485 DISABLE'" //Sets baud rate for Tandberg Port on AMX	
    }
    STRING:
    {
	SEND_STRING dvTAND,"'xstatus call 1 --',13"
	cTand_BUFF = REMOVE_STRING(cTand_BUFF,',',1)
	SET_LENGTH_STRING(cTand_BUFF,LENGTH_STRING(cTand_BUFF) - 1)	// BACKSPACE COMMAND
	SWITCH (RIGHT_STRING(cTand_BUFF,6))
	{
	    CASE 'Synced':		//In a call
	    {
		nTest = 666
	    }
	    CASE 'active':		//"In"active (not in a call)
	    {
		nTest = 777
	    }
	}
    }
}

All I care about is whether or not the codec is in a call. I don't have a codec to test this with unfortunatly. I would like to write as much of the code before I get on the job as possible. I wanted to see what you guys thought about this. If this works like I am thinking it should, it will parse the string as follows:

First: *s Call 1 (status=Synced, type=Vtlph, protocol=H323,
direction=Outgoing):
*s/end

Second: The REMOVE_STRING "," will return *s Call 1 (status=Synced,

Third: The SET_LENGTH_STRING (...-1) will give me a backspace, getting rid of the comma.

Fourth: (RIGHT_STRING(cTand_BUFF,6)) will start from the right and return the last 6 characters which will either return "Synced" or "active" of "Inactive".

This works out on paper, but I am not sure yet how it will work in real life. Any thoughts? Thanks.

Comments

  • Spire_JeffSpire_Jeff Posts: 1,917
    If I am interpreting this correctly, it looks like you are going to create an endless loop. Every time you send the string command, it's going to generate another string event and send the command again.

    You need to qualify when it is supposed to ask for the call status and only send that request when you need it.

    Jeff
  • Whenever the user selects a PC as a source, I need the Tandberg to verify if it is in a call. If it is in a call, it needs to automagically start Duo Video. If it is not in a call, all I need it to do is simply change to the PC input. So, should I move my string parsing to the PC selection button? I also think I need to throw in a CLEAR_BUFFER somewhere to ensure when I am asking for the status, I have a clean buffer to work with.
  • Spire_JeffSpire_Jeff Posts: 1,917
    Whenever the user selects a PC as a source, I need the Tandberg to verify if it is in a call. If it is in a call, it needs to automagically start Duo Video. If it is not in a call, all I need it to do is simply change to the PC input. So, should I move my string parsing to the PC selection button? I also think I need to throw in a CLEAR_BUFFER somewhere to ensure when I am asking for the status, I have a clean buffer to work with.

    I'm in the middle of converting/writing some code for a project due tomorrow, so use my advice at your own risk ;)

    I think you need to move the command that sends a string to the dvTand requesting its current status to the PC Selection button.

    As for clearing the buffer, cTand_BUFF = REMOVE_STRING(cTand_BUFF,',',1) effectively does that. The only downside to this would be if multiple commands come in to the processor during before you have a chance to look at them. In this case, you would only deal with the first command. All other commands in the buffer would be lost. A better way to handle this would be:

    1. Use a while loop to check the buffer for a command header and footer (start and end). If both are present and the start occurs before the end, proceed to #2.
    2. Remove everything before the header and discard it.
    3. Get the complete command from the buffer and store it in a variable. ( cTand_CMD = REMOVE_STRING(cTand_BUFF,cFOOTER,1) )
    4. Do your processing on the cTand_CMD as needed.

    The above is based on a protocol that uses headers and footers for the commands. You can use the same logic for other protocols, you just have to figure out the proper way to extract a single command. If the protocol does not provide a way to determine what a message refers to in the message itself, you will have to build a queue that allows you to see the last command sent and act accordingly.

    Hope this helps,
    Jeff
  • A quick way of doing this could be the following:

    1) Set the codec Presentation Start to Auto
    2) Set the Presentation Source to PC

    When you press the PC button on your touch panel send the following string:

    xcommand keypress presentation


    This will automatically start duo video if the codec is in a call call and the far end supports duovideo.

    If not in a call or the remote site does not support duovideo, then it will transmit the PC as the main source.

    The only downside would be if you press the PC buttons again and the codec is sending duovideo, it will stop sending duovideo.


    Bryan
  • bmitchell wrote:
    A quick way of doing this could be the following:

    1) Set the codec Presentation Start to Auto
    2) Set the Presentation Source to PC

    When you press the PC button on your touch panel send the following string:

    xcommand keypress presentation


    This will automatically start duo video if the codec is in a call call and the far end supports duovideo.

    If not in a call or the remote site does not support duovideo, then it will transmit the PC as the main source.

    The only downside would be if you press the PC buttons again and the codec is sending duovideo, it will stop sending duovideo.


    Bryan

    That's not quite as sexy as manipulating strings, but if it works, I think I would rather take the easy way out. I'll give it a shot and see what happens. Thanks.
  • Spire_Jeff wrote:
    I'm in the middle of converting/writing some code for a project due tomorrow, so use my advice at your own risk ;)

    I think you need to move the command that sends a string to the dvTand requesting its current status to the PC Selection button.

    As for clearing the buffer, cTand_BUFF = REMOVE_STRING(cTand_BUFF,',',1) effectively does that. The only downside to this would be if multiple commands come in to the processor during before you have a chance to look at them. In this case, you would only deal with the first command. All other commands in the buffer would be lost. A better way to handle this would be:

    1. Use a while loop to check the buffer for a command header and footer (start and end). If both are present and the start occurs before the end, proceed to #2.
    2. Remove everything before the header and discard it.
    3. Get the complete command from the buffer and store it in a variable. ( cTand_CMD = REMOVE_STRING(cTand_BUFF,cFOOTER,1) )
    4. Do your processing on the cTand_CMD as needed.

    The above is based on a protocol that uses headers and footers for the commands. You can use the same logic for other protocols, you just have to figure out the proper way to extract a single command. If the protocol does not provide a way to determine what a message refers to in the message itself, you will have to build a queue that allows you to see the last command sent and act accordingly.

    Hope this helps,
    Jeff

    This is pretty sexy. Even if I don't use this for my problem, I am going to take this back to my Honeycomb Hideout and play with it to see if I can get it to work. Thanks.
  • Yes, this is the quick and dirty way of doing it....

    The proper way would be to register the stat/call-- and follow any changes.
    Depending on the MXP options, there can be 11 calls, so you would need to know the status of each call.

    Of course you could also look at the xstat conf and if the conference is Idle, you are not in a call.

    Finally, you should aslo check to see if the remote site has duovideo capability.
    I usually use the stat/conf (xstat conf)for this.


    Bryan
Sign In or Register to comment.