From: Szymon Jastrzebski Date: Mon, 25 Sep 2017 07:32:45 +0000 (+0200) Subject: Removing Convergence API X-Git-Tag: GitHub/PR#69/guides-native-web~16^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F69%2F152169%2F1;p=sdk%2Fonline-doc.git Removing Convergence API segwon.han has requested to remove Convergence API. Change-Id: I8a4cd0b6ae55a8fbeda316614ee034b2c919c6a0 Signed-off-by: Szymon Jastrzebski --- diff --git a/org.tizen.guides/html/index.htm b/org.tizen.guides/html/index.htm index af33a24..a97bbb0 100644 --- a/org.tizen.guides/html/index.htm +++ b/org.tizen.guides/html/index.htm @@ -635,7 +635,6 @@
  • NFC
  • Secure Element Access
  • Content Downloads
  • -
  • Convergence Services
  • Messaging diff --git a/org.tizen.guides/html/web/connectivity/connectivity_cover_w.htm b/org.tizen.guides/html/web/connectivity/connectivity_cover_w.htm index 3c34546..8d9d0af 100644 --- a/org.tizen.guides/html/web/connectivity/connectivity_cover_w.htm +++ b/org.tizen.guides/html/web/connectivity/connectivity_cover_w.htm @@ -57,10 +57,6 @@
  • Content Downloads

    You can download files from the Internet. You can also monitor the download progress to keep the user informed of the status.

  • - -
  • Convergence Services - -

    You can establish wireless connections between applications on remote devices through device-to-device Convergence services. You can discover devices within the same network, obtain information about available device-to-device Convergence services, connect to applicable devices, and use the available services.

  • diff --git a/org.tizen.guides/html/web/connectivity/convergence_w.htm b/org.tizen.guides/html/web/connectivity/convergence_w.htm deleted file mode 100644 index 1784450..0000000 --- a/org.tizen.guides/html/web/connectivity/convergence_w.htm +++ /dev/null @@ -1,404 +0,0 @@ - - - - - - - - - - - - -Convergence Services - - - - - -
    -

    Convergence Services

    - -

    You can establish connections between different devices as well as propagate data and commands among them using a collection of device-to-device Convergence services. The Convergence services are remote functions to access and control nearby devices. If you implement an application with the Convergence API, the application can discover devices within the same network, obtain information about available device-to-device Convergence services, connect to applicable devices, and execute the services remotely, while you need no understanding of the communication details, such as connectivity type.

    - -

    This feature is supported in mobile and wearable applications only.

    - -

    The main features of the Convergence API include:

    - - -

    The following Convergence services are currently provided:

    -
      -
    • AppCommunicationService -

      You can spawn 2 types of instances: server and client. Typically, the client finds available server services through a discovery, establishes a connection with one of the servers, and launches an application on the server side. The server cannot launch an application on the client side. Both the client and server can exchange text messages and binary payloads.

      -
      - Note - The server for the AppCommunicationService can only be implemented on a TV device based on Tizen 3.0. You can develop a mobile or wearable client for the AppCommunicationService, if a server exists. -
      -
    • -
    • RemoteAppControlService -

      The communication between RemoteAppControlService device instances does not involve servers. If the RemoteAppControlService is available on the device, remote applications can launch applications and send application control requests. The communication between devices begins after a discovery of the RemoteAppControlService.

      -
    • -
    - -

    Prerequisites

    -

    To use the Convergence API (in mobile and wearable applications), the application has to request permission by adding the following privileges to the config.xml file:

    -
    -<tizen:privilege name="http://tizen.org/privilege/bluetooth"/>
    -<tizen:privilege name="http://tizen.org/privilege/internet"/>
    -<tizen:privilege name="http://tizen.org/privilege/d2d.datasharing"/>
    -
    - -

    Searching for Nearby Devices

    -

    A discovery is a search for Convergence services in the same device-to-device network. To launch a discovery procedure and attempt to connect with the found service:

    -
      -
    1. Search for nearby devices with the startDiscovery() method: - -
      -var timeout = 60 * 60;
      -
      -try {
      -    tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, timeout);
      -} catch (err) {
      -    console.log(err.name + ': ' + err.message);
      -}
      -
    2. - -
    3. Implement the discoverySuccessCallback callback defined in the first parameter of the startDiscovery() method.

      -

      The callback must contain 2 methods:

      -
        -
      • When a nearby device is detected, the onfound event is triggered. The device parameter holds the services available on the found device. In the following example, the connect() method is called on the found RemoteAppControlService.
      • -
      • When the discovery is finished and no more devices are found, the onfinished event is triggered.
      • -
      - -
      -var discoverySuccessCallback = {
      -    onfound: function(device) {
      -        console.log('Found a device');
      -        console.log(' - id: ' + device.id);
      -        console.log(' - name: ' + device.name);
      -        console.log(' - type: ' + device.type);
      -        console.log(' - service amount: ' + device.services.length);
      -        for (i in device.services) {
      -            if (device.services[i] instanceof RemoteAppControlService) {
      -                if (device.services[i].connectionState != 'CONNECTED') {
      -                    device.services[i].connect(onconnected, onerror);
      -                }
      -            }
      -        }
      -    },
      -
      -    onfinished: function(foundDevices) {
      -        console.log(' Device discovery has finished');
      -        if (foundDevices.length > 0) {
      -            console.log(' - devices found: ' + foundDevices.length);
      -        }
      -    }
      -};
      -
      -function onerror(err) {
      -    console.log(err.name + ': ' + err.message);
      -}
      -
    4. -
    5. When a connection is established, the onconnected callback is invoked with the connected service as a parameter:

      -
      -function onconnected(service) {
      -    console.log('Connected to the service');
      -}
      -
      -
    6. -
    - - -

    Setting up the AppCommunicationService and Exchanging Messages

    -

    You can set up a server service, establish a connection between it and a client, and exchange messages.

    -

    Launching a Server Service

    -

    To instantiate a server service:

    - -
      -
    1. Create a ChannelInfo object. It identifies the server and is used by the clients to address their demands. The first parameter of the ChannelInfo constructor is the server's application ID, set in its config.xml file. The second parameter is an ID set by you. -
      -var requestChannel = new tizen.ChannelInfo('targetApp0.main', 'chA');
      -
      -
    2. -
    3. Define the success and error callbacks for the server service start: -
      -function onerror(err) {
      -    console.log(err.name +': ' + err.message);
      -}
      -
      -function onstarted(channel, clientInfo) {
      -    console.log('Channel started');
      -    console.log('channel uri: ' + channel.uri);
      -    console.log('channel id: ' + channel.id);
      -
      -    if (clientInfo) {
      -        console.log('clientInfo');
      -        console.log('isHost: ' + clientInfo.isHost);
      -        console.log('client id: ' + clientInfo.clientId);
      -        console.log('connection time: ' + clientInfo.connectionTime);
      -    }
      -}
      -
      -
    4. -
    5. Instantiate an AppCommunicationServerService object: -
      -var service = new tizen.AppCommunicationServerService();
      -
      -
    6. -
    7. Start the server service. In addition to the ChannelInfo object, you must provide the success and error callbacks defined earlier. -
      -service.start(requestChannel, onstarted, onerror);
      -
    8. -
    - -

    Listening for Incoming Messages on the Server Side

    -

    Applications can transfer data as payload objects, consisting of a key string and a data chunk in form of a string or binary values array.

    -

    To wait for incoming messages on the server side:

    -
      -
    1. The started server service handles incoming messages through the onnotify callback, which is invoked when another service attempts to communicate with the server. The callback receives the sent payload and data about its sender.

      -
      -function onnotify(channel, payload, senderclientid) {
      -    console.log('On service notification');
      -    console.log('channel uri: ' + channel.uri);
      -    console.log('channel id: ' + channel.id);
      -    console.log('client id of sender: ' + senderclientid);
      -    for (i in payload) {
      -        console.log('payload: ' + payload[i].key + '-' + payload[i].value);
      -    }
      -}
      -
    2. - -
    3. To be able to receive messages, register the onnotify callback with the setListener() method:

      -
      -service.setListener(onnotify);
      -
      -

      After the callback has been registered, all incoming data is handled by the onnotify callback.

    4. -
    - -

    Communicating with the Server

    -

    In contrast to the server, a client service does not have to be instantiated. It can communicate with the server after discovering it.

    -

    To communicate with the server:

    -
      - -
    1. Discover available server services on the client side:

      -
      -function onerror(err) {
      -    console.log(err.name +': ' + err.message);
      -}
      -
      -var timeout = 60 * 60;
      -
      -try {
      -    tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, timeout);
      -} catch (err) {
      -    console.log(err.name + ': ' + err.message);
      -}
      -
    2. -
    3. Create a ChannelInfo instance with the same URI and ID as the channel used on the server side. Then start the available server service and send the payload to it.

      -
      -var serverService;
      -var channel = new tizen.ChannelInfo('targetApp0.main', 'chA');
      -
      -function onerror(err) {
      -    console.log(err.name +': ' + err.message);
      -}
      -
      -var requestPayload = {
      -    key: 'testPayload',
      -    value: 'Hello!'
      -};
      -
      -function sendSuccessCallback(channel) {
      -    console.log('requestPayload sent');
      -    console.log('channel uri: ' + channel.uri);
      -    console.log('channel id: ' + channel.id);
      -}
      -
      -function onstarted(channel, clientInfo) {
      -    serverService.send(channel, requestPayload, sendSuccessCallback, onerror);
      -}
      -
      -var discoverySuccessCallback = {
      -    onfound: function(device) {
      -        for (i in device.services) {
      -            if (device.services[i] instanceof AppCommunicationServerService) {
      -                serverService = device.services[i];
      -                device.services[i].start(channel, onstarted, onerror);
      -            }
      -        }
      -    },
      -
      -    onfinished: function(foundDevices) {
      -        console.log(' Device discovery has finished');
      -    }
      -};
      -
    4. -
    -

    Launching an Application Remotely

    - -

    This use case assumes that a "targetApp0.main" application has been installed on the remote device.

    - -

    To launch an application on a remote device:

    - -
      -
    1. Call the startDiscovery() method to establish connections with remote devices:

      -
      -var discoverySuccessCallback = {
      -    onfound: function(device) {
      -        for (i in device.services) {
      -            if (device.services[i].type === 'REMOTE_APP_CONTROL') {
      -                if (device.services[i].connectionState != 'CONNECTED') {
      -                    device.services[i].connect(onconnected, onerror);
      -                } else {
      -                    device.services[i].start(onstarted, onerror);
      -                }
      -            }
      -        }
      -    },
      -
      -    onfinished: function(foundDevices) {
      -        console.log('Device discovery has finished');
      -    }
      -};
      -
      -function onerror(err) {
      -    console.log(err.name +': ' + err.message);
      -}
      -
      -var timeout = 60 * 60;
      -
      -try {
      -    tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, timeout);
      -} catch (err) {
      -    console.log(err.name + ': ' + err.message);
      -}
      -
    2. -
    3. An application on the remote device is started from the onconnected callback. The remoteAppControlCallback method handles the data sent from the remote device.

      -
      -var requestAppId = 'targetApp0.main';
      -
      -function remoteAppControlCallback(data) {
      -    for (var i = 0; i < data.length; i++) {
      -        console.log('key: ' + data[i].key + 'value: ' + data[i].value[0]);
      -    }
      -    service.disconnect();
      -}
      -
      -function onstarted(service) {
      -    console.log('Remote app control service started');
      -    service.launch(requestAppId, remoteAppControlCallback, onerror);
      -}
      -
      -function onconnected(service) {
      -    console.log('Connected to the remote app control service');
      -    service.start(onstarted, onerror);
      -    service.launch(requestAppId, remoteAppControlCallback, onerror);
      -}
      -
    4. -
    - -

    Sending an Application Control Remotely

    -

    The ApplicationControl object is used to request applications to perform particular actions. This use case shows how to ask an image viewer to display a picture. For more information on application controls, see Application Controls.

    -
      -
    1. Use the startDiscovery() method to search for and connect to a RemoteAppControlService:

      -
      -var discoverySuccessCallback = {
      -    onfound: function(device) {
      -        for (i in device.services) {
      -            if (device.services[i] instanceof RemoteAppControlService) {
      -                if (device.services[i].connectionState != 'CONNECTED') {
      -                    device.services[i].connect(onconnected, onerror);
      -                }
      -            }
      -        }
      -    },
      -
      -    onfinished: function(foundDevices) {
      -        console.log(' Device discovery has finished');
      -    }
      -};
      -
      -function onerror(err) {
      -    console.log(err.name +': ' + err.message);
      -} try {
      -    tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
      -} catch (err) {
      -    console.log(err.name + ': ' + err.message);
      -}
      -
    2. -
    3. Create the ApplicationControl object:

      -
      -var requestAppControl =
      -    new tizen.ApplicationControl('http://tizen.org/appcontrol/operation/view', null,
      -                                 'image/jpeg', null,
      -                                 [new tizen.ApplicationControlData('images', [testImgData])]);
      -
    4. -
    5. Use the onconnected() callback to send the application control request to the remote service. The launchAppControl() method takes as parameters the ApplicationControl object, optionally the target application ID, and a callback defining the actions to be taken on the remote service reply.

      -
      -function remoteAppControlCallback(data) {
      -    for (var i = 0; i < data.length; i++) {
      -        console.log('key: ' + data[i].key + 'value: ' + data[i].value[0]);
      -    }
      -}
      -
      -function onconnected(service) {
      -    service.launchAppControl(requestAppControl, null,
      -                             remoteAppControlCallback, onerror);
      -}
      -
    6. -
    - - -
    - -Go to top - - - - - - - diff --git a/org.tizen.guides/index.xml b/org.tizen.guides/index.xml index 2a0f398..f8d600c 100644 --- a/org.tizen.guides/index.xml +++ b/org.tizen.guides/index.xml @@ -455,7 +455,6 @@ - diff --git a/org.tizen.training/html/web/details/app_filtering_w.htm b/org.tizen.training/html/web/details/app_filtering_w.htm index 3f95bd1..363db97 100644 --- a/org.tizen.training/html/web/details/app_filtering_w.htm +++ b/org.tizen.training/html/web/details/app_filtering_w.htm @@ -259,11 +259,6 @@ 4.0 -http://tizen.org/feature/convergence.d2d - Specify this key, if the application requires the Device-to-Device (D2D) Convergence feature, which provides the service to discover near-by devices and to communicate information and data to the remote devices. - 3.0 - - http://tizen.org/feature/database.encryption Specify this key, if the application requires the database encryption feature. 2.2.1 @@ -569,11 +564,6 @@ 4.0 -http://tizen.org/feature/convergence.d2d - Specify this key, if the application requires the Device-to-Device (D2D) Convergence feature, which provides the service to discover near-by devices and to communicate information and data to the remote devices. - 3.0 - - http://tizen.org/feature/database.encryption Specify this key, if the application requires the database encryption feature. 2.2.1 diff --git a/org.tizen.web.apireference/html/device_api/mobile/index.html b/org.tizen.web.apireference/html/device_api/mobile/index.html index 1403beb..62d42f9 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/index.html +++ b/org.tizen.web.apireference/html/device_api/mobile/index.html @@ -214,14 +214,6 @@ No - - Convergence - This API provides interfaces and methods for using Tizen device-to-device convergence services. - 3.0 - Optional - No - - Iotcon This API provides functions for IoT (Internet of Things) connectivity. diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/convergence.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/convergence.html deleted file mode 100755 index ade73e9..0000000 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/convergence.html +++ /dev/null @@ -1,4124 +0,0 @@ - - - - - -Convergence API - - -
    -
    -

    Convergence API

    -
    - The Convergence API defines interfaces and methods -for using Tizen device-to-device convergence services. -
    -
    -

    -The following functionality is provided: -

    -
      -
    • -Discovering nearby devices which support device-to-device services
    • -
    • -Getting device and service information
    • -
    • -Connecting and disconnecting services
    • -
    • -Starting and stopping services
    • -
    • -Sending data to services
    • -
    • -Listening to notifications from the service
    • -
    -

    -The collection of supported device-to-device services includes: -

    -
      -
    • -Remote App Control Service - Allows launching an application on a remote device.
    • -
    • -App Communication Service - Allows transferring data between applications on local and remote devices. -
      Note that there are 'client' and 'server' implementations of this service which allows easy set-up and -convenient handling of the data exchange process on both local and remote devices. -For better flexibility, the data transfer occurs in named user-defined communication channels.
    • -
    -

    -For more information on the Device-to-device Convergence features, -see the Convergence Services Guide. -

    -

    -Tizen 3.0 only supports Wi-Fi for Convergence services. More connectivity, such as BT/BLE and Wi-Fi Direct, is to be supported in further versions. -

    -
    -

    - Since: - 3.0 -

    -

    Table of Contents

    - -
    -

    Summary of Interfaces and Methods

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    InterfaceMethod
    ChannelInfo
    ConvergenceObject
    ConvergenceManager -
    void startDiscovery (DiscoverySuccessCallback successCallback, optional ErrorCallback? errorCallback, optional unsigned long? timeout)
    - -
    Device
    Service
    AppCommunicationService -
    void start (ChannelInfo channelInfo, AppCommunicationStartCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void getClientList (ChannelInfo channelInfo, AppCommunicationClientListCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void send (ChannelInfo channelInfo, Payload[] payload, AppCommunicationSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void stop (ChannelInfo channelInfo, optional AppCommunicationSuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    - - -
    AppCommunicationClientService -
    void connect (ConnectSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void disconnect (optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    -
    AppCommunicationServerService
    RemoteAppControlService -
    void start (RemoteAppControlStartCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void stop (optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    -
    void connect (ConnectSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void disconnect (optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    -
    void launch (ApplicationId appId, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    -
    void launchAppControl (ApplicationControl appControl, optional ApplicationId? appId, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback, optional RemoteAppControlCallback? replyCallback)
    -
    PayloadString
    PayloadRawBytes
    ClientInfo
    DiscoverySuccessCallback -
    void onfound (Device device)
    -
    void onfinished (Device[] foundDevices)
    -
    RemoteAppControlCallback -
    void onsuccess (optional ApplicationControlData[]? data)
    -
    void onfailure ()
    -
    ConnectSuccessCallback
    void onsuccess (Service service)
    RemoteAppControlStartCallback
    void onsuccess (Service service)
    AppCommunicationSuccessCallback
    void onsuccess (ChannelInfo channelInfo)
    AppCommunicationStartCallback
    void onsuccess (ChannelInfo channelInfo, ClientInfo clientInfo)
    AppCommunicationClientListCallback
    void onsuccess (ClientInfo[] clients)
    AppCommunicationListenerCallback
    void onnotify (ChannelInfo channelInfo, Payload[] payload, DOMString senderClientId)
    -
    -

    1. Type Definitions

    -
    -

    1.1. DeviceId

    -
    - The type of the remote device identifier. -
    -
        typedef DOMString DeviceId;
    -

    - Since: - 3.0 -

    -
    -
    -

    1.2. DeviceProfile

    -
    - Enumeration of the remote device profile. -
    -
        enum DeviceProfile {"MOBILE", "WEARABLE", "TV"};
    -

    - Since: - 3.0 -

    -
    -
    -

    1.3. Payload

    -
    - The type of payload item. An item is a key-value pair. The value may be either a string or an array of raw bytes. -
    -
        typedef (PayloadString or PayloadRawBytes) Payload;
    -

    - Since: - 3.0 -

    -
    -
    -

    1.4. PayloadType

    -
    - Enumeration of payload types. -
    -
        enum PayloadType{"STRING", "RAW_BYTES"};
    -

    - Since: - 3.0 -

    -
    -

    -The following values are supported: -

    -
      -
    • -STRING - The payload key-value value is a string.
    • -
    • -RAW_BYTES - The payload key-value value is a byte array.
    • -
    -
    -
    -
    -

    1.5. ConnectionState

    -
    - Enumeration of service connection states. -
    -
        enum ConnectionState{"CONNECTED", "NOT_CONNECTED", "CONNECTING"};
    -

    - Since: - 3.0 -

    -
    -

    -The following values are supported: -

    -
      -
    • -CONNECTED - Connected state.
    • -
    • -DISCONNECTED - Not connected state.
    • -
    • -CONNECTING - Connecting state.
    • -
    -
    -
    -
    -

    1.6. ServiceType

    -
    - Enumeration of service type. -
    -
        enum ServiceType{"APP_COMM_CLIENT", "APP_COMM_SERVER", "REMOTE_APP_CONTROL"};
    -

    - Since: - 3.0 -

    -
    -

    -The following values are supported: -

    -
      -
    • -APP_COMM_CLIENT - Application communication client service.
    • -
    • -APP_COMM_SERVER - Application communication server service.
    • -
    • -REMOTE_APP_CONTROL - Remote application control service.
    • -
    -
    -
    -
    -
    -

    2. Interfaces

    -
    -

    2.1. ChannelInfo

    -
    - The channel info interface that specifies the server application which a client application wants to connect with. -
    -
        [Constructor(DOMString uri, DOMString id)]
    -    interface ChannelInfo {
    -      attribute DOMString uri;
    -      attribute DOMString id;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The channelinfo is composed of a URI and a channel ID which is used in App Communication services. -The channelinfo URI is a URI for an application on the server side. -The channelinfo ID value is defined by the developer. -

    -
    -

    Remark: - We assume that the server side app URI is known. For example, either client and server side apps are both developed by the same developer or the server app URI is available from other sources. -

    -
    -

    Constructors

    -
    -
    ChannelInfo(DOMString uri, DOMString id);
    -
    -

    Code example:

    -/* Assume that the "targetApp0.main" application has been installed on remote device */
    -var channel = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -
    -
    -
    -
    -
    -

    Attributes

    -
      -
    • -DOMString uri
      - The uri of the channel. -
      -

      - Since: - 3.0 -

      -
    • -
    • -DOMString id
      - The identifier of the channel. -
      -

      - Since: - 3.0 -

      -
    • -
    -
    -
    -
    -

    2.2. ConvergenceObject

    -
    - The ConvergenceObject interface defines what is -instantiated by the Tizen object from the Tizen platform. -
    -
        [NoInterfaceObject] interface ConvergenceObject {
    -        readonly attribute ConvergenceManager convergence;
    -    };
    -
        Tizen implements ConvergenceObject;
    -

    - Since: - 3.0 -

    -
    -

    -The tizen.convergence object allows access to -Tizen device-to-device convergence API. -

    -
    -
    -
    -

    2.3. ConvergenceManager

    -
    - The ConvergenceManager interface provides access to the -convergence object. -
    -
        [NoInterfaceObject] interface ConvergenceManager {
    -
    -        void startDiscovery(DiscoverySuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback,
    -            optional unsigned long? timeout) raises(WebAPIException);
    -
    -        void stopDiscovery() raises(WebAPIException);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The device-to-device convergence manager allows discovering available -nearby devices, which support device-to-device services. -

    -
    -
    -

    Methods

    -
    -
    -startDiscovery -
    -
    -
    - Starts discovery of nearby devices. -
    -
    void startDiscovery(DiscoverySuccessCallback successCallback, optional ErrorCallback? errorCallback, optional unsigned long? timeout);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method initiates the device discovery procedure. -Depending on the progress of this procedure the following methods -are invoked: -

    -
      -
    • -onfound() - when a device is found. -This method is invoked with the device -information of -Device type. -If no device is found, this method will never be invoked.
    • -
    • -onfinished() - when a discovery procedure is finished. -This method is invoked -with the list of discovered device information.
    • -
    -

    -The discovery procedure can be canceled anytime, by calling -stopDiscovery() in -the ConvergenceManager. -
    Note the onfinished() discovery -callback will be invoked. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -
    -

    Parameters:

    -
      -
    • -successCallback: - The callback to invoke each time the device is -found. The callback will be invoked also when the discovery -procedure has finished. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure of device -discovery. -
    • -
    • -timeout [optional] [nullable]: - Duration of discovery procedure in seconds. If this -value is omitted or null is passed, the default timeout -is 5 seconds. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -discovery procedure has started already. -

      • -
      -
    -
    -
    -

    Code example:

    -/* Handling device discovery results */
    -var discoveryCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      /* Do something with the discovered device */
    -      /* If desired device is found, stop discovery with following call */
    -      tizen.convergence.stopDiscovery();
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log('Device discovery has finished');
    -   }
    -};
    -
    -/* Running device discovery procedure */
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoveryCallback, function(err)
    -   {
    -      console.log(err.name + ': ' + err.message);
    -   }, 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - 
    -
    -
    -
    -stopDiscovery -
    -
    -
    - Stops discovery of nearby devices. -
    -
    void stopDiscovery();
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method stops an ongoing discovery procedure. -

    -
    -

    Remark: - Device discovery is a heavyweight procedure, so it may be -useful to stop discovery when the required device is found. -
    Note this method triggers the onfinished() discovery -callback. -

    -

    Remark: - Example of using can be found at -startDiscovery() code example. -

    -
    -

    Exceptions:

    -
    • WebAPIException
      • - with error type InvalidStateError, if the -discovery procedure has not started yet. -

      -
    -
    -
    -
    -
    -
    -
    -

    2.4. Device

    -
    - The Device interface provides access to the remote -device's properties. -
    -
        [NoInterfaceObject] interface Device {
    -
    -        readonly attribute DeviceId id;
    -
    -        readonly attribute DOMString name;
    -
    -        readonly attribute DeviceProfile type;
    -
    -        readonly attribute Service[] services;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -This interface offers access to remote device information, such as the unique -identifier, name, profile type and list of provided services. -

    -

    -
    Note, device ID and device type are defined in the platform, and the developer cannot change it. -

    -
    -
    -

    Attributes

    -
      -
    • - readonly -DeviceId id
      - The unique device ID. -
      Note the device ID is a unique identifier string, generated with following rule. -If the Remote Server is installed on the device (e.g. TV), -then the device ID is assigned by application communication server service. -Usually it has a format of service name and version. Otherwise (e.g. mobile or wearable), -the device ID is device MAC address. -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -DOMString name
      - The device name. -
      Note device name is one that is set in the Settings app (Settings>About Devices>Device Name). -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -DeviceProfile type
      - The device profile type. -
      Note Device type represents the profile of the device, -such as “TV”, “Mobile” or “Wearable”. -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -Service[] - services
      - The list of services, available on the device. -
      -

      - Since: - 3.0 -

      -
    • -
    -
    -
    -
    -

    2.5. Service

    -
    - The Service interface is a base interface for all -device-to-device services. -
    -
        [NoInterfaceObject] interface Service {
    -
    -        readonly attribute ConnectionState connectionState;
    -
    -        readonly attribute ServiceType type;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -This interface defines common property for all device-to-device services -

    -
    -
    -

    Attributes

    -
    • - readonly -ConnectionState connectionState
      - The service connection state. -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -ServiceType type
      - The service type. -
      -

      - Since: - 3.0 -

      -
    • -
    -
    -
    -
    -

    2.6. AppCommunicationService

    -
    - The AppCommunicationService interface defines the base interface -of both application communication -Client and -Server services -and specifies common service features, such as start, stop, send, listener etc. -
    -
        [NoInterfaceObject] interface AppCommunicationService : Service {
    -
    -        void start(ChannelInfo channelInfo,
    -            AppCommunicationStartCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void getClientList(ChannelInfo channelInfo,
    -            AppCommunicationClientListCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void send(ChannelInfo channelInfo,
    -            Payload[] payload,
    -            AppCommunicationSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void stop(ChannelInfo channelInfo,
    -            optional AppCommunicationSuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void setListener(AppCommunicationListenerCallback listenerCallback)
    -            raises(WebAPIException);
    -
    -        void unsetListener();
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -App Communication Service allows transferring data between apps on local and remote devices. -The App Communication Service relies on a Remote Server. The initialization and execution of a server app -(the app on the side with the Remote Server, e.g. TV) and a client app (e.g. an app on a mobile or wearable device) -are slightly different. Furthermore, the client app can remotely launch an app on the server side or connect to an -already running server app, but the reverse way is impossible. More than one client can be connected to a server app. -For example, multiple players on mobile devices can connect to a game application on a TV which takes a role of a server. -Both client and server side apps can send payloads and listen to each other. -

    -

    -
    Note there are client and -server implementations -of this service for both local and remote devices. For better flexibility, the data transfer occurs in a user-defined -ChannelInfo. -

    -

    -These interfaces offer the following service features: -

    -
      -
    • -Starting and stopping the service
    • -
    • -Sending payloads to the service
    • -
    • -Listening to remote service notifications
    • -
    • -Getting the list of clients that are connected to the service
    • -
    -
    - -
    -

    Methods

    -
    -
    -start -
    -
    -
    - Starts the service. -
    -
    void start(ChannelInfo channelInfo, AppCommunicationStartCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method starts the channel of the service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    • - InvalidStateError: If the service has already started the channel. Note some services don't require a connection and disconnection procedures
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -

    Remark: - Before using this method for application communication client service, the service must be connected with the -connect() method. -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channelinfo of the service with specified URI and ID. -
      Note ChannelInfo in the application communication service specifies a server app which a client wants to connect with. -ChannelInfo URI is a URI of the server side app, while ChannelInfo ID is a developer-defined value. -
    • -
    • -successCallback: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      -
    -
    -
    -

    Code example:

    -/* App communication server service */
    -
    -var requestChannel = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstarted(channelinfo, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channelinfo.uri);
    -   console.log('channel id: ' + channelinfo.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -}
    -
    -/* Create an instance of application communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -service.start(requestChannel, onstarted, onerror);
    -
    -
    -
    -

    Output example:

     Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: true
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - 
    -
    -
    -

    Code example:

    -/* App communication client service */
    -
    -var clientService;
    -var requestChannel = new tizen.Channel('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstarted(channelinfo, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channelinfo.uri);
    -   console.log('channel id: ' + channelinfo.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -      clientService = service;
    -      service.start(requestChannel, onstarted, onerror);
    -   }
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            tizen.convergence.stopDiscovery();
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - 
    -
    -
    -
    -getClientList -
    -
    -
    - Get the client lists connected to the channel -
    -
    void getClientList(ChannelInfo channelInfo, AppCommunicationClientListCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    • - InvalidValuesError: If any of the input parameters contain an invalid value
    • -
    • - InvalidStateError: If the service has not started the channel
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -

    Remark: - Before using this method, the service must be connected and -started with -connect() and -start() methods -correspondingly. -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channelinfo of the service with specified URI and ID. -
    • -
    • -successCallback: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      -
    -
    -
    -

    Code example:

    -/* App communication server service */
    -
    -var requestChannel = new tizen.Channel('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onsuccess(clientinfolist)
    -{
    -   console.log('get client list');
    -   for (i in clientinfolist)
    -   {
    -      console.log('isHost: ' + clientinfolist[i].isHost);
    -      console.log('client id: ' + clientinfolist[i].clientId);
    -      console.log('connection time: ' + clientinfolist[i].connectionTime);
    -   }
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri' + channel.uri);
    -   console.log('channel id ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   service.getClientList(requestChannel, onsuccess, onerror);
    -}
    -
    -/* Create an instance of app communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -service.start(requestChannel, onstarted, onerror);
    -
    -
    -
    -

    Output example:

     Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: true
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - get client list
    - isHost: true
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - isHost: false
    - client id: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    - connection time: 1420163913807
    - isHost: false
    - client id: c13adb22-5423-22e4-5d8q-adf872d4q889
    - connection time: 1420163913125
    - 
    -
    -
    -

    Code example:

    -/* App communication client service */
    -
    -var clientService;
    -var requestChannel = new tizen.Channel('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onsuccess(clientinfolist)
    -{
    -   console.log('get client list');
    -   for (i in clientinfolist)
    -   {
    -      console.log('isHost: ' + clientinfolist[i].isHost);
    -      console.log('client id: ' + clientinfolist[i].clientId);
    -      console.log('connection time: ' + clientinfolist[i].connectionTime);
    -   }
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri' + channel.uri);
    -   console.log('channel id ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   clientService.getClientList(requestChannel, onsuccess, onerror);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -      clientService = service;
    -      service.start(requestChannel, onstarted, onerror);
    -   }
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            tizen.convergence.stopDiscovery();
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - clientinfo
    - isHost: false
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - get client list
    - isHost: false
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - isHost: false
    - client id: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    - connection time: 1420163913807
    - isHost: false
    - client id: c13adb22-5423-22e4-5d8q-adf872d4q889
    - connection time: 1420163913125
    - 
    -
    -
    -
    -send -
    -
    -
    - Sends a payload to the service. -
    -
    void send(ChannelInfo channelInfo, Payload[] payload, AppCommunicationSuccessCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    • - InvalidValuesError: If any of the input parameters contain an invalid value
    • -
    • - InvalidStateError: If the service has not started the channel
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -

    Remark: - Example of using can be found at -start() code example. -

    -

    Remark: - Before using this method, the service must be connected and -started with -connect() and -start() methods -correspondingly. -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channelinfo of the service with specified URI and ID. -
    • -
    • -payload: - The payload containing request data. -
    • -
    • -successCallback: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      -
    -
    -
    -

    Code example:

    -/* App communication server service */
    -
    -var requestChannel = new tizen.Channel('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function sendSuccessCallback(channelinfo)
    -{
    -   console.log('requestPayload sent');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by Multi Screen server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   /* Send data to the remote service */
    -   service.send(channel, requestPayload, sendSuccessCallback, onerror);
    -}
    -
    -/* Create an instance of app communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -service.start(requestChannel, onstarted, onerror);
    -
    -
    -
    -

    Output example:

     Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: true
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - requestPayload sent
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - 
    -
    -
    -

    Code example:

    -/* App communication client service */
    -
    -var clientService;
    -var requestChannel = new tizen.Channel('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function sendSuccessCallback(channel)
    -{
    -   console.log('requestPayload sent');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   /* Send data to the remote service */
    -   clientService.send(channel, requestPayload, sendSuccessCallback, onerror);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -      clientService = service;
    -      service.start(requestChannel, onstarted, onerror);
    -   }
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            else
    -            {
    -               clientService = device.service[i];
    -               clientService.start(requestChannel, onstarted, onerror);
    -            }
    -         }
    -         tizen.convergence.stopDiscovery();
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - requestPayload sent
    - channel uri: targetApp0.main
    - channel id: chA
    - 
    -
    -
    -
    -stop -
    -
    -
    - Stops the service. -
    -
    void stop(ChannelInfo channelInfo, optional AppCommunicationSuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method stops the specified channel of the service. -
    Note When all clients have stopped using the service channel, the server side automatically terminates the application. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    • - InvalidValuesError: If any of the input parameters contain an invalid value
    • -
    • - InvalidStateError: If the service has not started the channel
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channelInfo of the service with specified URI and ID. -
    • -
    • -successCallback [optional] [nullable]: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      -
    -
    -
    -

    Code example:

    -/* App communication server service */
    -
    -var requestChannel1 = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -var requestChannel2 = new tizen.ChannelInfo('targetApp1.main', 'chB');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstopped(channel)
    -{
    -   console.log('Channel stopped');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('clienti id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   if (channel id == 'chB')
    -   {
    -      service.stop(requestChannel2, onstopped);
    -   }
    -}
    -
    -/* Create an instance of app communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -service.start(requestChannel1, onstarted, onerror);
    -service.start(requestChannel2, onstarted, onerror);
    -
    -
    - -
    -

    Output example:

    -Channel started
    -channel uri: targetApp0.main
    -channel id: chA
    -clientinfo
    -isHost: true
    -clientId: 2c9f9510-48c2-11e6-b620-abffc41c391f
    -connectionTime: 1420163913035
    -Channel started
    -channel uri: targetApp1.main
    -channel id: chB
    -clientinfo
    -isHost: true
    -clientId: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    -connectionTime: 1420163913807
    -Channel stopped
    -channel uri: targetApp1.main
    -channel id: chB
    -
    -
    -
    -

    Code example:

    -/* App communication client service */
    -
    -var clientService;
    -var requestChannel1 = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -var requestChannel2 = new tizen.ChannelInfo('targetApp1.main', 'chB');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstopped(channel)
    -{
    -   console.log('Channel stopped');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   if (channel id == 'chB')
    -   {
    -      clientService.stop(requestChannel2, onstopped);
    -   }
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -      clientService = service;
    -      service.start(requestChannel, onstarted, onerror);
    -   }
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log('Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            tizen.convergence.stopDiscovery();
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - clientId: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connectionTime: 1420163913035
    - requestPayload sent
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - clientId: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connectionTime: 1420163913035
    - Channel started
    - channel uri: targetApp1.main
    - channel id: chB
    - clientinfo
    - isHost: false
    - clientId: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    - connectionTime: 1420163913807
    - Channel stopped
    - channel uri: targetApp1.main
    - channel id: chB
    - 
    -
    -
    -
    -setListener -
    -
    -
    - Registers the service listener. -
    -
    void setListener(AppCommunicationListenerCallback listenerCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -listenerCallback: - The method to invoke when a service -notification is received. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      -
    -
    -
    -

    Code example:

    -/* App communication server service */
    -
    -var requestChannel = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onnotify(channel, payload, senderclientid)
    -{
    -   console.log('On service notification');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   /* clientid of the sender of the payload */
    -   console.log('client id of sender: ' + senderclientid);
    -   for (i in payload)
    -   {
    -      console.log('payload: ' + payload[i].key + '-' + payload[i].value);
    -   }
    -   /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
    -   service.unsetListener();
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by Multi Screen server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -}
    -
    -/* Create an instance of app communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -/* Register listener to receive notifications from remote service */
    -service.setListener(onnotify);
    -service.start(requestChannel, onstarted, onerror);
    -
    -
    -
    -

    Output example:

     Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: true
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - On service notification
    - channel uri: targetApp0.main
    - channel id: chA
    - client id of sender: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    - payload: msg-hello
    - 
    -
    -
    -

    Code example:

    -/* App communication client service */
    -
    -var clientService;
    -var requestChannel = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onnotify(channel, payload, senderclientid)
    -{
    -   console.log('On service notification');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   /* clientid of the sender of the payload */
    -   console.log('client id of sender: ' + senderclientid);
    -   for (i in payload)
    -   {
    -      console.log('payload ' + payload[i].key + ': ' + payload[i].value);
    -   }
    -   /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
    -   clientService.unsetListener();
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -      service.start(requestChannel, onstarted, onerror);
    -      /* Register listener to receive notifications from remote service */
    -      service.setListener(onnotify);
    -   }
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -         }
    -         tizen.convergence.stopDiscovery();
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - clientId: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connectionTime: 1420163913035
    - On service notification
    - channel uri: targetApp0.main
    - channel id: chA
    - client id of sender: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    - payload: msg-hello
    - 
    -
    -
    -
    -unsetListener -
    -
    -
    - Unregisters the service listener. -
    -
    void unsetListener();
    -             
    -

    - Since: - 3.0 -

    -

    Remark: - Example of using can be found at -setListener() code example. -

    -
    -
    -
    -
    -
    -

    2.7. AppCommunicationClientService

    -
    - The AppCommunicationClientService interface provides access to -application communication client service features. -
    -
        [NoInterfaceObject] interface AppCommunicationClientService : AppCommunicationService {
    -
    -        void connect(ConnectSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void disconnect(optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -This interface offers following service features: -

    -
      -
    • -Connecting and disconnecting the remote service
    • -
    • -Reading immediate data of the remote service
    • -
    • -Listening to remote service update notifications
    • -
    • -Sending data to the remote service
    • -
    -
    - -
    -

    Methods

    -
    -
    -connect -
    -
    -
    - Connects to the service. -
    -
    void connect(ConnectSuccessCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -Makes physical connection such as Wi-Fi or Bluetooth to the -service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -

    Warning: - Connecting is only supported for services on devices not connected via WiFi. -For devices connected via WiFi, connectionState will always be "CONNECTED". -

    -

    Remark: - App developers do not need to specify the connectivity type -explicitly. The framework automatically determines which connectivity -to use in a selected service. -

    -
    -

    Parameters:

    -
      -
    • -successCallback: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service is connected already. -

      • -
      -
    -
    -
    -

    Code example:

    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -   }
    -   else if (service.type === "REMOTE_APP_CONTROL")
    -   {
    -      console.log('Connected to the remote app control service');
    -   }
    -   service.disconnect();
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -         }
    -         else if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -         }
    -         tizen.convergence.stopDiscovery();
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 2
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Connected to the service
    - Connected to the remote app control service
    - 
    -
    -
    -
    -disconnect -
    -
    -
    - Disconnects the connected service. -
    -
    void disconnect(optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -Disconnect physical connection with device-to-device service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -

    Warning: - Disconnecting is only supported for services on devices not connected via WiFi. -

    -

    Remark: - Example of using can be found at connect() code example. -

    -
    -

    Parameters:

    -
      -
    • -successCallback [optional] [nullable]: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service was not connected yet. -

      • -
      -
    -
    -
    -
    -
    -
    -
    -

    2.8. AppCommunicationServerService

    -
    - The AppCommunicationServerService interface provides access to -application communication server service features. -
    -
        [Constructor()]
    -    interface AppCommunicationServerService : AppCommunicationService {
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -This interface offers following service features: -

    -
      -
    • -Instantiating the service
    • -
    • -Reading immediate data of the service
    • -
    • -Listening to service update notifications
    • -
    • -Sending data for the service
    • -
    -
    -

    Warning: - AppCommunicationServerService API is supported on Tizen 3.0 TV product only. -

    -

    Remark: - application server service is used without discovery phase. -The developer should instantiate a standalone service object using -the constructor. -

    - -
    -

    Constructors

    -
    -
    AppCommunicationServerService();
    -
    -

    Code example:

    -/* Create an instance of application communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -
    -
    -
    -
    -
    -
    -

    2.9. RemoteAppControlService

    -
    - The RemoteAppControlService interface provides access to -remote application control service features. -
    -
        [NoInterfaceObject] interface RemoteAppControlService : Service {
    -        void start(RemoteAppControlStartCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void stop(optional SuccessCallback? successCallback,
    -                  optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void connect(ConnectSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void disconnect(optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void launch(ApplicationId appId,
    -            optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void launchAppControl(ApplicationControl appControl,
    -            optional ApplicationId? appId,
    -            optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback,
    -            optional RemoteAppControlCallback? replyCallback) raises(WebAPIException);
    -
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -This interface offers following device-to-device service features: -

    -
      -
    • -Connecting and disconnecting the service
    • -
    • -Sending app control data to the service
    • -
    • -Receiving app control results
    • -
    -
    - -
    -

    Methods

    -
    -
    -start -
    -
    -
    - Starts and initiates remote service. -
    -
    void start(RemoteAppControlStartCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method starts the remote app control service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -

    Remark : - Before using this method for remote application service, the service must be connected with the -connect() method. -

    -
    -

    Parameters:

    -
      -
    • -successCallback: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -the service is already started. -

      • -
      • - with error type AbortError, if the -other error occurs during start. -

      • -
      -
    -
    -
    -

    Code example:

    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstarted(service)
    -{
    -   console.log('Remote app control service started');
    -   service.disconnect();
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the remote app control service');
    -   service.start(onstarted, onerror);
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log('Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            else
    -            {
    -               device.services[i].start(onstarted, onerror);
    -            }
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    -<< Found a device
    -   - id: de2bea-ddvia
    -   - name : deviceA
    -   - type : TV
    -   - service amount: 2
    -<< Device discovery has finished
    -Connected to the remote app control service
    -Remote app control service started
    -
    -
    -
    -
    -stop -
    -
    -
    - Stops remote service. -
    -
    void stop(optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method stops and release internally allocated resources for remote service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -
    -

    Parameters:

    -
      -
    • -successCallback [optional] [nullable]: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -the service is not started yet. -

      • -
      • - with error type AbortError, if the -other error occurs during start. -

      • -
      -
    -
    -
    -

    Code example:

    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstopped()
    -{
    -   console.log('Remote App Control service stopped');
    -   /* Disconnect */
    -   service.disconnect();
    -}
    -
    -function onstarted(service)
    -{
    -   console.log('Remote App Control service started');
    -   /* Stop the service */
    -   service.stop(onstopped, onerror);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the remote app control service');
    -   service.start(onstarted, onerror);
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log('Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            else
    -            {
    -               device.services[i].start(onstarted, onerror);
    -            }
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    -<< Found a device
    -   - id: de2bea-ddvia
    -   - name : deviceA
    -   - type : TV
    -   - service amount: 2
    -<< Device discovery has finished
    -Connected to the remote app control service
    -Remote App Control service started
    -Remote App Control service stopped
    -
    -
    -
    -
    -connect -
    -
    -
    - Connects to the service. -
    -
    void connect(ConnectSuccessCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -Makes physical connection such as Wi-Fi or Bluetooth to remote -device-to-device service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -

    Warning: - Connecting is only supported for services on devices not connected via WiFi. -For devices connected via WiFi, connectionState will always be "CONNECTED". -

    -

    Remark: - App developers do not need to specify the connectivity type -explicitly. Framework automatically determines which connectivity -to use in a selected service. -

    -
    -

    Parameters:

    -
      -
    • -successCallback: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service is connected already. -

      • -
      -
    -
    -
    -

    Code example:

    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the remote app control service');
    -   service.disconnect();
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log('Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -console.log('>> STARTING DEVICE DISCOVERY');
    -tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 2
    - << Device discovery has finished
    - Connected to the remote app control service
    - 
    -
    -
    -
    -disconnect -
    -
    -
    - Disconnects the connected service. -
    -
    void disconnect(optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -Disconnect physical connection with device-to-device service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -

    Warning: - Disconnecting is only supported for services on devices not connected via WiFi. -

    -
    -

    Parameters:

    -
      -
    • -successCallback [optional] [nullable]: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service was not connected yet. -

      • -
      -
    -
    -
    -

    Code example:

    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function ondisconnected()
    -{
    -   console.log('Disconnected to the service');
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log('Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState == "CONNECTED")
    -            {
    -               device.services[i].disconnect(ondisconnected, onerror);
    -            }
    -            tizen.convergence.stopDiscovery();
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log('Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 2
    - << Device discovery has finished
    - Disconnected to the service
    - 
    -
    -
    -
    -launch -
    -
    -
    - Sends the given application ID to launch an application on the remote device. -
    -
    void launch(ApplicationId appId, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method sends an application ID to the remote service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    • - InvalidValuesError: If any of the input parameters contain an -invalid value
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -

    Remark: - Before using this method, the service must be connected -with -connect() method -and started with start() method. -

    -
    -

    Parameters:

    -
      -
    • -appId: - The target app id. -
    • -
    • -successCallback [optional] [nullable]: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service is not started yet. -

      • -
      -
    -
    -
    -

    Code example:

    -/* Assume that the "targetApp0.main" application has been installed on remote device */
    -var requestAppId = 'targetApp0.main';
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onsuccess()
    -{
    -   console.log('The application has launched successfully');
    -}
    -
    -function onstarted(service)
    -{
    -   console.log('Service started');
    -
    -   /* Launching server app remotely */
    -   service.launch(requestAppId, remoteAppControlCallback, onerror);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   /* Start the service */
    -   service.start(onstarted, onerror);
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            tizen.convergence.stopDiscovery();
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -console.log('>> STARTING DEVICE DISCOVERY');
    -tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 2
    - << Device discovery has finished
    - Connected to the service
    - Service started
    - The application has launched successfully
    - 
    -
    -
    -
    -launchAppControl -
    -
    -
    - Sends an app control to launch an application on the remote device. -
    -
    void launchAppControl(ApplicationControl appControl, optional ApplicationId? appId, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback, optional RemoteAppControlCallback? replyCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method sends an app control to the remote service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -

    Remark: - Before using this method, the service must be connected with -connect() method -and started with start() method. -

    -
    -

    Parameters:

    -
      -
    • -appControl: - The app control data. -
    • -
    • -appId [optional] [nullable]: - The target app id. -
    • -
    • -successCallback [optional] [nullable]: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    • -replyCallback [optional] [nullable]: - The method to invoke when the application gets back result from the remote service. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service is not started yet. -

      • -
      -
    -
    -
    -

    Code example:

    -var requestAppControl = new tizen.ApplicationControl('http://tizen.org/appcontrol/operation/view',
    -                                                     null, 'image/jpeg', null,
    -                                                     [new tizen.ApplicationControlData('images', [testImgData])]);
    -
    -function onsuccess()
    -{
    -   console.log('Launch application control succeed');
    -}
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -var remoteAppControlCallback =
    -{
    -   onsuccess: function(data)
    -   {
    -      console.log('On remote app control service reply');
    -      for(var i = 0; i < data.length; i++)
    -      {
    -         console.log("key : " + data[i].key + "value : " + data[i].value[0]);
    -      }
    -   },
    -   /* Callee returned failure */
    -   onfailure: function()
    -   {
    -      console.log('The launch application control failed');
    -   }
    -}
    -
    -function onstarted(service)
    -{
    -   console.log('Service started');
    -
    -   /* Send data to the remote service */
    -   service.launchAppControl(requestAppControl, null, onsuccess, onerror, remoteAppControlCallback);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -
    -   /* Start the service */
    -   service.start(onstarted, onerror);
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -         }
    -         tizen.convergence.stopDiscovery();
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 2
    - << Device discovery has finished
    - Connected to the service
    - Service started
    - 
    -
    -
    -
    -
    -
    -
    -

    2.10. PayloadString

    -
    - The dictionary that specifies a payload string for the -device-to-device service. -
    -
        dictionary PayloadString {
    -        DOMString key;
    -
    -        DOMString value;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -PayloadString is a key-value pair. Both the key and value are strings. -

    -
    -
    -

    Dictionary members

    -
    -
    DOMString key
    -
    -
    - The name of the payload string. -
    -

    - Since: - 3.0 -

    -
    -
    DOMString value
    -
    -
    - The value of the payload string. -
    -

    - Since: - 3.0 -

    -
    -
    -
    -
    -
    -

    2.11. PayloadRawBytes

    -
    - The dictionary that specifies a raw bytes payload for the -device-to-device service. -
    -
        dictionary PayloadRawBytes {
    -        DOMString key;
    -
    -        byte[] value;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -PayloadRawBytes is a key-value pair. The key is a string and the value is a byte -array which is to be delivered to a remote service. -

    -
    -
    -

    Dictionary members

    -
    -
    DOMString key
    -
    -
    - The name of the payload byte array. -
    -

    - Since: - 3.0 -

    -
    -
    byte[] value
    -
    -
    - The bytes of the payload byte array. -
    -

    - Since: - 3.0 -

    -
    -
    -
    -
    -
    -

    2.12. ClientInfo

    -
    - The interface specifies client information. -
    -
        [NoInterfaceObject] interface ClientInfo {
    -        readonly attribute boolean isHost;
    -
    -        readonly attribute DOMString clientId;
    -
    -        readonly attribute long connectionTime;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    Attributes

    -
      -
    • - readonly -boolean isHost
      - The value indicating if the service is local (true) or remote (false). -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -DOMString clientId
      - The unique client id. -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -long connectionTime
      - The connection time in milliseconds. -
      -

      - Since: - 3.0 -

      -
    • -
    -
    -
    -
    -

    2.13. DiscoverySuccessCallback

    -
    - The DiscoverySuccessCallback interface defines the -success method for startDiscovery(). -
    -
        [Callback, NoInterfaceObject] interface DiscoverySuccessCallback {
    -
    -        void onfound(Device device);
    -
    -        void onfinished(Device[] foundDevices);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -Specifies the type of function passed to ConvergenceManager.startDiscovery(). -Called when device providing device-to-device service is discovered nearby. -

    -

    -A usage example can be found in the -startDiscovery() code example. -

    -
    -
    -

    Methods

    -
    -
    -onfound -
    -
    -
    - Called when device is discovered during the discovery -procedure. -
    -
    void onfound(Device device);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -device: - The discovered remote device. -
    • -
    -
    -
    -
    -onfinished -
    -
    -
    - Called when the device discovery procedure has finished. -
    -
    void onfinished(Device[] foundDevices);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -foundDevices: - Array of devices found in this discovery session. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.14. RemoteAppControlCallback

    -
    - The RemoteAppControlCallback specifies callbacks that are invoked as a reply -from the requested application control within the application control requester. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlCallback {
    -
    -        void onsuccess(optional ApplicationControlData[]? data);
    -
    -        void onfailure();
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -launchAppControl() method. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the received reply from the requested application on the remote device has no errors. -
    -
    void onsuccess(optional ApplicationControlData[]? data);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -data [optional] [nullable]: - An array of ApplicationControlData objects -
    • -
    -
    -
    -
    -onfailure -
    -
    -
    - Called when the received reply from the requested application on the remote device contains any error. -
    -
    void onfailure();
    -             
    -

    - Since: - 3.0 -

    -
    -
    -
    -
    -
    -

    2.15. ConnectSuccessCallback

    -
    - The ConnectSuccessCallback interface defines the success method -to be invoked when a service is connected. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface ConnectSuccessCallback {
    -
    -        void onsuccess(Service service);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -connect() of AppCommunicationClientService and -connect() of RemoteAppControlService methods. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the service connection is established. -
    -
    void onsuccess(Service service);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -service: - The connected service on a remote device. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.16. RemoteAppControlStartCallback

    -
    - The RemoteAppControlStartCallback interface defines the success method -to be invoked when a RemoteAppControlService is started. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlStartCallback {
    -
    -        void onsuccess(Service service);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -start() of RemoteAppControlService methods. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the service connection is established. -
    -
    void onsuccess(Service service);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -service: - The connected service on a remote device. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.17. AppCommunicationSuccessCallback

    -
    - The AppCommunicationSuccessCallback interface defines the success method -to be invoked when a service operation, such as stop or send is successful. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationSuccessCallback {
    -
    -        void onsuccess(ChannelInfo channelInfo);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -stop() or -send() methods. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the service operation is successful. -
    -
    void onsuccess(ChannelInfo channelInfo);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channel info of the service with specified URI and ID. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.18. AppCommunicationStartCallback

    -
    - The AppCommunicationStartCallback interface defines the success method -to be invoked when a start service operation is successful. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationStartCallback {
    -
    -        void onsuccess(ChannelInfo channelInfo, ClientInfo clientInfo);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -start() method. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the start service operation is successful. -
    -
    void onsuccess(ChannelInfo channelInfo, ClientInfo clientInfo);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channel info of the service with specified URI and ID. -
    • -
    • -clientInfo: - The client information. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.19. AppCommunicationClientListCallback

    -
    - The AppCommunicationClientListCallback interface defines the -method to be invoked when requested a list of clients, connected to -the specified channel of the application communication service. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationClientListCallback {
    -
    -        void onsuccess(ClientInfo[] clients);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -getClientList() method. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the list of connected clients is requested. -
    -
    void onsuccess(ClientInfo[] clients);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -clients: - The list of connected clients. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.20. AppCommunicationListenerCallback

    -
    - The AppCommunicationListenerCallback interface defines the -method to be invoked when a service notification is received -from the application communication service. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationListenerCallback {
    -
    -        void onnotify(ChannelInfo channelInfo, Payload[] payload, DOMString senderClientId);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type can be assigned to the service using the -setListener() method. -

    -
    -
    -

    Methods

    -
    -
    -onnotify -
    -
    -
    - Called when the service channel notification is received. -
    -
    void onnotify(ChannelInfo channelInfo, Payload[] payload, DOMString senderClientId);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channel info of the service with specified URI and ID. -
    • -
    • -payload: - The payload containing notification data. -
    • -
    • -senderClientId: - The client id of the sender. -
    • -
    -
    -
    -
    -
    -
    -
    -

    3. Related Feature

    -
    - You can check if this API is supported with tizen.systeminfo.getCapability() and decide enable/disable codes that need this API. -
    -

    -

    -To guarantee that the application runs on a device with Convergence feature, -declare the following feature requirements in the config file: -

    -

    -
  • http://tizen.org/feature/convergence.d2d
  • -
    -

    - For more information, see Application Filtering. -
    -

    4. Full WebIDL

    -
    module Convergence {
    -
    -    typedef DOMString DeviceId;
    -
    -    enum DeviceProfile {"MOBILE", "WEARABLE", "TV"};
    -
    -    typedef (PayloadString or PayloadRawBytes) Payload;
    -
    -    enum PayloadType{"STRING", "RAW_BYTES"};
    -
    -    enum ConnectionState{"CONNECTED", "NOT_CONNECTED", "CONNECTING"};
    -
    -    enum ServiceType{"APP_COMM_CLIENT", "APP_COMM_SERVER", "REMOTE_APP_CONTROL"};
    -
    -    [Constructor(DOMString uri, DOMString id)]
    -    interface ChannelInfo {
    -      attribute DOMString uri;
    -      attribute DOMString id;
    -    };
    -
    -    [NoInterfaceObject] interface ConvergenceObject {
    -        readonly attribute ConvergenceManager convergence;
    -    };
    -
    -    Tizen implements ConvergenceObject;
    -
    -    [NoInterfaceObject] interface ConvergenceManager {
    -
    -        void startDiscovery(DiscoverySuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback,
    -            optional unsigned long? timeout) raises(WebAPIException);
    -
    -        void stopDiscovery() raises(WebAPIException);
    -    };
    -
    -    [NoInterfaceObject] interface Device {
    -
    -        readonly attribute DeviceId id;
    -
    -        readonly attribute DOMString name;
    -
    -        readonly attribute DeviceProfile type;
    -
    -        readonly attribute Service[] services;
    -    };
    -
    -    [NoInterfaceObject] interface Service {
    -
    -        readonly attribute ConnectionState connectionState;
    -
    -        readonly attribute ServiceType type;
    -    };
    -
    -    [NoInterfaceObject] interface AppCommunicationService : Service {
    -
    -        void start(ChannelInfo channelInfo,
    -            AppCommunicationStartCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void getClientList(ChannelInfo channelInfo,
    -            AppCommunicationClientListCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void send(ChannelInfo channelInfo,
    -            Payload[] payload,
    -            AppCommunicationSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void stop(ChannelInfo channelInfo,
    -            optional AppCommunicationSuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void setListener(AppCommunicationListenerCallback listenerCallback)
    -            raises(WebAPIException);
    -
    -        void unsetListener();
    -    };
    -
    -    [NoInterfaceObject] interface AppCommunicationClientService : AppCommunicationService {
    -
    -        void connect(ConnectSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void disconnect(optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -    };
    -
    -
    -    [Constructor()]
    -    interface AppCommunicationServerService : AppCommunicationService {
    -    };
    -
    -    [NoInterfaceObject] interface RemoteAppControlService : Service {
    -        void start(RemoteAppControlStartCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void stop(optional SuccessCallback? successCallback,
    -                  optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void connect(ConnectSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void disconnect(optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void launch(ApplicationId appId,
    -            optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void launchAppControl(ApplicationControl appControl,
    -            optional ApplicationId? appId,
    -            optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback,
    -            optional RemoteAppControlCallback? replyCallback) raises(WebAPIException);
    -
    -    };
    -
    -    dictionary PayloadString {
    -        DOMString key;
    -
    -        DOMString value;
    -    };
    -
    -    dictionary PayloadRawBytes {
    -        DOMString key;
    -
    -        byte[] value;
    -    };
    -
    -    [NoInterfaceObject] interface ClientInfo {
    -        readonly attribute boolean isHost;
    -
    -        readonly attribute DOMString clientId;
    -
    -        readonly attribute long connectionTime;
    -    };
    -
    -    [Callback, NoInterfaceObject] interface DiscoverySuccessCallback {
    -
    -        void onfound(Device device);
    -
    -        void onfinished(Device[] foundDevices);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlCallback {
    -
    -        void onsuccess(optional ApplicationControlData[]? data);
    -
    -        void onfailure();
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface ConnectSuccessCallback {
    -
    -        void onsuccess(Service service);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlStartCallback {
    -
    -        void onsuccess(Service service);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationSuccessCallback {
    -
    -        void onsuccess(ChannelInfo channelInfo);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationStartCallback {
    -
    -        void onsuccess(ChannelInfo channelInfo, ClientInfo clientInfo);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationClientListCallback {
    -
    -        void onsuccess(ClientInfo[] clients);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationListenerCallback {
    -
    -        void onnotify(ChannelInfo channelInfo, Payload[] payload, DOMString senderClientId);
    -    };
    -};
    -
    - - - diff --git a/org.tizen.web.apireference/html/device_api/tv/index.html b/org.tizen.web.apireference/html/device_api/tv/index.html index 22b64cb..862bfd5 100755 --- a/org.tizen.web.apireference/html/device_api/tv/index.html +++ b/org.tizen.web.apireference/html/device_api/tv/index.html @@ -115,13 +115,6 @@ APIDescriptionVersion - - - Convergence - This API provides interfaces and methods for using Tizen device-to-device convergence services. - 3.0 - - Iotcon diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/convergence.html b/org.tizen.web.apireference/html/device_api/tv/tizen/convergence.html deleted file mode 100755 index 8f81f2e..0000000 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/convergence.html +++ /dev/null @@ -1,4123 +0,0 @@ - - - - - -Convergence API - - -
    -

    Convergence API

    -
    - The Convergence API defines interfaces and methods -for using Tizen device-to-device convergence services. -
    -
    -

    -The following functionality is provided: -

    -
      -
    • -Discovering nearby devices which support device-to-device services
    • -
    • -Getting device and service information
    • -
    • -Connecting and disconnecting services
    • -
    • -Starting and stopping services
    • -
    • -Sending data to services
    • -
    • -Listening to notifications from the service
    • -
    -

    -The collection of supported device-to-device services includes: -

    -
      -
    • -Remote App Control Service - Allows launching an application on a remote device.
    • -
    • -App Communication Service - Allows transferring data between applications on local and remote devices. -
      Note that there are 'client' and 'server' implementations of this service which allows easy set-up and -convenient handling of the data exchange process on both local and remote devices. -For better flexibility, the data transfer occurs in named user-defined communication channels.
    • -
    -

    -For more information on the Device-to-device Convergence features, -see the Convergence Services Guide. -

    -

    -Tizen 3.0 only supports Wi-Fi for Convergence services. More connectivity, such as BT/BLE and Wi-Fi Direct, is to be supported in further versions. -

    -
    -

    - Since: - 3.0 -

    -

    Table of Contents

    - -
    -

    Summary of Interfaces and Methods

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    InterfaceMethod
    ChannelInfo
    ConvergenceObject
    ConvergenceManager -
    void startDiscovery (DiscoverySuccessCallback successCallback, optional ErrorCallback? errorCallback, optional unsigned long? timeout)
    - -
    Device
    Service
    AppCommunicationService -
    void start (ChannelInfo channelInfo, AppCommunicationStartCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void getClientList (ChannelInfo channelInfo, AppCommunicationClientListCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void send (ChannelInfo channelInfo, Payload[] payload, AppCommunicationSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void stop (ChannelInfo channelInfo, optional AppCommunicationSuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    - - -
    AppCommunicationClientService -
    void connect (ConnectSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void disconnect (optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    -
    AppCommunicationServerService
    RemoteAppControlService -
    void start (RemoteAppControlStartCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void stop (optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    -
    void connect (ConnectSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void disconnect (optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    -
    void launch (ApplicationId appId, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    -
    void launchAppControl (ApplicationControl appControl, optional ApplicationId? appId, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback, optional RemoteAppControlCallback? replyCallback)
    -
    PayloadString
    PayloadRawBytes
    ClientInfo
    DiscoverySuccessCallback -
    void onfound (Device device)
    -
    void onfinished (Device[] foundDevices)
    -
    RemoteAppControlCallback -
    void onsuccess (optional ApplicationControlData[]? data)
    -
    void onfailure ()
    -
    ConnectSuccessCallback
    void onsuccess (Service service)
    RemoteAppControlStartCallback
    void onsuccess (Service service)
    AppCommunicationSuccessCallback
    void onsuccess (ChannelInfo channelInfo)
    AppCommunicationStartCallback
    void onsuccess (ChannelInfo channelInfo, ClientInfo clientInfo)
    AppCommunicationClientListCallback
    void onsuccess (ClientInfo[] clients)
    AppCommunicationListenerCallback
    void onnotify (ChannelInfo channelInfo, Payload[] payload, DOMString senderClientId)
    -
    -

    1. Type Definitions

    -
    -

    1.1. DeviceId

    -
    - The type of the remote device identifier. -
    -
        typedef DOMString DeviceId;
    -

    - Since: - 3.0 -

    -
    -
    -

    1.2. DeviceProfile

    -
    - Enumeration of the remote device profile. -
    -
        enum DeviceProfile {"MOBILE", "WEARABLE", "TV"};
    -

    - Since: - 3.0 -

    -
    -
    -

    1.3. Payload

    -
    - The type of payload item. An item is a key-value pair. The value may be either a string or an array of raw bytes. -
    -
        typedef (PayloadString or PayloadRawBytes) Payload;
    -

    - Since: - 3.0 -

    -
    -
    -

    1.4. PayloadType

    -
    - Enumeration of payload types. -
    -
        enum PayloadType{"STRING", "RAW_BYTES"};
    -

    - Since: - 3.0 -

    -
    -

    -The following values are supported: -

    -
      -
    • -STRING - The payload key-value value is a string.
    • -
    • -RAW_BYTES - The payload key-value value is a byte array.
    • -
    -
    -
    -
    -

    1.5. ConnectionState

    -
    - Enumeration of service connection states. -
    -
        enum ConnectionState{"CONNECTED", "NOT_CONNECTED", "CONNECTING"};
    -

    - Since: - 3.0 -

    -
    -

    -The following values are supported: -

    -
      -
    • -CONNECTED - Connected state.
    • -
    • -DISCONNECTED - Not connected state.
    • -
    • -CONNECTING - Connecting state.
    • -
    -
    -
    -
    -

    1.6. ServiceType

    -
    - Enumeration of service type. -
    -
        enum ServiceType{"APP_COMM_CLIENT", "APP_COMM_SERVER", "REMOTE_APP_CONTROL"};
    -

    - Since: - 3.0 -

    -
    -

    -The following values are supported: -

    -
      -
    • -APP_COMM_CLIENT - Application communication client service.
    • -
    • -APP_COMM_SERVER - Application communication server service.
    • -
    • -REMOTE_APP_CONTROL - Remote application control service.
    • -
    -
    -
    -
    -
    -

    2. Interfaces

    -
    -

    2.1. ChannelInfo

    -
    - The channel info interface that specifies the server application which a client application wants to connect with. -
    -
        [Constructor(DOMString uri, DOMString id)]
    -    interface ChannelInfo {
    -      attribute DOMString uri;
    -      attribute DOMString id;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The channelinfo is composed of a URI and a channel ID which is used in App Communication services. -The channelinfo URI is a URI for an application on the server side. -The channelinfo ID value is defined by the developer. -

    -
    -

    Remark: - We assume that the server side app URI is known. For example, either client and server side apps are both developed by the same developer or the server app URI is available from other sources. -

    -
    -

    Constructors

    -
    -
    ChannelInfo(DOMString uri, DOMString id);
    -
    -

    Code example:

    -/* Assume that the "targetApp0.main" application has been installed on remote device */
    -var channel = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -
    -
    -
    -
    -
    -

    Attributes

    -
      -
    • -DOMString uri
      - The uri of the channel. -
      -

      - Since: - 3.0 -

      -
    • -
    • -DOMString id
      - The identifier of the channel. -
      -

      - Since: - 3.0 -

      -
    • -
    -
    -
    -
    -

    2.2. ConvergenceObject

    -
    - The ConvergenceObject interface defines what is -instantiated by the Tizen object from the Tizen platform. -
    -
        [NoInterfaceObject] interface ConvergenceObject {
    -        readonly attribute ConvergenceManager convergence;
    -    };
    -
        Tizen implements ConvergenceObject;
    -

    - Since: - 3.0 -

    -
    -

    -The tizen.convergence object allows access to -Tizen device-to-device convergence API. -

    -
    -
    -
    -

    2.3. ConvergenceManager

    -
    - The ConvergenceManager interface provides access to the -convergence object. -
    -
        [NoInterfaceObject] interface ConvergenceManager {
    -
    -        void startDiscovery(DiscoverySuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback,
    -            optional unsigned long? timeout) raises(WebAPIException);
    -
    -        void stopDiscovery() raises(WebAPIException);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The device-to-device convergence manager allows discovering available -nearby devices, which support device-to-device services. -

    -
    -
    -

    Methods

    -
    -
    -startDiscovery -
    -
    -
    - Starts discovery of nearby devices. -
    -
    void startDiscovery(DiscoverySuccessCallback successCallback, optional ErrorCallback? errorCallback, optional unsigned long? timeout);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method initiates the device discovery procedure. -Depending on the progress of this procedure the following methods -are invoked: -

    -
      -
    • -onfound() - when a device is found. -This method is invoked with the device -information of -Device type. -If no device is found, this method will never be invoked.
    • -
    • -onfinished() - when a discovery procedure is finished. -This method is invoked -with the list of discovered device information.
    • -
    -

    -The discovery procedure can be canceled anytime, by calling -stopDiscovery() in -the ConvergenceManager. -
    Note the onfinished() discovery -callback will be invoked. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -
    -

    Parameters:

    -
      -
    • -successCallback: - The callback to invoke each time the device is -found. The callback will be invoked also when the discovery -procedure has finished. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure of device -discovery. -
    • -
    • -timeout [optional] [nullable]: - Duration of discovery procedure in seconds. If this -value is omitted or null is passed, the default timeout -is 5 seconds. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -discovery procedure has started already. -

      • -
      -
    -
    -
    -

    Code example:

    -/* Handling device discovery results */
    -var discoveryCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      /* Do something with the discovered device */
    -      /* If desired device is found, stop discovery with following call */
    -      tizen.convergence.stopDiscovery();
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log('Device discovery has finished');
    -   }
    -};
    -
    -/* Running device discovery procedure */
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoveryCallback, function(err)
    -   {
    -      console.log(err.name + ': ' + err.message);
    -   }, 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - 
    -
    -
    -
    -stopDiscovery -
    -
    -
    - Stops discovery of nearby devices. -
    -
    void stopDiscovery();
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method stops an ongoing discovery procedure. -

    -
    -

    Remark: - Device discovery is a heavyweight procedure, so it may be -useful to stop discovery when the required device is found. -
    Note this method triggers the onfinished() discovery -callback. -

    -

    Remark: - Example of using can be found at -startDiscovery() code example. -

    -
    -

    Exceptions:

    -
    • WebAPIException
      • - with error type InvalidStateError, if the -discovery procedure has not started yet. -

      -
    -
    -
    -
    -
    -
    -
    -

    2.4. Device

    -
    - The Device interface provides access to the remote -device's properties. -
    -
        [NoInterfaceObject] interface Device {
    -
    -        readonly attribute DeviceId id;
    -
    -        readonly attribute DOMString name;
    -
    -        readonly attribute DeviceProfile type;
    -
    -        readonly attribute Service[] services;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -This interface offers access to remote device information, such as the unique -identifier, name, profile type and list of provided services. -

    -

    -
    Note, device ID and device type are defined in the platform, and the developer cannot change it. -

    -
    -
    -

    Attributes

    -
      -
    • - readonly -DeviceId id
      - The unique device ID. -
      Note the device ID is a unique identifier string, generated with following rule. -If the Remote Server is installed on the device (e.g. TV), -then the device ID is assigned by application communication server service. -Usually it has a format of service name and version. Otherwise (e.g. mobile or wearable), -the device ID is device MAC address. -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -DOMString name
      - The device name. -
      Note device name is one that is set in the Settings app (Settings>About Devices>Device Name). -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -DeviceProfile type
      - The device profile type. -
      Note Device type represents the profile of the device, -such as “TV”, “Mobile” or “Wearable”. -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -Service[] - services
      - The list of services, available on the device. -
      -

      - Since: - 3.0 -

      -
    • -
    -
    -
    -
    -

    2.5. Service

    -
    - The Service interface is a base interface for all -device-to-device services. -
    -
        [NoInterfaceObject] interface Service {
    -
    -        readonly attribute ConnectionState connectionState;
    -
    -        readonly attribute ServiceType type;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -This interface defines common property for all device-to-device services -

    -
    -
    -

    Attributes

    -
    • - readonly -ConnectionState connectionState
      - The service connection state. -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -ServiceType type
      - The service type. -
      -

      - Since: - 3.0 -

      -
    • -
    -
    -
    -
    -

    2.6. AppCommunicationService

    -
    - The AppCommunicationService interface defines the base interface -of both application communication -Client and -Server services -and specifies common service features, such as start, stop, send, listener etc. -
    -
        [NoInterfaceObject] interface AppCommunicationService : Service {
    -
    -        void start(ChannelInfo channelInfo,
    -            AppCommunicationStartCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void getClientList(ChannelInfo channelInfo,
    -            AppCommunicationClientListCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void send(ChannelInfo channelInfo,
    -            Payload[] payload,
    -            AppCommunicationSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void stop(ChannelInfo channelInfo,
    -            optional AppCommunicationSuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void setListener(AppCommunicationListenerCallback listenerCallback)
    -            raises(WebAPIException);
    -
    -        void unsetListener();
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -App Communication Service allows transferring data between apps on local and remote devices. -The App Communication Service relies on a Remote Server. The initialization and execution of a server app -(the app on the side with the Remote Server, e.g. TV) and a client app (e.g. an app on a mobile or wearable device) -are slightly different. Furthermore, the client app can remotely launch an app on the server side or connect to an -already running server app, but the reverse way is impossible. More than one client can be connected to a server app. -For example, multiple players on mobile devices can connect to a game application on a TV which takes a role of a server. -Both client and server side apps can send payloads and listen to each other. -

    -

    -
    Note there are client and -server implementations -of this service for both local and remote devices. For better flexibility, the data transfer occurs in a user-defined -ChannelInfo. -

    -

    -These interfaces offer the following service features: -

    -
      -
    • -Starting and stopping the service
    • -
    • -Sending payloads to the service
    • -
    • -Listening to remote service notifications
    • -
    • -Getting the list of clients that are connected to the service
    • -
    -
    - -
    -

    Methods

    -
    -
    -start -
    -
    -
    - Starts the service. -
    -
    void start(ChannelInfo channelInfo, AppCommunicationStartCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method starts the channel of the service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    • - InvalidStateError: If the service has already started the channel. Note some services don't require a connection and disconnection procedures
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -

    Remark: - Before using this method for application communication client service, the service must be connected with the -connect() method. -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channelinfo of the service with specified URI and ID. -
      Note ChannelInfo in the application communication service specifies a server app which a client wants to connect with. -ChannelInfo URI is a URI of the server side app, while ChannelInfo ID is a developer-defined value. -
    • -
    • -successCallback: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      -
    -
    -
    -

    Code example:

    -/* App communication server service */
    -
    -var requestChannel = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstarted(channelinfo, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channelinfo.uri);
    -   console.log('channel id: ' + channelinfo.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -}
    -
    -/* Create an instance of application communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -service.start(requestChannel, onstarted, onerror);
    -
    -
    -
    -

    Output example:

     Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: true
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - 
    -
    -
    -

    Code example:

    -/* App communication client service */
    -
    -var clientService;
    -var requestChannel = new tizen.Channel('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstarted(channelinfo, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channelinfo.uri);
    -   console.log('channel id: ' + channelinfo.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -      clientService = service;
    -      service.start(requestChannel, onstarted, onerror);
    -   }
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            tizen.convergence.stopDiscovery();
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - 
    -
    -
    -
    -getClientList -
    -
    -
    - Get the client lists connected to the channel -
    -
    void getClientList(ChannelInfo channelInfo, AppCommunicationClientListCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    • - InvalidValuesError: If any of the input parameters contain an invalid value
    • -
    • - InvalidStateError: If the service has not started the channel
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -

    Remark: - Before using this method, the service must be connected and -started with -connect() and -start() methods -correspondingly. -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channelinfo of the service with specified URI and ID. -
    • -
    • -successCallback: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      -
    -
    -
    -

    Code example:

    -/* App communication server service */
    -
    -var requestChannel = new tizen.Channel('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onsuccess(clientinfolist)
    -{
    -   console.log('get client list');
    -   for (i in clientinfolist)
    -   {
    -      console.log('isHost: ' + clientinfolist[i].isHost);
    -      console.log('client id: ' + clientinfolist[i].clientId);
    -      console.log('connection time: ' + clientinfolist[i].connectionTime);
    -   }
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri' + channel.uri);
    -   console.log('channel id ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   service.getClientList(requestChannel, onsuccess, onerror);
    -}
    -
    -/* Create an instance of app communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -service.start(requestChannel, onstarted, onerror);
    -
    -
    -
    -

    Output example:

     Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: true
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - get client list
    - isHost: true
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - isHost: false
    - client id: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    - connection time: 1420163913807
    - isHost: false
    - client id: c13adb22-5423-22e4-5d8q-adf872d4q889
    - connection time: 1420163913125
    - 
    -
    -
    -

    Code example:

    -/* App communication client service */
    -
    -var clientService;
    -var requestChannel = new tizen.Channel('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onsuccess(clientinfolist)
    -{
    -   console.log('get client list');
    -   for (i in clientinfolist)
    -   {
    -      console.log('isHost: ' + clientinfolist[i].isHost);
    -      console.log('client id: ' + clientinfolist[i].clientId);
    -      console.log('connection time: ' + clientinfolist[i].connectionTime);
    -   }
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri' + channel.uri);
    -   console.log('channel id ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   clientService.getClientList(requestChannel, onsuccess, onerror);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -      clientService = service;
    -      service.start(requestChannel, onstarted, onerror);
    -   }
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            tizen.convergence.stopDiscovery();
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - clientinfo
    - isHost: false
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - get client list
    - isHost: false
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - isHost: false
    - client id: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    - connection time: 1420163913807
    - isHost: false
    - client id: c13adb22-5423-22e4-5d8q-adf872d4q889
    - connection time: 1420163913125
    - 
    -
    -
    -
    -send -
    -
    -
    - Sends a payload to the service. -
    -
    void send(ChannelInfo channelInfo, Payload[] payload, AppCommunicationSuccessCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    • - InvalidValuesError: If any of the input parameters contain an invalid value
    • -
    • - InvalidStateError: If the service has not started the channel
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -

    Remark: - Example of using can be found at -start() code example. -

    -

    Remark: - Before using this method, the service must be connected and -started with -connect() and -start() methods -correspondingly. -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channelinfo of the service with specified URI and ID. -
    • -
    • -payload: - The payload containing request data. -
    • -
    • -successCallback: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      -
    -
    -
    -

    Code example:

    -/* App communication server service */
    -
    -var requestChannel = new tizen.Channel('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function sendSuccessCallback(channelinfo)
    -{
    -   console.log('requestPayload sent');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by Multi Screen server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   /* Send data to the remote service */
    -   service.send(channel, requestPayload, sendSuccessCallback, onerror);
    -}
    -
    -/* Create an instance of app communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -service.start(requestChannel, onstarted, onerror);
    -
    -
    -
    -

    Output example:

     Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: true
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - requestPayload sent
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - 
    -
    -
    -

    Code example:

    -/* App communication client service */
    -
    -var clientService;
    -var requestChannel = new tizen.Channel('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function sendSuccessCallback(channel)
    -{
    -   console.log('requestPayload sent');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   /* Send data to the remote service */
    -   clientService.send(channel, requestPayload, sendSuccessCallback, onerror);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -      clientService = service;
    -      service.start(requestChannel, onstarted, onerror);
    -   }
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            else
    -            {
    -               clientService = device.service[i];
    -               clientService.start(requestChannel, onstarted, onerror);
    -            }
    -         }
    -         tizen.convergence.stopDiscovery();
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - requestPayload sent
    - channel uri: targetApp0.main
    - channel id: chA
    - 
    -
    -
    -
    -stop -
    -
    -
    - Stops the service. -
    -
    void stop(ChannelInfo channelInfo, optional AppCommunicationSuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method stops the specified channel of the service. -
    Note When all clients have stopped using the service channel, the server side automatically terminates the application. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    • - InvalidValuesError: If any of the input parameters contain an invalid value
    • -
    • - InvalidStateError: If the service has not started the channel
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channelInfo of the service with specified URI and ID. -
    • -
    • -successCallback [optional] [nullable]: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      -
    -
    -
    -

    Code example:

    -/* App communication server service */
    -
    -var requestChannel1 = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -var requestChannel2 = new tizen.ChannelInfo('targetApp1.main', 'chB');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstopped(channel)
    -{
    -   console.log('Channel stopped');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('clienti id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   if (channel id == 'chB')
    -   {
    -      service.stop(requestChannel2, onstopped);
    -   }
    -}
    -
    -/* Create an instance of app communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -service.start(requestChannel1, onstarted, onerror);
    -service.start(requestChannel2, onstarted, onerror);
    -
    -
    - -
    -

    Output example:

    -Channel started
    -channel uri: targetApp0.main
    -channel id: chA
    -clientinfo
    -isHost: true
    -clientId: 2c9f9510-48c2-11e6-b620-abffc41c391f
    -connectionTime: 1420163913035
    -Channel started
    -channel uri: targetApp1.main
    -channel id: chB
    -clientinfo
    -isHost: true
    -clientId: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    -connectionTime: 1420163913807
    -Channel stopped
    -channel uri: targetApp1.main
    -channel id: chB
    -
    -
    -
    -

    Code example:

    -/* App communication client service */
    -
    -var clientService;
    -var requestChannel1 = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -var requestChannel2 = new tizen.ChannelInfo('targetApp1.main', 'chB');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstopped(channel)
    -{
    -   console.log('Channel stopped');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   if (channel id == 'chB')
    -   {
    -      clientService.stop(requestChannel2, onstopped);
    -   }
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -      clientService = service;
    -      service.start(requestChannel, onstarted, onerror);
    -   }
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log('Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            tizen.convergence.stopDiscovery();
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - clientId: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connectionTime: 1420163913035
    - requestPayload sent
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - clientId: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connectionTime: 1420163913035
    - Channel started
    - channel uri: targetApp1.main
    - channel id: chB
    - clientinfo
    - isHost: false
    - clientId: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    - connectionTime: 1420163913807
    - Channel stopped
    - channel uri: targetApp1.main
    - channel id: chB
    - 
    -
    -
    -
    -setListener -
    -
    -
    - Registers the service listener. -
    -
    void setListener(AppCommunicationListenerCallback listenerCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -listenerCallback: - The method to invoke when a service -notification is received. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      -
    -
    -
    -

    Code example:

    -/* App communication server service */
    -
    -var requestChannel = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onnotify(channel, payload, senderclientid)
    -{
    -   console.log('On service notification');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   /* clientid of the sender of the payload */
    -   console.log('client id of sender: ' + senderclientid);
    -   for (i in payload)
    -   {
    -      console.log('payload: ' + payload[i].key + '-' + payload[i].value);
    -   }
    -   /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
    -   service.unsetListener();
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by Multi Screen server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -}
    -
    -/* Create an instance of app communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -/* Register listener to receive notifications from remote service */
    -service.setListener(onnotify);
    -service.start(requestChannel, onstarted, onerror);
    -
    -
    -
    -

    Output example:

     Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: true
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - On service notification
    - channel uri: targetApp0.main
    - channel id: chA
    - client id of sender: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    - payload: msg-hello
    - 
    -
    -
    -

    Code example:

    -/* App communication client service */
    -
    -var clientService;
    -var requestChannel = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onnotify(channel, payload, senderclientid)
    -{
    -   console.log('On service notification');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   /* clientid of the sender of the payload */
    -   console.log('client id of sender: ' + senderclientid);
    -   for (i in payload)
    -   {
    -      console.log('payload ' + payload[i].key + ': ' + payload[i].value);
    -   }
    -   /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
    -   clientService.unsetListener();
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -      service.start(requestChannel, onstarted, onerror);
    -      /* Register listener to receive notifications from remote service */
    -      service.setListener(onnotify);
    -   }
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -         }
    -         tizen.convergence.stopDiscovery();
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - clientId: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connectionTime: 1420163913035
    - On service notification
    - channel uri: targetApp0.main
    - channel id: chA
    - client id of sender: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    - payload: msg-hello
    - 
    -
    -
    -
    -unsetListener -
    -
    -
    - Unregisters the service listener. -
    -
    void unsetListener();
    -             
    -

    - Since: - 3.0 -

    -

    Remark: - Example of using can be found at -setListener() code example. -

    -
    -
    -
    -
    -
    -

    2.7. AppCommunicationClientService

    -
    - The AppCommunicationClientService interface provides access to -application communication client service features. -
    -
        [NoInterfaceObject] interface AppCommunicationClientService : AppCommunicationService {
    -
    -        void connect(ConnectSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void disconnect(optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -This interface offers following service features: -

    -
      -
    • -Connecting and disconnecting the remote service
    • -
    • -Reading immediate data of the remote service
    • -
    • -Listening to remote service update notifications
    • -
    • -Sending data to the remote service
    • -
    -
    - -
    -

    Methods

    -
    -
    -connect -
    -
    -
    - Connects to the service. -
    -
    void connect(ConnectSuccessCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -Makes physical connection such as Wi-Fi or Bluetooth to the -service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -

    Warning: - Connecting is only supported for services on devices not connected via WiFi. -For devices connected via WiFi, connectionState will always be "CONNECTED". -

    -

    Remark: - App developers do not need to specify the connectivity type -explicitly. The framework automatically determines which connectivity -to use in a selected service. -

    -
    -

    Parameters:

    -
      -
    • -successCallback: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service is connected already. -

      • -
      -
    -
    -
    -

    Code example:

    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -   }
    -   else if (service.type === "REMOTE_APP_CONTROL")
    -   {
    -      console.log('Connected to the remote app control service');
    -   }
    -   service.disconnect();
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -         }
    -         else if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -         }
    -         tizen.convergence.stopDiscovery();
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 2
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Connected to the service
    - Connected to the remote app control service
    - 
    -
    -
    -
    -disconnect -
    -
    -
    - Disconnects the connected service. -
    -
    void disconnect(optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -Disconnect physical connection with device-to-device service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -

    Warning: - Disconnecting is only supported for services on devices not connected via WiFi. -

    -

    Remark: - Example of using can be found at connect() code example. -

    -
    -

    Parameters:

    -
      -
    • -successCallback [optional] [nullable]: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service was not connected yet. -

      • -
      -
    -
    -
    -
    -
    -
    -
    -

    2.8. AppCommunicationServerService

    -
    - The AppCommunicationServerService interface provides access to -application communication server service features. -
    -
        [Constructor()]
    -    interface AppCommunicationServerService : AppCommunicationService {
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -This interface offers following service features: -

    -
      -
    • -Instantiating the service
    • -
    • -Reading immediate data of the service
    • -
    • -Listening to service update notifications
    • -
    • -Sending data for the service
    • -
    -
    -

    Warning: - AppCommunicationServerService API is supported on Tizen 3.0 TV product only. -

    -

    Remark: - application server service is used without discovery phase. -The developer should instantiate a standalone service object using -the constructor. -

    - -
    -

    Constructors

    -
    -
    AppCommunicationServerService();
    -
    -

    Code example:

    -/* Create an instance of application communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -
    -
    -
    -
    -
    -
    -

    2.9. RemoteAppControlService

    -
    - The RemoteAppControlService interface provides access to -remote application control service features. -
    -
        [NoInterfaceObject] interface RemoteAppControlService : Service {
    -        void start(RemoteAppControlStartCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void stop(optional SuccessCallback? successCallback,
    -                  optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void connect(ConnectSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void disconnect(optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void launch(ApplicationId appId,
    -            optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void launchAppControl(ApplicationControl appControl,
    -            optional ApplicationId? appId,
    -            optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback,
    -            optional RemoteAppControlCallback? replyCallback) raises(WebAPIException);
    -
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -This interface offers following device-to-device service features: -

    -
      -
    • -Connecting and disconnecting the service
    • -
    • -Sending app control data to the service
    • -
    • -Receiving app control results
    • -
    -
    - -
    -

    Methods

    -
    -
    -start -
    -
    -
    - Starts and initiates remote service. -
    -
    void start(RemoteAppControlStartCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method starts the remote app control service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -

    Remark : - Before using this method for remote application service, the service must be connected with the -connect() method. -

    -
    -

    Parameters:

    -
      -
    • -successCallback: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -the service is already started. -

      • -
      • - with error type AbortError, if the -other error occurs during start. -

      • -
      -
    -
    -
    -

    Code example:

    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstarted(service)
    -{
    -   console.log('Remote app control service started');
    -   service.disconnect();
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the remote app control service');
    -   service.start(onstarted, onerror);
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log('Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            else
    -            {
    -               device.services[i].start(onstarted, onerror);
    -            }
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    -<< Found a device
    -   - id: de2bea-ddvia
    -   - name : deviceA
    -   - type : TV
    -   - service amount: 2
    -<< Device discovery has finished
    -Connected to the remote app control service
    -Remote app control service started
    -
    -
    -
    -
    -stop -
    -
    -
    - Stops remote service. -
    -
    void stop(optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method stops and release internally allocated resources for remote service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -
    -

    Parameters:

    -
      -
    • -successCallback [optional] [nullable]: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -the service is not started yet. -

      • -
      • - with error type AbortError, if the -other error occurs during start. -

      • -
      -
    -
    -
    -

    Code example:

    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstopped()
    -{
    -   console.log('Remote App Control service stopped');
    -   /* Disconnect */
    -   service.disconnect();
    -}
    -
    -function onstarted(service)
    -{
    -   console.log('Remote App Control service started');
    -   /* Stop the service */
    -   service.stop(onstopped, onerror);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the remote app control service');
    -   service.start(onstarted, onerror);
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log('Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            else
    -            {
    -               device.services[i].start(onstarted, onerror);
    -            }
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    -<< Found a device
    -   - id: de2bea-ddvia
    -   - name : deviceA
    -   - type : TV
    -   - service amount: 2
    -<< Device discovery has finished
    -Connected to the remote app control service
    -Remote App Control service started
    -Remote App Control service stopped
    -
    -
    -
    -
    -connect -
    -
    -
    - Connects to the service. -
    -
    void connect(ConnectSuccessCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -Makes physical connection such as Wi-Fi or Bluetooth to remote -device-to-device service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -

    Warning: - Connecting is only supported for services on devices not connected via WiFi. -For devices connected via WiFi, connectionState will always be "CONNECTED". -

    -

    Remark: - App developers do not need to specify the connectivity type -explicitly. Framework automatically determines which connectivity -to use in a selected service. -

    -
    -

    Parameters:

    -
      -
    • -successCallback: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service is connected already. -

      • -
      -
    -
    -
    -

    Code example:

    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the remote app control service');
    -   service.disconnect();
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log('Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -console.log('>> STARTING DEVICE DISCOVERY');
    -tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 2
    - << Device discovery has finished
    - Connected to the remote app control service
    - 
    -
    -
    -
    -disconnect -
    -
    -
    - Disconnects the connected service. -
    -
    void disconnect(optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -Disconnect physical connection with device-to-device service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -

    Warning: - Disconnecting is only supported for services on devices not connected via WiFi. -

    -
    -

    Parameters:

    -
      -
    • -successCallback [optional] [nullable]: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service was not connected yet. -

      • -
      -
    -
    -
    -

    Code example:

    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function ondisconnected()
    -{
    -   console.log('Disconnected to the service');
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log('Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState == "CONNECTED")
    -            {
    -               device.services[i].disconnect(ondisconnected, onerror);
    -            }
    -            tizen.convergence.stopDiscovery();
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log('Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 2
    - << Device discovery has finished
    - Disconnected to the service
    - 
    -
    -
    -
    -launch -
    -
    -
    - Sends the given application ID to launch an application on the remote device. -
    -
    void launch(ApplicationId appId, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method sends an application ID to the remote service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    • - InvalidValuesError: If any of the input parameters contain an -invalid value
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -

    Remark: - Before using this method, the service must be connected -with -connect() method -and started with start() method. -

    -
    -

    Parameters:

    -
      -
    • -appId: - The target app id. -
    • -
    • -successCallback [optional] [nullable]: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service is not started yet. -

      • -
      -
    -
    -
    -

    Code example:

    -/* Assume that the "targetApp0.main" application has been installed on remote device */
    -var requestAppId = 'targetApp0.main';
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onsuccess()
    -{
    -   console.log('The application has launched successfully');
    -}
    -
    -function onstarted(service)
    -{
    -   console.log('Service started');
    -
    -   /* Launching server app remotely */
    -   service.launch(requestAppId, remoteAppControlCallback, onerror);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   /* Start the service */
    -   service.start(onstarted, onerror);
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            tizen.convergence.stopDiscovery();
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -console.log('>> STARTING DEVICE DISCOVERY');
    -tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 2
    - << Device discovery has finished
    - Connected to the service
    - Service started
    - The application has launched successfully
    - 
    -
    -
    -
    -launchAppControl -
    -
    -
    - Sends an app control to launch an application on the remote device. -
    -
    void launchAppControl(ApplicationControl appControl, optional ApplicationId? appId, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback, optional RemoteAppControlCallback? replyCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method sends an app control to the remote service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -

    Remark: - Before using this method, the service must be connected with -connect() method -and started with start() method. -

    -
    -

    Parameters:

    -
      -
    • -appControl: - The app control data. -
    • -
    • -appId [optional] [nullable]: - The target app id. -
    • -
    • -successCallback [optional] [nullable]: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    • -replyCallback [optional] [nullable]: - The method to invoke when the application gets back result from the remote service. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service is not started yet. -

      • -
      -
    -
    -
    -

    Code example:

    -var requestAppControl = new tizen.ApplicationControl('http://tizen.org/appcontrol/operation/view',
    -                                                     null, 'image/jpeg', null,
    -                                                     [new tizen.ApplicationControlData('images', [testImgData])]);
    -
    -function onsuccess()
    -{
    -   console.log('Launch application control succeed');
    -}
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -var remoteAppControlCallback =
    -{
    -   onsuccess: function(data)
    -   {
    -      console.log('On remote app control service reply');
    -      for(var i = 0; i < data.length; i++)
    -      {
    -         console.log("key : " + data[i].key + "value : " + data[i].value[0]);
    -      }
    -   },
    -   /* Callee returned failure */
    -   onfailure: function()
    -   {
    -      console.log('The launch application control failed');
    -   }
    -}
    -
    -function onstarted(service)
    -{
    -   console.log('Service started');
    -
    -   /* Send data to the remote service */
    -   service.launchAppControl(requestAppControl, null, onsuccess, onerror, remoteAppControlCallback);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -
    -   /* Start the service */
    -   service.start(onstarted, onerror);
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -         }
    -         tizen.convergence.stopDiscovery();
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 2
    - << Device discovery has finished
    - Connected to the service
    - Service started
    - 
    -
    -
    -
    -
    -
    -
    -

    2.10. PayloadString

    -
    - The dictionary that specifies a payload string for the -device-to-device service. -
    -
        dictionary PayloadString {
    -        DOMString key;
    -
    -        DOMString value;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -PayloadString is a key-value pair. Both the key and value are strings. -

    -
    -
    -

    Dictionary members

    -
    -
    DOMString key
    -
    -
    - The name of the payload string. -
    -

    - Since: - 3.0 -

    -
    -
    DOMString value
    -
    -
    - The value of the payload string. -
    -

    - Since: - 3.0 -

    -
    -
    -
    -
    -
    -

    2.11. PayloadRawBytes

    -
    - The dictionary that specifies a raw bytes payload for the -device-to-device service. -
    -
        dictionary PayloadRawBytes {
    -        DOMString key;
    -
    -        byte[] value;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -PayloadRawBytes is a key-value pair. The key is a string and the value is a byte -array which is to be delivered to a remote service. -

    -
    -
    -

    Dictionary members

    -
    -
    DOMString key
    -
    -
    - The name of the payload byte array. -
    -

    - Since: - 3.0 -

    -
    -
    byte[] value
    -
    -
    - The bytes of the payload byte array. -
    -

    - Since: - 3.0 -

    -
    -
    -
    -
    -
    -

    2.12. ClientInfo

    -
    - The interface specifies client information. -
    -
        [NoInterfaceObject] interface ClientInfo {
    -        readonly attribute boolean isHost;
    -
    -        readonly attribute DOMString clientId;
    -
    -        readonly attribute long connectionTime;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    Attributes

    -
      -
    • - readonly -boolean isHost
      - The value indicating if the service is local (true) or remote (false). -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -DOMString clientId
      - The unique client id. -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -long connectionTime
      - The connection time in milliseconds. -
      -

      - Since: - 3.0 -

      -
    • -
    -
    -
    -
    -

    2.13. DiscoverySuccessCallback

    -
    - The DiscoverySuccessCallback interface defines the -success method for startDiscovery(). -
    -
        [Callback, NoInterfaceObject] interface DiscoverySuccessCallback {
    -
    -        void onfound(Device device);
    -
    -        void onfinished(Device[] foundDevices);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -Specifies the type of function passed to ConvergenceManager.startDiscovery(). -Called when device providing device-to-device service is discovered nearby. -

    -

    -A usage example can be found in the -startDiscovery() code example. -

    -
    -
    -

    Methods

    -
    -
    -onfound -
    -
    -
    - Called when device is discovered during the discovery -procedure. -
    -
    void onfound(Device device);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -device: - The discovered remote device. -
    • -
    -
    -
    -
    -onfinished -
    -
    -
    - Called when the device discovery procedure has finished. -
    -
    void onfinished(Device[] foundDevices);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -foundDevices: - Array of devices found in this discovery session. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.14. RemoteAppControlCallback

    -
    - The RemoteAppControlCallback specifies callbacks that are invoked as a reply -from the requested application control within the application control requester. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlCallback {
    -
    -        void onsuccess(optional ApplicationControlData[]? data);
    -
    -        void onfailure();
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -launchAppControl() method. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the received reply from the requested application on the remote device has no errors. -
    -
    void onsuccess(optional ApplicationControlData[]? data);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -data [optional] [nullable]: - An array of ApplicationControlData objects -
    • -
    -
    -
    -
    -onfailure -
    -
    -
    - Called when the received reply from the requested application on the remote device contains any error. -
    -
    void onfailure();
    -             
    -

    - Since: - 3.0 -

    -
    -
    -
    -
    -
    -

    2.15. ConnectSuccessCallback

    -
    - The ConnectSuccessCallback interface defines the success method -to be invoked when a service is connected. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface ConnectSuccessCallback {
    -
    -        void onsuccess(Service service);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -connect() of AppCommunicationClientService and -connect() of RemoteAppControlService methods. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the service connection is established. -
    -
    void onsuccess(Service service);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -service: - The connected service on a remote device. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.16. RemoteAppControlStartCallback

    -
    - The RemoteAppControlStartCallback interface defines the success method -to be invoked when a RemoteAppControlService is started. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlStartCallback {
    -
    -        void onsuccess(Service service);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -start() of RemoteAppControlService methods. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the service connection is established. -
    -
    void onsuccess(Service service);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -service: - The connected service on a remote device. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.17. AppCommunicationSuccessCallback

    -
    - The AppCommunicationSuccessCallback interface defines the success method -to be invoked when a service operation, such as stop or send is successful. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationSuccessCallback {
    -
    -        void onsuccess(ChannelInfo channelInfo);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -stop() or -send() methods. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the service operation is successful. -
    -
    void onsuccess(ChannelInfo channelInfo);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channel info of the service with specified URI and ID. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.18. AppCommunicationStartCallback

    -
    - The AppCommunicationStartCallback interface defines the success method -to be invoked when a start service operation is successful. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationStartCallback {
    -
    -        void onsuccess(ChannelInfo channelInfo, ClientInfo clientInfo);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -start() method. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the start service operation is successful. -
    -
    void onsuccess(ChannelInfo channelInfo, ClientInfo clientInfo);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channel info of the service with specified URI and ID. -
    • -
    • -clientInfo: - The client information. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.19. AppCommunicationClientListCallback

    -
    - The AppCommunicationClientListCallback interface defines the -method to be invoked when requested a list of clients, connected to -the specified channel of the application communication service. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationClientListCallback {
    -
    -        void onsuccess(ClientInfo[] clients);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -getClientList() method. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the list of connected clients is requested. -
    -
    void onsuccess(ClientInfo[] clients);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -clients: - The list of connected clients. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.20. AppCommunicationListenerCallback

    -
    - The AppCommunicationListenerCallback interface defines the -method to be invoked when a service notification is received -from the application communication service. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationListenerCallback {
    -
    -        void onnotify(ChannelInfo channelInfo, Payload[] payload, DOMString senderClientId);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type can be assigned to the service using the -setListener() method. -

    -
    -
    -

    Methods

    -
    -
    -onnotify -
    -
    -
    - Called when the service channel notification is received. -
    -
    void onnotify(ChannelInfo channelInfo, Payload[] payload, DOMString senderClientId);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channel info of the service with specified URI and ID. -
    • -
    • -payload: - The payload containing notification data. -
    • -
    • -senderClientId: - The client id of the sender. -
    • -
    -
    -
    -
    -
    -
    -
    -

    3. Related Feature

    -
    - You can check if this API is supported with tizen.systeminfo.getCapability() and decide enable/disable codes that need this API. -
    -

    -

    -To guarantee that the application runs on a device with Convergence feature, -declare the following feature requirements in the config file: -

    -

    -
  • http://tizen.org/feature/convergence.d2d
  • -
    -

    - For more information, see Application Filtering. -
    -

    4. Full WebIDL

    -
    module Convergence {
    -
    -    typedef DOMString DeviceId;
    -
    -    enum DeviceProfile {"MOBILE", "WEARABLE", "TV"};
    -
    -    typedef (PayloadString or PayloadRawBytes) Payload;
    -
    -    enum PayloadType{"STRING", "RAW_BYTES"};
    -
    -    enum ConnectionState{"CONNECTED", "NOT_CONNECTED", "CONNECTING"};
    -
    -    enum ServiceType{"APP_COMM_CLIENT", "APP_COMM_SERVER", "REMOTE_APP_CONTROL"};
    -
    -    [Constructor(DOMString uri, DOMString id)]
    -    interface ChannelInfo {
    -      attribute DOMString uri;
    -      attribute DOMString id;
    -    };
    -
    -    [NoInterfaceObject] interface ConvergenceObject {
    -        readonly attribute ConvergenceManager convergence;
    -    };
    -
    -    Tizen implements ConvergenceObject;
    -
    -    [NoInterfaceObject] interface ConvergenceManager {
    -
    -        void startDiscovery(DiscoverySuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback,
    -            optional unsigned long? timeout) raises(WebAPIException);
    -
    -        void stopDiscovery() raises(WebAPIException);
    -    };
    -
    -    [NoInterfaceObject] interface Device {
    -
    -        readonly attribute DeviceId id;
    -
    -        readonly attribute DOMString name;
    -
    -        readonly attribute DeviceProfile type;
    -
    -        readonly attribute Service[] services;
    -    };
    -
    -    [NoInterfaceObject] interface Service {
    -
    -        readonly attribute ConnectionState connectionState;
    -
    -        readonly attribute ServiceType type;
    -    };
    -
    -    [NoInterfaceObject] interface AppCommunicationService : Service {
    -
    -        void start(ChannelInfo channelInfo,
    -            AppCommunicationStartCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void getClientList(ChannelInfo channelInfo,
    -            AppCommunicationClientListCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void send(ChannelInfo channelInfo,
    -            Payload[] payload,
    -            AppCommunicationSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void stop(ChannelInfo channelInfo,
    -            optional AppCommunicationSuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void setListener(AppCommunicationListenerCallback listenerCallback)
    -            raises(WebAPIException);
    -
    -        void unsetListener();
    -    };
    -
    -    [NoInterfaceObject] interface AppCommunicationClientService : AppCommunicationService {
    -
    -        void connect(ConnectSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void disconnect(optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -    };
    -
    -
    -    [Constructor()]
    -    interface AppCommunicationServerService : AppCommunicationService {
    -    };
    -
    -    [NoInterfaceObject] interface RemoteAppControlService : Service {
    -        void start(RemoteAppControlStartCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void stop(optional SuccessCallback? successCallback,
    -                  optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void connect(ConnectSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void disconnect(optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void launch(ApplicationId appId,
    -            optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void launchAppControl(ApplicationControl appControl,
    -            optional ApplicationId? appId,
    -            optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback,
    -            optional RemoteAppControlCallback? replyCallback) raises(WebAPIException);
    -
    -    };
    -
    -    dictionary PayloadString {
    -        DOMString key;
    -
    -        DOMString value;
    -    };
    -
    -    dictionary PayloadRawBytes {
    -        DOMString key;
    -
    -        byte[] value;
    -    };
    -
    -    [NoInterfaceObject] interface ClientInfo {
    -        readonly attribute boolean isHost;
    -
    -        readonly attribute DOMString clientId;
    -
    -        readonly attribute long connectionTime;
    -    };
    -
    -    [Callback, NoInterfaceObject] interface DiscoverySuccessCallback {
    -
    -        void onfound(Device device);
    -
    -        void onfinished(Device[] foundDevices);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlCallback {
    -
    -        void onsuccess(optional ApplicationControlData[]? data);
    -
    -        void onfailure();
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface ConnectSuccessCallback {
    -
    -        void onsuccess(Service service);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlStartCallback {
    -
    -        void onsuccess(Service service);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationSuccessCallback {
    -
    -        void onsuccess(ChannelInfo channelInfo);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationStartCallback {
    -
    -        void onsuccess(ChannelInfo channelInfo, ClientInfo clientInfo);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationClientListCallback {
    -
    -        void onsuccess(ClientInfo[] clients);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationListenerCallback {
    -
    -        void onnotify(ChannelInfo channelInfo, Payload[] payload, DOMString senderClientId);
    -    };
    -};
    -
    - - - diff --git a/org.tizen.web.apireference/html/device_api/wearable/index.html b/org.tizen.web.apireference/html/device_api/wearable/index.html index 232fb93..caa1dd1 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/index.html +++ b/org.tizen.web.apireference/html/device_api/wearable/index.html @@ -196,14 +196,6 @@ Optional No - - - Convergence - This API provides interfaces and methods for using Tizen device-to-device convergence services. - 3.0 - Optional - No - Iotcon This API provides functions for IoT (Internet of Things) connectivity. diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/convergence.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/convergence.html deleted file mode 100755 index b1ccb39..0000000 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/convergence.html +++ /dev/null @@ -1,4124 +0,0 @@ - - - - - -Convergence API - - -
    -
    -

    Convergence API

    -
    - The Convergence API defines interfaces and methods -for using Tizen device-to-device convergence services. -
    -
    -

    -The following functionality is provided: -

    -
      -
    • -Discovering nearby devices which support device-to-device services
    • -
    • -Getting device and service information
    • -
    • -Connecting and disconnecting services
    • -
    • -Starting and stopping services
    • -
    • -Sending data to services
    • -
    • -Listening to notifications from the service
    • -
    -

    -The collection of supported device-to-device services includes: -

    -
      -
    • -Remote App Control Service - Allows launching an application on a remote device.
    • -
    • -App Communication Service - Allows transferring data between applications on local and remote devices. -
      Note that there are 'client' and 'server' implementations of this service which allows easy set-up and -convenient handling of the data exchange process on both local and remote devices. -For better flexibility, the data transfer occurs in named user-defined communication channels.
    • -
    -

    -For more information on the Device-to-device Convergence features, -see the Convergence Services Guide. -

    -

    -Tizen 3.0 only supports Wi-Fi for Convergence services. More connectivity, such as BT/BLE and Wi-Fi Direct, is to be supported in further versions. -

    -
    -

    - Since: - 3.0 -

    -

    Table of Contents

    - -
    -

    Summary of Interfaces and Methods

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    InterfaceMethod
    ChannelInfo
    ConvergenceObject
    ConvergenceManager -
    void startDiscovery (DiscoverySuccessCallback successCallback, optional ErrorCallback? errorCallback, optional unsigned long? timeout)
    - -
    Device
    Service
    AppCommunicationService -
    void start (ChannelInfo channelInfo, AppCommunicationStartCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void getClientList (ChannelInfo channelInfo, AppCommunicationClientListCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void send (ChannelInfo channelInfo, Payload[] payload, AppCommunicationSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void stop (ChannelInfo channelInfo, optional AppCommunicationSuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    - - -
    AppCommunicationClientService -
    void connect (ConnectSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void disconnect (optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    -
    AppCommunicationServerService
    RemoteAppControlService -
    void start (RemoteAppControlStartCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void stop (optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    -
    void connect (ConnectSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    -
    void disconnect (optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    -
    void launch (ApplicationId appId, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    -
    void launchAppControl (ApplicationControl appControl, optional ApplicationId? appId, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback, optional RemoteAppControlCallback? replyCallback)
    -
    PayloadString
    PayloadRawBytes
    ClientInfo
    DiscoverySuccessCallback -
    void onfound (Device device)
    -
    void onfinished (Device[] foundDevices)
    -
    RemoteAppControlCallback -
    void onsuccess (optional ApplicationControlData[]? data)
    -
    void onfailure ()
    -
    ConnectSuccessCallback
    void onsuccess (Service service)
    RemoteAppControlStartCallback
    void onsuccess (Service service)
    AppCommunicationSuccessCallback
    void onsuccess (ChannelInfo channelInfo)
    AppCommunicationStartCallback
    void onsuccess (ChannelInfo channelInfo, ClientInfo clientInfo)
    AppCommunicationClientListCallback
    void onsuccess (ClientInfo[] clients)
    AppCommunicationListenerCallback
    void onnotify (ChannelInfo channelInfo, Payload[] payload, DOMString senderClientId)
    -
    -

    1. Type Definitions

    -
    -

    1.1. DeviceId

    -
    - The type of the remote device identifier. -
    -
        typedef DOMString DeviceId;
    -

    - Since: - 3.0 -

    -
    -
    -

    1.2. DeviceProfile

    -
    - Enumeration of the remote device profile. -
    -
        enum DeviceProfile {"MOBILE", "WEARABLE", "TV"};
    -

    - Since: - 3.0 -

    -
    -
    -

    1.3. Payload

    -
    - The type of payload item. An item is a key-value pair. The value may be either a string or an array of raw bytes. -
    -
        typedef (PayloadString or PayloadRawBytes) Payload;
    -

    - Since: - 3.0 -

    -
    -
    -

    1.4. PayloadType

    -
    - Enumeration of payload types. -
    -
        enum PayloadType{"STRING", "RAW_BYTES"};
    -

    - Since: - 3.0 -

    -
    -

    -The following values are supported: -

    -
      -
    • -STRING - The payload key-value value is a string.
    • -
    • -RAW_BYTES - The payload key-value value is a byte array.
    • -
    -
    -
    -
    -

    1.5. ConnectionState

    -
    - Enumeration of service connection states. -
    -
        enum ConnectionState{"CONNECTED", "NOT_CONNECTED", "CONNECTING"};
    -

    - Since: - 3.0 -

    -
    -

    -The following values are supported: -

    -
      -
    • -CONNECTED - Connected state.
    • -
    • -DISCONNECTED - Not connected state.
    • -
    • -CONNECTING - Connecting state.
    • -
    -
    -
    -
    -

    1.6. ServiceType

    -
    - Enumeration of service type. -
    -
        enum ServiceType{"APP_COMM_CLIENT", "APP_COMM_SERVER", "REMOTE_APP_CONTROL"};
    -

    - Since: - 3.0 -

    -
    -

    -The following values are supported: -

    -
      -
    • -APP_COMM_CLIENT - Application communication client service.
    • -
    • -APP_COMM_SERVER - Application communication server service.
    • -
    • -REMOTE_APP_CONTROL - Remote application control service.
    • -
    -
    -
    -
    -
    -

    2. Interfaces

    -
    -

    2.1. ChannelInfo

    -
    - The channel info interface that specifies the server application which a client application wants to connect with. -
    -
        [Constructor(DOMString uri, DOMString id)]
    -    interface ChannelInfo {
    -      attribute DOMString uri;
    -      attribute DOMString id;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The channelinfo is composed of a URI and a channel ID which is used in App Communication services. -The channelinfo URI is a URI for an application on the server side. -The channelinfo ID value is defined by the developer. -

    -
    -

    Remark: - We assume that the server side app URI is known. For example, either client and server side apps are both developed by the same developer or the server app URI is available from other sources. -

    -
    -

    Constructors

    -
    -
    ChannelInfo(DOMString uri, DOMString id);
    -
    -

    Code example:

    -/* Assume that the "targetApp0.main" application has been installed on remote device */
    -var channel = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -
    -
    -
    -
    -
    -

    Attributes

    -
      -
    • -DOMString uri
      - The uri of the channel. -
      -

      - Since: - 3.0 -

      -
    • -
    • -DOMString id
      - The identifier of the channel. -
      -

      - Since: - 3.0 -

      -
    • -
    -
    -
    -
    -

    2.2. ConvergenceObject

    -
    - The ConvergenceObject interface defines what is -instantiated by the Tizen object from the Tizen platform. -
    -
        [NoInterfaceObject] interface ConvergenceObject {
    -        readonly attribute ConvergenceManager convergence;
    -    };
    -
        Tizen implements ConvergenceObject;
    -

    - Since: - 3.0 -

    -
    -

    -The tizen.convergence object allows access to -Tizen device-to-device convergence API. -

    -
    -
    -
    -

    2.3. ConvergenceManager

    -
    - The ConvergenceManager interface provides access to the -convergence object. -
    -
        [NoInterfaceObject] interface ConvergenceManager {
    -
    -        void startDiscovery(DiscoverySuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback,
    -            optional unsigned long? timeout) raises(WebAPIException);
    -
    -        void stopDiscovery() raises(WebAPIException);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The device-to-device convergence manager allows discovering available -nearby devices, which support device-to-device services. -

    -
    -
    -

    Methods

    -
    -
    -startDiscovery -
    -
    -
    - Starts discovery of nearby devices. -
    -
    void startDiscovery(DiscoverySuccessCallback successCallback, optional ErrorCallback? errorCallback, optional unsigned long? timeout);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method initiates the device discovery procedure. -Depending on the progress of this procedure the following methods -are invoked: -

    -
      -
    • -onfound() - when a device is found. -This method is invoked with the device -information of -Device type. -If no device is found, this method will never be invoked.
    • -
    • -onfinished() - when a discovery procedure is finished. -This method is invoked -with the list of discovered device information.
    • -
    -

    -The discovery procedure can be canceled anytime, by calling -stopDiscovery() in -the ConvergenceManager. -
    Note the onfinished() discovery -callback will be invoked. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -
    -

    Parameters:

    -
      -
    • -successCallback: - The callback to invoke each time the device is -found. The callback will be invoked also when the discovery -procedure has finished. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure of device -discovery. -
    • -
    • -timeout [optional] [nullable]: - Duration of discovery procedure in seconds. If this -value is omitted or null is passed, the default timeout -is 5 seconds. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -discovery procedure has started already. -

      • -
      -
    -
    -
    -

    Code example:

    -/* Handling device discovery results */
    -var discoveryCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      /* Do something with the discovered device */
    -      /* If desired device is found, stop discovery with following call */
    -      tizen.convergence.stopDiscovery();
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log('Device discovery has finished');
    -   }
    -};
    -
    -/* Running device discovery procedure */
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoveryCallback, function(err)
    -   {
    -      console.log(err.name + ': ' + err.message);
    -   }, 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - 
    -
    -
    -
    -stopDiscovery -
    -
    -
    - Stops discovery of nearby devices. -
    -
    void stopDiscovery();
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method stops an ongoing discovery procedure. -

    -
    -

    Remark: - Device discovery is a heavyweight procedure, so it may be -useful to stop discovery when the required device is found. -
    Note this method triggers the onfinished() discovery -callback. -

    -

    Remark: - Example of using can be found at -startDiscovery() code example. -

    -
    -

    Exceptions:

    -
    • WebAPIException
      • - with error type InvalidStateError, if the -discovery procedure has not started yet. -

      -
    -
    -
    -
    -
    -
    -
    -

    2.4. Device

    -
    - The Device interface provides access to the remote -device's properties. -
    -
        [NoInterfaceObject] interface Device {
    -
    -        readonly attribute DeviceId id;
    -
    -        readonly attribute DOMString name;
    -
    -        readonly attribute DeviceProfile type;
    -
    -        readonly attribute Service[] services;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -This interface offers access to remote device information, such as the unique -identifier, name, profile type and list of provided services. -

    -

    -
    Note, device ID and device type are defined in the platform, and the developer cannot change it. -

    -
    -
    -

    Attributes

    -
      -
    • - readonly -DeviceId id
      - The unique device ID. -
      Note the device ID is a unique identifier string, generated with following rule. -If the Remote Server is installed on the device (e.g. TV), -then the device ID is assigned by application communication server service. -Usually it has a format of service name and version. Otherwise (e.g. mobile or wearable), -the device ID is device MAC address. -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -DOMString name
      - The device name. -
      Note device name is one that is set in the Settings app (Settings>About Devices>Device Name). -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -DeviceProfile type
      - The device profile type. -
      Note Device type represents the profile of the device, -such as “TV”, “Mobile” or “Wearable”. -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -Service[] - services
      - The list of services, available on the device. -
      -

      - Since: - 3.0 -

      -
    • -
    -
    -
    -
    -

    2.5. Service

    -
    - The Service interface is a base interface for all -device-to-device services. -
    -
        [NoInterfaceObject] interface Service {
    -
    -        readonly attribute ConnectionState connectionState;
    -
    -        readonly attribute ServiceType type;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -This interface defines common property for all device-to-device services -

    -
    -
    -

    Attributes

    -
    • - readonly -ConnectionState connectionState
      - The service connection state. -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -ServiceType type
      - The service type. -
      -

      - Since: - 3.0 -

      -
    • -
    -
    -
    -
    -

    2.6. AppCommunicationService

    -
    - The AppCommunicationService interface defines the base interface -of both application communication -Client and -Server services -and specifies common service features, such as start, stop, send, listener etc. -
    -
        [NoInterfaceObject] interface AppCommunicationService : Service {
    -
    -        void start(ChannelInfo channelInfo,
    -            AppCommunicationStartCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void getClientList(ChannelInfo channelInfo,
    -            AppCommunicationClientListCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void send(ChannelInfo channelInfo,
    -            Payload[] payload,
    -            AppCommunicationSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void stop(ChannelInfo channelInfo,
    -            optional AppCommunicationSuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void setListener(AppCommunicationListenerCallback listenerCallback)
    -            raises(WebAPIException);
    -
    -        void unsetListener();
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -App Communication Service allows transferring data between apps on local and remote devices. -The App Communication Service relies on a Remote Server. The initialization and execution of a server app -(the app on the side with the Remote Server, e.g. TV) and a client app (e.g. an app on a mobile or wearable device) -are slightly different. Furthermore, the client app can remotely launch an app on the server side or connect to an -already running server app, but the reverse way is impossible. More than one client can be connected to a server app. -For example, multiple players on mobile devices can connect to a game application on a TV which takes a role of a server. -Both client and server side apps can send payloads and listen to each other. -

    -

    -
    Note there are client and -server implementations -of this service for both local and remote devices. For better flexibility, the data transfer occurs in a user-defined -ChannelInfo. -

    -

    -These interfaces offer the following service features: -

    -
      -
    • -Starting and stopping the service
    • -
    • -Sending payloads to the service
    • -
    • -Listening to remote service notifications
    • -
    • -Getting the list of clients that are connected to the service
    • -
    -
    - -
    -

    Methods

    -
    -
    -start -
    -
    -
    - Starts the service. -
    -
    void start(ChannelInfo channelInfo, AppCommunicationStartCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method starts the channel of the service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    • - InvalidStateError: If the service has already started the channel. Note some services don't require a connection and disconnection procedures
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -

    Remark: - Before using this method for application communication client service, the service must be connected with the -connect() method. -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channelinfo of the service with specified URI and ID. -
      Note ChannelInfo in the application communication service specifies a server app which a client wants to connect with. -ChannelInfo URI is a URI of the server side app, while ChannelInfo ID is a developer-defined value. -
    • -
    • -successCallback: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      -
    -
    -
    -

    Code example:

    -/* App communication server service */
    -
    -var requestChannel = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstarted(channelinfo, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channelinfo.uri);
    -   console.log('channel id: ' + channelinfo.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -}
    -
    -/* Create an instance of application communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -service.start(requestChannel, onstarted, onerror);
    -
    -
    -
    -

    Output example:

     Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: true
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - 
    -
    -
    -

    Code example:

    -/* App communication client service */
    -
    -var clientService;
    -var requestChannel = new tizen.Channel('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstarted(channelinfo, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channelinfo.uri);
    -   console.log('channel id: ' + channelinfo.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -      clientService = service;
    -      service.start(requestChannel, onstarted, onerror);
    -   }
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            tizen.convergence.stopDiscovery();
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - 
    -
    -
    -
    -getClientList -
    -
    -
    - Get the client lists connected to the channel -
    -
    void getClientList(ChannelInfo channelInfo, AppCommunicationClientListCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    • - InvalidValuesError: If any of the input parameters contain an invalid value
    • -
    • - InvalidStateError: If the service has not started the channel
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -

    Remark: - Before using this method, the service must be connected and -started with -connect() and -start() methods -correspondingly. -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channelinfo of the service with specified URI and ID. -
    • -
    • -successCallback: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      -
    -
    -
    -

    Code example:

    -/* App communication server service */
    -
    -var requestChannel = new tizen.Channel('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onsuccess(clientinfolist)
    -{
    -   console.log('get client list');
    -   for (i in clientinfolist)
    -   {
    -      console.log('isHost: ' + clientinfolist[i].isHost);
    -      console.log('client id: ' + clientinfolist[i].clientId);
    -      console.log('connection time: ' + clientinfolist[i].connectionTime);
    -   }
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri' + channel.uri);
    -   console.log('channel id ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   service.getClientList(requestChannel, onsuccess, onerror);
    -}
    -
    -/* Create an instance of app communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -service.start(requestChannel, onstarted, onerror);
    -
    -
    -
    -

    Output example:

     Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: true
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - get client list
    - isHost: true
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - isHost: false
    - client id: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    - connection time: 1420163913807
    - isHost: false
    - client id: c13adb22-5423-22e4-5d8q-adf872d4q889
    - connection time: 1420163913125
    - 
    -
    -
    -

    Code example:

    -/* App communication client service */
    -
    -var clientService;
    -var requestChannel = new tizen.Channel('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onsuccess(clientinfolist)
    -{
    -   console.log('get client list');
    -   for (i in clientinfolist)
    -   {
    -      console.log('isHost: ' + clientinfolist[i].isHost);
    -      console.log('client id: ' + clientinfolist[i].clientId);
    -      console.log('connection time: ' + clientinfolist[i].connectionTime);
    -   }
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri' + channel.uri);
    -   console.log('channel id ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   clientService.getClientList(requestChannel, onsuccess, onerror);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -      clientService = service;
    -      service.start(requestChannel, onstarted, onerror);
    -   }
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            tizen.convergence.stopDiscovery();
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - clientinfo
    - isHost: false
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - get client list
    - isHost: false
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - isHost: false
    - client id: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    - connection time: 1420163913807
    - isHost: false
    - client id: c13adb22-5423-22e4-5d8q-adf872d4q889
    - connection time: 1420163913125
    - 
    -
    -
    -
    -send -
    -
    -
    - Sends a payload to the service. -
    -
    void send(ChannelInfo channelInfo, Payload[] payload, AppCommunicationSuccessCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    • - InvalidValuesError: If any of the input parameters contain an invalid value
    • -
    • - InvalidStateError: If the service has not started the channel
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -

    Remark: - Example of using can be found at -start() code example. -

    -

    Remark: - Before using this method, the service must be connected and -started with -connect() and -start() methods -correspondingly. -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channelinfo of the service with specified URI and ID. -
    • -
    • -payload: - The payload containing request data. -
    • -
    • -successCallback: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      -
    -
    -
    -

    Code example:

    -/* App communication server service */
    -
    -var requestChannel = new tizen.Channel('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function sendSuccessCallback(channelinfo)
    -{
    -   console.log('requestPayload sent');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by Multi Screen server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   /* Send data to the remote service */
    -   service.send(channel, requestPayload, sendSuccessCallback, onerror);
    -}
    -
    -/* Create an instance of app communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -service.start(requestChannel, onstarted, onerror);
    -
    -
    -
    -

    Output example:

     Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: true
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - requestPayload sent
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - 
    -
    -
    -

    Code example:

    -/* App communication client service */
    -
    -var clientService;
    -var requestChannel = new tizen.Channel('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function sendSuccessCallback(channel)
    -{
    -   console.log('requestPayload sent');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   /* Send data to the remote service */
    -   clientService.send(channel, requestPayload, sendSuccessCallback, onerror);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -      clientService = service;
    -      service.start(requestChannel, onstarted, onerror);
    -   }
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            else
    -            {
    -               clientService = device.service[i];
    -               clientService.start(requestChannel, onstarted, onerror);
    -            }
    -         }
    -         tizen.convergence.stopDiscovery();
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - requestPayload sent
    - channel uri: targetApp0.main
    - channel id: chA
    - 
    -
    -
    -
    -stop -
    -
    -
    - Stops the service. -
    -
    void stop(ChannelInfo channelInfo, optional AppCommunicationSuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method stops the specified channel of the service. -
    Note When all clients have stopped using the service channel, the server side automatically terminates the application. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    • - InvalidValuesError: If any of the input parameters contain an invalid value
    • -
    • - InvalidStateError: If the service has not started the channel
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channelInfo of the service with specified URI and ID. -
    • -
    • -successCallback [optional] [nullable]: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      -
    -
    -
    -

    Code example:

    -/* App communication server service */
    -
    -var requestChannel1 = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -var requestChannel2 = new tizen.ChannelInfo('targetApp1.main', 'chB');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstopped(channel)
    -{
    -   console.log('Channel stopped');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('clienti id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   if (channel id == 'chB')
    -   {
    -      service.stop(requestChannel2, onstopped);
    -   }
    -}
    -
    -/* Create an instance of app communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -service.start(requestChannel1, onstarted, onerror);
    -service.start(requestChannel2, onstarted, onerror);
    -
    -
    - -
    -

    Output example:

    -Channel started
    -channel uri: targetApp0.main
    -channel id: chA
    -clientinfo
    -isHost: true
    -clientId: 2c9f9510-48c2-11e6-b620-abffc41c391f
    -connectionTime: 1420163913035
    -Channel started
    -channel uri: targetApp1.main
    -channel id: chB
    -clientinfo
    -isHost: true
    -clientId: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    -connectionTime: 1420163913807
    -Channel stopped
    -channel uri: targetApp1.main
    -channel id: chB
    -
    -
    -
    -

    Code example:

    -/* App communication client service */
    -
    -var clientService;
    -var requestChannel1 = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -var requestChannel2 = new tizen.ChannelInfo('targetApp1.main', 'chB');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstopped(channel)
    -{
    -   console.log('Channel stopped');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -   if (channel id == 'chB')
    -   {
    -      clientService.stop(requestChannel2, onstopped);
    -   }
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -      clientService = service;
    -      service.start(requestChannel, onstarted, onerror);
    -   }
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log('Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            tizen.convergence.stopDiscovery();
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - clientId: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connectionTime: 1420163913035
    - requestPayload sent
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - clientId: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connectionTime: 1420163913035
    - Channel started
    - channel uri: targetApp1.main
    - channel id: chB
    - clientinfo
    - isHost: false
    - clientId: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    - connectionTime: 1420163913807
    - Channel stopped
    - channel uri: targetApp1.main
    - channel id: chB
    - 
    -
    -
    -
    -setListener -
    -
    -
    - Registers the service listener. -
    -
    void setListener(AppCommunicationListenerCallback listenerCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -listenerCallback: - The method to invoke when a service -notification is received. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      -
    -
    -
    -

    Code example:

    -/* App communication server service */
    -
    -var requestChannel = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onnotify(channel, payload, senderclientid)
    -{
    -   console.log('On service notification');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   /* clientid of the sender of the payload */
    -   console.log('client id of sender: ' + senderclientid);
    -   for (i in payload)
    -   {
    -      console.log('payload: ' + payload[i].key + '-' + payload[i].value);
    -   }
    -   /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
    -   service.unsetListener();
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by Multi Screen server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -}
    -
    -/* Create an instance of app communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -/* Register listener to receive notifications from remote service */
    -service.setListener(onnotify);
    -service.start(requestChannel, onstarted, onerror);
    -
    -
    -
    -

    Output example:

     Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: true
    - client id: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connection time: 1420163913035
    - On service notification
    - channel uri: targetApp0.main
    - channel id: chA
    - client id of sender: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    - payload: msg-hello
    - 
    -
    -
    -

    Code example:

    -/* App communication client service */
    -
    -var clientService;
    -var requestChannel = new tizen.ChannelInfo('targetApp0.main', 'chA');
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onnotify(channel, payload, senderclientid)
    -{
    -   console.log('On service notification');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   /* clientid of the sender of the payload */
    -   console.log('client id of sender: ' + senderclientid);
    -   for (i in payload)
    -   {
    -      console.log('payload ' + payload[i].key + ': ' + payload[i].value);
    -   }
    -   /* If using unsetListener, unregisters the listener and stops receiving notifications from the service */
    -   clientService.unsetListener();
    -}
    -
    -function onstarted(channel, clientinfo)
    -{
    -   console.log('Channel started');
    -   console.log('channel uri: ' + channel.uri);
    -   console.log('channel id: ' + channel.id);
    -   console.log('clientinfo');
    -   console.log('isHost: ' + clientinfo.isHost);
    -   /* Remote DeviceId generated by remote server */
    -   console.log('client id: ' + clientinfo.clientId);
    -   console.log('connection time: ' + clientinfo.connectionTime);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -      service.start(requestChannel, onstarted, onerror);
    -      /* Register listener to receive notifications from remote service */
    -      service.setListener(onnotify);
    -   }
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -         }
    -         tizen.convergence.stopDiscovery();
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 1
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Channel started
    - channel uri: targetApp0.main
    - channel id: chA
    - clientinfo
    - isHost: false
    - clientId: 2c9f9510-48c2-11e6-b620-abffc41c391f
    - connectionTime: 1420163913035
    - On service notification
    - channel uri: targetApp0.main
    - channel id: chA
    - client id of sender: d6ca19f0-9222-11e4-b829-67c2b8c2d9bc
    - payload: msg-hello
    - 
    -
    -
    -
    -unsetListener -
    -
    -
    - Unregisters the service listener. -
    -
    void unsetListener();
    -             
    -

    - Since: - 3.0 -

    -

    Remark: - Example of using can be found at -setListener() code example. -

    -
    -
    -
    -
    -
    -

    2.7. AppCommunicationClientService

    -
    - The AppCommunicationClientService interface provides access to -application communication client service features. -
    -
        [NoInterfaceObject] interface AppCommunicationClientService : AppCommunicationService {
    -
    -        void connect(ConnectSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void disconnect(optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -This interface offers following service features: -

    -
      -
    • -Connecting and disconnecting the remote service
    • -
    • -Reading immediate data of the remote service
    • -
    • -Listening to remote service update notifications
    • -
    • -Sending data to the remote service
    • -
    -
    - -
    -

    Methods

    -
    -
    -connect -
    -
    -
    - Connects to the service. -
    -
    void connect(ConnectSuccessCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -Makes physical connection such as Wi-Fi or Bluetooth to the -service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -

    Warning: - Connecting is only supported for services on devices not connected via WiFi. -For devices connected via WiFi, connectionState will always be "CONNECTED". -

    -

    Remark: - App developers do not need to specify the connectivity type -explicitly. The framework automatically determines which connectivity -to use in a selected service. -

    -
    -

    Parameters:

    -
      -
    • -successCallback: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service is connected already. -

      • -
      -
    -
    -
    -

    Code example:

    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   if (service.type === "APP_COMM_CLIENT")
    -   {
    -      console.log('Connected to the app communication client service');
    -   }
    -   else if (service.type === "REMOTE_APP_CONTROL")
    -   {
    -      console.log('Connected to the remote app control service');
    -   }
    -   service.disconnect();
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "APP_COMM_CLIENT")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -         }
    -         else if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -         }
    -         tizen.convergence.stopDiscovery();
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 2
    - << Device discovery has finished
    - Connected to the service
    - Connected to the app communication client service
    - Connected to the service
    - Connected to the remote app control service
    - 
    -
    -
    -
    -disconnect -
    -
    -
    - Disconnects the connected service. -
    -
    void disconnect(optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -Disconnect physical connection with device-to-device service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -

    Warning: - Disconnecting is only supported for services on devices not connected via WiFi. -

    -

    Remark: - Example of using can be found at connect() code example. -

    -
    -

    Parameters:

    -
      -
    • -successCallback [optional] [nullable]: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service was not connected yet. -

      • -
      -
    -
    -
    -
    -
    -
    -
    -

    2.8. AppCommunicationServerService

    -
    - The AppCommunicationServerService interface provides access to -application communication server service features. -
    -
        [Constructor()]
    -    interface AppCommunicationServerService : AppCommunicationService {
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -This interface offers following service features: -

    -
      -
    • -Instantiating the service
    • -
    • -Reading immediate data of the service
    • -
    • -Listening to service update notifications
    • -
    • -Sending data for the service
    • -
    -
    -

    Warning: - AppCommunicationServerService API is supported on Tizen 3.0 TV product only. -

    -

    Remark: - application server service is used without discovery phase. -The developer should instantiate a standalone service object using -the constructor. -

    - -
    -

    Constructors

    -
    -
    AppCommunicationServerService();
    -
    -

    Code example:

    -/* Create an instance of application communication server service object */
    -var service = new tizen.AppCommunicationServerService();
    -
    -
    -
    -
    -
    -
    -

    2.9. RemoteAppControlService

    -
    - The RemoteAppControlService interface provides access to -remote application control service features. -
    -
        [NoInterfaceObject] interface RemoteAppControlService : Service {
    -        void start(RemoteAppControlStartCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void stop(optional SuccessCallback? successCallback,
    -                  optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void connect(ConnectSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void disconnect(optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void launch(ApplicationId appId,
    -            optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void launchAppControl(ApplicationControl appControl,
    -            optional ApplicationId? appId,
    -            optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback,
    -            optional RemoteAppControlCallback? replyCallback) raises(WebAPIException);
    -
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -This interface offers following device-to-device service features: -

    -
      -
    • -Connecting and disconnecting the service
    • -
    • -Sending app control data to the service
    • -
    • -Receiving app control results
    • -
    -
    - -
    -

    Methods

    -
    -
    -start -
    -
    -
    - Starts and initiates remote service. -
    -
    void start(RemoteAppControlStartCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method starts the remote app control service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -

    Remark : - Before using this method for remote application service, the service must be connected with the -connect() method. -

    -
    -

    Parameters:

    -
      -
    • -successCallback: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -the service is already started. -

      • -
      • - with error type AbortError, if the -other error occurs during start. -

      • -
      -
    -
    -
    -

    Code example:

    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstarted(service)
    -{
    -   console.log('Remote app control service started');
    -   service.disconnect();
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the remote app control service');
    -   service.start(onstarted, onerror);
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log('Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            else
    -            {
    -               device.services[i].start(onstarted, onerror);
    -            }
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    -<< Found a device
    -   - id: de2bea-ddvia
    -   - name : deviceA
    -   - type : TV
    -   - service amount: 2
    -<< Device discovery has finished
    -Connected to the remote app control service
    -Remote app control service started
    -
    -
    -
    -
    -stop -
    -
    -
    - Stops remote service. -
    -
    void stop(optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method stops and release internally allocated resources for remote service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -
    -

    Parameters:

    -
      -
    • -successCallback [optional] [nullable]: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -the service is not started yet. -

      • -
      • - with error type AbortError, if the -other error occurs during start. -

      • -
      -
    -
    -
    -

    Code example:

    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onstopped()
    -{
    -   console.log('Remote App Control service stopped');
    -   /* Disconnect */
    -   service.disconnect();
    -}
    -
    -function onstarted(service)
    -{
    -   console.log('Remote App Control service started');
    -   /* Stop the service */
    -   service.stop(onstopped, onerror);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the remote app control service');
    -   service.start(onstarted, onerror);
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log('Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            else
    -            {
    -               device.services[i].start(onstarted, onerror);
    -            }
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    -<< Found a device
    -   - id: de2bea-ddvia
    -   - name : deviceA
    -   - type : TV
    -   - service amount: 2
    -<< Device discovery has finished
    -Connected to the remote app control service
    -Remote App Control service started
    -Remote App Control service stopped
    -
    -
    -
    -
    -connect -
    -
    -
    - Connects to the service. -
    -
    void connect(ConnectSuccessCallback successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -Makes physical connection such as Wi-Fi or Bluetooth to remote -device-to-device service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -

    Warning: - Connecting is only supported for services on devices not connected via WiFi. -For devices connected via WiFi, connectionState will always be "CONNECTED". -

    -

    Remark: - App developers do not need to specify the connectivity type -explicitly. Framework automatically determines which connectivity -to use in a selected service. -

    -
    -

    Parameters:

    -
      -
    • -successCallback: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service is connected already. -

      • -
      -
    -
    -
    -

    Code example:

    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the remote app control service');
    -   service.disconnect();
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log('Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -console.log('>> STARTING DEVICE DISCOVERY');
    -tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 2
    - << Device discovery has finished
    - Connected to the remote app control service
    - 
    -
    -
    -
    -disconnect -
    -
    -
    - Disconnects the connected service. -
    -
    void disconnect(optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -Disconnect physical connection with device-to-device service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth -

    -

    Warning: - Disconnecting is only supported for services on devices not connected via WiFi. -

    -
    -

    Parameters:

    -
      -
    • -successCallback [optional] [nullable]: - The method to invoke on success -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service was not connected yet. -

      • -
      -
    -
    -
    -

    Code example:

    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function ondisconnected()
    -{
    -   console.log('Disconnected to the service');
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log('Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState == "CONNECTED")
    -            {
    -               device.services[i].disconnect(ondisconnected, onerror);
    -            }
    -            tizen.convergence.stopDiscovery();
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log('Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 2
    - << Device discovery has finished
    - Disconnected to the service
    - 
    -
    -
    -
    -launch -
    -
    -
    - Sends the given application ID to launch an application on the remote device. -
    -
    void launch(ApplicationId appId, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method sends an application ID to the remote service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    • - InvalidValuesError: If any of the input parameters contain an -invalid value
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -

    Remark: - Before using this method, the service must be connected -with -connect() method -and started with start() method. -

    -
    -

    Parameters:

    -
      -
    • -appId: - The target app id. -
    • -
    • -successCallback [optional] [nullable]: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service is not started yet. -

      • -
      -
    -
    -
    -

    Code example:

    -/* Assume that the "targetApp0.main" application has been installed on remote device */
    -var requestAppId = 'targetApp0.main';
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -function onsuccess()
    -{
    -   console.log('The application has launched successfully');
    -}
    -
    -function onstarted(service)
    -{
    -   console.log('Service started');
    -
    -   /* Launching server app remotely */
    -   service.launch(requestAppId, remoteAppControlCallback, onerror);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -   /* Start the service */
    -   service.start(onstarted, onerror);
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -            tizen.convergence.stopDiscovery();
    -         }
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -console.log('>> STARTING DEVICE DISCOVERY');
    -tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 2
    - << Device discovery has finished
    - Connected to the service
    - Service started
    - The application has launched successfully
    - 
    -
    -
    -
    -launchAppControl -
    -
    -
    - Sends an app control to launch an application on the remote device. -
    -
    void launchAppControl(ApplicationControl appControl, optional ApplicationId? appId, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback, optional RemoteAppControlCallback? replyCallback);
    -             
    -

    - Since: - 3.0 -

    -
    -

    -This method sends an app control to the remote service. -

    -
    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - AbortError: If any system error occurred
    • -
    -
    -

    - Privilege level: - public -

    -

    - Privilege: - http://tizen.org/privilege/internet
    http://tizen.org/privilege/bluetooth
    http://tizen.org/privilege/d2d.datasharing -

    -

    Remark: - Before using this method, the service must be connected with -connect() method -and started with start() method. -

    -
    -

    Parameters:

    -
      -
    • -appControl: - The app control data. -
    • -
    • -appId [optional] [nullable]: - The target app id. -
    • -
    • -successCallback [optional] [nullable]: - The method to invoke on success. -
    • -
    • -errorCallback [optional] [nullable]: - The method to invoke on failure. -
    • -
    • -replyCallback [optional] [nullable]: - The method to invoke when the application gets back result from the remote service. -
    • -
    -
    -
    -

    Exceptions:

    -
    • WebAPIException
        -
      • - with error type TypeMismatchError, if any -input parameter is not compatible with the expected type for that -parameter. -

      • -
      • - with error type SecurityError, if the -application does not have the privilege to call this method. -

      • -
      • - with error type InvalidStateError, if the -service is not started yet. -

      • -
      -
    -
    -
    -

    Code example:

    -var requestAppControl = new tizen.ApplicationControl('http://tizen.org/appcontrol/operation/view',
    -                                                     null, 'image/jpeg', null,
    -                                                     [new tizen.ApplicationControlData('images', [testImgData])]);
    -
    -function onsuccess()
    -{
    -   console.log('Launch application control succeed');
    -}
    -
    -function onerror(err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -var remoteAppControlCallback =
    -{
    -   onsuccess: function(data)
    -   {
    -      console.log('On remote app control service reply');
    -      for(var i = 0; i < data.length; i++)
    -      {
    -         console.log("key : " + data[i].key + "value : " + data[i].value[0]);
    -      }
    -   },
    -   /* Callee returned failure */
    -   onfailure: function()
    -   {
    -      console.log('The launch application control failed');
    -   }
    -}
    -
    -function onstarted(service)
    -{
    -   console.log('Service started');
    -
    -   /* Send data to the remote service */
    -   service.launchAppControl(requestAppControl, null, onsuccess, onerror, remoteAppControlCallback);
    -}
    -
    -function onconnected(service)
    -{
    -   console.log('Connected to the service');
    -
    -   /* Start the service */
    -   service.start(onstarted, onerror);
    -}
    -
    -var discoverySuccessCallback =
    -{
    -   onfound: function(device)
    -   {
    -      console.log(' Found a device');
    -      console.log(" - id: " + device.id);
    -      console.log(" - name: " + device.name);
    -      console.log(" - type: " + device.type);
    -      console.log(" - service amount: " + device.services.length);
    -      for (i in device.services)
    -      {
    -         if (device.services[i].type === "REMOTE_APP_CONTROL")
    -         {
    -            if (device.services[i].connectionState != "CONNECTED")
    -            {
    -               device.services[i].connect(onconnected, onerror);
    -            }
    -         }
    -         tizen.convergence.stopDiscovery();
    -      }
    -   },
    -
    -   onfinished: function(foundDevices)
    -   {
    -      console.log(' Device discovery has finished');
    -      console.log(" - devices found: " + foundDevices.length);
    -   }
    -};
    -
    -try
    -{
    -   console.log('>> STARTING DEVICE DISCOVERY');
    -   tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
    -}
    -catch (err)
    -{
    -   console.log(err.name + ': ' + err.message);
    -}
    -
    -
    -
    -

    Output example:

     >> STARTING DEVICE DISCOVERY
    - << Found a device
    -  - id: de2bea-ddvia
    -  - name: deviceA
    -  - type: TV
    -  - service amount: 2
    - << Device discovery has finished
    - Connected to the service
    - Service started
    - 
    -
    -
    -
    -
    -
    -
    -

    2.10. PayloadString

    -
    - The dictionary that specifies a payload string for the -device-to-device service. -
    -
        dictionary PayloadString {
    -        DOMString key;
    -
    -        DOMString value;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -PayloadString is a key-value pair. Both the key and value are strings. -

    -
    -
    -

    Dictionary members

    -
    -
    DOMString key
    -
    -
    - The name of the payload string. -
    -

    - Since: - 3.0 -

    -
    -
    DOMString value
    -
    -
    - The value of the payload string. -
    -

    - Since: - 3.0 -

    -
    -
    -
    -
    -
    -

    2.11. PayloadRawBytes

    -
    - The dictionary that specifies a raw bytes payload for the -device-to-device service. -
    -
        dictionary PayloadRawBytes {
    -        DOMString key;
    -
    -        byte[] value;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -PayloadRawBytes is a key-value pair. The key is a string and the value is a byte -array which is to be delivered to a remote service. -

    -
    -
    -

    Dictionary members

    -
    -
    DOMString key
    -
    -
    - The name of the payload byte array. -
    -

    - Since: - 3.0 -

    -
    -
    byte[] value
    -
    -
    - The bytes of the payload byte array. -
    -

    - Since: - 3.0 -

    -
    -
    -
    -
    -
    -

    2.12. ClientInfo

    -
    - The interface specifies client information. -
    -
        [NoInterfaceObject] interface ClientInfo {
    -        readonly attribute boolean isHost;
    -
    -        readonly attribute DOMString clientId;
    -
    -        readonly attribute long connectionTime;
    -    };
    -

    - Since: - 3.0 -

    -
    -

    Attributes

    -
      -
    • - readonly -boolean isHost
      - The value indicating if the service is local (true) or remote (false). -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -DOMString clientId
      - The unique client id. -
      -

      - Since: - 3.0 -

      -
    • -
    • - readonly -long connectionTime
      - The connection time in milliseconds. -
      -

      - Since: - 3.0 -

      -
    • -
    -
    -
    -
    -

    2.13. DiscoverySuccessCallback

    -
    - The DiscoverySuccessCallback interface defines the -success method for startDiscovery(). -
    -
        [Callback, NoInterfaceObject] interface DiscoverySuccessCallback {
    -
    -        void onfound(Device device);
    -
    -        void onfinished(Device[] foundDevices);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -Specifies the type of function passed to ConvergenceManager.startDiscovery(). -Called when device providing device-to-device service is discovered nearby. -

    -

    -A usage example can be found in the -startDiscovery() code example. -

    -
    -
    -

    Methods

    -
    -
    -onfound -
    -
    -
    - Called when device is discovered during the discovery -procedure. -
    -
    void onfound(Device device);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -device: - The discovered remote device. -
    • -
    -
    -
    -
    -onfinished -
    -
    -
    - Called when the device discovery procedure has finished. -
    -
    void onfinished(Device[] foundDevices);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -foundDevices: - Array of devices found in this discovery session. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.14. RemoteAppControlCallback

    -
    - The RemoteAppControlCallback specifies callbacks that are invoked as a reply -from the requested application control within the application control requester. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlCallback {
    -
    -        void onsuccess(optional ApplicationControlData[]? data);
    -
    -        void onfailure();
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -launchAppControl() method. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the received reply from the requested application on the remote device has no errors. -
    -
    void onsuccess(optional ApplicationControlData[]? data);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -data [optional] [nullable]: - An array of ApplicationControlData objects -
    • -
    -
    -
    -
    -onfailure -
    -
    -
    - Called when the received reply from the requested application on the remote device contains any error. -
    -
    void onfailure();
    -             
    -

    - Since: - 3.0 -

    -
    -
    -
    -
    -
    -

    2.15. ConnectSuccessCallback

    -
    - The ConnectSuccessCallback interface defines the success method -to be invoked when a service is connected. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface ConnectSuccessCallback {
    -
    -        void onsuccess(Service service);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -connect() of AppCommunicationClientService and -connect() of RemoteAppControlService methods. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the service connection is established. -
    -
    void onsuccess(Service service);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -service: - The connected service on a remote device. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.16. RemoteAppControlStartCallback

    -
    - The RemoteAppControlStartCallback interface defines the success method -to be invoked when a RemoteAppControlService is started. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlStartCallback {
    -
    -        void onsuccess(Service service);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -start() of RemoteAppControlService methods. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the service connection is established. -
    -
    void onsuccess(Service service);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -service: - The connected service on a remote device. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.17. AppCommunicationSuccessCallback

    -
    - The AppCommunicationSuccessCallback interface defines the success method -to be invoked when a service operation, such as stop or send is successful. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationSuccessCallback {
    -
    -        void onsuccess(ChannelInfo channelInfo);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -stop() or -send() methods. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the service operation is successful. -
    -
    void onsuccess(ChannelInfo channelInfo);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channel info of the service with specified URI and ID. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.18. AppCommunicationStartCallback

    -
    - The AppCommunicationStartCallback interface defines the success method -to be invoked when a start service operation is successful. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationStartCallback {
    -
    -        void onsuccess(ChannelInfo channelInfo, ClientInfo clientInfo);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -start() method. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the start service operation is successful. -
    -
    void onsuccess(ChannelInfo channelInfo, ClientInfo clientInfo);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channel info of the service with specified URI and ID. -
    • -
    • -clientInfo: - The client information. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.19. AppCommunicationClientListCallback

    -
    - The AppCommunicationClientListCallback interface defines the -method to be invoked when requested a list of clients, connected to -the specified channel of the application communication service. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationClientListCallback {
    -
    -        void onsuccess(ClientInfo[] clients);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type is invoked in -getClientList() method. -

    -
    -
    -

    Methods

    -
    -
    -onsuccess -
    -
    -
    - Called when the list of connected clients is requested. -
    -
    void onsuccess(ClientInfo[] clients);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -clients: - The list of connected clients. -
    • -
    -
    -
    -
    -
    -
    -
    -

    2.20. AppCommunicationListenerCallback

    -
    - The AppCommunicationListenerCallback interface defines the -method to be invoked when a service notification is received -from the application communication service. -
    -
        [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationListenerCallback {
    -
    -        void onnotify(ChannelInfo channelInfo, Payload[] payload, DOMString senderClientId);
    -    };
    -

    - Since: - 3.0 -

    -
    -

    -The callback of this type can be assigned to the service using the -setListener() method. -

    -
    -
    -

    Methods

    -
    -
    -onnotify -
    -
    -
    - Called when the service channel notification is received. -
    -
    void onnotify(ChannelInfo channelInfo, Payload[] payload, DOMString senderClientId);
    -             
    -

    - Since: - 3.0 -

    -
    -

    Parameters:

    -
      -
    • -channelInfo: - The channel info of the service with specified URI and ID. -
    • -
    • -payload: - The payload containing notification data. -
    • -
    • -senderClientId: - The client id of the sender. -
    • -
    -
    -
    -
    -
    -
    -
    -

    3. Related Feature

    -
    - You can check if this API is supported with tizen.systeminfo.getCapability() and decide enable/disable codes that need this API. -
    -

    -

    -To guarantee that the application runs on a device with Convergence feature, -declare the following feature requirements in the config file: -

    -

    -
  • http://tizen.org/feature/convergence.d2d
  • -
    -

    - For more information, see Application Filtering. -
    -

    4. Full WebIDL

    -
    module Convergence {
    -
    -    typedef DOMString DeviceId;
    -
    -    enum DeviceProfile {"MOBILE", "WEARABLE", "TV"};
    -
    -    typedef (PayloadString or PayloadRawBytes) Payload;
    -
    -    enum PayloadType{"STRING", "RAW_BYTES"};
    -
    -    enum ConnectionState{"CONNECTED", "NOT_CONNECTED", "CONNECTING"};
    -
    -    enum ServiceType{"APP_COMM_CLIENT", "APP_COMM_SERVER", "REMOTE_APP_CONTROL"};
    -
    -    [Constructor(DOMString uri, DOMString id)]
    -    interface ChannelInfo {
    -      attribute DOMString uri;
    -      attribute DOMString id;
    -    };
    -
    -    [NoInterfaceObject] interface ConvergenceObject {
    -        readonly attribute ConvergenceManager convergence;
    -    };
    -
    -    Tizen implements ConvergenceObject;
    -
    -    [NoInterfaceObject] interface ConvergenceManager {
    -
    -        void startDiscovery(DiscoverySuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback,
    -            optional unsigned long? timeout) raises(WebAPIException);
    -
    -        void stopDiscovery() raises(WebAPIException);
    -    };
    -
    -    [NoInterfaceObject] interface Device {
    -
    -        readonly attribute DeviceId id;
    -
    -        readonly attribute DOMString name;
    -
    -        readonly attribute DeviceProfile type;
    -
    -        readonly attribute Service[] services;
    -    };
    -
    -    [NoInterfaceObject] interface Service {
    -
    -        readonly attribute ConnectionState connectionState;
    -
    -        readonly attribute ServiceType type;
    -    };
    -
    -    [NoInterfaceObject] interface AppCommunicationService : Service {
    -
    -        void start(ChannelInfo channelInfo,
    -            AppCommunicationStartCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void getClientList(ChannelInfo channelInfo,
    -            AppCommunicationClientListCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void send(ChannelInfo channelInfo,
    -            Payload[] payload,
    -            AppCommunicationSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void stop(ChannelInfo channelInfo,
    -            optional AppCommunicationSuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void setListener(AppCommunicationListenerCallback listenerCallback)
    -            raises(WebAPIException);
    -
    -        void unsetListener();
    -    };
    -
    -    [NoInterfaceObject] interface AppCommunicationClientService : AppCommunicationService {
    -
    -        void connect(ConnectSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void disconnect(optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -    };
    -
    -
    -    [Constructor()]
    -    interface AppCommunicationServerService : AppCommunicationService {
    -    };
    -
    -    [NoInterfaceObject] interface RemoteAppControlService : Service {
    -        void start(RemoteAppControlStartCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void stop(optional SuccessCallback? successCallback,
    -                  optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void connect(ConnectSuccessCallback successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void disconnect(optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void launch(ApplicationId appId,
    -            optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void launchAppControl(ApplicationControl appControl,
    -            optional ApplicationId? appId,
    -            optional SuccessCallback? successCallback,
    -            optional ErrorCallback? errorCallback,
    -            optional RemoteAppControlCallback? replyCallback) raises(WebAPIException);
    -
    -    };
    -
    -    dictionary PayloadString {
    -        DOMString key;
    -
    -        DOMString value;
    -    };
    -
    -    dictionary PayloadRawBytes {
    -        DOMString key;
    -
    -        byte[] value;
    -    };
    -
    -    [NoInterfaceObject] interface ClientInfo {
    -        readonly attribute boolean isHost;
    -
    -        readonly attribute DOMString clientId;
    -
    -        readonly attribute long connectionTime;
    -    };
    -
    -    [Callback, NoInterfaceObject] interface DiscoverySuccessCallback {
    -
    -        void onfound(Device device);
    -
    -        void onfinished(Device[] foundDevices);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlCallback {
    -
    -        void onsuccess(optional ApplicationControlData[]? data);
    -
    -        void onfailure();
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface ConnectSuccessCallback {
    -
    -        void onsuccess(Service service);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlStartCallback {
    -
    -        void onsuccess(Service service);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationSuccessCallback {
    -
    -        void onsuccess(ChannelInfo channelInfo);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationStartCallback {
    -
    -        void onsuccess(ChannelInfo channelInfo, ClientInfo clientInfo);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationClientListCallback {
    -
    -        void onsuccess(ClientInfo[] clients);
    -    };
    -
    -    [Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationListenerCallback {
    -
    -        void onnotify(ChannelInfo channelInfo, Payload[] payload, DOMString senderClientId);
    -    };
    -};
    -
    - - - diff --git a/org.tizen.web.apireference/html/index.htm b/org.tizen.web.apireference/html/index.htm index 6fa8462..73b601d 100644 --- a/org.tizen.web.apireference/html/index.htm +++ b/org.tizen.web.apireference/html/index.htm @@ -56,7 +56,6 @@
  • Network