Giter VIP home page Giter VIP logo

xdialserver's Introduction

DIAL 2.2.1 Server Implementation

XCAST Overview

Architecture Overview

The RDK DIAL server supports XCAST_2 API through thunder plugin interface

XCAST_2 API

setEnabled

void setEnabled(boolean);

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 manger 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.

getEnabled

object getEnabled(void)

Return the persisted value in json object Object Parameter

{
  "enabled" :  "true"|"false"
}

onApplicationLaunchRequest

void onApplicationLaunchRequest(Object)

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

Object parameter

{
  applicationName : <string> 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" : <string> "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.
 */
}

onApplicationStopRequest

void onApplicationStopRequest(Object)

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

Object parameter

{
  applicationName : <string> registered application name
  applicationId: [string] (optional) application instance Id.
}

onApplicationStateRequest

void onApplicationStateRequest(object)

Fired when service needs an update of application state.

This request must result in an onApplicationStateChanged event

Object parameter

{
  applicationName: <string> name of the application whose state is being requested
  applicationId: [string] (optional) application instance Id.
}

onApplicationStateChanged

void onApplicationStateRequest(object)

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.

Object parameter

{
  serviceName: [string] (optional) name of the service that the request originates from (DIAL, Alexa etc.)
  applicationName: <string> name of the application whose state has changed.
  applicationId: [string] (optional) application instance Id,
  state: <string> Predefined state strings. [running|stopped],
  error: [string] (optional) Predefined Error string from cast target app [none|forbidden|unavailable|invalid|internal]
}

Client Error Mapping Example:

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

xdialserver's People

Contributors

acheri988 avatar akhilsarada avatar apatel859 avatar balajims88 avatar dwrobel avatar honglh avatar mikolaj-staworzynski-red avatar rdkcmf-jenkins avatar tomasz-karczewski-red avatar vaisakh806 avatar zrash avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

xdialserver's Issues

Design and implementation details clarification request around rtcache

Hi,

I have couple of questions related to rtcache submodule. Some of the aspects of implementation looks very strange for me:

(1) Why the file: https://github.com/rdkcentral/xdialserver/blob/master/server/plat/rtRemoteObjectCache.hpp is here ?
Is it not a part of rtRemote API provided here: https://github.com/pxscene/rtRemote/blob/master/include/rtRemoteObjectCache.h ?

(2) Id mapping for the cache: https://github.com/rdkcentral/xdialserver/blob/master/server/plat/rtcache.cpp#L25
What is the reason of introducing such a mapping - looks like "Dial" prefixed names are there, but only for YouTube and Netflix ?
Why all the others are mapped to "INVALID" ?
Could it be done in a straight forward way without that strange name remap ?
I mean application name should be an identifier in the ObjectCache ?

(3) rtRemoteObjectCache cache object created by rtcache: https://github.com/rdkcentral/xdialserver/blob/master/server/plat/rtcache.hpp#L36 works in the very strange way.

My observation is the following:

3.1 Object are cached there for the time equal to setup of rt.rpc.cache.max_object_lifetime= later they disappear from there when there are no additional application state refresh, it happens in the following line of code: https://github.com/pxscene/rtRemote/blob/master/src/rtRemoteServer.cpp#L376
Reason of that is, even if we have two instances of the rtRemoteObjectCache, both of them share the same map: https://github.com/pxscene/rtRemote/blob/master/src/rtRemoteObjectCache.cpp#L50

3.2 Cached object are not in scope of keep alive mechanism for rtRemote, to make that happens they should be registrered in the xcast (rtRemoteRegisterObject) and located in xdial (rtRemoteLocateObject), otherwise keep alive does not work for them.

As a result of 3.1 and 3.2 we have the following strange behaviour:
If we start, let's say Netflix and receive "running" state for Netflix object will be cached, after time defined by: rt.rpc.cache.max_object_lifetime= object will disappear from cache.
Later on, after rt.rpc.cache.max_object_lifetime time, if we would like to do the stop/ or hide there are no state at all in the cache.

My question is the following: What is a reason of introducing such a strange solution here, that appears to me like being a bug, but maybe I do not know yet all the aspects.
Please clarify that if you could, maybe there are some not yet discovered places here that I should know about and not yet discovered by me.

Is the cache keep aliving/refreshing mechanism for the objects in the rtcache base on a little bit hidden assumption that the 2nd screen application periodically doing GET requests for the state of the application ? Every 10-20 seconds ? for example GET /apps/Netflix or GET /apps/YouTube ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.