Webportal

emmbedded apps

API Reference

    API REFERENCE #


    Car.GetBatteryAutonomy() #

    Car.GetBatteryAutonomy()

    Description Gets the Battery autonomy remaining always in km.
    Response Number Remaining battery autonomy.
    Parameter Void

    EXAMPLE

    var Batteryautonomy = Car.GetBatteryAutonomy();
    // Batteryautonomy = 1000 km
    

    REMARK

    Note: The Battery autonomy’s max length is 4 characters.

    Appeared in Software version 40.03.51.50


    Car.GetBatteryLevel() #

    Car.GetBatteryLevel()

    Description Gets the Battery level in percentage.
    Response Number Remaining battery percentage.
    Parameter Void

    EXAMPLE

    var BatteryLevel = Car.GetLevel();
    // Batteryautonomy = 5 %
    

    Appeared in Software version 40.03.51.50


    Car.GetDayNightStatus() #

    Car.GetDayNightStatus()

    Description Returns if the portal should use the day or night theme.
    Response Integer 0 for day, 1 for night.
    Parameter Void

    EXAMPLE

    // It's noon
    var GetDayNightStatus = Car.GetDayNightStatus();
    // GetDayNightStatus = 0
    

    Appeared in Software version 40.03.51.50


    Car.GetDrivingState() #

    Car.GetDrivingState()

    Description Determines whether the user is driving their car or not.
    Response Boolean True if the speed is higher than 5km/h (default value), else False.
    Parameter Void

    EXAMPLE

    if (Car.GetDrivingState() == false) {
    	Startapplication()
    } else {
    	DisplayDrivingWarning()
    }
    

    REMARK

    Note: The 5km/h limit to delimit the driving states can be changed by diagnostic.

    Appeared in Software version 5.14.11.30


    Car.GetFuelAutonomy() #

    Car.GetFuelAutonomy()

    Description Gets the Fuel autonomy remaining always in km.
    Response Number Remaining fuel autonomy.
    Parameter Void

    EXAMPLE

    var FuelAutonomy = Car.GetFuelAutonomy();
    // FuelAutonomy = 2000 km
    

    REMARK

    Note: The Fuel Autonomy’s max length is 4 characters.

    Appeared in Software version 40.03.51.50


    Car.GetFuelLevel() #

    Car.GetFuelLevel()

    Description Gets the current fuel level of the vehicle.
    Response Number The fuel level of the car in percentage.
    Parameter Void

    EXAMPLE

    var fuelLevel = Car.GetFuelLevel()
    // fuelLevel = 60 %
    alert("You are at" + fuelLevel + "of fuel left")
    

    Appeared in Software version 30.04.48.50


    Car.GetFuelType() #

    Car.GetFuelType()

    Description Gets the Fuel type of the car as a Number.
    Response Number Fuel type of the car.
    Parameter Void

    EXAMPLE

    var FuelType = Car.GetFuelType;
    // FuelType = 0
    // The car uses Essence
    

    REMARK

    Note: The fuel type’s length is 2 characters max.

    Number Fuel type
    0 Essence
    1 Bicarburation Essence GPL
    2 Bicarburation Essence GNV
    3 Diesel
    4 Essence et batterie
    5 Essence et alcool
    6 Diesel et batterie
    7 Battery
    8 Hydrogen
    15 Undefined

    Appeared in Software version 5.14.11.30


    Car.GetFuelUnit() #

    Car.GetFuelUnit()

    Description Gets the currently used fuel unit.
    Response String The fuel unit, Possible values are: - l, - gal
    Parameter Void

    EXAMPLE

    if (Car.GetFuelUnit() === 'l') {
    	var FuelUnit = 'Litre'
    } else {
    	var FuelUnit = 'Gallon'
    }
    

    Appeared in Software version 5.14.11.30


    Car.GetMileage() #

    Car.GetMileage()

    Description Gets the mileage of the vehicle.
    Response Number The mileage of the car in kilometers, length is 9 characters max.
    Parameter Void

    EXAMPLE

    var carMileage = Car.GetMileage()
    // carMileage = 125000 km
    

    Appeared in Software version 5.14.11.30


    Car.GetSpeed() #

    Car.GetSpeed()

    Description Gets the current Speed of the car aways in km/h.
    Response Number Speed in km/h
    Parameter Void

    EXAMPLE

    var Speed = Car.GetSpeed();
    // Speed = 117 km/h
    

    REMARK

    Note: The speed’s max length is 3 characters.

    Note 2: This information must not be passed to your server. If you want to use this value then you have to do it directly on the embedded part of the app.

    Appeared in Software version 5.14.11.30


    Car.GetTime() #

    Car.GetTime()

    Description Synchronizes all time values: Car.Time.Hours, Car.Time.Minutes and Car.Time.OffsetUTC.
    Response Boolean True if the time values were synchronized correctly, else False.
    Parameter Void

    EXAMPLE

    //If the user goes from one time zone to another the Time.GetTime function will update all time values
    
    //Time values before updating
    Car.Time.Hours()
    Car.Time.Minutes()
    Car.Time.OffsetUTC()
    
    //Update the time values
    Car.GetTime()
    
    //Updated time values
    Car.Time.Hours()
    Car.Time.Minutes()
    Car.Time.OffsetUTC()
    

    REMARK

    Note: Car.GetTime should always be called before reading time values to make sure all the values are synchronized.

    Note 2: For example a car going from France to England having its time updated based on Navigation satellites will see the time values displayed changed.

    Appeared in Software version 30.04.64.40


    Car.GetVINCode() #

    Car.GetVINCode()

    Description Gets the VIN code, a vehicle’s unique identifier.
    Response String The VIN code.
    Parameter Void

    EXAMPLE

    var VINCode = Car.GetVINCode();
    // VINCode = VF7AAAAAA00000001
    

    REMARK

    Note: a VIN code is always 17 characters long.

    Appeared in Software version 5.14.11.30


    Car.Time.Hours() #

    Car.Time.Hours()

    Description Gets the current hour of the car.
    Response Number Hour part of the car time.
    Parameter Void

    EXAMPLE

    //Update the time values
    Car.GetTime()
    
    //Updated time values
    var CurrentHour = Car.Time.Hours()
    // CurrentHour = 13 hours
    

    REMARK

    Note: Car.GetTime should always be called before reading time values to make sure all the values are synchronized.

    Appeared in Software version 30.04.64.40


    Car.Time.Minutes() #

    Car.Time.Minutes()

    Description Gets the current minutes of the car.
    Response Number Minute part of the car time.
    Parameter Void

    EXAMPLE

    //Update the time values
    Car.GetTime()
    
    //Updated time values
    var CurrentMinutes = Car.Time.Minutes()
    // CurrentMinutes = 17 minutes
    

    REMARK

    Note: Car.GetTime should always be called before reading time values to make sure all the values are synchronized.

    Appeared in Software version 30.04.64.40


    Car.Time.OffsetUTC() #

    Car.Time.OffsetUTC()

    Description Get the current Offset/Time zone of the car.
    Response String Offset format is [-]HHMM. With HHMM: Hours and minutes. And - is displayed if timezone is negative. If the timezone is positive, only HHMM is displayed. See example below.
    Parameter Void

    EXAMPLE

    //Update the time values
    Car.GetTime()
    
    //Save time values
    var CurrentOffset = Car.Time.OffsetUTC()
    // Example 1 - Timezone is negative: CurrentOffset = "-0900";
    // Example 2 - Timezone if positive: CurrentOffset = "0100";
    

    REMARK

    Note: Car.GetTime should always be called before reading time values to make sure all the values are synchronized.

    Appeared in Software version 30.04.64.40


    Device.GetCarBrand() #

    Device.GetCarBrand()

    Description Get the brand of the vehicle
    Response Number Car brand
    Value Car Brand
    0 Peugeot
    1 Citroen
    2 DS
    Parameter Void

    EXAMPLE

    var carBrand = Device.GetCarBrand()
    if (carbrand === 2) {
      DisplayMenuDS()
    } else {
      DisplayMenu()
    }
    

    Appeared in Software version 5.14.11.30


    Device.GetDistanceUnit() #

    Device.GetDistanceUnit()

    Description Gets the currently used distance unit.
    Response String The distance unit, Possible values are: - km, - miles

    EXAMPLE

    var distanceUnit = Device.GetDistanceUnit()
    // distanceUnit = "km"
    

    Appeared in Software version 5.14.11.30


    Device.GetHMIFocus() #

    Device.GetHMIFocus()

    Description Get the focus of the HMI
    Response boolean True if focus is on portal, else False
    Parameter Void

    EXAMPLE

    if (Device.GetHMIFocus() === False) {
    	//focus is not on portal
    } else {
    	//focus is on portal
    }
    

    Appeared in Software version 30.11.04.10


    Device.GetHMITheme() #

    Device.GetHMITheme()

    Description Get the theme of the HMI
    Response Number
    The number corresponding to the theme ID.
    Browse Ambience Section for a correspondence table.
    Parameter Void

    EXAMPLE

    // Get vehicle brand
    var vehicleBrand = Device.GetCarBrand()
    // vehicleBrand = 1 
    // value 1 is Citroën
    
    // Get Theme
    var currentTheme = Device.GetHMITheme()
    // currentTheme = 0
    // for citroen, value 0 is theme Orange
    

    Note: To retrieve HMI theme you need to know the vehicle brand first. You can use Device.GetCarBrand() to do so. Then you can use Device.GetHMITheme() and browse Ambience Section for a correspondence table.

    Appeared in Software version 30.11.04.10


    Device.GetInternetStatus() #

    Device.GetInternetStatus()

    Description Gets the current status of the internet connection.
    Response Boolean True if the connection is up, else False.
    Parameter Void

    EXAMPLE

    var Myvar = setInterval(MyFunction,  30000);
    
    function MyFunction() {
    	if (Device.GetInternetStatus() === True){
    		// Connection is up
    		clearInterval(MyVar);
    	}
    }
    

    Appeared in Software version 5.14.06.10


    Device.GetSoftwareRelease() #

    Device.GetSoftwareRelease()

    Description Gets the currently used software release.
    Response String Software release.
    Parameter Void

    EXAMPLE

    var Soft = Device.GetSoftwareRelease()
    // Soft = 31.09.46.60_NAC-r0
    

    Appeared in Software version 5.14.11.30


    Device.GetSpeedUnit() #

    Device.GetSpeedUnit()

    Description Gets the currently used speed unit.
    Response String The speed unit, Possible values are: - km/h, - mph
    Parameter Void

    EXAMPLE

    var speedUnit = Device.GetSpeedUnit()
    // speedUnit = "km/h"
    

    Appeared in Software version 5.14.11.30


    Device.GetUIN() #

    Device.GetUIN()

    Description Get the UIN
    Response String UIN
    Parameter Void

    EXAMPLE

    var UIN = Device.GetUIN()
    // UIN = "0A12345B67C8D9E012FG"
    


    Media.Audio.configure() #

    Media.Audio.configure(String Type,String Sound_State)

    Description Configures the sound.
    Response None
    Parameter Type Description Required
    Type String The player to configure, 31 characters max Possible values: - MEDIA_PLAYER_SOURCE, - TEMPORARY_SOURCE Required
    Sound_State String To activate or deactivate sound, 8 characters max Possible values: - Active, - Inactive Required

    EXAMPLE

    // Wait for the browser to fully load
    HMI.WebBrowser.addEventListener("show", activateSource);
    
    // Configure media
    var activateSource = function(){
    Media.Audio.configure("MEDIA_PLAYER_SOURCE", "Active");
    };
    
    // Handle player and events
    var player = document.getElementById('player')[0];
    player.src = './sounds/louvre-les-voyages-de-champollion.mp3';
    document.getElementById('play').onclick = function(){
    player.play();
    };
    document.getElementById('pause').onclick = function(){
    player.pause();
    };
    

    Appeared in Software version 30.04.48.50


    Media.GetAlbumName() #

    Media.GetAlbumName()

    Description Gets the name of the current album.
    Response String The current album’s name < 255 characters.
    Parameter Void

    EXAMPLE

    //Check the state of the media
    
    if (Media.GetMediaState() === 2) {
    	// Media currently playing
    	
    	var albumname = Media.GetAlbumName()
    }
    

    Appeared in Software version 30.10.10.00


    Media.GetArtistName() #

    Media.GetArtistName()

    Description Gets the name of the current artist.
    Response String The current artist’s name < 255 characters.
    Parameter Void

    EXAMPLE

    //Check the state of the media
    
    if (Media.GetMediaState() === 2) {
    	// Media currently playing
    	
    	var artistname = Media.GetArtistName()
    }
    

    Appeared in Software version 30.10.10.00


    Media.GetCurrentTrack() #

    Media.GetCurrentTrack()

    Description Gets the current track number.
    Response Number Current Track number if there is one, else returns error state.
    Parameter Void

    EXAMPLE

    //Check the state of the media
    
    if (Media.GetMediaState() === 2) {
    	// Media currently playing
    	
    	var tracknumber = Media.GetCurrentTrack()
    }
    

    *Appeared in Software version 30.10.10.00


    Media.GetFolderName() #

    Media.GetFolderName()

    Description Gets the name of the current folder.
    Response String The current folder name < 255 characters.
    Parameter Void

    EXAMPLE

    //Check the state of the media
    
    if (Media.GetMediaState() === 2) {
    	// Media currently playing
    	
    	var foldername = Media.GetFolderName()
    }
    

    Appeared in Software version 30.10.10.00


    Media.GetMediaState() #

    Media.GetMediaState()

    Description Gets the state of the media currently connected.
    Response Number State of the media.
    Parameter Void

    EXAMPLE

    //Check the state of the media
    if (Media.GetMediaState() === 2) {
    	// Media currently playing
    }
    

    REMARK

    The possible values returned are the following:

    Value State
    1 stop
    2 play
    3 pause
    4 seek up
    5 seek down

    Appeared in Software version 30.10.10.00


    Media.GetTotalTracks() #

    Media.GetTotalTracks()

    Description Gets the total number of tracks on the connected media.
    Response Number The total number of tracks < 9999.
    Parameter Void

    EXAMPLE

    //Check the state of the media
    
    if (Media.GetMediaState() === 2) {
    	// Media currently playing
    	
    	var tracknumber = Media.GetCurrentTrack()
    	var totaltracks = Media.GetTotalTracks()
    	
    	// tracksremaining = totaltracks - tracknumber
    }
    

    Appeared in Software version 30.10.10.00*


    Media.GetTrackName() #

    Media.GetTrackName()

    Description Gets the current track’s name.
    Response String The name of the current track, 32 characters long max.
    Parameter Void

    EXAMPLE

    //Check the state of the media
    
    if (Media.GetMediaState() === 2) {
    	// Media currently playing
    	var currentTrack = Media.GetTrackName()
    }
    

    Appeared in Software version 30.10.10.00


    Media.GetTypeName() #

    Media.GetTypeName()

    Description Gets the type of the media.
    Response Number The type of the media curretly connected.
    Parameter Void
    Value Type
    0 USB mass storage 1
    1 iPod 1
    2 External MonoCD drive
    3 BT streaming
    4 auxiliary input
    5 USB mass storage 2
    6 iPod 2
    7 External DVD drive by USB
    8 Phone by MirrorLink
    9 Phone by DIPO
    10 Embedded Ringtone
    11 Tuner FM/aM/DaB
    12 Phone by BT
    13 Webbrowser Media app
    14 Webradio
    15 USB Video
    16 Jukebox
    17 Media app by MirrorLink
    18 Media app by DIPO
    19 MirrorLink temporary
    20 FM-Ta
    21 DaB-NEWS
    22 Embedded Voice Recognition
    23 Text Reader (TTS)
    24 Text Reader MirrorLink (TTS)
    25 Text Reader DIPO (TTS)
    26 Ext. Voice Recognition by BT
    27 Ext. Voice Recognition by MirrorLink
    28 Ext. Voice Recognition by DIPO
    29 Webbrowser Voice Recognition

    EXAMPLE

    //Get the name of the media
    var mediaName = Media.GetTypeName()
    // mediaName = 0
    

    Appeared in Software version 30.10.10.00


    Navigation.GetCurrentPosition() #

    Description Retrieves the current position and stores it inside Navigation.CurrentPosition.
    Response Boolean True If the value is now correctly stored in Navigation.CurrentPosition, else False if the process failed.
    Parameter Void

    EXAMPLE

    if ( Navigation.GetCurrentPosition === false ) {
    	// GPS error, Navigation.CurrentPosition is empty
    } else {
    	var Storedaddress = Navigation.CurrentPosition.address;
    	var StoredTown = Navigation.CurrentPosition.Town;
    	var StoredCity = Navigation.CurrentPosition.City;
    	var StoredProvince = Navigation.CurrentPosition.Province;
    	var StoredCountry = Navigation.CurrentPosition.Country;
    }
    

    REMARK

    Note: Navigation.GetCurrentPosition must always be used before accessing the value stored in Navigation.CurrentPosition.

    Appeared in Software version 40.03.42.30


    Navigation.GetCurrentPositionLatitude() #

    Description Gets the current position’s latitude in WGS84 Signed Decimal Degrees.
    Response Number Current position’s latitude as WGS Signed Decimal Degrees.
    Parameter Void

    EXAMPLE

    var CurrentLatitude = Navigation.GetCurrentPositionLatitude();
    // CurrentLatitude = 48.866669
    

    REMARK

    Note: The returned latitude’s length < 11 characters.

    Appeared in Software version 40.03.42.30


    Navigation.GetCurrentPositionLongitude() #

    Description Gets the current position’s longitude in WGS84 Signed Decimal Degrees.
    Response Number Current position’s longitude as WGS84 Signed Decimal Degrees.
    Parameter Void

    EXAMPLE

    var CurrentLongitude = Navigation.GetCurrentPositionLongitude();
    // CurrentLongitude = 2.333333
    

    REMARK

    Note: The returned longitude’s length < 11 characters.

    Appeared in Software version 40.03.42.30


    Navigation.GetDestination() #

    Description Retrieves the current destination and stores it inside Navigation.Destination. Navigation.Destination.Latitude and Navigation.Destination.Longitude are given in WGS84 Signed Decimal Degrees.
    Response Boolean True if the value is now correctly stored in Navigation.Destination, else False if the process failed.
    Parameter Void

    EXAMPLE

    if ( Navigation.GetDestination() === false ) {
    	// GPS error, Navigation.Destination is empty
    } else {
    	var DestinationLatitude = Navigation.Destination.Latitude;
    	var Destinationlongitude = Navigation.Destination.Longitude;
    	var Destinationaddress = Navigation.Destination.address;
    	var DestinationTown = Navigation.Destination.Town;
    	var Destinationity = Navigation.Destination.City;
    	var DestinationProvince = Navigation.Destination.Province;
    	var DestinationCountry = Navigation.Destination.Country;
    }
    

    REMARK

    Note: Navigation.GetDestination must always be used before accessing the value stored in Navigation.Destination.

    Appeared in Software version 40.03.42.30


    Navigation.GetJourneyInfo() #

    Description Calculates the estimated time of arrival and stores it inside Navigation.JourneyInfo.
    Response Boolean True if the value is now correctly stored in Navigation.JourneyInfo, else False if the process failed.
    Parameter Void

    EXAMPLE

    if ( Navigation.GetJourneyInfo() === false ) {
    	// GPS error, Navigation.JourneyInfo is empty
    } else {
    	var JourneyETaHours = Navigation.JourneyInfo.estimatedTimeOfarrivalH;
    	var JourneyETaMinutes = Navigation.JourneyInfo.estimatedTimeOfarrivalMin;
    }
    

    REMARK

    Note: Navigation.GetJourneyInfo must always be used before accessing the value stored in Navigation.ManeuverInfo.

    Appeared in Software version 40.03.42.30


    Navigation.GetManeuverInfo() #

    Description Retrieves the position of the next maneuver to be done and stores it inside Navigation.ManeuverInfo.
    Response Boolean True if the value is now correctly stored in Navigation.ManeuverInfo, else False if the process failed.
    Parameter Void

    EXAMPLE

    if ( Navigation.GetManeuverInfo() === false ) {
    	// GPS error, Navigation.ManeuverInfo is empty
    } else {
    	var ManeuverLatitude = Navigation.ManeuverInfo.Latitude;
    	var ManeuverLongitude = Navigation.ManeuverInfo.Longitude;
    	var ManeuverNextStreetName = Navigation.ManeuverInfo.nextStreetName;
    	var ManeuverTown = Navigation.ManeuverInfo.Town;
    	var ManeuverCity = Navigation.ManeuverInfo.City;
    	var ManeuverProvince = Navigation.ManeuverInfo.Province;
    	var ManeuverCountry = Navigation.ManeuverInfo.Country;
    }
    

    REMARK

    Note: Navigation.GetManeuverInfo must always be used before accessing the value stored in Navigation.ManeuverInfo.

    Appeared in Software version 40.03.42.30


    Navigation.GetNextWaypoint.ETAHours() #

    Description Calculates and returns the estimated time of arrival at the next waypoint, precisely the hour.
    Response Number Estimated arrival hour at next waypoint.
    Parameter Void

    EXAMPLE

    var WaypointETAHours = Navigation.GetNextWaypoint.ETAHours();
    // WaypointETAHours = 1 Hour
    

    REMARK

    Note: Navigation.GetNextWaypoint.ETAHours only gives the “Hour” part of the Estimated Time of arrival. To get the “Minutes” part, use Navigation.GetNextWaypoint.ETAMinutes.

    Appeared in Software version 40.03.42.30


    Navigation.GetNextWaypoint.ETAMinutes() #

    Description Calculate and return the estimated time of arrival at the next waypoint, precisely the minutes.
    Response Number Estimated minute of arrival at the next waypoint.
    Parameter Void

    EXAMPLE

    var WaypointETAMinutes = Navigation.GetNextWaypoint.ETAMinutes();
    // WaypointETAMinutes = 27 minutes
    

    REMARK

    Note: Navigation.GetNextWaypoint.ETAMinutes only gives the “Minutes” part of the Estimated Time of arrival. To get the “Hour” part, use Navigation.GetNextWaypoint.ETAHour.

    Appeared in Software version 40.03.42.30


    Navigation.LaunchGuidance() #

    Description Starts the navigation to the specified destination.
    Response Boolean True if the final destination and Intermediary destinations were all correctly set, else False if the process failed.

    IMPORTANT

    Caution: Guidance can not be launched when a popup (either MQTT or nativePopup) is displayed. To make sure the guidance have actually been launched please check that Navigation.LaunchGuidance() return is True.

    Parameter Type Description Required
    desc String The destination’s description, Should have a length < 60 characters. Required
    destLon Number The destination’s longitude, Should be WGS84 Signed Decimal Degrees and have a length < 4 characters. Required
    destLat Number The destination’s latitude, Should be WGS84 Signed Decimal Degrees and have a length < 4 characters. Required
    s1Lon Number The first waypoint’s longitude, Should be WGS84 Signed Decimal Degrees and have a length < 4 characters. Optional
    s1Lat Number The first waypoint’s latitude, Should be WGS84 Signed Decimal Degrees and have a length < 4 characters. Optional
    s2Lon Number The second waypoint’s longitude, Should be WGS84 Signed Decimal Degrees and have a length < 4 characters. Optional
    s2Lat Number The second waypoint’s latitude, Should be WGS84 Signed Decimal Degrees and have a length < 4 characters. Optional
    s3Lon Number The third waypoint’s longitude, Should be WGS84 Signed Decimal Degrees and have a length < 4 characters. Optional
    s3Lat Number The third waypoint’s latitude, Should be WGS84 Signed Decimal Degrees and have a length < 4 characters. Optional
    shifted Number The coordinate system to use, Should be either 0 or 1 Optional

    EXAMPLE

    var Description ="Ignored"
    var DestinationLongitude = 48.866669
    var DestinationLatitude = 2.33333
    var Waypoint1Lat = 0
    var Waypoint1Lon = 0
    var Waypoint2Lat = 0
    var Waypoint2Lon = 0
    var Waypoint3Lat = 0
    var Waypoint3Lon = 0
    var Shifted = 0
    
    if ( Navigation.LaunchGuidance(Description, DestinationLongitude, DestinationLatitude, Waypoint1Lat, Waypoint1Lon, Waypoint2Lat, Waypoint2Lon, Waypoint3Lat, Waypoint3Lon, Shifted) === false ) {
    	// Error, Itinerary not correctly set
    } else {
    	// Itinerary started
    }
    

    REMARK

    Note: Only the destLon and destLat parameters are needed, the others will be ignored, so they can be replaced by 0.

    Note 2: The old version of the LaunchGuidance will ask for confirmation before overriding the current journey with the one being passed.

    Note 3: The Navigation events are triggered only if the Navigation was launched using either LaunchGuidance or LaunchGuidanceWaypoints.

    Important: In order to verify if you can use the new API Navigation.LaunchGuidanceWaypoints or the old one Navigation.LaunchGuidance, you can check the existence of one of the following JS events:

    • Navigation.InvalidCoordinates
    • Navigation.RouteCalculationSuccessful
    • Navigation.RouteCalculationCanceled
    • Navigation.RouteCalculationFailed
    function() {
       try{
         if('undefined' != typeof Navigation)
         {
           if(Navigation.hasOwnProperty('InvalidCoordinates'))
           {
             this.newInterface = true
           }
         }      
       } catch (e)
       {
         this.newInterface = false
       }
     }
    

    If newInterface is false then you should use the old one Navigation.LaunchGuidance

    Appeared in Software version 40.03.42.30


    Navigation.LaunchGuidanceWaypoints() #

    Description Starts the navigation to the specified destination and going through all the specified waypoints.
    Response Boolean True if the destination and waypoints were all correctly set, else False if the process failed.
    Parameter Type Description Required
    destLon Number The destination’s longitude, Should be WGS84 Signed Decimal Degrees and have a length < 11 characters. Required
    destLat Number The destination’s latitude, Should be WGS84 Signed Decimal Degrees and have a length < 11 characters. Required
    waypoints array[object(lat: Number, lon: Number)] The waypoints to go through before the final destination (9 waypoints max), Each waypoint should be WGS84 Signed Decimal Degrees and have a length < 11 characters. Required
    cus- tomerConfirmation Boolean Available since 42.02.64.50, if set to true, a pop-up will ask the user to confirm the new guidance request. Optional, default: false.

    IMPORTANT

    Caution: Guidance can not be launched when a popup (either MQTT or nativePopup) is displayed. To make sure the guidance have actually been launched please check that Navigation.LaunchGuidanceWaypoints() return is True.

    EXAMPLE

    var DestinationLongitude = 48.866669
    var DestinationLatitude = 2.33333
    var Waypoint1Lat = 48.77745
    var Waypoint1Lon = 2.22366
    var Waypoint2Lat = 48.111111
    var Waypoint2Lon = 2.11132
    
    if ( Navigation.LaunchGuidanceWaypoints(DestinationLongitude, DestinationLatitude, [{lat: Waypoint1Lat, lon: Waypoint1Lon}, {lat: Waypoint2Lat, lon: Waypoint2Lon}]) === false ) {
    	// Error, Itinerary not correctly set
    } else {
    	// Itinerary started
    }
    

    REMARK

    Note: This new version of the LaunchGuidance will override the current journey with the one being passed.

    Note 2: The Navigation events are triggered only if the Navigation was launched using either LaunchGuidance or LaunchGuidanceWaypoints.

    Important: In order to verify if you can use the new API Navigation.LaunchGuidanceWaypoints or the old one Navigation.LaunchGuidance, you can check the existence of one of the following JS events:

    • Navigation.InvalidCoordinates
    • Navigation.RouteCalculationSuccessful
    • Navigation.RouteCalculationCanceled
    • Navigation.RouteCalculationFailed
    function() {
       try{
         if('undefined' != typeof Navigation)
         {
           if(Navigation.hasOwnProperty('InvalidCoordinates'))
           {
             this.newInterface = true
           }
         }      
       } catch (e)
       {
         this.newInterface = false
       }
     }
    

    If newInterface is true then you should use the new version of the API (wave 4)

    Appeared in Software version 21.08.15.30

    Appeared in Software version 40.03.49.50


    Phone.LaunchPhoneCall() #

    Phone.LaunchPhoneCall(String phoneNumber)

    Description Intiates a phone call.
    Response Boolean True if the number passed contains only digits, False otherwise.
    Parameter Type Description Required
    phoneNumber String The phone number to be called, Should be comprised of only Digits and have a length < 16 characters. Required

    EXAMPLE

    The following example tries to call a phone number and then reacts acordingly to the outcome.

    var PhoneNumber = '0123456789';
    if (Phone.LaunchPhoneCall(PhoneNumber) === False) {
    	//Cannot Launch the phone call
    	GoBackToactivity();
    } else {
    	//Phone call will start soon
    	Changeactivity();
    }
    

    KNOWN ISSUES

    The returned value does not represent the fact that the phone is present nor that the call was actually initiated.Indeed True might be returned even though the phone appaired by bluetooth doesn’t have a Hands Free Profile.

    Appeared in Wave 4.1 - version 30.10.08.00


    Privacy.Mode() #

    Privacy.Mode()

    Description Gets the privacy mode.
    Response String Current privacy mode.
    Parameter Void

    EXAMPLE

    If (Privacy.Mode() === "Private" || Privacy.Mode() === "Geoloc" ) {
    	
    } else {
    	//Privacy.Mode() = "Public"
    	Startapplication()
    }
    

    REMARK

    Note: 3 values are available

    • Public: All informations are available (Geolocalisation and internet connectivity are authorized)
    • Geoloc: Geolocalisation is authorized
    • Private: No Data sharing is authorized (No internet and no Geolocalisation)

    Appeared in Wave 4.1 - version 30.05.14.30


    Radio.GetBand() #

    Radio.GetBand()

    Description Gets the currently used Radio Band.
    Response String The currently used radio band.
    Parameter Void

    EXAMPLE

    //Get the Radio Band
    var RadioBand = Radio.GetBand()
    // RadioBand = "FM"
    

    REMARK

    The possible values for the radio band are the following strings:

    • FM HD
    • MW
    • LW
    • FM
    • DaB
    • DMB
    • SDaRS
    • DaB+

    Appeared in Wave 4.1 - version 30.00.09.00


    Radio.GetFrequency() #

    Radio.GetFrequency()

    Description Gets the currently selected radio frequency of the car in kHz.
    Response Number Frequency currently selected.
    Parameter Void

    EXAMPLE

    //Get the Radio Frequency
    var MyFrequency1 = Radio.GetFrequency()
    // MyFrequency1 = 89800 kHz
    

    REMARK

    Note: The interval of values returned depends on the band that is being used.

    Band Interval
    FM [87500 - 108000]
    DaB [0 -63]
    aM [144 - 288], [531-1629]

    Appeared in Wave 4.1 - version 30.00.09.00


    Radio.GetPreset() #

    Radio.GetPreset()

    Description Indicates the saved preset corresponding to the current frequency.
    Response Number If the current frequency matches a saved preset returns the number < 6 corresponding to it, else returns 0.
    Parameter Void

    EXAMPLE

    if (Radio.GetPreset() === 0) {
    	// Current frequency does not correspond to a preset frequency
    } else {
    	// The frequency has been defined as a preset by the user
    }
    

    Appeared in Wave 4.1 - version 30.00.09.00


    Radio.PSName() #

    Radio.PSName()

    Description Return the program service name..
    Response String Program service name.
    Parameter Void

    Example

    // Get the Radio Program Service Name
    var RadioPSName = Radio.PSName()
    // RadioPSName = "BBC Radio"
    

    Appeared - version 30.00.09.00


    Radio.PTY() #

    Radio.PTY()

    Description Returns the program type as defined by either RDS or RBDS. Possible values are [0-31].
    Response boolean Program type.
    Parameter Void

    EXAMPLE

    // Get the Radio PTY
    var RadioPTY = Radio.PTY()
    // RadioPTY = false
    

    Appeared - version 30.00.09.00


    Radio.RDS() #

    Radio.RDS()

    Description Return true if the current radio stations supports RDS, false otherwise.
    Response boolean RDS support.
    Parameter Void

    EXAMPLE

    // Get the Radio RDS 
    var RadioRDS = Radio.RDS()
    // RadioRDS = true
    

    Appeared - version 30.00.09.00


    Radio.TA() #

    Radio.TA()

    Description Returns true if traffic announcement is available.
    Response boolean Traffic announcement.
    Parameter Void

    EXAMPLE

    // Get the Radio TA
    var RadioTA = Radio.TA()
    // RadioTA = false
    

    Appeared - version 30.00.09.00


    Radio.Text() #

    Radio.Text()

    Description Return the radio text.
    Response String Radio text.
    Parameter Void

    EXAMPLE

    // Get the Radio text
    var RadioText = Radio.Text()
    // RadioText = "Thriller by Michael Jackson"
    

    Appeared in version 30.00.09.00


    WebPortal.getCountry() #

    WebPortal.getCountry()

    Description Gets the country currently selected by the user.
    Response String The country’s name.
    Parameter Void

    EXAMPLE

    var userCountry = WebPortal.getCountry()
    if (userCountry === "France") {
    	DisplayFranceContent()
    }
    


    WebPortal.getLanguage() #

    WebPortal.getLanguage()

    Description Gets the language currently being used.
    Response String The language in the following format: “en-GB”.
    Parameter Void

    EXAMPLE

    var userLanguage = WebPortal.getLanguage()
    // userLanguage = "fr-FR"
    if (userLanguage === "fr-FR") {
    	ContentInFrench()
    }
    


    WebPortal.getPendingNotifications() #

    WebPortal.getPendingNotifications()

    Description Gets the notifications currently pending. Look at Tutorial(Advanced) for an integration example.
    Response The Notifications as Array (either empty or containing Strings) or Unrecognised Error if the application is not fully launched.
    Parameter String The application ID (AppID).

    EXAMPLE

    var notificationMessages = WebPortal.getPendingNotifications()
    // notificationMessages = []
    


    WebPortal.nativePopup.open #

    WebPortal.nativePopup.open

    Description Request from your application to display a disruptive popup, whether the user is browsing your application or not. Linked events: OK button, Cancel Button, Display timeout.
    Type postMessage command. See implementation tutorial for post message commands.
    Parameter None

    SEE ALSO

    IMPORTANT

    Caution: Popups (either MQTT or nativePopup) must not be asked more often than once every 20 seconds.

    Caution 2: Navigation.LaunchGuidance() and Navigation.LaunchGuidanceWaypoints() can not be launched when a popup (either MQTT or nativePopup) is displayed. To make sure the guidance have actually been launched please check that LaunchGuidance function return is True.


    EVENTS REFERENCE #


    Car.distanceUnit #

    Event triggered when the distance unit is changed.

    EXAMPLE

    try {
    	
    	// Car
    	if ((typeof Car !== "undefined") && (typeof Car.addEventListener !== "undefined")) {
    		Car.addEventListener("distanceUnit", function(){
    			alert("The distance unit is now:" + Car.GetDistanceUnit() );
    		});
    	}
    }catch(e) {
    	DealWithCarError(e);
    }
    

    Appeared in Software version 5.14.11.30


    Car.driverDistractionOff #

    Event triggered when the distraction status is changed to OFF (hide driver distraction popup).

    Note: This event is triggered when the speed exceeds 5km/h.

    EXAMPLE

    try {
    	
    	// Car
    	if ((typeof Car !== "undefined") && (typeof Car.addEventListener !== "undefined")) {
    		Car.addEventListener("driverDistractionOff", function(){
    			alert("Driver distraction mode is now off");
    		});
    	}
    }catch(e) {
    	DealWithCarError(e);
    }
    

    Appeared in Software version 5.14.11.30


    Car.driverDistractionOn #

    Event triggered when the distraction status is changed to ON (display driver distraction popup).

    Note: This event is triggered when the speed goes below 5km/h.

    EXAMPLE

    try {
    	
    	// Car
    	if ((typeof Car !== "undefined") && (typeof Car.addEventListener !== "undefined")) {
    		Car.addEventListener("driverDistractionOn", function(){
    			alert("The driver distraction mode is now turned on.");
    		});
    	}
    }catch(e) {
    	DealWithCarError(e);
    }
    

    Appeared in Software version 5.14.11.30


    Car.fuelUnit #

    Event triggered when the fuel unit is changed.

    EXAMPLE

    try {
    	
    	// Car
    	if ((typeof Car !== "undefined") && (typeof Car.addEventListener !== "undefined")) {
    		Car.addEventListener("fuelUnit", function(){
    			alert("The fuel unit is now:" + Car.GetFuelUnit());
    	}
    }catch(e) {
    	DealWithCarError(e);
    }
    

    Appeared in Software version 5.14.11.30


    Car.speedUnit #

    Event triggered when the speed unit is changed.

    EXAMPLE

    try {
    	
    	// Car
    	if ((typeof Car !== "undefined") && (typeof Car.addEventListener !== "undefined")) {
    		Car.addEventListener("speedUnit", function(){
    			alert("The speed unit is now:" + Car.GetSpeednUnit());
    		});
    	}
    }catch(e) {
    	DealWithCarError(e);
    }
    

    Appeared in Software version 5.14.11.30


    Connectivity.connectivityOff #

    Event triggered when the Internet connectivity status changes to False.

    EXAMPLE

    try{
    	// Connectivity
    	if ((typeof Connectivity !== "undefined") && (typeof Connectivity.addEventListener !== "undefined")) {
    		Connectivity.addEventListener("connectivityOff", function(){
    			alert("The internet connectivity is now off");
    		});
    	}
    } catch(e) {
    	DealWithConnectivityError(e);
    }
    

    Appeared in Software version 5.14.06.10


    Connectivity.connectivityOn #

    Event triggered when the Internet connectivity status changes to True.

    EXAMPLE

    try{
    	// Connectivity
    	if ((typeof Connectivity !== "undefined") && (typeof Connectivity.addEventListener !== "undefined")) {
    		Connectivity.addEventListener("connectivityOn", function(){
    			alert("The internet connectivity is now on");
    		});
    	}
    } catch(e) {
    	DealWithConnectivityError(e);
    }
    

    Appeared in Software version 5.14.06.10


    HMI.Settings.languageSet #

    Event triggered when the user changes the language in the settings.

    EXAMPLE

    try{// HMI.Settings
    	if ((typeof HMI !== "undefined") && (typeof HMI.Settings !== "undefined") && (typeof HMI.Settings.addEventListener !== "undefined")) {
    		HMI.Settings.addEventListener("languageSet", ChangeLanguageDisplayed(WebPortal.getLanguage()));
    	}
    } catch(e) {
    	DealWithHMISettingsError(e);
    }
    

    Appeared in Software version 30.11.04.10


    HMI.Settings.themeSet #

    Event triggered when the theme is changed.

    EXAMPLE

    try{// HMI.Settings
    	if ((typeof HMI !== "undefined") && (typeof HMI.Settings !== "undefined") && (typeof HMI.Settings.addEventListener !== "undefined")) {
    		HMI.Settings.addEventListener("themeSet", function(){
    			Alert("The theme was changed");
    		});
    	}
    } catch(e) {
    	DealWithHMISettingsError(e);
    }
    

    Appeared in Software version 30.11.04.10


    HMI.WebBrowser.hide #

    Event triggered when focus is not on WebPortal.

    EXAMPLE

    try {
    	// HMI.WebBrowser
    	if ((typeof HMI !== "undefined") && (typeof HMI.WebBrowser !== "undefined") && (typeof HMI.WebBrowser.addEventListener !== "undefined")) {
    		HMI.WebBrowser.addEventListener("hide", function(){
    			alert("The Browser has been hidden");
    		});
    	}
    } catch(e) {
    	DealWithHMIWebBrowserError(e);
    }
    

    Appeared in Software version 30.11.04.10


    HMI.WebBrowser.show #

    Event triggered when focus is on the WebPortal browser.

    EXAMPLE

    try {
    	// HMI.WebBrowser
    	if ((typeof HMI !== "undefined") && (typeof HMI.WebBrowser !== "undefined") && (typeof HMI.WebBrowser.addEventListener !== "undefined")) {
    		HMI.WebBrowser.addEventListener("show", function(){
    			alert("The browser is back in focus");
    		});
    	}
    } catch(e) {
    	DealWithHMIWebBrowserError(e);
    }
    

    Appeared in Software version 30.11.04.10


    HMI.cancelBtnPopupRequestClicked #

    Event triggered when the Cancel button is clicked on the HMI popup request.

    EXAMPLE

    try {
    	// HMI
    	if ((typeof HMI !== "undefined") && (typeof HMI.addEventListener !== "undefined")) {
    		HMI.addEventListener("cancelBtnPopupRequestClicked", CancelAction());
    	}
    } catch(e) {
    	DealWithHMIError(e);
    }
    

    Appeared in Software version 30.11.04.10


    HMI.closeTimeoutPopupRequest #

    Event triggered when no button is clicked on the HMI popup request and the timeout expires.

    EXAMPLE

    try {
    	// HMI
    	if ((typeof HMI !== "undefined") && (typeof HMI.addEventListener !== "undefined")) {
    		HMI.addEventListener("closeTimeoutPopupRequest", TimeoutAction());
    	}
    } catch(e) {
    	DealWithHMIError(e);
    }
    

    Appeared in Software version 30.11.04.10


    HMI.homeBtnClick #

    Event triggered whenever the Home button is pressed.

    EXAMPLE

    try {
    	// HMI
    	if ((typeof HMI !== "undefined") && (typeof HMI.addEventListener !== "undefined")) {
    		HMI.addEventListener("homeBtnClick", function(){
    			alert("Application is being hidden to back to Home");
    		});
    	}
    } catch(e) {
    	DealWithHMIError(e);
    }
    


    HMI.okBtnPopupRequestClicked #

    Event triggered when the Ok button is clicked on the HMI popup request.

    EXAMPLE

    try {
    	// HMI
    	if ((typeof HMI !== "undefined") && (typeof HMI.addEventListener !== "undefined")) {
    		HMI.addEventListener("okBtnPopupRequestClicked", ProceedAction());
    	}
    } catch(e) {
    	DealWithHMIError();
    }
    

    Appeared in Software version 30.11.04.10


    Media.Audio.audioAvailable #

    Event triggered when the audio source is connected.

    EXAMPLE

    try{
    	
    	// Media
    	if ((typeof Media !== "undefined") && (typeof Media.Audio !== "undefined") && (typeof Media.Audio.addEventListener !== "undefined")) {
    		Media.Audio.addEventListener("audioAvailable", function(){
    			alert("Audio files are available");
    		});
    	}
    } catch(e) {
    	DealWithMediaError(e);
    }
    

    Appeared in Software version 31.06.42.30


    Media.Audio.audioLost #

    Event triggered when the audio source is disconnected.

    EXAMPLE

    try{
    	
    	// Media
    	if ((typeof Media !== "undefined") && (typeof Media.Audio !== "undefined") && (typeof Media.Audio.addEventListener !== "undefined")) {
    		Media.Audio.addEventListener("audioLost", function(){
    			printLogCb("success", "Media.Audio.audioLost()");
    		});
    		Media.Audio.addEventListener("audioAvailable", function(){
    			printLogCb("success", "Media.Audio.audioAvailable()");
    		});
    		Media.Audio.addEventListener("startPlayback", function(){
    			printLogCb("success", "Media.Audio.startPlayback()");
    		});
    		Media.Audio.addEventListener("stopPlayback", function(){
    			printLogCb("success", "Media.Audio.stopPlayback()");
    		});
    		Media.Audio.addEventListener("playPreviousTrack", function(){
    			printLogCb("success", "Media.Audio.playPreviousTrack()");
    		});
    		Media.Audio.addEventListener("playNextTrack", function(){
    			printLogCb("success", "Media.Audio.playNextTrack()");
    		});
    	}
    } catch(e) {
    	HandleMediaAudioError(e);
    }
    

    Appeared in Software version 31.06.42.30


    Navigation.InvalidCoordinates #

    Event triggered when at least one of the coordinates used with Navigation.LaunchGuidance is invalid, due to: Type, size…

    EXAMPLE

    try{	
    	// Navigation
    	if ((typeof Navigation !== "undefined") && (typeof Navigation.addEventListener !== "undefined")) {
    		Navigation.addEventListener("InvalidCoordinates", InformUserInvalidCoordinates()	}
    } catch(e) {
    	DealWithNavigationError(e);
    }
    

    Note: The Navigation events are triggered only if the Navigation was launched using either LaunchGuidance or LaunchGuidanceWaypoints.

    Appeared in Software version 40.03.49.50


    Navigation.RouteCalculationCancelled #

    Event triggered when the calculation of the itinerary was ended abruptly.

    EXAMPLE

    try{	
    	// Navigation
    	if ((typeof Navigation !== "undefined") && (typeof Navigation.addEventListener !== "undefined")) {
    		Navigation.addEventListener("RouteCalculationCancelled", HandleRouteCancelation());
    	}
    } catch(e) {
    	DealWithNavigationError(e);
    }
    

    Note: The Navigation events are triggered only if the Navigation was launched using either LaunchGuidance or LaunchGuidanceWaypoints.

    Appeared in Software version 40.03.49.50


    Navigation.RouteCalculationFailed #

    Event triggered when the calculation of the itinerary ended with an error.

    EXAMPLE

    try{	
    	// Navigation
    	if ((typeof Navigation !== "undefined") && (typeof Navigation.addEventListener !== "undefined")) {
    		Navigation.addEventListener("RouteCalculationFailed", HandleRouteFailure());
    	}
    } catch(e) {
    	DealWithNavigationError(e);
    }
    

    Note: The Navigation events are triggered only if the Navigation was launched using either LaunchGuidance or LaunchGuidanceWaypoints.

    Appeared in Software version 40.03.49.50


    Navigation.RouteCalculationSuccessful #

    Event triggered when the calculation of the itinerary ended without any error.

    EXAMPLE

    try{	
    	// Navigation
    	if ((typeof Navigation !== "undefined") && (typeof Navigation.addEventListener !== "undefined")) {
    		Navigation.addEventListener("RouteCalculationSuccessful", HandleRouteSuccess());
    	}
    } catch(e) {
    	DealWithNavigationError(e);
    }
    

    Note: The Navigation events are triggered only if the Navigation was launched using either LaunchGuidance or LaunchGuidanceWaypoints.

    Appeared in Software version 40.03.49.50


    Navigation.WebDestinationReached #

    Event triggered when a route launched via Navigation.LaunchGuidance or Navigation.LaunchGuidanceWaypoints has reached the destination.

    EXAMPLE

    try{	
    	// Navigation
    	if ((typeof Navigation !== "undefined") && (typeof Navigation.addEventListener !== "undefined")) {
    		Navigation.addEventListener("WebDestinationReached", InformUserDestinationReached()	}
    } catch(e) {
    	DealWithNavigationError(e);
    }
    

    Note: The Navigation events are triggered only if the Navigation was launched using either LaunchGuidance or LaunchGuidanceWaypoints.

    Appeared in Wave 4.1 - version 40.03.49.50


    Privacy.ModeFull #

    Event triggered when the Full privacy mode is selected.

    EXAMPLE

    try {
    	// Privacy
    	if ((typeof Privacy !== "undefined") && (typeof Privacy.addEventListener !== "undefined")) {
    		Privacy.addEventListener("ModeFull", function(){
    			alert("The privacy full mode is now Active");
    		});
    	}
    } catch(e) {
    	DealWithPrivacyError(e);
    }
    

    Appeared in Wave 4.1 - version 30.05.14.30


    Privacy.ModeGeoloc #

    Event triggered when the Geolocalisation privacy mode is selected.

    EXAMPLE

    try {
    	// Privacy
    	if ((typeof Privacy !== "undefined") && (typeof Privacy.addEventListener !== "undefined")) {
    		Privacy.addEventListener("ModeGeoloc", function(){
    			alert("Geoloc privacy mode is now active some functionnalities won't be available");
    		});
    	}
    } catch(e) {
    	DealWithPrivacyError(e);
    }
    

    Appeared in Wave 4.1 - version 30.05.14.30


    Privacy.ModePublic #

    Event triggered when the Public privacy mode is selected.

    EXAMPLE

    try {
    	// Privacy
    	if ((typeof Privacy !== "undefined") && (typeof Privacy.addEventListener !== "undefined")) {
    		Privacy.addEventListener("ModePublic", function(){
    			alert("Public privacy mode is now active");
    		});
    	}
    } catch(e) {
    	DealWithPrivacyError(e);
    }
    

    Appeared in Wave 4.1 - version 30.05.14.30


    System.OnShutDown #

    Event triggered when the system is being shut down.

    Note: This event is triggered 2 seconds before the system is completely shut down.

    EXAMPLE

    try{
    	
    	// System
    	if ((typeof System !== "undefined") && (typeof System.addEventListener !== "undefined")) {
    		System.addEventListener("OnShutDown", SaveAllBeforeShutDown());
    	}
    } catch(e) {
    	DealWithSystemError(e);
    }
    

    Appeared in Wave 4.1 - version 21.02.23.40


    WebPortal.cancelBtnPopupRequestClicked #

    Event triggered when the Cancel popup MQTT popup button is clicked.

    Be carefull: To retrieve this event you have to use WebPortal.getPendingNotifications() method.

    //Retrieve pending notification
    var getPendingNotifications = function(){
    	var notificationsList = WebPortal.getPendingNotifications('app_id');
    	notificationsList.map(processNotification);
    };
    
    //Process retrieved notification
    var processNotification = function(notification) {
    	if (notification.popupAction === 'WebPortal.cancelBtnPopupRequestClicked') {
    		alert("Popup cancel button clicked!");
    	}
    }; 
    


    WebPortal.closeTimeoutPopupRequest #

    Event triggered when the popup MQTT popup timeout occurs (15 seconds by default).

    EXAMPLE

    window.addEventListener("message", function(event){
    	
    	if (typeof event.data !== 'undefined' && typeof event.data.type !== 'undefined' ){
    
    	    var data = event.data;
    	    var type = event.data.type;
    
    	    switch(data.value.popupAction){
    
    		//When the application is put in foreground
    	    case "WebPortal.closeTimeoutPopupRequest":
    		console.log("Popup timeout reached");
    		alert("Popup timeout reached");
    		break;
    	    
    	    }
    	}
     });
    


    WebPortal.nativePopup.evt.cancel #

    Event triggered when the Cancel button of the native popup is clicked.

    EXAMPLE

    window.addEventListener("message", function(event){
    	
    	if (typeof event.data !== 'undefined' && typeof event.data.type !== 'undefined' ){
    
    	    var data = event.data;
    	    var type = event.data.type;
    
    	    switch(type){
    
    	    //When the *cancel* button of the native popup is clicked.
    	    case "WebPortal.nativePopup.evt.cancel":
    		console.log("The *cancel* button of the native popup is clicked");
    		alert("The *cancel* button of the native popup is clicked");
    		break;
    
    	    }
    	}
        });
    


    WebPortal.nativePopup.evt.ok #

    Event triggered when the OK button of the native popup is clicked.

    EXAMPLE

    window.addEventListener("message", function(event){
    	
    	if (typeof event.data !== 'undefined' && typeof event.data.type !== 'undefined' ){
    
    	    var data = event.data;
    	    var type = event.data.type;
    
    	    switch(type){
    
    	    //When the *OK* button of the native popup is clicked.
    	    case "WebPortal.nativePopup.evt.ok":
    		console.log("The *OK* button of the native popup is clicked");
    		alert("The *OK* button of the native popup is clicked");
    		break;
    
    	    }
    	}
        });
    


    WebPortal.nativePopup.evt.timeout #

    Event triggered when the timeout of the native popup is finish.

    EXAMPLE

    window.addEventListener("message", function(event){
    	
    	if (typeof event.data !== 'undefined' && typeof event.data.type !== 'undefined' ){
    
    	    var data = event.data;
    	    var type = event.data.type;
    
    	    switch(type){
    
    	    //When the *timeout* of the native popup is finish
    	    case "WebPortal.nativePopup.evt.timeout":
    		console.log("The the *timeout* of the native popup is finish");
    		alert("The the *timeout* of the native popup is finish");
    		break;
    
    	    }
    	}
        });
    


    WebPortal.okBtnPopupRequestClicked #

    Event triggered when the OK button of the MQTT popup is clicked.

    EXAMPLE

    window.addEventListener("message", function(event){
    	
    	if (typeof event.data !== 'undefined' && typeof event.data.type !== 'undefined' ){
    
    	    var data = event.data;
    	    var type = event.data.type;
    
    	    switch(data.value.popupAction){
    
    		//When the application is put in foreground
    	    case "WebPortal.okBtnPopupRequestClicked":
    		console.log("Popup ok button clicked!");
    		alert("Popup ok button clicked!");
    		break;
    	    
    	    }
    	}
     });
    


    WebPortal.onApplicationHide #

    Event triggered when the application loses focus.

    EXAMPLE

    window.addEventListener("message", function(event){
    	
    	if (typeof event.data !== 'undefined' && typeof event.data.type !== 'undefined' ){
    
    	    var data = event.data;
    	    var type = event.data.type;
    
    	    switch(type){
    
    		//When the application is put in background    
    	    case "WebPortal.onApplicationHide":  
    		console.log("Application is hidden");
    		alert("Application is hidden");
    		break;
    
    	    }
    	}
    });
    


    WebPortal.onApplicationLoaded #

    Event to send to WebPortal to indicate that the application has loaded properly.

    Note: Must be sent to the WebPortal using the Window.postMessage API each time your application is launched.

    EXAMPLE

    //Mandatory: inform the parent window (applications portal) that the application is loaded and ready 
      window.parent.postMessage({'type':'WebPortal.onApplicationLoaded'}, '*');
    


    WebPortal.onApplicationShow #

    Event triggered when the application gains focus.

    EXAMPLE

    window.addEventListener("message", function(event){
    	
    	if (typeof event.data !== 'undefined' && typeof event.data.type !== 'undefined' ){
    
    	    var data = event.data;
    	    var type = event.data.type;
    
    	    switch(type){
    
    		//When the application is put in foreground
    	    case "WebPortal.onApplicationShow":
    		console.log("Application is shown");
    		alert("Application is shown");
    		break;
    
    	    }
    	}
    );
    


    WebPortal.onApplicationUnloaded #

    Event triggered when the application is unloaded.

    EXAMPLE

    window.addEventListener("message", function(event){
    	
    	if (typeof event.data !== 'undefined' && typeof event.data.type !== 'undefined' ){
    
    	    var data = event.data;
    	    var type = event.data.type;
    
    	    switch(type){
    
    	    //When the application is killed or reloaded via an update
    	    case "WebPortal.onApplicationUnloaded":
    		console.log("The application will be killed, it's time to save your application data");
    		alert("The application will be killed, it's time to save your application data");
    		break;
    
    	    }
    	}
        });
    


    WebPortal.onApplicationUpdated #

    Event triggered when the application has been updated.

    EXAMPLE

    window.addEventListener("message", function(event){
    	
    	if (typeof event.data !== 'undefined' && typeof event.data.type !== 'undefined' ){
    
    	    var data = event.data;
    	    var type = event.data.type;
    
    	    switch(type){
    
    	    //When the application is killed or reloaded via an update
    	    case "WebPortal.onApplicationUpdated":
    		console.log("The application has been updated, data has changed");
    		alert("The application has been updated, data has changed");
    		break;
    
    	    }
    	}
        });
    


    WebPortal.onCurrentNotificationReceived #

    Event triggered when a notification is received.

    EXAMPLE

    window.addEventListener("message", function(event){
    	
    	if (typeof event.data !== 'undefined' && typeof event.data.type !== 'undefined' ){
    
    	    var data = event.data;
    	    var type = event.data.type;
    
    	    switch(type){
    
    	    //When a notification is pushed to the application
    	    case "WebPortal.onCurrentNotificationReceived":
    		if (typeof data.value !== 'undefined'){
    		    console.log("Notification received",data.value);
    		    if (typeof data.value === 'object'){
    			alert("Notification received: "+JSON.stringify(data.value));
    		    } else {
    			alert("Notification received: "+data.value);
    		    }
    		}
    		break;
    	    }
    	}
    });