Home AMX User Forum AMXForums Archive Threads AMX Hardware AutoPatch Forum

Optima - Sending BCS Command

Hello,
First, I am new to Netlinx programming and it's been a while since I took the Programmer 1 course. Second, we are currently using an Extron Switch but have since made the 'switch' to the AMX AP Optima. I'm trying to get my feet wet by trying a simple command with a button press on the TP. I would like to make an assignment for the DVD player to show up on the Panasonic monitor. Here is what I have:
DEFINE_DEVICE
dvAP = 5001:1:0
dvPanasonic = 5001:6:0
dvDVD = 5001:9:0
dvTP = 10001:1:0

vdvAP = 41003:3:0
vdvPanasonic = 41003:6:0

DEFINE_MODULE 'AutoPatch_Matrix_Switcher_Comm_dr1_0_0' INST(vdvAP, dvAP)
DEFINE_MODULE 'Panasonic_TH50PF30U_Comm_dr1_0_0' mdlPANASONIC_COMM(vdvPanasonic,dvPanasonic)

DEFINE_EVENT
BUTTON_EVENT[dvTP,2]
{
    PUSH:
    {
        SEND_COMMAND dvAP,"'CL1I2O5T'"  //DVD player is on level 1 input 2; send to output 5 (panasonic monitor)
    }
}
The monitor is on (HDMI input) and the DVD player is playing so I was expecting the assignment to be made and see the movie playing on the monitor but no such luck. Is there something else I need to include in my 'simple' program? When I look at the Notifications I can see where my command was sent to the D:P:S of the monitor but I'm not sure how to read the 'String From' lines.

Any help would be greatly appreciated!
tspoe

Comments

  • viningvining Posts: 4,368
    Since you're using a DUET module you may not be able to send commands directly to the device. I do know that you will not recieve string from the device if you create your own data_event and string handler unless you issue the "PASSBACK' command to the virtual. Likely you may need to send this command to the virtual too using the "PASSTHRU" command. Read the doc that comes with the module and it should clarify this for you. I don't use duet modules myself so I only know the tid bits that are posted on the forums.

    Once you read the doc it should give you the format to control the virtual which in turn will control the device so you don't even need to send string directly to the device using the "PASSTHRU" command.
  • tspoetspoe Posts: 32
    Thanks for the quick reply!! I re-read the duet module doc and put in a PASSBACK command in an ONLINE DATA_EVENT. I also changed the D:P:S for the virtual devices (oops) and am sending the PASSTHRU command to the virtual device.
    DEFINE_DEVICE
    dvAP = 5001:1:0
    dvPanasonic = 5001:6:0
    dvDVD = 5001:9:0
    dvTP = 10001:1:0
    
    vdvAP = 41001:1:0
    vdvPanasonic = 41004:1:0
    
    DEFINE_MODULE 'AutoPatch_Matrix_Switcher_Comm_dr1_0_0' INST(vdvAP, dvAP)
    DEFINE_MODULE 'Panasonic_TH50PF30U_Comm_dr1_0_0' mdlPANASONIC_COMM(vdvPanasonic,dvPanasonic)
    
    DEFINE_EVENT
    BUTTON_EVENT[dvTP,2]
    {
        PUSH:
        {
            SEND_COMMAND vdvAP,"'PASSTHRU-CL1I2O5T'"  //DVD player is on level 1 input 2; send to output 5 (panasonic monitor)
        }
    }
    
    DATA_EVENT[vdvAP]
    {
        ONLINE:
        {
            SEND_COMMAND vdvAP,"'PROPERTY-Baud_Rate,9600'"
            SEND_COMMAND vdvAP,"'PASSBACK-1'"
            SEND_COMMAND vdvAP,"'REINIT'"
        }
    }
    

    It still doesn't work. I even tried to 'Control a Device' using the command. Do I have the command formatted correctly? Did I misunderstand your explanation? Another thing I noticed is I'm getting a "PanasonicMonitor: Received Error: 401" error when I enable the diagnostic messages. I'm not sure what that means...I was able to turn the monitor on/off using 'Control a Device'.
    Thanks for your help!!
  • huttencmhuttencm Posts: 23
    Send_Command is only for virtual devices and controller ports, if you want to control a physical device then use Send_String.
    If you are just doing simple switching you don't need the comm module.

    DATA_EVENT[dvAP] // SETUP RS232 PORT 1
    {
    ONLINE:
    {
    SEND_COMMAND DATA.DEVICE,"'SET BAUD 9600,N,8,1,485 DISABLE'"
    }
    }

    BUTTON_EVENT[dvTP,2]
    {
    PUSH:
    {
    SEND_STRING dvAP,"'CL1I2O5T'" //DVD player is on level 1 input 2; send to output 5 (panasonic monitor)
    }
    }

    also I am not seeing where you are telling the monitor to switch to the proper input to display this source?
  • tspoetspoe Posts: 32
    Thank you, hunttencm!
    I commented out the duet modules (not sure if that mattered), changed the DATA_EVENT per your example and set the input of the monitor to HDMI (question: Do I have to explicitly set the input even tho the monitor was already on the HDMI input?). I'm not sure what happened. I pressed the button on the TP and nothing happened. About 1 min later all of a sudden the DVD appeared playing on the monitor. Was this just a delayed reaction?
    DEFINE_DEVICE
    dvAP = 5001:1:0
    dvPanasonic = 5001:6:0
    dvDVD = 5001:9:0
    dvTP = 10001:1:0
    
    vdvAP = 41001:1:0
    vdvPanasonic = 41004:1:0
    
    //DEFINE_MODULE 'AutoPatch_Matrix_Switcher_Comm_dr1_0_0' INST(vdvAP, dvAP)
    //DEFINE_MODULE 'Panasonic_TH50PF30U_Comm_dr1_0_0' mdlPANASONIC_COMM(vdvPanasonic,dvPanasonic)
    
    DEFINE_EVENT
    BUTTON_EVENT[dvTP,2]
    {
        PUSH:
        {
            PULSE[vdvPanasonic,9] //just testing here
            SEND_STRING dvPanasonic,"'INPUT-HDMI,1'"
            SEND_STRING dvAP,"'CL1I2O5T'"  //DVD player is on level 1 input 2; send to output 5 (panasonic monitor)
        }
    }
    
    DATA_EVENT[dvAP]
    {
        ONLINE:
        {
            SEND_COMMAND DATA.DEVICE,"'SET BAUD 9600,N,8,1 485 DISABLE'"
        }
    }
    

    One more question...where can I find information on how to set the baud rate using 'SET BAUD'? Our predecessors used 'PROPERTY-Baud_Rate...' etc when sending the command to the virtual device but now I'm not so sure that's correct...and they've since resigned so I can't ask them!
  • [Deleted User][Deleted User] Harman Integrated Technologies Group (ITG) Posts: 0
    In reality, you do not need to use passthru in this case. The passthru feature is intended to offer the programmer a means of communicating outside of what is built into the module. There may be a feature you need to add that is not built in or part of SNAPI, and you would use passthru to send that and still work within the module structure.

    You also do not need the ONLINE data event for the autopatch because the interface document points out that the module is setting the baud to the 9600 setting by default. You would only use the PROPERTY command if you want to deviate from the default.

    Here is the code I used based on your sample, and then expanded to assist with read-ability:
    PROGRAM_NAME = 'Simple Program'
    
    DEFINE_DEVICE
    dvAP = 5001:1:0
    dvPanasonic = 5001:6:0
    dvDVD = 5001:9:0
    dvTP = 10001:1:0
    
    vdvAP = 41001:1:0
    vdvPanasonic = 41004:1:0
    
    #INCLUDE 'SNAPI.axi'
    
    DEFINE_CONSTANT
    VOLATILE INTEGER nSwitchINPUT_Cable = 1
    VOLATILE INTEGER nSwitchINPUT_DVD = 2
    VOLATILE INTEGER nSwitchINPUT_AppleTV = 3
    
    VOLATILE INTEGER nSwitchOUTPUT_Samsung = 2
    VOLATILE INTEGER nSwitchOUTPUT_Panasonic = 5
    
    VOLATILE INTEGER eSwitchLevel_All = 1
    VOLATILE INTEGER eSwitchLevel_Video = 2
    VOLATILE INTEGER eSwitchLevel_Audio = 3
    
    VOLATILE INTEGER eDestination_Panasonic = 1
    VOLATILE INTEGER eDestination_Samsung = 2
    
    VOLATILE INTEGER eSource_DVD = 1
    VOLATILE INTEGER eSource_Cable = 2
    VOLATILE INTEGER eSource_AppleTV = 3
    
    DEFINE_VARIABLE
    VOLATILE CHAR cSwitcher_Levels[][5]=
    {
    	'ALL',
    	'VIDEO',
    	'AUDIO'
    }
    VOLATILE DEV vdvDestinations[]=
    {
    	vdvPanasonic
    	//vdvSamsung //if it existed in the system etc...
    }
    VOLATILE INTEGER nPanasonicInputs[]=
    {
    //INPUTSELECT- values for this module.  When I select x source, goto THIS inputselect number
    	1, //DVD
    	5, //Cable
    	4  //Apple TV
    }
    
    DEFINE_FUNCTION fnMakeSwitch (INTEGER nInput, INTEGER nOutput, INTEGER nSwitchLevel)
    {
    	SEND_COMMAND vdvAP,"'CL',cSwitcher_Levels[nSwitchLevel],'I',ITOA(nInput),'O',ITOA(nOutput)"
    }
    
    DEFINE_FUNCTION fnSetDisplayPower(INTEGER eDestination, INTEGER nSTATE)
    {
    	PULSE [vdvDestinations[eDestination], nSTATE];
    }
    DEFINE_FUNCTION fnSetDisplayInput(INTEGER eDestination, INTEGER nInput)
    {
    	SEND_COMMAND vdvDestinations[eDestination], "'INPUTSELECT-',ITOA(nINPUT)";
    }
    
    DEFINE_MODULE 'AutoPatch_Matrix_Switcher_Comm_dr1_0_0' mdlAutopatch(vdvAP, dvAP)
    DEFINE_MODULE 'Panasonic_TH50PF30U_Comm_dr1_0_0' mdlPANASONIC_COMM(vdvPanasonic,dvPanasonic)
    
    
    DEFINE_EVENT
    BUTTON_EVENT[dvTP,2]
    {
        PUSH:
        {
    	fnSetDisplayPower(eDestination_Panasonic, PWR_ON)
    	fnSetDisplayInput(eDestination_Panasonic, nPanasonicInputs[eSource_DVD])
    	fnMakeSwitch(nSwitchINPUT_DVD,nSwitchOUTPUT_Panasonic, eSwitchLevel_All)
        }
    }
    
    

    Here is the Netlinx Studio output notifications I received when I EMULATE device 10001 and do a push of channel 2 to trigger the button event:
    Line      1 (10:29:48):: Feedback:On [41004:1:1] - Channel 27 
    Line      2 (10:29:48):: Command To [41004:1:1]-[INPUTSELECT-1]
    Line      3 (10:29:48):: Command From [41004:1:1]-[INPUTSELECT-1]
    Line      4 (10:29:48):: Command To [41001:1:1]-[CLALLI2O5]
    Line      5 (10:29:48):: Command From [41001:1:1]-[CLALLI2O5]
    Line      6 (10:29:48):: String To [5001:1:1]-[CL0I2O5T]
    Line      7 (10:29:48):: Feedback:Off [41004:1:1] - Channel 27 
    
  • tspoetspoe Posts: 32
    Wow...thanks, Chris. I'll need time to digest this, but I see you're making the assignments using "CL<sl>I<input>O
    <output,..>" command. We have an HDMI board and a HD-15 board...using this command, how do you specify which VIDEO level you're working with? I haven't found any documentation on this so I've been using the "CI" command.
  • [Deleted User][Deleted User] Harman Integrated Technologies Group (ITG) Posts: 0
    CI should work fine, it is a shortcut that should result in the same outcome as CLALL. If your notifications indicate the proper string going out, but the result is not as expected, is there an error message coming back from the device? You could see this return string with DIAGNOSTICS > NETLINX DEVICE NOTIFICATION OPTIONS > strings TO and FROM 5001:1:1

    Assuming there are no errors returned, and you still don't see the outcome you intended, what does the front panel of the switch indicate for the current status? If that matches what your string was, something else is going on.

    At some point, you may want to engage technical support if it doesn't appear to be working and all signs point to correct syntax.
  • tspoetspoe Posts: 32
    Hi Chris,
    I added the #INCLUDE file and it appears to be working now. We'll see if it still works tomorrow morning. :)
    Thanks for your help! I haven't had time to look over your example yet but I'll do that first thing in the morning (after I test).
    T
  • tspoetspoe Posts: 32
    I've been testing Chris' code and for some reason when I send a command to the virtual device it doesn't work, but I'm successful in sending the same string to the device itself. I can see via the Notifications window that the 'CL1I2O5T' command was sent to the switch (41001:1:1) and the switch returned the same command. The next 2 lines are puzzling...a 'String To' then a 'String From', both to/from 5001:1:1, responds with [XXXXX]. What does this mean?

    The front panel on the switch doesn't show me which input is tied to which output(s) but I can 'Change' the ties via the front panel and the blue lights appear.
  • [Deleted User][Deleted User] Harman Integrated Technologies Group (ITG) Posts: 0
    To my knowledge, the 'xxxxx' is the heartbeat poll from the module to ensure the endpoint device is still alive and responsive.

    Pasting in your notifications or telnet log would be helpful to further assist here. In Netlinx Studio, I would make sure the "command" radio button is selected prior to sending.

    You indicated that you are sending strings directly to the device - how is that occurring -- telnet or Diagnostics>Control A Device? When you are sending the string, is the module loaded or is that being done outside of your program?

    In telnet, if you type 'device status 41001:1:1' - what do you see for the feedback channels?
  • tspoetspoe Posts: 32
    Hi Chris!
    When I was sending the command to the device I was using the code in my program:
    BUTTON_EVENT[dvTP,2]
    {
        PUSH:
        {
            SEND_STRING dvPanasonic,"'INPUT-HDMI,1'"
            SEND_STRING dvAP,"'CL1I2O5T'"  //DVD player is on level 1 input 2; send to output 5 (panasonic monitor)
        }
    }
    

    I tried using 'Control a Device' (5001:1:1, command=CL1I2O5T - I tried with and without the 'T') but nothing happened.

    When I get the status of the device via telnet, I get the following:

    Port 1 - Channels:255 Levels:8
    MaxStringLen=2000 Types= etc...
    The following input channels are on:None
    The following output channels are on:251
    The following feedback channels are on:251
    Level 1=0 Supported data types= etc...

    Hope that helps...I'm stumped.
  • [Deleted User][Deleted User] Harman Integrated Technologies Group (ITG) Posts: 0
    Seeing that you have feedback channel 251 (device communicating), and not 252 (data initialized), could be part of the issue. At present, the module feedback indicates it is not initialized with the hardware.

    When you revisit this, telnet into your master and do the following:

    1) type msg on
    2) type send command 41001, 'DEBUG-4'

    Watch the internal module dialog to see if you can identify where the breakdown is occurring in the communications.

    My suggestion is to contact technical support when you are connected to the device as they would be able to provide assistance when you need it rather than a delayed response once you are offsite.

    Additionally, it sounds like you are not using the tools within netlinx studio quite right.
    tspoe wrote:
    I tried using 'Control a Device' (5001:1:1, command=CL1I2O5T - I tried with and without the 'T') but nothing happened.
    To do what you are attempting, it would be a send STRING to 5001, or a send COMMAND to 41001. The module interface guide would describe the syntax to send, but based on what I recall - what you are typing would not work as a send command to this module. The interface document suggested CLVIDEOI2O5 -- the module would then convert that into CL1I2O5T before sending it as a string to the physical device.

    You are close! Good luck and I hope you are able to speak with support the next time you are onsite and connected to this system.
  • tspoetspoe Posts: 32
    Hi Chris,
    Is there anyway to find out what the debug info means in the telnet session??
    I forgot that I needed to 'send_string' to the device vs 'send_command'...thank you.
    I changed the 'CL1' to 'CLVIDEO' and that seems to be working and I can see where the command translates to 'CL1...' in telnet mode. This brings me back to one of my questions tho. We have an HDMI board (Level 1) and an HD-15 (Level 2) board...by using 'VIDEO' in the command, how do I distinguish between the 2 Levels? The command translated to Level 1 but what if I'm sending commands to the HD-15 level?
    Thanks for your help!!
    T
  • [Deleted User][Deleted User] Harman Integrated Technologies Group (ITG) Posts: 0
    Your understanding of the term level, when used in this context, is incorrect. An autopatch level pertains to the audio signal or the video signal and not the card plane the input/output boards are mounted to.

    In your case, you only have video to contend with. In some design scenarios, like a precis 8x8 component switch with analog stereo audio, Input 1 would have an audio signal and a separate video signal. Using the protocol, I could request the audio signal from one input, and route that to an output - but not the video portion of the same input. We call this break-away audio or break-away video.

    The optima does not currently support break-away audio on HDMI signals, and your other card is HD15. If it is HD15+stereo, you would have both audio and video levels, or just video if it is a HD15 without the stereo inputs. You will notice that the default is to generally use CL0, or CLALL within the module because that command will switch audio and video together. This gives you one command instead of two - just like the CI command does the same as the CL0 (or CLALL in the module).

    The inputs are numbered on your Optima. These numbers are managed within the configuration file on the device. You will change the level based on what you are looking to accomplish - audio only, video only, or both. The Input number is what is deciding whether you get the HDMI or the HD15. In your case, the top card is probably 1-8 and the second card is 9-16. The XNConnect utility would allow you drill into that configuration file if needed.

    To further illustrate the differences in levels, here are three examples with what the outcome should be. Understand that some commands are not valid with all products using the BCS API.

    CL0I1O1 - route audio AND video for Input 1 to Output 1 (command is valid for some, but not all models)
    CL1I1O1 - route video only for Input 1 to Output 1
    CL2I1O1 - route audio only for Input 1 to Output 1

    Make sense?
  • tspoetspoe Posts: 32
    Ugh...just when I thought I had it figured out.

    Can you explain AFV (audio-follow-video)? I haven't come across a document that really explains it. It's in the Autopatch Official Demo file but no explanation.

    The HDMI board is numbered 1-8, the HD-15 board is numbered 1-8 and the Audio board is numbered 1-8. Is it possible they're configured 1-8, 9-16, 17-24? I haven't looked at XNConnect yet.
Sign In or Register to comment.