### onApplicationLaunchRequest Source: https://github.com/rdkcentral/xdialserver/blob/main/README.md Fired when the service receives a launch request from a client. If the application is not running, it is started. If running in the background, it is brought to the foreground. If already in the foreground, the state remains unchanged. ```APIDOC ## onApplicationLaunchRequest ### Description Fired when service receives a launch request from client. If not already running, the requested app is started. if already running and in background mode, the requested app enters foreground mode (optimus::running, xcast::running). If already in foreground mode, the request does not change app state. This request must result in an `onApplicationStateChanged` event. ### Method void ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **applicationName** (string) - Required - The registered name of the application to launch. - **parameters** (object) - Optional - Additional parameters for launching the application. Example: `{"url": "dialpayload=...&&additionalDataUrl=...[&&{query_string}]"}` ``` -------------------------------- ### Handle Application Launch Request Source: https://github.com/rdkcentral/xdialserver/blob/main/README.md Fired when the service receives a launch request from a client. If the app is not running, it starts it. If running in the background, it brings it to the foreground. The request must result in an `onApplicationStateChanged` event. ```javascript void onApplicationLaunchRequest(Object) ``` ```json { applicationName : registered application name parameters: type information see below /* * The format and interpretation of 'parameter values' is determined between the (app launcher * or cast target) and the cast client for each application. But overall, the parameter string * conforms to the following pattern: * * parameters: { * "url" : "dialpayload=...&&additionalDataUrl=...[&&{query_string}] * } * * where in the `url` value, * `dialpayload` is the url-encoded HTTP POST payload from DIAL launch request * `additionalDataUrl` is a local URL generated by DIAL server for application to communicate with. * `query_string` contains all the url-encoded query strings in the HTTP POST request. */ } ``` -------------------------------- ### Client Error Mapping Example Source: https://github.com/rdkcentral/xdialserver/blob/main/README.md Provides a mapping between XCastService errors and their corresponding DIAL client HTTP error codes. This helps in translating server-side issues into client-understandable error responses. ```markdown |XCastService Error| Definition | DIAL Client Error| |------------------|------------|------------------| |none (or absent) |request (start/stop) is fulfilled successfully|HTTP 200 OK| |forbidden |user is not allowed to change the state of the app (This is not related to user account authentication of the native app)|HTTP 403 Forbidden| |unavailable |the target native app is not available on the device|HTTP 404 Not Found| |invalid |the request is invalid (bad param for example)|HTTP 400 Bad Request| |internal |the server fail to fulfill the request (server error)|HTTP 500 Internal| ``` -------------------------------- ### Get XCAST Service Enabled State Source: https://github.com/rdkcentral/xdialserver/blob/main/README.md Retrieves the current persisted state of the XCAST service. The response is a JSON object indicating whether the service is enabled or disabled. ```javascript object getEnabled(void) ``` ```json { "enabled" : "true"|"false" } ``` -------------------------------- ### onApplicationStateRequest Source: https://github.com/rdkcentral/xdialserver/blob/main/README.md Fired when the service requires an update on the application's state. This must result in an `onApplicationStateChanged` event. ```APIDOC ## onApplicationStateRequest ### Description Fired when service needs an update of application state. This request must result in an `onApplicationStateChanged` event. ### Method void ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **applicationName** (string) - Required - The name of the application whose state is being requested. - **applicationId** (string) - Optional - The instance ID of the application. ``` -------------------------------- ### onApplicationStopRequest Source: https://github.com/rdkcentral/xdialserver/blob/main/README.md Fired when the service receives a stop request from a cast client. If the application is running (foreground or background), it is destroyed. If the application is not running, an error is reported. ```APIDOC ## onApplicationStopRequest ### Description Fired when service receives an stop request from cast client. If the app is already running and either in foreground or background mode, then the requested app is destroyed (optimus::destroyed, xcast::stopped). If the app is not running, this request triggers an error onApplicationStateChanged message with error = "Invalid". This request must result in an `onApplicationStateChanged` event. ### Method void ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **applicationName** (string) - Required - The registered name of the application to stop. - **applicationId** (string) - Optional - The instance ID of the application to stop. ``` -------------------------------- ### Request Application State Update Source: https://github.com/rdkcentral/xdialserver/blob/main/README.md Fired when the service needs an update of an application's state. This request must result in an `onApplicationStateChanged` event. ```javascript void onApplicationStateRequest(object) ``` ```json { applicationName: name of the application whose state is being requested applicationId: [string] (optional) application instance Id. } ``` -------------------------------- ### onApplicationStateChanged Source: https://github.com/rdkcentral/xdialserver/blob/main/README.md Notifies whenever an application's state changes. This can be due to user activity, internal errors, or other reasons. Includes error information if the state change failed or was triggered by an error. ```APIDOC ## onApplicationStateChanged ### Description Notify whenever app changes state (due to user activity or internal error or other reasons). For singleton, applicationId is optional. If application launch/stop request is denied or fails to reach the target state or the state change is triggered by an internal error, a predefined error string should be included. This error may be translated from DIAL http error code to a XCAST client's error code. ### Method void ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **serviceName** (string) - Optional - The name of the service originating the request (e.g., DIAL, Alexa). - **applicationName** (string) - Required - The name of the application whose state has changed. - **applicationId** (string) - Optional - The instance ID of the application. - **state** (string) - Required - The new state of the application. Predefined values: [running|stopped]. - **error** (string) - Optional - Predefined error string from the cast target app. Possible values: [none|forbidden|unavailable|invalid|internal]. ``` -------------------------------- ### Handle Application Stop Request Source: https://github.com/rdkcentral/xdialserver/blob/main/README.md Fired when the service receives a stop request from a cast client. If the app is running, it is destroyed. If the app is not running, an error is triggered. This request must result in an `onApplicationStateChanged` event. ```javascript void onApplicationStopRequest(Object) ``` ```json { applicationName : registered application name applicationId: [string] (optional) application instance Id. } ``` -------------------------------- ### setEnabled Source: https://github.com/rdkcentral/xdialserver/blob/main/README.md Enable or disable the XCAST service. The default value is true. When disabled, clients cannot discover the CPE as a cast target. Enabling the service re-registers all available applications. ```APIDOC ## setEnabled ### Description Enable or disable XCAST service. Default value is __true__. When disabled, the customer should not be able to discover CPE as a cast target for any client application. After enable(true) server application manager must re-register all app that are available for user to cast. The value is persisted on device after each call. Upon reboot or reconnect, the persisted value is used until the next call. ### Method void ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **enabled** (boolean) - Required - Specifies whether to enable or disable the XCAST service. ``` -------------------------------- ### Enable/Disable XCAST Service Source: https://github.com/rdkcentral/xdialserver/blob/main/README.md Use this method to enable or disable the XCAST service. The default value is true. When disabled, CPEs cannot be discovered as cast targets. The setting is persisted across device reboots. ```javascript void setEnabled(boolean); ``` -------------------------------- ### getEnabled Source: https://github.com/rdkcentral/xdialserver/blob/main/README.md Retrieves the current enabled/disabled state of the XCAST service. The state is persisted on the device. ```APIDOC ## getEnabled ### Description Return the persisted value in json object. ### Method object ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **enabled** (string) - The current state of the XCAST service, either "true" or "false". ``` -------------------------------- ### Notify Application State Change Source: https://github.com/rdkcentral/xdialserver/blob/main/README.md Notifies whenever an application's state changes due to user activity, internal errors, or other reasons. Includes error details if the state change fails or is triggered by an error. For singleton applications, `applicationId` is optional. ```javascript void onApplicationStateRequest(object) ``` ```json { serviceName: [string] (optional) name of the service that the request originates from (DIAL, Alexa etc.) applicationName: name of the application whose state has changed. applicationId: [string] (optional) application instance Id, state: Predefined state strings. [running|stopped], error: [string] (optional) Predefined Error string from cast target app [none|forbidden|unavailable|invalid|internal] } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.