AMX IS-SPX-1000/1300 manual Concepts Behind Shared Variables, Javascript API, Interface

Page 93

Shared Variables

Shared Variables

Overview

The IS-SPX Player introduces a new mechanism called “shared variables”. This mechanism is based on a client/server model whereby a server maintains a collection of variables. The value of the variables may be updated at any time. When needed, one or more clients connect to the server to get the current value of the variables. The client can further elect to receive real-time notification when the value of those variables is updated.

The client and the server might be located on the same physical host. In this case, the shared variables are used to share information within documents. For instance, this can be used to generate interactive menus. The server might be a remote PC or another IS-SPX Player. In this case the shared variables can be used to trigger many types of events on the IS-SPX Player, such as changing the content displayed by the player, displaying a message on the screen, or the real time update of news feeds.

Concepts Behind Shared Variables

The operation of notifying the server of the list of variables for which notification is desired is called a “subscription”. Clients may subscribe and un-subscribe to variables at any time. When a client first subscribes to a variable and this variable already has a value, it will immediately receive a notification with the current value. Subsequently, the client will receive notifications each time the value has been updated, regardless of whether the value is actually different from what it was before.

The update notification always carries an absolute UTC timestamp that may be used to synchronize the action of multiple clients on a variable update. This publish and subscribe mechanism resembles the “messaging” feature of enterprise application frameworks with the exception that due to the real-time orientation only the most up to date value of a variable is distributed, so some notifications may be dropped if a newer update is available.

It is possible to subscribe to input events (mouse clicks or keyboard inputs) from an IS-SPX Player. In this case, all events received by the server will be passed to the client. For instance, it is possible using a keyboard plugged into an IS- SPX Player to control not only the attached player but also other players connected through the network. The special subscription variable “%EVENTS%” will cause event notifications to be sent instead of updates.

Javascript API

Shared variables are meant to be used with the JavaScript and NetLinx programming languages.

Interface

interface SharedVariable { readonly attribute DOMString name; readonly attribute DOMString value;

readonly attribute float lastUpdateTime; // milliseconds since Jan 1st 1970 UTC

void set( DOMString newValue );

void addUpdateListener( UpdateListener listener ); void removeUpdateListener( UpdateListener listener ); };

void UpdateListener( SharedVariable var ); interface SVGGLobal {

SharedVariable createSharedVariable( DOMString name ); };

The main API is the global createSharedVariable function, which is used both to create a local variable and to connect to a remote one.

A local variable will be stored in a non-persistent manner on the IS-SPX Player. This means that a reboot of the IS-SPX Player will reset all shared variables to empty values. Local variables can be accessed from remote clients only when the network API of the player is enabled.

To connect to a remote variable, the name parameter must contain the variable name followed by '@' and the hostname of

the variable server. Optionally, a TCP port should be added if the port number on the server is different from the port number on the local host, e.g: text@remotehost:4567.

Inspired XPress - Programming Guide

85

 

 

Image 93
Contents Inspired Signage XPress WARRANTY, Disclaimer and License Table of Contents Remote Control Synchronized Content Interactivity Serial Protocol File Editor Table of Contents Inspired XPress Programming Guide When to use XPress Authoring Features? InstallationInstalling Inspired Signage XPress for the First Time IntroductionXPress must be restarted to complete the activation Minimum Recommended PC RequirementsInstallation Location Inspired Signage XPress UIXPress Removal Learning XPress Authoring Features XPress ProjectsXPress Main Interface My Projects folder Creating a New ProjectNew Project dialog Target Browsing PanelImporting Multi-Media Files Importing ImagesImporting Video Importing PowerPoint Presentations Creating and Editing SVG FilesImporting Flash SWF Files Template Document Parameters Editing an Existing SVG DocumentMedia description dialog lets you change Edit a Media PropertyInteractively Editing SVG Files Interactive EditingDemonstration of Media Elements Editing Media Elements LayoutEditing Text Editing Media LinksMulti-Layered SVG Templates Composing a SceneCustomizing a Multi-Layer SVG Document Playlist Template Example EditingComposing a playlist SVG document How to Customize a Playlist SVG DocumentPlaylist Tab Composing a Live News Document Special News TemplatesLayout Templates Format HelpersNews.svg Customizing a News SVG DocumentNewsticker.svg Newscrawler.svgSwitch.svg Using Format HelpersBouncingtext.svg Fittext.svgExample of 169 content Scalable Content and Aspect Ratio of Your Display169 templates as shows on a 43 screen Configuring Effects Multimedia EffectsAdding Effects Previewing Preview XPress ContentPublishing Using Quick PublishManually Add Devices to XPress MonitoringScheduling Scheduling the Content Displayed by an IS-SPX PlayerCheck the Status of the Devices Open a DeviceOpen a Schedule Create a New ScheduleCalendar view Add Events To a ScheduleDefine Default Events and Recurrences Define a Default AnimationModify the Scheduling Properties of an Event Edit recurrence rule Define Recurring EventsData Polling Rates Preview Scheduled ContentWhen To Use Remote Control Remote Control of ContentHow To Use Remote Control OverviewID table Playlist Triggering a Content Switch Over IPSettings menu Enable Network API Example TestingSwitching Content With a USB HID Device Switching Content With the Serial PortKey Identifiers tab Switching Content From Another DeviceRemote Control of Playback When To Use Remote Control of PlaybackHow To Use Remote Control of Playback Interactive Pause/Resume Over TCP Interactive Pause/Resume Using Http GETGET Embedded In an Html Interactive Pause/Resume From a DeviceTimed pause/seek/resume Knowing the Current Position With Extra Accuracy Getting Feedback On the Playback ProgressTriggering an Alternative Content Remote TriggersTriggering a Text or Image Overlay Triggering of SVG Animations Application Examples Multiscreen DisplaysDesigning Basic Projects for Multiscreen Layouts New Project menu Creating a Configurable Multiscreen ProjectMultiscreen Properties Finding the multiscreen templates Creating a Multiscreen Project from TemplatesNew multiscreen project can now be Saved and Edited Multiscreen layout drop down options Editing Multiscreen ContentConfiguring XPress and the IS-SPX Player Configure the Multiscreen IDCreate a Virtual Device Synchronization Publish Your Project To Your DeviceSynchronizing Devices Administration Date/Time Configure NTP Through the Http InterfaceAdvanced Configuration Using an IS-SPX Player as an NTP ServerConfiguration Master/Server Architecture Examples Configuration of the IS-SPX Player Acting as MasterSynchronization Elements Syntax for Multiscreen Synchronized ContentCanvas and Viewbox Concepts Multiscreen ElementsAdditional Syntax for Multiscreen Content Extension of the SVG switch ElementSpxbegin Element Example Screen Layout With Six Screens Extension of JavaScriptExample Screen Layout With Spread Displays Example switch SVG ElementExample JavaScript TroubleshootingNTP Synchronization Project CreationSynchronized Content Synchronized Content Inspired XPress Programming Guide Interactivity Template Files Creating Interactive ContentCreating Buttons Creating a Touch Screen MenuAdding an Action ID Controlling MediaEnter Interactive Mode Testing the ProjectCreating the Menu Creating a Keyboard MenuButton Action IDs Configuring the menuRGB values Hexadecimal value Eyedropper tool Color Selection green Controlling the MenuInteractive controls KeystrokesLayers tab keystroke.svg Controlling MediaTesting the Project Playback ProjectsSuggestions for Further Projects New Project Playback TemplateControlling the Media Playback PositionExample Media player Playback.svg details Slider.svg placement Interactivity Settings IS-SPX Player ConfigurationCalibration of a Touchscreen Through the IS-SPX Player Calibration For Touch ScreensTroubleshooting Manual Calibration ProcedureAdding a List Variable Serial Protocol File Editor Edit Variable Page List variable Adding a Range VariableEdit Variable page Range variable Exporting the Finished FilePage Concepts Behind Shared Variables Javascript APIInterface Sample Code Setting the VariableNetwork API Reading the VariableNetwork API Commands List of CommandsSample Code Enabling the Network APIAPI Emulation Restarting XPress will reset all the shared variablesShared Variables Inspired XPress Programming Guide Gathering Display Serial Protocol Commands Serial Protocol Commands TextSerial Control Creating a Serial Protocol File Serial Protocol Commands HexHex Manual Command Text EntriesVariable List Volume Control VariableScreen Mute Picture Off Screen Mute Picture OnMute On Sound Mute Off SoundUploading the Serial Protocol File Under the Administration section, select RS232 / USB IOXPress My Templates Folder Creating New TemplatesXML Tree with new attribute param1 Creating and updating a new calendar fileNew.ics file Power command Adding Additional Templates to Inspired Signage XPressSerial Control From NetLinx FSM Commonly Used TermsIncrease Your Revenue through education + knowledge