Part 3: Handle Media Devices Using History State
UsuallyThe thereIVI aresystem allows the use of various Mediamedia devices available in an IVI.devices. The user can chooseselect a certainspecific device inwithin the Media context. He can leave the Mediamedia context and switch to e.g.navigation Navigation.or Onceother hefunctions. comesWhen backreturning to the Mediamedia scene, the correctlast selected Mediamedia device willmust be displayed.displayed correctly.
To achieve this withbehavior in Scene Composer we need toComposer, create a configuration similar configuration to the whatsettings we have already donemade for Navigation, MediaMedia, and Phone:Phone. WeSpecifically, willcreate need separateindividual states for our Media devices Radio, BluetoothBluetooth, and USB.USB, Weand set up two-way transitions between them (e.g. Radio ⇔ Bluetooth).
In addition, you will also need toa configure transitions between these states in both directions (from Radiofunction to Bluetooth, from Bluetooth to Radio etc).
Within these Media States we also have to keep track of the currently selected device within the media scene. To do this, use a History State so that when the user leaves the media context and returns, the device that was last selected is automatically restored.
This tutorial will explain how to set these up in detail.
Configure SubChart
The Media device.States Thisthat exist in Main_StateMachine are configured as SubCharts. Within the Media States configured as SubCharts, the States for Radio, Bluetooth, and USB are placed.
Converting a Media State to a Subchart
Create a Sub Chart for Media
This chartSubchart will be created inside the Media State. Its starting point will be an Initial State, so drag and drop an initial state onto the Media State.

Additionally we will need to add separate states for Radio, Bluetooth and USB. In order to find enough space for these states, we could enlarge the media state using the resize handlesdisplayed in the cornerslower right of the selectedState).
media

AThe more elegant way isoperation to create a subchart. Select theconvert Media State to SubChart is now complete.
Adding an Initial State and pressStates
After selecting the Media State, double-click to

Expand the size of the Subchart by dragging the Subchart frame handle with the mouse.
In the Subchart, place one Initial State and three States from the toolbar at the top right of the State Machine
The newplacement structureof alsothe appearsbasic components is now complete. Continue to configure the OnEntry action and Transition settings.
Structure of each State
When transitioning to each State in the panelSubchart on(entering and exiting States), the leftcorresponding inscene must be made active or inactive. In addition, when each scene is made active or inactive, the Media Menu scene text must be set to be displayed or hidden accordingly.
Scene display settings

The inner state "Media" can also be renamed by selecting the name] in the lower left panel and changing the name in the properties panel (or using the keyboard shortcut F2).
This inner state "Media" can be accessed by double-clicking the initial state inof the State Machine Editor orpanel.
A link will appear as you move the mouse, so release the left mouse button at the any location.
Select “Action > Transition > Transition Request” from the list and connect it to the top node.

field at the top of the dialog.
TheRepeat the same process for the
Make the following settings for the
Repeat the
Text Display Settings
A link will appear
Select "Action > Property > Enable Rendering" from the list and connect it to the top node.
Enable Rendering is

Repeat
Addthe Statessame process for Mediathe Devices
[On OurExit sampleActions] IVIof willthe provideRadio threeFusion Medianode Devices.to So,connect let'sthe addEnable Rendering Fusion node.
ConfigureFollow the Statessame -procedure OnEntryto make similar settings for Bluetooth and OnExitUSB State.
Adding a Transition
We havewill tonow configurecreate whata happenstransition whenbetween the states are entered and when they are exited. Our configuration here will be similar to what we did for Navigation, Media and Phone.
When a state is entered, we have tocreated activateso far.
Setting the respectiveInitial SceneState
We awill TransitionRequest. Whenset the state is exited, the Scene has to be deactivated again with a TransitionRequest.

Additionally, we want the Media_Menu Scene to display the currently active Media Device. This is also configured with an OnEntry and an OnExit Action.

Configure all States (Radio, USB and Bluetooth) in a similar way:

Insert Transitions
Now it's time to draw a transition from the Initial State to the Radio State, which is the initial state.
While the Transition is ready to be placed, click on the Radio State.
The direction of the Transition connection is from the Initial State to the Radio State.
With this setting, the transition to the Radio State has been configured as the initial state of the Media State (Subchart).
Transition settings between each State
Next, we will set up the transitions intobetween botheach directionsState (similarRadio, Bluetooth, USB).
With the added Transition selected, click [ Fusion... ] at the bottom left of the State Machine Editor panel.
The Check Click Fusion node is connected to the connector (Condition) at the top right of the Transition Fusion node.
Select the Check Click Fusion node that is connected by default, and
Drag the connector (Condition) at the upper right of the Transition Fusion node, move the mouse, and
Enter “Check Key Input” in
Drag the connector (Actions) at the bottom right of the Transition Fusion node, move the mouse, and release the left mouse button at the any location.
Enter “Transition Request” in the search field at the top of the dialog.
Double-click Transition Request.
Make the following settings for the Transition Request Fusion node.
| Check |
Repeat the above steps 1 to 11 to set the following five transitions.
TheTransition
Key_DownArrow Scenes>Media USB USB to Radio Scenes>Media Radio Radio to USB
Scenes>Media USB
USB to Bluetooth Scenes>Media Bluetooth Bluetooth to Radio Scenes>Media RadioWhen all settings are complete, the screen will look

With the above settings, the scene that is displayed when a transition occurs from each scene in the subchart has been set.

ConfigureChecking Statethe Transitionsscreen transition
TheUse userthe should be ablePlayer to navigatecheck fromthe screen transition.
Pressing the right arrow key on the keyboard switches the text on the screen, and “Media Title”, “Radio Title”, and “Radio” are displayed in the simulation display, and the transition to the Media Menu scene (Subchart) is performed.
Pressing the up and down arrow
Close the CGI Panel and exit the Player.
In addition to navigatingthe switching between the Navigation, Phone and Media scenes set in Part 2, we were able to confirm that it is also possible to switch between the Radio, Bluetooth and Phone).
Allscenes, clockwisewhich transitionsare subcharts. However, at present, even if you switch to a scene placed in a subchart in the Media scene, when you transition back to the Navigation or Phone scene (namedusing *_next)the left and right directional keys) and then return to the Media scene, the Radio scene, which is always set as the initial scene of the Media scene, will be configured for Key_DownArrow and all counter-clockwise transitions (named *_prev) will be configured for Key_UpArrow.displayed.
If

that was displayed immediately before, you can do this by placing a History State in the Subchart.
Configure History State
AddPlacing the History State
When
After selecting the Media
To handling such use cases, you need to replace
Drag and drop [Transition] from the toolbar at the top of the panel into the Subchart.


Draw a transition from
Checking the History State to the Radio State, our default Media Device.
The History State will remember which state was active last time and perform thescreen transition

Test the Configuration - Start
Use the Player
Saveto yourcheck solutionthe andscreen transition.

After the Player is opened,and you can see that the simulation display shows “Navi Title” and “Navigation” text, and that the initial transition has occurred to the Main Menu and Navigation Scene.scenes.
When
Pressing

Key_LeftArrow. The “Media SceneTitle” shouldwill be visibledisplayed again,again.
By replacing the Initial State in the Subchart with the History State, you can see that the Historyscene Statetransition isin working,the itSubchart has broughtbecome usa backstate tothat remembers the recentlystate selectedof device.the previous transition.
