cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
939
Views
0
Helpful
1
Replies

User Interface widgets and Macros

hadybejjani
Level 1
Level 1

Dear;

Kindly note that i have created a user interface panel on my cisco codec Pro touch  10 tablet, which contains a toggle button to switch the main display on and off and a slider for controlling ceiling microphone volume and a a buttons to switch between HDMI inputs. my panel look like the attached screenshot.

 

i need helo with programing a Macro which is linked to each widgets created in the UI in order to apply a change as when I press off the Main display should turn off and when I press on it should turn on as well. as for now even I turn it on or off nothing happens on the main display because there is no Macros configured for the widgets yet, which I need your help in.

 

Thank you in advance.

 

1 Reply 1

Dirk-Jan Uittenbogaard
Cisco Employee
Cisco Employee

Hello,

Here's an example of what the macro could look like. You have to find some things yourself like: 

  • Which microphone volume needs to be changed (1-8). (update variable "my_microphone_number")
  • Create a group-button called 'my_inputselector' that has button ID's 1-6
    (you can change the button IDs to 2,4,6 if those are the inputs you want to use)
  • For the widget "toggle_button" you have to add the command that toggles or turns on/off the intended display. It may be easier to have an ON button and an OFF button, each with their own macro action.

NOTE that your question talks about "ceiling microphone volume" but the photo shows "speaker volume". I took "microphone volume"

import xapi from 'xapi';
const my_microphone_number = 2

function onGui(event) {  //__ Process widget activity
  //__ 'slider' widgets respond to 'changed'
  if (event.Type == 'changed') {
    switch(event.WidgetId) {
      case 'mic_volume_slider':
        const newMicVolume = parseInt(event.Value / (255/70));  // based on volume range of 0..70
        // DJ: you have to check which microphone, instead of [2] below 
        xapi.Configuration.Audio.Input.Microphone[my_microphone_number].Level.set(newMicVolume);
        break;
    }
  };
  //__ button widgets respond to 'pressed'
  if (event.Type == 'pressed') {
    switch(event.WidgetId) {
      case 'my_inputselector':
        // DJ: switches to the button value (1-6) of groupbutton 'my_inputselector'
        xapi.Command.Video.Input.SetMainVideoSource({ ConnectorId: event.Value });
        break;
      case 'toggle_display':
        // DJ: put your command to turn off a display here
        console.log(">> someone pressed the toggle_display button!");
        break;
    }
  }
}

//__ run 'onGui' function if someone presses a button
xapi.event.on('UserInterface Extensions Widget Action', onGui);

 

 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: