</head>
<body id="page-content" onload="prettyPrint()">
<div class="api" id="::Convergence">
-<div class="supported-platforms"><img class="mobile-optional" title="Optional, Supported by Tizen Mobile emulator" src="mobile_s_w_optional.png"></div>
+<div class="supported-platforms"><img class="mobile-mandatory emulator" title="Mandatory, Supported by Tizen Mobile emulator" src="mobile_s_w.png"></div>
<div class="title"><h1>Convergence API</h1></div>
<div class="brief">
The Convergence API defines interfaces and methods
<li>
1.5. <a href="#ConnectionState">ConnectionState</a>
</li>
+<li>
+ 1.6. <a href="#ServiceType">ServiceType</a>
+</li>
</ul>
</li>
<li>2. <a href="#interfaces-section">Interfaces</a><ul class="toc">
</li>
<li>2.15. <a href="#ConnectSuccessCallback">ConnectSuccessCallback</a>
</li>
-<li>2.16. <a href="#AppCommunicationSuccessCallback">AppCommunicationSuccessCallback</a>
+<li>2.16. <a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a>
</li>
-<li>2.17. <a href="#AppCommunicationStartCallback">AppCommunicationStartCallback</a>
+<li>2.17. <a href="#AppCommunicationSuccessCallback">AppCommunicationSuccessCallback</a>
</li>
-<li>2.18. <a href="#AppCommunicationClientListCallback">AppCommunicationClientListCallback</a>
+<li>2.18. <a href="#AppCommunicationStartCallback">AppCommunicationStartCallback</a>
</li>
-<li>2.19. <a href="#AppCommunicationListenerCallback">AppCommunicationListenerCallback</a>
+<li>2.19. <a href="#AppCommunicationClientListCallback">AppCommunicationClientListCallback</a>
+</li>
+<li>2.20. <a href="#AppCommunicationListenerCallback">AppCommunicationListenerCallback</a>
</li>
</ul>
</li>
<tr>
<td><a href="#RemoteAppControlService">RemoteAppControlService</a></td>
<td>
+<div>void <a href="#RemoteAppControlService::start">start</a> (<a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a> successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
+<div>void <a href="#RemoteAppControlService::stop">stop</a> (optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
<div>void <a href="#RemoteAppControlService::connect">connect</a> (<a href="#ConnectSuccessCallback">ConnectSuccessCallback</a> successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
<div>void <a href="#RemoteAppControlService::disconnect">disconnect</a> (optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
-<div>void <a href="#RemoteAppControlService::launch">launch</a> (<a href="application.html#ApplicationId">ApplicationId</a> appId, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
-<div>void <a href="#RemoteAppControlService::launchAppControl">launchAppControl</a> (<a href="application.html#ApplicationControl">ApplicationControl</a> appControl, optional <a href="application.html#ApplicationId">ApplicationId</a>? appId, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
+<div>void <a href="#RemoteAppControlService::launch">launch</a> (<a href="application.html#ApplicationId">ApplicationId</a> appId, optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
+<div>void <a href="#RemoteAppControlService::launchAppControl">launchAppControl</a> (<a href="application.html#ApplicationControl">ApplicationControl</a> appControl, optional <a href="application.html#ApplicationId">ApplicationId</a>? appId, optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? replyCallback)</div>
</td>
</tr>
<tr>
</tr>
<tr>
<td><a href="#RemoteAppControlCallback">RemoteAppControlCallback</a></td>
-<td><div>void <a href="#RemoteAppControlCallback::onsuccess">onsuccess</a> (optional <a href="application.html#ApplicationControlData">ApplicationControlData</a>[]? data)</div></td>
+<td>
+<div>void <a href="#RemoteAppControlCallback::onsuccess">onsuccess</a> (optional <a href="application.html#ApplicationControlData">ApplicationControlData</a>[]? data)</div>
+<div>void <a href="#RemoteAppControlCallback::onfailure">onfailure</a> ()</div>
+</td>
</tr>
<tr>
<td><a href="#ConnectSuccessCallback">ConnectSuccessCallback</a></td>
<td><div>void <a href="#ConnectSuccessCallback::onsuccess">onsuccess</a> (<a href="#Service">Service</a> service)</div></td>
</tr>
<tr>
+<td><a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a></td>
+<td><div>void <a href="#RemoteAppControlStartCallback::onsuccess">onsuccess</a> (<a href="#Service">Service</a> service)</div></td>
+</tr>
+<tr>
<td><a href="#AppCommunicationSuccessCallback">AppCommunicationSuccessCallback</a></td>
<td><div>void <a href="#AppCommunicationSuccessCallback::onsuccess">onsuccess</a> (<a href="#ChannelInfo">ChannelInfo</a> channelInfo)</div></td>
</tr>
</ul>
</div>
</div>
+<div class="enum" id="ServiceType">
+<a class="backward-compatibility-anchor" name="::Convergence::ServiceType"></a><h3>1.6. ServiceType</h3>
+<div class="brief">
+ Enumeration of service type.
+ </div>
+<pre class="webidl prettyprint"> enum ServiceType{"APP_COMM_CLIENT", "APP_COMM_SERVER", "REMOTE_APP_CONTROL"};</pre>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="description">
+ <p>
+The following values are supported:
+ </p>
+ <ul>
+ <li>
+APP_COMM_CLIENT - Application communication client service. </li>
+ <li>
+APP_COMM_SERVER - Application communication server service. </li>
+ <li>
+REMOTE_APP_CONTROL - Remote application control service. </li>
+ </ul>
+ </div>
+</div>
</div>
<div class="interfaces" id="interfaces-section">
<h2>2. Interfaces</h2>
<span class="name">timeout</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Duration of discovery procedure in seconds. If this
value is omitted or <em>null</em> is passed, the default timeout
-is 60 seconds.
+is 5 seconds.
</li>
</ul>
</div>
<pre class="webidl prettyprint"> [NoInterfaceObject] interface Service {
readonly attribute <a href="#ConnectionState">ConnectionState</a> connectionState;
+
+ readonly attribute <a href="#ServiceType">ServiceType</a> type;
};</pre>
<p><span class="version">
Since: </span>
Since: </span>
3.0
</p>
-</li></ul>
+</li>
+<li class="attribute" id="Service::type">
+<span class="attrName"><span class="readonly"> readonly
+</span><span class="type">ServiceType </span><span class="name">type</span></span><div class="brief">
+ The service type.
+ </div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+</li>
+</ul>
</div>
</div>
<div class="interface" id="AppCommunicationService">
<ul>
<li>
AbortError: If any system error occurred </li>
+ <li>
+ InvalidStateError: If the service has already started the channel. Note some services don't require a connection and disconnection procedures </li>
</ul>
</div>
<p><span class="privilegelevel">
with error type SecurityError, if the
application does not have the privilege to call this method.
</p></li>
-<li class="list"><p>
- with error type InvalidStateError, if the
-service is started already. <br>Note some services don't require
-a connection and disconnection procedures.
- </p></li>
</ul>
</li></ul>
</div>
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
clientService = service;
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "APP_COMM_CLIENT")
{
if (device.services[i].connectionState != "CONNECTED")
{
<li>
AbortError: If any system error occurred </li>
<li>
- InvalidValuesError: If any of the input parameters contain an
-invalid value </li>
+ InvalidValuesError: If any of the input parameters contain an invalid value </li>
+ <li>
+ InvalidStateError: If the service has not started the channel </li>
</ul>
</div>
<p><span class="privilegelevel">
with error type SecurityError, if the
application does not have the privilege to call this method.
</p></li>
-<li class="list"><p>
- with error type InvalidStateError, if the
-service is not started yet.
- </p></li>
</ul>
</li></ul>
</div>
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
clientService = service;
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "APP_COMM_CLIENT")
{
if (device.services[i].connectionState != "CONNECTED")
{
<li>
AbortError: If any system error occurred </li>
<li>
- InvalidValuesError: If any of the input parameters contain an
-invalid value </li>
+ InvalidValuesError: If any of the input parameters contain an invalid value </li>
+ <li>
+ InvalidStateError: If the service has not started the channel </li>
</ul>
</div>
<p><span class="privilegelevel">
with error type SecurityError, if the
application does not have the privilege to call this method.
</p></li>
-<li class="list"><p>
- with error type InvalidStateError, if the
-service is not started yet.
- </p></li>
</ul>
</li></ul>
</div>
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
clientService = service;
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "APP_COMM_CLIENT")
{
if (device.services[i].connectionState != "CONNECTED")
{
<li>
AbortError: If any system error occurred </li>
<li>
- InvalidValuesError: If any of the input parameters contain an
-invalid value </li>
+ InvalidValuesError: If any of the input parameters contain an invalid value </li>
+ <li>
+ InvalidStateError: If the service has not started the channel </li>
</ul>
</div>
<p><span class="privilegelevel">
with error type SecurityError, if the
application does not have the privilege to call this method.
</p></li>
-<li class="list"><p>
- with error type InvalidStateError, if the
-service is not started yet.
- </p></li>
</ul>
</li></ul>
</div>
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
clientService = service;
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "APP_COMM_CLIENT")
{
if (device.services[i].connectionState != "CONNECTED")
{
/* Create an instance of app communication server service object */
var service = new tizen.AppCommunicationServerService();
-var service.start(requestChannel, onstarted, onerror);
/* Register listener to receive notifications from remote service */
service.setListener(onnotify);
+service.start(requestChannel, onstarted, onerror);
</pre>
</div>
<div class="output">
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
service.start(requestChannel, onstarted, onerror);
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "APP_COMM_CLIENT")
{
if (device.services[i].connectionState != "CONNECTED")
{
Privilege: </span>
http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
</p>
+<p class="warning"><b>Warning:</b>
+ Connecting is only supported for services on devices not connected via WiFi.
+For devices connected via WiFi, <a href="convergence.html#ConnectionState">connectionState</a> will always be <em>"CONNECTED"</em>.
+ </p>
<p><span class="remark"> Remark: </span>
App developers do not need to specify the connectivity type
explicitly. The framework automatically determines which connectivity
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
}
- else if (service instanceof RemoteAppControlService)
+ else if (service.type === "REMOTE_APP_CONTROL")
{
console.log('Connected to the remote app control service');
}
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ 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] instanceof RemoteAppControlService)
+ else if (device.services[i].type === "REMOTE_APP_CONTROL")
{
if (device.services[i].connectionState != "CONNECTED")
{
Privilege: </span>
http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
</p>
+<p class="warning"><b>Warning:</b>
+ Disconnecting is only supported for services on devices not connected via WiFi.
+ </p>
<p><span class="remark"> Remark: </span>
Example of using can be found at <a href="convergence.html#AppCommunicationClientService::connect">connect()</a> code example.
</p>
Sending data for the service </li>
</ul>
</div>
+<p class="warning"><b>Warning:</b>
+ AppCommunicationServerService API is supported on Tizen 3.0 TV product only.
+ </p>
<p><span class="remark"> Remark: </span>
application server service is used without discovery phase.
The developer should instantiate a standalone service object using
remote application control service features.
</div>
<pre class="webidl prettyprint"> [NoInterfaceObject] interface RemoteAppControlService : <a href="#Service">Service</a> {
+ void start(<a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a> successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+
+ void stop(optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void connect(<a href="#ConnectSuccessCallback">ConnectSuccessCallback</a> successCallback,
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void launch(<a href="application.html#ApplicationId">ApplicationId</a> appId,
- optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback,
+ optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void launchAppControl(<a href="application.html#ApplicationControl">ApplicationControl</a> appControl,
optional <a href="application.html#ApplicationId">ApplicationId</a>? appId,
- optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback,
- optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback,
+ optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? replyCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+
};</pre>
<p><span class="version">
Since: </span>
<div class="methods">
<h4>Methods</h4>
<dl>
+<dt class="method" id="RemoteAppControlService::start">
+<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlService::start"></a><code><b><span class="methodName">start</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Starts and initiates remote service.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void start(<a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a> successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="description">
+ <p>
+This method starts the remote app control service.
+ </p>
+ </div>
+<div class="description">
+ <p>
+The ErrorCallback is launched with these error types:
+ </p>
+ <ul>
+ <li>
+ AbortError: If any system error occurred </li>
+ </ul>
+ </div>
+<p><span class="privilege">
+ Privilege: </span>
+ http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
+ </p>
+<p><span class="remark"> Remark : </span>
+ Before using this method for remote application service, the service must be connected with the
+<a href="convergence.html#RemoteAppControlService::connect">connect()</a> method.
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">successCallback</span>:
+ The method to invoke on success
+ </li>
+ <li class="param">
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The method to invoke on failure
+ </li>
+ </ul>
+</div>
+<div class="exceptionlist">
+<p><span class="except">Exceptions:</span></p>
+ <ul class="exception"><li>WebAPIException<ul>
+<li class="list"><p>
+ with error type TypeMismatchError, if any
+input parameter is not compatible with the expected type for that
+parameter.
+ </p></li>
+<li class="list"><p>
+ with error type SecurityError, if the
+application does not have the privilege to call this method.
+ </p></li>
+<li class="list"><p>
+ with error type InvalidStateError, if the
+the service is already started.
+ </p></li>
+<li class="list"><p>
+ with error type AbortError, if the
+other error occurs during start.
+ </p></li>
+</ul>
+</li></ul>
+ </div>
+<div class="example">
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+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);
+</pre>
+</div>
+<div class="output">
+<span class="title"><p>Output example:</p></span><pre> >> 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
+</pre>
+</div>
+</dd>
+<dt class="method" id="RemoteAppControlService::stop">
+<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlService::stop"></a><code><b><span class="methodName">stop</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Stops remote service.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void stop(optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="description">
+ <p>
+This method stops and release internally allocated resources for remote service.
+ </p>
+ </div>
+<div class="description">
+ <p>
+The ErrorCallback is launched with these error types:
+ </p>
+ <ul>
+ <li>
+ AbortError: If any system error occurred </li>
+ </ul>
+ </div>
+<p><span class="privilege">
+ Privilege: </span>
+ http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The method to invoke on success
+ </li>
+ <li class="param">
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The method to invoke on failure
+ </li>
+ </ul>
+</div>
+<div class="exceptionlist">
+<p><span class="except">Exceptions:</span></p>
+ <ul class="exception"><li>WebAPIException<ul>
+<li class="list"><p>
+ with error type TypeMismatchError, if any
+input parameter is not compatible with the expected type for that
+parameter.
+ </p></li>
+<li class="list"><p>
+ with error type SecurityError, if the
+application does not have the privilege to call this method.
+ </p></li>
+<li class="list"><p>
+ with error type InvalidStateError, if the
+the service is not started yet.
+ </p></li>
+<li class="list"><p>
+ with error type AbortError, if the
+other error occurs during start.
+ </p></li>
+</ul>
+</li></ul>
+ </div>
+<div class="example">
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+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);
+</pre>
+</div>
+<div class="output">
+<span class="title"><p>Output example:</p></span><pre> >> 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
+</pre>
+</div>
+</dd>
<dt class="method" id="RemoteAppControlService::connect">
<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlService::connect"></a><code><b><span class="methodName">connect</span></b></code>
</dt>
Privilege: </span>
http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
</p>
+<p class="warning"><b>Warning:</b>
+ Connecting is only supported for services on devices not connected via WiFi.
+For devices connected via WiFi, <a href="convergence.html#ConnectionState">connectionState</a> will always be <em>"CONNECTED"</em>.
+ </p>
<p><span class="remark"> Remark: </span>
App developers do not need to specify the connectivity type
explicitly. Framework automatically determines which connectivity
function onconnected(service)
{
- console.log('Connected to the service');
- if (service instanceof RemoteAppControlService)
- {
- console.log('Connected to the remote app control service');
- }
- else if (service instanceof AppCommunicationClientService))
- {
- console.log('Connected to the app communication client service');
- }
+ console.log('Connected to the remote app control service');
service.disconnect();
}
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);
- }
- }
- else if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
{
if (device.services[i].connectionState != "CONNECTED")
{
}
};
-try
-{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
-}
-catch (err)
-{
- console.log(err.name + ': ' + err.message);
-}
+console.log('>> STARTING DEVICE DISCOVERY');
+tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
</pre>
</div>
<div class="output">
- 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
</pre>
</div>
Privilege: </span>
http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
</p>
+<p class="warning"><b>Warning:</b>
+ Disconnecting is only supported for services on devices not connected via WiFi.
+ </p>
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<ul>
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof RemoteAppControlService)
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
{
if (device.services[i].connectionState == "CONNECTED")
{
<div class="brief">
Sends the given application ID to launch an application on the remote device.
</div>
-<div class="synopsis"><pre class="signature prettyprint">void launch(<a href="application.html#ApplicationId">ApplicationId</a> appId, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback);
+<div class="synopsis"><pre class="signature prettyprint">void launch(<a href="application.html#ApplicationId">ApplicationId</a> appId, optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback);
</pre></div>
<p><span class="version">
Since: </span>
Before using this method, the service must be connected
with
<a href="convergence.html#RemoteAppControlService::connect">connect()</a> method
-correspondingly.
+and started with <a href="convergence.html#RemoteAppControlService::start">start()</a> method.
</p>
<div class="parameters">
<p><span class="param">Parameters:</span></p>
console.log(err.name + ': ' + err.message);
}
-function remoteAppControlCallback(data)
+function onsuccess()
{
- console.log('On remote app control service reply');
- console.log('clientId: ' + clientId);
- for (var i = 0; i data.length; i++)
- {
- console.log("key: " + data[i].key + "value: " + data[i].value[0]);
- }
+ console.log('The application has launched successfully');
}
-function onconnected(service)
+function onstarted(service)
{
- console.log('Connected to the 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(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof RemoteAppControlService)
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
{
if (device.services[i].connectionState != "CONNECTED")
{
}
};
-try
-{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
-}
-catch (err)
-{
- console.log(err.name + ': ' + err.message);
-}
+console.log('>> STARTING DEVICE DISCOVERY');
+tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
</pre>
</div>
<div class="output">
- service amount: 2
<< Device discovery has finished
Connected to the service
+ Service started
+ The application has launched successfully
</pre>
</div>
</dd>
<div class="brief">
Sends an app control to launch an application on the remote device.
</div>
-<div class="synopsis"><pre class="signature prettyprint">void launchAppControl(<a href="application.html#ApplicationControl">ApplicationControl</a> appControl, optional <a href="application.html#ApplicationId">ApplicationId</a>? appId, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback);
+<div class="synopsis"><pre class="signature prettyprint">void launchAppControl(<a href="application.html#ApplicationControl">ApplicationControl</a> appControl, optional <a href="application.html#ApplicationId">ApplicationId</a>? appId, optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? replyCallback);
</pre></div>
<p><span class="version">
Since: </span>
</p>
<p><span class="remark"> Remark: </span>
Before using this method, the service must be connected with
-<a href="convergence.html#RemoteAppControlService::connect">connect()</a> method.
+<a href="convergence.html#RemoteAppControlService::connect">connect()</a> method
+and started with <a href="convergence.html#RemoteAppControlService::start">start()</a> method.
</p>
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on failure.
</li>
+ <li class="param">
+<span class="name">replyCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The method to invoke when the application gets back result from the remote service.
+ </li>
</ul>
</div>
<div class="exceptionlist">
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);
}
-function remoteAppControlCallback(data)
+var remoteAppControlCallback =
{
- console.log('On remote app control service reply');
- for (var i = 0; i data.length; i++)
+ 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("key: " + data[i].key + "value: " + data[i].value[0]);
+ 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');
- /* Send data to the remote service */
- service.launchAppControl(requestAppControl, null, remoteAppControlCallback, onerror);
+ /* Start the service */
+ service.start(onstarted, onerror);
}
var discoverySuccessCallback =
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof RemoteAppControlService)
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
{
if (device.services[i].connectionState != "CONNECTED")
{
- service amount: 2
<< Device discovery has finished
Connected to the service
+ Service started
</pre>
</div>
</dd>
</dl>
</div>
</div>
-<div class="dictionary" id="ClientInfo">
+<div class="interface" id="ClientInfo">
<a class="backward-compatibility-anchor" name="::Convergence::ClientInfo"></a><h3>2.12. ClientInfo</h3>
<div class="brief">
- The dictionary that specifies client information.
+ The interface specifies client information.
</div>
-<pre class="webidl prettyprint"> dictionary ClientInfo {
- boolean isHost;
+<pre class="webidl prettyprint"> [NoInterfaceObject] interface ClientInfo {
+ readonly attribute boolean isHost;
- DOMString clientId;
+ readonly attribute DOMString clientId;
- long connectionTime;
+ readonly attribute long connectionTime;
};</pre>
<p><span class="version">
Since: </span>
3.0
</p>
<div class="attributes">
-<h4>Dictionary members</h4>
-<dl>
-<dt class="member" id="ClientInfo::isHost"><span class="attrName">boolean isHost</span></dt>
-<dd>
-<div class="brief">
- The value indicating if the service is local (true) or
-remote (false).
+<h4>Attributes</h4>
+<ul>
+<li class="attribute" id="ClientInfo::isHost">
+<span class="attrName"><span class="readonly"> readonly
+</span><span class="type">boolean </span><span class="name">isHost</span></span><div class="brief">
+ The value indicating if the service is local (true) or remote (false).
</div>
<p><span class="version">
Since: </span>
3.0
</p>
-</dd>
-<dt class="member" id="ClientInfo::clientId"><span class="attrName">DOMString clientId</span></dt>
-<dd>
-<div class="brief">
+</li>
+<li class="attribute" id="ClientInfo::clientId">
+<span class="attrName"><span class="readonly"> readonly
+</span><span class="type">DOMString </span><span class="name">clientId</span></span><div class="brief">
The unique client id.
</div>
<p><span class="version">
Since: </span>
3.0
</p>
-</dd>
-<dt class="member" id="ClientInfo::connectionTime"><span class="attrName">long connectionTime</span></dt>
-<dd>
-<div class="brief">
+</li>
+<li class="attribute" id="ClientInfo::connectionTime">
+<span class="attrName"><span class="readonly"> readonly
+</span><span class="type">long </span><span class="name">connectionTime</span></span><div class="brief">
The connection time in milliseconds.
</div>
<p><span class="version">
Since: </span>
3.0
</p>
-</dd>
-</dl>
+</li>
+</ul>
</div>
</div>
<div class="interface" id="DiscoverySuccessCallback">
<div class="interface" id="RemoteAppControlCallback">
<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlCallback"></a><h3>2.14. RemoteAppControlCallback</h3>
<div class="brief">
- The <em>RemoteAppControlCallback</em> interface defines the
-success method to be invoked when a service sends app control
-successfully.
+ The RemoteAppControlCallback specifies callbacks that are invoked as a reply
+from the requested application control within the application control requester.
</div>
<pre class="webidl prettyprint"> [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlCallback {
void onsuccess(optional <a href="application.html#ApplicationControlData">ApplicationControlData</a>[]? data);
+
+ void onfailure();
};</pre>
<p><span class="version">
Since: </span>
<div class="description">
<p>
The callback of this type is invoked in
-<a href="convergence.html#RemoteAppControlService::launch">launch()</a> and
-<a href="convergence.html#RemoteAppControlService::launchAppControl">launchAppControl()</a> methods.
+<a href="convergence.html#RemoteAppControlService::launchAppControl">launchAppControl()</a> method.
</p>
</div>
<div class="methods">
</dt>
<dd>
<div class="brief">
- The RemoteAppControlCallback callback specifies success callbacks that are invoked as a reply
-from the requested application control within the application control requester.
+ Called when the received reply from the requested application on the remote device has no errors.
</div>
<div class="synopsis"><pre class="signature prettyprint">void onsuccess(optional <a href="application.html#ApplicationControlData">ApplicationControlData</a>[]? data);
</pre></div>
</ul>
</div>
</dd>
+<dt class="method" id="RemoteAppControlCallback::onfailure">
+<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlCallback::onfailure"></a><code><b><span class="methodName">onfailure</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Called when the received reply from the requested application on the remote device contains any error.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void onfailure();
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+</dd>
</dl>
</div>
</div>
<div class="description">
<p>
The callback of this type is invoked in
-<a href="convergence.html#AppCommunicationClientService::connect">connect()</a> and
-<a href="convergence.html#RemoteAppControlService::connect">connect()</a> methods.
+<a href="convergence.html#AppCommunicationClientService::connect">connect()</a> of AppCommunicationClientService and
+<a href="convergence.html#RemoteAppControlService::connect">connect()</a> of RemoteAppControlService methods.
</p>
</div>
<div class="methods">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">service</span>:
+<span class="name">service</span>:
+ The connected service on a remote device.
+ </li>
+ </ul>
+</div>
+</dd>
+</dl>
+</div>
+</div>
+<div class="interface" id="RemoteAppControlStartCallback">
+<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlStartCallback"></a><h3>2.16. RemoteAppControlStartCallback</h3>
+<div class="brief">
+ The <em>RemoteAppControlStartCallback</em> interface defines the success method
+to be invoked when a RemoteAppControlService is started.
+ </div>
+<pre class="webidl prettyprint"> [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlStartCallback {
+
+ void onsuccess(<a href="#Service">Service</a> service);
+ };</pre>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="description">
+ <p>
+The callback of this type is invoked in
+<a href="convergence.html#RemoteAppControlService::start">start()</a> of RemoteAppControlService methods.
+ </p>
+ </div>
+<div class="methods">
+<h4>Methods</h4>
+<dl>
+<dt class="method" id="RemoteAppControlStartCallback::onsuccess">
+<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlStartCallback::onsuccess"></a><code><b><span class="methodName">onsuccess</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Called when the service connection is established.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void onsuccess(<a href="#Service">Service</a> service);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">service</span>:
The connected service on a remote device.
</li>
</ul>
</div>
</div>
<div class="interface" id="AppCommunicationSuccessCallback">
-<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationSuccessCallback"></a><h3>2.16. AppCommunicationSuccessCallback</h3>
+<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationSuccessCallback"></a><h3>2.17. AppCommunicationSuccessCallback</h3>
<div class="brief">
The <em>AppCommunicationSuccessCallback</em> interface defines the success method
to be invoked when a service operation, such as stop or send is successful.
</div>
</div>
<div class="interface" id="AppCommunicationStartCallback">
-<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationStartCallback"></a><h3>2.17. AppCommunicationStartCallback</h3>
+<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationStartCallback"></a><h3>2.18. AppCommunicationStartCallback</h3>
<div class="brief">
The <em>AppCommunicationStartCallback</em> interface defines the success method
to be invoked when a start service operation is successful.
</div>
</div>
<div class="interface" id="AppCommunicationClientListCallback">
-<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationClientListCallback"></a><h3>2.18. AppCommunicationClientListCallback</h3>
+<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationClientListCallback"></a><h3>2.19. AppCommunicationClientListCallback</h3>
<div class="brief">
The <em>AppCommunicationClientListCallback</em> interface defines the
method to be invoked when requested a list of clients, connected to
</div>
</div>
<div class="interface" id="AppCommunicationListenerCallback">
-<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationListenerCallback"></a><h3>2.19. AppCommunicationListenerCallback</h3>
+<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationListenerCallback"></a><h3>2.20. AppCommunicationListenerCallback</h3>
<div class="brief">
The <em>AppCommunicationListenerCallback</em> interface defines the
method to be invoked when a service notification is received
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;
[NoInterfaceObject] interface Service {
readonly attribute <a href="#ConnectionState">ConnectionState</a> connectionState;
+
+ readonly attribute <a href="#ServiceType">ServiceType</a> type;
};
[NoInterfaceObject] interface AppCommunicationService : <a href="#Service">Service</a> {
};
[NoInterfaceObject] interface RemoteAppControlService : <a href="#Service">Service</a> {
+ void start(<a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a> successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+
+ void stop(optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void connect(<a href="#ConnectSuccessCallback">ConnectSuccessCallback</a> successCallback,
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void launch(<a href="application.html#ApplicationId">ApplicationId</a> appId,
- optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback,
+ optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void launchAppControl(<a href="application.html#ApplicationControl">ApplicationControl</a> appControl,
optional <a href="application.html#ApplicationId">ApplicationId</a>? appId,
- optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback,
- optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback,
+ optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? replyCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+
};
dictionary PayloadString {
byte[] value;
};
- dictionary ClientInfo {
- boolean isHost;
+ [NoInterfaceObject] interface ClientInfo {
+ readonly attribute boolean isHost;
- DOMString clientId;
+ readonly attribute DOMString clientId;
- long connectionTime;
+ readonly attribute long connectionTime;
};
[Callback, NoInterfaceObject] interface DiscoverySuccessCallback {
[Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlCallback {
void onsuccess(optional <a href="application.html#ApplicationControlData">ApplicationControlData</a>[]? data);
+
+ void onfailure();
};
[Callback=FunctionOnly, NoInterfaceObject] interface ConnectSuccessCallback {
void onsuccess(<a href="#Service">Service</a> service);
};
+ [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlStartCallback {
+
+ void onsuccess(<a href="#Service">Service</a> service);
+ };
+
[Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationSuccessCallback {
void onsuccess(<a href="#ChannelInfo">ChannelInfo</a> channelInfo);
<li>
1.5. <a href="#ConnectionState">ConnectionState</a>
</li>
+<li>
+ 1.6. <a href="#ServiceType">ServiceType</a>
+</li>
</ul>
</li>
<li>2. <a href="#interfaces-section">Interfaces</a><ul class="toc">
</li>
<li>2.15. <a href="#ConnectSuccessCallback">ConnectSuccessCallback</a>
</li>
-<li>2.16. <a href="#AppCommunicationSuccessCallback">AppCommunicationSuccessCallback</a>
+<li>2.16. <a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a>
</li>
-<li>2.17. <a href="#AppCommunicationStartCallback">AppCommunicationStartCallback</a>
+<li>2.17. <a href="#AppCommunicationSuccessCallback">AppCommunicationSuccessCallback</a>
</li>
-<li>2.18. <a href="#AppCommunicationClientListCallback">AppCommunicationClientListCallback</a>
+<li>2.18. <a href="#AppCommunicationStartCallback">AppCommunicationStartCallback</a>
</li>
-<li>2.19. <a href="#AppCommunicationListenerCallback">AppCommunicationListenerCallback</a>
+<li>2.19. <a href="#AppCommunicationClientListCallback">AppCommunicationClientListCallback</a>
+</li>
+<li>2.20. <a href="#AppCommunicationListenerCallback">AppCommunicationListenerCallback</a>
</li>
</ul>
</li>
<tr>
<td><a href="#RemoteAppControlService">RemoteAppControlService</a></td>
<td>
+<div>void <a href="#RemoteAppControlService::start">start</a> (<a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a> successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
+<div>void <a href="#RemoteAppControlService::stop">stop</a> (optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
<div>void <a href="#RemoteAppControlService::connect">connect</a> (<a href="#ConnectSuccessCallback">ConnectSuccessCallback</a> successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
<div>void <a href="#RemoteAppControlService::disconnect">disconnect</a> (optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
-<div>void <a href="#RemoteAppControlService::launch">launch</a> (<a href="application.html#ApplicationId">ApplicationId</a> appId, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
-<div>void <a href="#RemoteAppControlService::launchAppControl">launchAppControl</a> (<a href="application.html#ApplicationControl">ApplicationControl</a> appControl, optional <a href="application.html#ApplicationId">ApplicationId</a>? appId, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
+<div>void <a href="#RemoteAppControlService::launch">launch</a> (<a href="application.html#ApplicationId">ApplicationId</a> appId, optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
+<div>void <a href="#RemoteAppControlService::launchAppControl">launchAppControl</a> (<a href="application.html#ApplicationControl">ApplicationControl</a> appControl, optional <a href="application.html#ApplicationId">ApplicationId</a>? appId, optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? replyCallback)</div>
</td>
</tr>
<tr>
</tr>
<tr>
<td><a href="#RemoteAppControlCallback">RemoteAppControlCallback</a></td>
-<td><div>void <a href="#RemoteAppControlCallback::onsuccess">onsuccess</a> (optional <a href="application.html#ApplicationControlData">ApplicationControlData</a>[]? data)</div></td>
+<td>
+<div>void <a href="#RemoteAppControlCallback::onsuccess">onsuccess</a> (optional <a href="application.html#ApplicationControlData">ApplicationControlData</a>[]? data)</div>
+<div>void <a href="#RemoteAppControlCallback::onfailure">onfailure</a> ()</div>
+</td>
</tr>
<tr>
<td><a href="#ConnectSuccessCallback">ConnectSuccessCallback</a></td>
<td><div>void <a href="#ConnectSuccessCallback::onsuccess">onsuccess</a> (<a href="#Service">Service</a> service)</div></td>
</tr>
<tr>
+<td><a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a></td>
+<td><div>void <a href="#RemoteAppControlStartCallback::onsuccess">onsuccess</a> (<a href="#Service">Service</a> service)</div></td>
+</tr>
+<tr>
<td><a href="#AppCommunicationSuccessCallback">AppCommunicationSuccessCallback</a></td>
<td><div>void <a href="#AppCommunicationSuccessCallback::onsuccess">onsuccess</a> (<a href="#ChannelInfo">ChannelInfo</a> channelInfo)</div></td>
</tr>
</ul>
</div>
</div>
+<div class="enum" id="ServiceType">
+<a class="backward-compatibility-anchor" name="::Convergence::ServiceType"></a><h3>1.6. ServiceType</h3>
+<div class="brief">
+ Enumeration of service type.
+ </div>
+<pre class="webidl prettyprint"> enum ServiceType{"APP_COMM_CLIENT", "APP_COMM_SERVER", "REMOTE_APP_CONTROL"};</pre>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="description">
+ <p>
+The following values are supported:
+ </p>
+ <ul>
+ <li>
+APP_COMM_CLIENT - Application communication client service. </li>
+ <li>
+APP_COMM_SERVER - Application communication server service. </li>
+ <li>
+REMOTE_APP_CONTROL - Remote application control service. </li>
+ </ul>
+ </div>
+</div>
</div>
<div class="interfaces" id="interfaces-section">
<h2>2. Interfaces</h2>
<span class="name">timeout</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Duration of discovery procedure in seconds. If this
value is omitted or <em>null</em> is passed, the default timeout
-is 60 seconds.
+is 5 seconds.
</li>
</ul>
</div>
<pre class="webidl prettyprint"> [NoInterfaceObject] interface Service {
readonly attribute <a href="#ConnectionState">ConnectionState</a> connectionState;
+
+ readonly attribute <a href="#ServiceType">ServiceType</a> type;
};</pre>
<p><span class="version">
Since: </span>
Since: </span>
3.0
</p>
-</li></ul>
+</li>
+<li class="attribute" id="Service::type">
+<span class="attrName"><span class="readonly"> readonly
+</span><span class="type">ServiceType </span><span class="name">type</span></span><div class="brief">
+ The service type.
+ </div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+</li>
+</ul>
</div>
</div>
<div class="interface" id="AppCommunicationService">
<ul>
<li>
AbortError: If any system error occurred </li>
+ <li>
+ InvalidStateError: If the service has already started the channel. Note some services don't require a connection and disconnection procedures </li>
</ul>
</div>
<p><span class="privilegelevel">
with error type SecurityError, if the
application does not have the privilege to call this method.
</p></li>
-<li class="list"><p>
- with error type InvalidStateError, if the
-service is started already. <br>Note some services don't require
-a connection and disconnection procedures.
- </p></li>
</ul>
</li></ul>
</div>
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
clientService = service;
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "APP_COMM_CLIENT")
{
if (device.services[i].connectionState != "CONNECTED")
{
<li>
AbortError: If any system error occurred </li>
<li>
- InvalidValuesError: If any of the input parameters contain an
-invalid value </li>
+ InvalidValuesError: If any of the input parameters contain an invalid value </li>
+ <li>
+ InvalidStateError: If the service has not started the channel </li>
</ul>
</div>
<p><span class="privilegelevel">
with error type SecurityError, if the
application does not have the privilege to call this method.
</p></li>
-<li class="list"><p>
- with error type InvalidStateError, if the
-service is not started yet.
- </p></li>
</ul>
</li></ul>
</div>
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
clientService = service;
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "APP_COMM_CLIENT")
{
if (device.services[i].connectionState != "CONNECTED")
{
<li>
AbortError: If any system error occurred </li>
<li>
- InvalidValuesError: If any of the input parameters contain an
-invalid value </li>
+ InvalidValuesError: If any of the input parameters contain an invalid value </li>
+ <li>
+ InvalidStateError: If the service has not started the channel </li>
</ul>
</div>
<p><span class="privilegelevel">
with error type SecurityError, if the
application does not have the privilege to call this method.
</p></li>
-<li class="list"><p>
- with error type InvalidStateError, if the
-service is not started yet.
- </p></li>
</ul>
</li></ul>
</div>
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
clientService = service;
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "APP_COMM_CLIENT")
{
if (device.services[i].connectionState != "CONNECTED")
{
<li>
AbortError: If any system error occurred </li>
<li>
- InvalidValuesError: If any of the input parameters contain an
-invalid value </li>
+ InvalidValuesError: If any of the input parameters contain an invalid value </li>
+ <li>
+ InvalidStateError: If the service has not started the channel </li>
</ul>
</div>
<p><span class="privilegelevel">
with error type SecurityError, if the
application does not have the privilege to call this method.
</p></li>
-<li class="list"><p>
- with error type InvalidStateError, if the
-service is not started yet.
- </p></li>
</ul>
</li></ul>
</div>
service.stop(requestChannel2, onstopped);
}
}
-</pre>
-</div>
-<div class="output">
-<span class="title"><p>Output example:</p></span><pre>
/* Create an instance of app communication server service object */
var service = new tizen.AppCommunicationServerService();
service.start(requestChannel1, onstarted, onerror);
service.start(requestChannel2, onstarted, onerror);
+</pre>
+</div>
+
+<div class="output">
+<span class="title"><p>Output example:</p></span><pre>
Channel started
channel uri: targetApp0.main
channel id: chA
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
clientService = service;
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "APP_COMM_CLIENT")
{
if (device.services[i].connectionState != "CONNECTED")
{
/* Create an instance of app communication server service object */
var service = new tizen.AppCommunicationServerService();
-var service.start(requestChannel, onstarted, onerror);
/* Register listener to receive notifications from remote service */
service.setListener(onnotify);
+service.start(requestChannel, onstarted, onerror);
</pre>
</div>
<div class="output">
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
service.start(requestChannel, onstarted, onerror);
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "APP_COMM_CLIENT")
{
if (device.services[i].connectionState != "CONNECTED")
{
Privilege: </span>
http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
</p>
+<p class="warning"><b>Warning:</b>
+ Connecting is only supported for services on devices not connected via WiFi.
+For devices connected via WiFi, <a href="convergence.html#ConnectionState">connectionState</a> will always be <em>"CONNECTED"</em>.
+ </p>
<p><span class="remark"> Remark: </span>
App developers do not need to specify the connectivity type
explicitly. The framework automatically determines which connectivity
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
}
- else if (service instanceof RemoteAppControlService)
+ else if (service.type === "REMOTE_APP_CONTROL")
{
console.log('Connected to the remote app control service');
}
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ 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] instanceof RemoteAppControlService)
+ else if (device.services[i].type === "REMOTE_APP_CONTROL")
{
if (device.services[i].connectionState != "CONNECTED")
{
Privilege: </span>
http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
</p>
+<p class="warning"><b>Warning:</b>
+ Disconnecting is only supported for services on devices not connected via WiFi.
+ </p>
<p><span class="remark"> Remark: </span>
Example of using can be found at <a href="convergence.html#AppCommunicationClientService::connect">connect()</a> code example.
</p>
Sending data for the service </li>
</ul>
</div>
+<p class="warning"><b>Warning:</b>
+ AppCommunicationServerService API is supported on Tizen 3.0 TV product only.
+ </p>
<p><span class="remark"> Remark: </span>
application server service is used without discovery phase.
The developer should instantiate a standalone service object using
remote application control service features.
</div>
<pre class="webidl prettyprint"> [NoInterfaceObject] interface RemoteAppControlService : <a href="#Service">Service</a> {
+ void start(<a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a> successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+
+ void stop(optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void connect(<a href="#ConnectSuccessCallback">ConnectSuccessCallback</a> successCallback,
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void launch(<a href="application.html#ApplicationId">ApplicationId</a> appId,
- optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback,
+ optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void launchAppControl(<a href="application.html#ApplicationControl">ApplicationControl</a> appControl,
optional <a href="application.html#ApplicationId">ApplicationId</a>? appId,
- optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback,
- optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback,
+ optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? replyCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+
};</pre>
<p><span class="version">
Since: </span>
<div class="methods">
<h4>Methods</h4>
<dl>
+<dt class="method" id="RemoteAppControlService::start">
+<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlService::start"></a><code><b><span class="methodName">start</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Starts and initiates remote service.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void start(<a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a> successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="description">
+ <p>
+This method starts the remote app control service.
+ </p>
+ </div>
+<div class="description">
+ <p>
+The ErrorCallback is launched with these error types:
+ </p>
+ <ul>
+ <li>
+ AbortError: If any system error occurred </li>
+ </ul>
+ </div>
+<p><span class="privilege">
+ Privilege: </span>
+ http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
+ </p>
+<p><span class="remark"> Remark : </span>
+ Before using this method for remote application service, the service must be connected with the
+<a href="convergence.html#RemoteAppControlService::connect">connect()</a> method.
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">successCallback</span>:
+ The method to invoke on success
+ </li>
+ <li class="param">
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The method to invoke on failure
+ </li>
+ </ul>
+</div>
+<div class="exceptionlist">
+<p><span class="except">Exceptions:</span></p>
+ <ul class="exception"><li>WebAPIException<ul>
+<li class="list"><p>
+ with error type TypeMismatchError, if any
+input parameter is not compatible with the expected type for that
+parameter.
+ </p></li>
+<li class="list"><p>
+ with error type SecurityError, if the
+application does not have the privilege to call this method.
+ </p></li>
+<li class="list"><p>
+ with error type InvalidStateError, if the
+the service is already started.
+ </p></li>
+<li class="list"><p>
+ with error type AbortError, if the
+other error occurs during start.
+ </p></li>
+</ul>
+</li></ul>
+ </div>
+<div class="example">
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+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);
+</pre>
+</div>
+<div class="output">
+<span class="title"><p>Output example:</p></span><pre> >> 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
+</pre>
+</div>
+</dd>
+<dt class="method" id="RemoteAppControlService::stop">
+<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlService::stop"></a><code><b><span class="methodName">stop</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Stops remote service.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void stop(optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="description">
+ <p>
+This method stops and release internally allocated resources for remote service.
+ </p>
+ </div>
+<div class="description">
+ <p>
+The ErrorCallback is launched with these error types:
+ </p>
+ <ul>
+ <li>
+ AbortError: If any system error occurred </li>
+ </ul>
+ </div>
+<p><span class="privilege">
+ Privilege: </span>
+ http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The method to invoke on success
+ </li>
+ <li class="param">
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The method to invoke on failure
+ </li>
+ </ul>
+</div>
+<div class="exceptionlist">
+<p><span class="except">Exceptions:</span></p>
+ <ul class="exception"><li>WebAPIException<ul>
+<li class="list"><p>
+ with error type TypeMismatchError, if any
+input parameter is not compatible with the expected type for that
+parameter.
+ </p></li>
+<li class="list"><p>
+ with error type SecurityError, if the
+application does not have the privilege to call this method.
+ </p></li>
+<li class="list"><p>
+ with error type InvalidStateError, if the
+the service is not started yet.
+ </p></li>
+<li class="list"><p>
+ with error type AbortError, if the
+other error occurs during start.
+ </p></li>
+</ul>
+</li></ul>
+ </div>
+<div class="example">
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+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);
+</pre>
+</div>
+<div class="output">
+<span class="title"><p>Output example:</p></span><pre> >> 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
+</pre>
+</div>
+</dd>
<dt class="method" id="RemoteAppControlService::connect">
<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlService::connect"></a><code><b><span class="methodName">connect</span></b></code>
</dt>
Privilege: </span>
http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
</p>
+<p class="warning"><b>Warning:</b>
+ Connecting is only supported for services on devices not connected via WiFi.
+For devices connected via WiFi, <a href="convergence.html#ConnectionState">connectionState</a> will always be <em>"CONNECTED"</em>.
+ </p>
<p><span class="remark"> Remark: </span>
App developers do not need to specify the connectivity type
explicitly. Framework automatically determines which connectivity
function onconnected(service)
{
- console.log('Connected to the service');
- if (service instanceof RemoteAppControlService)
- {
- console.log('Connected to the remote app control service');
- }
- else if (service instanceof AppCommunicationClientService))
- {
- console.log('Connected to the app communication client service');
- }
+ console.log('Connected to the remote app control service');
service.disconnect();
}
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);
- }
- }
- else if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
{
if (device.services[i].connectionState != "CONNECTED")
{
}
};
-try
-{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
-}
-catch (err)
-{
- console.log(err.name + ': ' + err.message);
-}
+console.log('>> STARTING DEVICE DISCOVERY');
+tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
</pre>
</div>
<div class="output">
- 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
</pre>
</div>
Privilege: </span>
http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
</p>
+<p class="warning"><b>Warning:</b>
+ Disconnecting is only supported for services on devices not connected via WiFi.
+ </p>
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<ul>
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof RemoteAppControlService)
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
{
if (device.services[i].connectionState == "CONNECTED")
{
<div class="brief">
Sends the given application ID to launch an application on the remote device.
</div>
-<div class="synopsis"><pre class="signature prettyprint">void launch(<a href="application.html#ApplicationId">ApplicationId</a> appId, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback);
+<div class="synopsis"><pre class="signature prettyprint">void launch(<a href="application.html#ApplicationId">ApplicationId</a> appId, optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback);
</pre></div>
<p><span class="version">
Since: </span>
Before using this method, the service must be connected
with
<a href="convergence.html#RemoteAppControlService::connect">connect()</a> method
-correspondingly.
+and started with <a href="convergence.html#RemoteAppControlService::start">start()</a> method.
</p>
<div class="parameters">
<p><span class="param">Parameters:</span></p>
console.log(err.name + ': ' + err.message);
}
-function remoteAppControlCallback(data)
+function onsuccess()
{
- console.log('On remote app control service reply');
- console.log('clientId: ' + clientId);
- for (var i = 0; i data.length; i++)
- {
- console.log("key: " + data[i].key + "value: " + data[i].value[0]);
- }
+ console.log('The application has launched successfully');
}
-function onconnected(service)
+function onstarted(service)
{
- console.log('Connected to the 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(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof RemoteAppControlService)
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
{
if (device.services[i].connectionState != "CONNECTED")
{
}
};
-try
-{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
-}
-catch (err)
-{
- console.log(err.name + ': ' + err.message);
-}
+console.log('>> STARTING DEVICE DISCOVERY');
+tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
</pre>
</div>
<div class="output">
- service amount: 2
<< Device discovery has finished
Connected to the service
+ Service started
+ The application has launched successfully
</pre>
</div>
</dd>
<div class="brief">
Sends an app control to launch an application on the remote device.
</div>
-<div class="synopsis"><pre class="signature prettyprint">void launchAppControl(<a href="application.html#ApplicationControl">ApplicationControl</a> appControl, optional <a href="application.html#ApplicationId">ApplicationId</a>? appId, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback);
+<div class="synopsis"><pre class="signature prettyprint">void launchAppControl(<a href="application.html#ApplicationControl">ApplicationControl</a> appControl, optional <a href="application.html#ApplicationId">ApplicationId</a>? appId, optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? replyCallback);
</pre></div>
<p><span class="version">
Since: </span>
</p>
<p><span class="remark"> Remark: </span>
Before using this method, the service must be connected with
-<a href="convergence.html#RemoteAppControlService::connect">connect()</a> method.
+<a href="convergence.html#RemoteAppControlService::connect">connect()</a> method
+and started with <a href="convergence.html#RemoteAppControlService::start">start()</a> method.
</p>
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on failure.
</li>
+ <li class="param">
+<span class="name">replyCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The method to invoke when the application gets back result from the remote service.
+ </li>
</ul>
</div>
<div class="exceptionlist">
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);
}
-function remoteAppControlCallback(data)
+var remoteAppControlCallback =
{
- console.log('On remote app control service reply');
- for (var i = 0; i data.length; i++)
+ onsuccess: function(data)
{
- console.log("key: " + data[i].key + "value: " + data[i].value[0]);
+ 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');
- /* Send data to the remote service */
- service.launchAppControl(requestAppControl, null, remoteAppControlCallback, onerror);
+ /* Start the service */
+ service.start(onstarted, onerror);
}
var discoverySuccessCallback =
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof RemoteAppControlService)
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
{
if (device.services[i].connectionState != "CONNECTED")
{
- service amount: 2
<< Device discovery has finished
Connected to the service
+ Service started
</pre>
</div>
</dd>
</dl>
</div>
</div>
-<div class="dictionary" id="ClientInfo">
+<div class="interface" id="ClientInfo">
<a class="backward-compatibility-anchor" name="::Convergence::ClientInfo"></a><h3>2.12. ClientInfo</h3>
<div class="brief">
- The dictionary that specifies client information.
+ The interface specifies client information.
</div>
-<pre class="webidl prettyprint"> dictionary ClientInfo {
- boolean isHost;
+<pre class="webidl prettyprint"> [NoInterfaceObject] interface ClientInfo {
+ readonly attribute boolean isHost;
- DOMString clientId;
+ readonly attribute DOMString clientId;
- long connectionTime;
+ readonly attribute long connectionTime;
};</pre>
<p><span class="version">
Since: </span>
3.0
</p>
<div class="attributes">
-<h4>Dictionary members</h4>
-<dl>
-<dt class="member" id="ClientInfo::isHost"><span class="attrName">boolean isHost</span></dt>
-<dd>
-<div class="brief">
- The value indicating if the service is local (true) or
-remote (false).
+<h4>Attributes</h4>
+<ul>
+<li class="attribute" id="ClientInfo::isHost">
+<span class="attrName"><span class="readonly"> readonly
+</span><span class="type">boolean </span><span class="name">isHost</span></span><div class="brief">
+ The value indicating if the service is local (true) or remote (false).
</div>
<p><span class="version">
Since: </span>
3.0
</p>
-</dd>
-<dt class="member" id="ClientInfo::clientId"><span class="attrName">DOMString clientId</span></dt>
-<dd>
-<div class="brief">
+</li>
+<li class="attribute" id="ClientInfo::clientId">
+<span class="attrName"><span class="readonly"> readonly
+</span><span class="type">DOMString </span><span class="name">clientId</span></span><div class="brief">
The unique client id.
</div>
<p><span class="version">
Since: </span>
3.0
</p>
-</dd>
-<dt class="member" id="ClientInfo::connectionTime"><span class="attrName">long connectionTime</span></dt>
-<dd>
-<div class="brief">
+</li>
+<li class="attribute" id="ClientInfo::connectionTime">
+<span class="attrName"><span class="readonly"> readonly
+</span><span class="type">long </span><span class="name">connectionTime</span></span><div class="brief">
The connection time in milliseconds.
</div>
<p><span class="version">
Since: </span>
3.0
</p>
-</dd>
-</dl>
+</li>
+</ul>
</div>
</div>
<div class="interface" id="DiscoverySuccessCallback">
<div class="interface" id="RemoteAppControlCallback">
<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlCallback"></a><h3>2.14. RemoteAppControlCallback</h3>
<div class="brief">
- The <em>RemoteAppControlCallback</em> interface defines the
-success method to be invoked when a service sends app control
-successfully.
+ The RemoteAppControlCallback specifies callbacks that are invoked as a reply
+from the requested application control within the application control requester.
</div>
<pre class="webidl prettyprint"> [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlCallback {
void onsuccess(optional <a href="application.html#ApplicationControlData">ApplicationControlData</a>[]? data);
+
+ void onfailure();
};</pre>
<p><span class="version">
Since: </span>
<div class="description">
<p>
The callback of this type is invoked in
-<a href="convergence.html#RemoteAppControlService::launch">launch()</a> and
-<a href="convergence.html#RemoteAppControlService::launchAppControl">launchAppControl()</a> methods.
+<a href="convergence.html#RemoteAppControlService::launchAppControl">launchAppControl()</a> method.
</p>
</div>
<div class="methods">
</dt>
<dd>
<div class="brief">
- The RemoteAppControlCallback callback specifies success callbacks that are invoked as a reply
-from the requested application control within the application control requester.
+ Called when the received reply from the requested application on the remote device has no errors.
</div>
<div class="synopsis"><pre class="signature prettyprint">void onsuccess(optional <a href="application.html#ApplicationControlData">ApplicationControlData</a>[]? data);
</pre></div>
</ul>
</div>
</dd>
+<dt class="method" id="RemoteAppControlCallback::onfailure">
+<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlCallback::onfailure"></a><code><b><span class="methodName">onfailure</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Called when the received reply from the requested application on the remote device contains any error.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void onfailure();
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+</dd>
</dl>
</div>
</div>
<div class="description">
<p>
The callback of this type is invoked in
-<a href="convergence.html#AppCommunicationClientService::connect">connect()</a> and
-<a href="convergence.html#RemoteAppControlService::connect">connect()</a> methods.
+<a href="convergence.html#AppCommunicationClientService::connect">connect()</a> of AppCommunicationClientService and
+<a href="convergence.html#RemoteAppControlService::connect">connect()</a> of RemoteAppControlService methods.
</p>
</div>
<div class="methods">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">service</span>:
+<span class="name">service</span>:
+ The connected service on a remote device.
+ </li>
+ </ul>
+</div>
+</dd>
+</dl>
+</div>
+</div>
+<div class="interface" id="RemoteAppControlStartCallback">
+<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlStartCallback"></a><h3>2.16. RemoteAppControlStartCallback</h3>
+<div class="brief">
+ The <em>RemoteAppControlStartCallback</em> interface defines the success method
+to be invoked when a RemoteAppControlService is started.
+ </div>
+<pre class="webidl prettyprint"> [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlStartCallback {
+
+ void onsuccess(<a href="#Service">Service</a> service);
+ };</pre>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="description">
+ <p>
+The callback of this type is invoked in
+<a href="convergence.html#RemoteAppControlService::start">start()</a> of RemoteAppControlService methods.
+ </p>
+ </div>
+<div class="methods">
+<h4>Methods</h4>
+<dl>
+<dt class="method" id="RemoteAppControlStartCallback::onsuccess">
+<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlStartCallback::onsuccess"></a><code><b><span class="methodName">onsuccess</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Called when the service connection is established.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void onsuccess(<a href="#Service">Service</a> service);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">service</span>:
The connected service on a remote device.
</li>
</ul>
</div>
</div>
<div class="interface" id="AppCommunicationSuccessCallback">
-<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationSuccessCallback"></a><h3>2.16. AppCommunicationSuccessCallback</h3>
+<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationSuccessCallback"></a><h3>2.17. AppCommunicationSuccessCallback</h3>
<div class="brief">
The <em>AppCommunicationSuccessCallback</em> interface defines the success method
to be invoked when a service operation, such as stop or send is successful.
</div>
</div>
<div class="interface" id="AppCommunicationStartCallback">
-<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationStartCallback"></a><h3>2.17. AppCommunicationStartCallback</h3>
+<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationStartCallback"></a><h3>2.18. AppCommunicationStartCallback</h3>
<div class="brief">
The <em>AppCommunicationStartCallback</em> interface defines the success method
to be invoked when a start service operation is successful.
</div>
</div>
<div class="interface" id="AppCommunicationClientListCallback">
-<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationClientListCallback"></a><h3>2.18. AppCommunicationClientListCallback</h3>
+<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationClientListCallback"></a><h3>2.19. AppCommunicationClientListCallback</h3>
<div class="brief">
The <em>AppCommunicationClientListCallback</em> interface defines the
method to be invoked when requested a list of clients, connected to
</div>
</div>
<div class="interface" id="AppCommunicationListenerCallback">
-<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationListenerCallback"></a><h3>2.19. AppCommunicationListenerCallback</h3>
+<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationListenerCallback"></a><h3>2.20. AppCommunicationListenerCallback</h3>
<div class="brief">
The <em>AppCommunicationListenerCallback</em> interface defines the
method to be invoked when a service notification is received
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;
[NoInterfaceObject] interface Service {
readonly attribute <a href="#ConnectionState">ConnectionState</a> connectionState;
+
+ readonly attribute <a href="#ServiceType">ServiceType</a> type;
};
[NoInterfaceObject] interface AppCommunicationService : <a href="#Service">Service</a> {
};
[NoInterfaceObject] interface RemoteAppControlService : <a href="#Service">Service</a> {
+ void start(<a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a> successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+
+ void stop(optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void connect(<a href="#ConnectSuccessCallback">ConnectSuccessCallback</a> successCallback,
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void launch(<a href="application.html#ApplicationId">ApplicationId</a> appId,
- optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback,
+ optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void launchAppControl(<a href="application.html#ApplicationControl">ApplicationControl</a> appControl,
optional <a href="application.html#ApplicationId">ApplicationId</a>? appId,
- optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback,
- optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback,
+ optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? replyCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+
};
dictionary PayloadString {
byte[] value;
};
- dictionary ClientInfo {
- boolean isHost;
+ [NoInterfaceObject] interface ClientInfo {
+ readonly attribute boolean isHost;
- DOMString clientId;
+ readonly attribute DOMString clientId;
- long connectionTime;
+ readonly attribute long connectionTime;
};
[Callback, NoInterfaceObject] interface DiscoverySuccessCallback {
[Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlCallback {
void onsuccess(optional <a href="application.html#ApplicationControlData">ApplicationControlData</a>[]? data);
+
+ void onfailure();
};
[Callback=FunctionOnly, NoInterfaceObject] interface ConnectSuccessCallback {
void onsuccess(<a href="#Service">Service</a> service);
};
+ [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlStartCallback {
+
+ void onsuccess(<a href="#Service">Service</a> service);
+ };
+
[Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationSuccessCallback {
void onsuccess(<a href="#ChannelInfo">ChannelInfo</a> channelInfo);
<li>
1.5. <a href="#ConnectionState">ConnectionState</a>
</li>
+<li>
+ 1.6. <a href="#ServiceType">ServiceType</a>
+</li>
</ul>
</li>
<li>2. <a href="#interfaces-section">Interfaces</a><ul class="toc">
</li>
<li>2.15. <a href="#ConnectSuccessCallback">ConnectSuccessCallback</a>
</li>
-<li>2.16. <a href="#AppCommunicationSuccessCallback">AppCommunicationSuccessCallback</a>
+<li>2.16. <a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a>
</li>
-<li>2.17. <a href="#AppCommunicationStartCallback">AppCommunicationStartCallback</a>
+<li>2.17. <a href="#AppCommunicationSuccessCallback">AppCommunicationSuccessCallback</a>
</li>
-<li>2.18. <a href="#AppCommunicationClientListCallback">AppCommunicationClientListCallback</a>
+<li>2.18. <a href="#AppCommunicationStartCallback">AppCommunicationStartCallback</a>
</li>
-<li>2.19. <a href="#AppCommunicationListenerCallback">AppCommunicationListenerCallback</a>
+<li>2.19. <a href="#AppCommunicationClientListCallback">AppCommunicationClientListCallback</a>
+</li>
+<li>2.20. <a href="#AppCommunicationListenerCallback">AppCommunicationListenerCallback</a>
</li>
</ul>
</li>
<tr>
<td><a href="#RemoteAppControlService">RemoteAppControlService</a></td>
<td>
+<div>void <a href="#RemoteAppControlService::start">start</a> (<a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a> successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
+<div>void <a href="#RemoteAppControlService::stop">stop</a> (optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
<div>void <a href="#RemoteAppControlService::connect">connect</a> (<a href="#ConnectSuccessCallback">ConnectSuccessCallback</a> successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
<div>void <a href="#RemoteAppControlService::disconnect">disconnect</a> (optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
-<div>void <a href="#RemoteAppControlService::launch">launch</a> (<a href="application.html#ApplicationId">ApplicationId</a> appId, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
-<div>void <a href="#RemoteAppControlService::launchAppControl">launchAppControl</a> (<a href="application.html#ApplicationControl">ApplicationControl</a> appControl, optional <a href="application.html#ApplicationId">ApplicationId</a>? appId, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
+<div>void <a href="#RemoteAppControlService::launch">launch</a> (<a href="application.html#ApplicationId">ApplicationId</a> appId, optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback)</div>
+<div>void <a href="#RemoteAppControlService::launchAppControl">launchAppControl</a> (<a href="application.html#ApplicationControl">ApplicationControl</a> appControl, optional <a href="application.html#ApplicationId">ApplicationId</a>? appId, optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? replyCallback)</div>
</td>
</tr>
<tr>
</tr>
<tr>
<td><a href="#RemoteAppControlCallback">RemoteAppControlCallback</a></td>
-<td><div>void <a href="#RemoteAppControlCallback::onsuccess">onsuccess</a> (optional <a href="application.html#ApplicationControlData">ApplicationControlData</a>[]? data)</div></td>
+<td>
+<div>void <a href="#RemoteAppControlCallback::onsuccess">onsuccess</a> (optional <a href="application.html#ApplicationControlData">ApplicationControlData</a>[]? data)</div>
+<div>void <a href="#RemoteAppControlCallback::onfailure">onfailure</a> ()</div>
+</td>
</tr>
<tr>
<td><a href="#ConnectSuccessCallback">ConnectSuccessCallback</a></td>
<td><div>void <a href="#ConnectSuccessCallback::onsuccess">onsuccess</a> (<a href="#Service">Service</a> service)</div></td>
</tr>
<tr>
+<td><a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a></td>
+<td><div>void <a href="#RemoteAppControlStartCallback::onsuccess">onsuccess</a> (<a href="#Service">Service</a> service)</div></td>
+</tr>
+<tr>
<td><a href="#AppCommunicationSuccessCallback">AppCommunicationSuccessCallback</a></td>
<td><div>void <a href="#AppCommunicationSuccessCallback::onsuccess">onsuccess</a> (<a href="#ChannelInfo">ChannelInfo</a> channelInfo)</div></td>
</tr>
</ul>
</div>
</div>
+<div class="enum" id="ServiceType">
+<a class="backward-compatibility-anchor" name="::Convergence::ServiceType"></a><h3>1.6. ServiceType</h3>
+<div class="brief">
+ Enumeration of service type.
+ </div>
+<pre class="webidl prettyprint"> enum ServiceType{"APP_COMM_CLIENT", "APP_COMM_SERVER", "REMOTE_APP_CONTROL"};</pre>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="description">
+ <p>
+The following values are supported:
+ </p>
+ <ul>
+ <li>
+APP_COMM_CLIENT - Application communication client service. </li>
+ <li>
+APP_COMM_SERVER - Application communication server service. </li>
+ <li>
+REMOTE_APP_CONTROL - Remote application control service. </li>
+ </ul>
+ </div>
+</div>
</div>
<div class="interfaces" id="interfaces-section">
<h2>2. Interfaces</h2>
<span class="name">timeout</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
Duration of discovery procedure in seconds. If this
value is omitted or <em>null</em> is passed, the default timeout
-is 60 seconds.
+is 5 seconds.
</li>
</ul>
</div>
<pre class="webidl prettyprint"> [NoInterfaceObject] interface Service {
readonly attribute <a href="#ConnectionState">ConnectionState</a> connectionState;
+
+ readonly attribute <a href="#ServiceType">ServiceType</a> type;
};</pre>
<p><span class="version">
Since: </span>
Since: </span>
3.0
</p>
-</li></ul>
+</li>
+<li class="attribute" id="Service::type">
+<span class="attrName"><span class="readonly"> readonly
+</span><span class="type">ServiceType </span><span class="name">type</span></span><div class="brief">
+ The service type.
+ </div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+</li>
+</ul>
</div>
</div>
<div class="interface" id="AppCommunicationService">
<ul>
<li>
AbortError: If any system error occurred </li>
+ <li>
+ InvalidStateError: If the service has already started the channel. Note some services don't require a connection and disconnection procedures </li>
</ul>
</div>
<p><span class="privilegelevel">
with error type SecurityError, if the
application does not have the privilege to call this method.
</p></li>
-<li class="list"><p>
- with error type InvalidStateError, if the
-service is started already. <br>Note some services don't require
-a connection and disconnection procedures.
- </p></li>
</ul>
</li></ul>
</div>
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
clientService = service;
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "APP_COMM_CLIENT")
{
if (device.services[i].connectionState != "CONNECTED")
{
<li>
AbortError: If any system error occurred </li>
<li>
- InvalidValuesError: If any of the input parameters contain an
-invalid value </li>
+ InvalidValuesError: If any of the input parameters contain an invalid value </li>
+ <li>
+ InvalidStateError: If the service has not started the channel </li>
</ul>
</div>
<p><span class="privilegelevel">
with error type SecurityError, if the
application does not have the privilege to call this method.
</p></li>
-<li class="list"><p>
- with error type InvalidStateError, if the
-service is not started yet.
- </p></li>
</ul>
</li></ul>
</div>
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
clientService = service;
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "APP_COMM_CLIENT")
{
if (device.services[i].connectionState != "CONNECTED")
{
<li>
AbortError: If any system error occurred </li>
<li>
- InvalidValuesError: If any of the input parameters contain an
-invalid value </li>
+ InvalidValuesError: If any of the input parameters contain an invalid value </li>
+ <li>
+ InvalidStateError: If the service has not started the channel </li>
</ul>
</div>
<p><span class="privilegelevel">
with error type SecurityError, if the
application does not have the privilege to call this method.
</p></li>
-<li class="list"><p>
- with error type InvalidStateError, if the
-service is not started yet.
- </p></li>
</ul>
</li></ul>
</div>
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
clientService = service;
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "APP_COMM_CLIENT")
{
if (device.services[i].connectionState != "CONNECTED")
{
<li>
AbortError: If any system error occurred </li>
<li>
- InvalidValuesError: If any of the input parameters contain an
-invalid value </li>
+ InvalidValuesError: If any of the input parameters contain an invalid value </li>
+ <li>
+ InvalidStateError: If the service has not started the channel </li>
</ul>
</div>
<p><span class="privilegelevel">
with error type SecurityError, if the
application does not have the privilege to call this method.
</p></li>
-<li class="list"><p>
- with error type InvalidStateError, if the
-service is not started yet.
- </p></li>
</ul>
</li></ul>
</div>
service.stop(requestChannel2, onstopped);
}
}
-</pre>
-</div>
-<div class="output">
-<span class="title"><p>Output example:</p></span><pre>
/* Create an instance of app communication server service object */
var service = new tizen.AppCommunicationServerService();
service.start(requestChannel1, onstarted, onerror);
service.start(requestChannel2, onstarted, onerror);
+</pre>
+</div>
+
+<div class="output">
+<span class="title"><p>Output example:</p></span><pre>
Channel started
channel uri: targetApp0.main
channel id: chA
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
clientService = service;
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "APP_COMM_CLIENT")
{
if (device.services[i].connectionState != "CONNECTED")
{
/* Create an instance of app communication server service object */
var service = new tizen.AppCommunicationServerService();
-var service.start(requestChannel, onstarted, onerror);
/* Register listener to receive notifications from remote service */
service.setListener(onnotify);
+service.start(requestChannel, onstarted, onerror);
</pre>
</div>
<div class="output">
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
service.start(requestChannel, onstarted, onerror);
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "APP_COMM_CLIENT")
{
if (device.services[i].connectionState != "CONNECTED")
{
Privilege: </span>
http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
</p>
+<p class="warning"><b>Warning:</b>
+ Connecting is only supported for services on devices not connected via WiFi.
+For devices connected via WiFi, <a href="convergence.html#ConnectionState">connectionState</a> will always be <em>"CONNECTED"</em>.
+ </p>
<p><span class="remark"> Remark: </span>
App developers do not need to specify the connectivity type
explicitly. The framework automatically determines which connectivity
function onconnected(service)
{
console.log('Connected to the service');
- if (service instanceof AppCommunicationClientService)
+ if (service.type === "APP_COMM_CLIENT")
{
console.log('Connected to the app communication client service');
}
- else if (service instanceof RemoteAppControlService)
+ else if (service.type === "REMOTE_APP_CONTROL")
{
console.log('Connected to the remote app control service');
}
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof AppCommunicationClientService)
+ 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] instanceof RemoteAppControlService)
+ else if (device.services[i].type === "REMOTE_APP_CONTROL")
{
if (device.services[i].connectionState != "CONNECTED")
{
Privilege: </span>
http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
</p>
+<p class="warning"><b>Warning:</b>
+ Disconnecting is only supported for services on devices not connected via WiFi.
+ </p>
<p><span class="remark"> Remark: </span>
Example of using can be found at <a href="convergence.html#AppCommunicationClientService::connect">connect()</a> code example.
</p>
Sending data for the service </li>
</ul>
</div>
+<p class="warning"><b>Warning:</b>
+ AppCommunicationServerService API is supported on Tizen 3.0 TV product only.
+ </p>
<p><span class="remark"> Remark: </span>
application server service is used without discovery phase.
The developer should instantiate a standalone service object using
remote application control service features.
</div>
<pre class="webidl prettyprint"> [NoInterfaceObject] interface RemoteAppControlService : <a href="#Service">Service</a> {
+ void start(<a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a> successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+
+ void stop(optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void connect(<a href="#ConnectSuccessCallback">ConnectSuccessCallback</a> successCallback,
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void launch(<a href="application.html#ApplicationId">ApplicationId</a> appId,
- optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback,
+ optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void launchAppControl(<a href="application.html#ApplicationControl">ApplicationControl</a> appControl,
optional <a href="application.html#ApplicationId">ApplicationId</a>? appId,
- optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback,
- optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback,
+ optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? replyCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+
};</pre>
<p><span class="version">
Since: </span>
<div class="methods">
<h4>Methods</h4>
<dl>
+<dt class="method" id="RemoteAppControlService::start">
+<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlService::start"></a><code><b><span class="methodName">start</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Starts and initiates remote service.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void start(<a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a> successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="description">
+ <p>
+This method starts the remote app control service.
+ </p>
+ </div>
+<div class="description">
+ <p>
+The ErrorCallback is launched with these error types:
+ </p>
+ <ul>
+ <li>
+ AbortError: If any system error occurred </li>
+ </ul>
+ </div>
+<p><span class="privilege">
+ Privilege: </span>
+ http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
+ </p>
+<p><span class="remark"> Remark : </span>
+ Before using this method for remote application service, the service must be connected with the
+<a href="convergence.html#RemoteAppControlService::connect">connect()</a> method.
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">successCallback</span>:
+ The method to invoke on success
+ </li>
+ <li class="param">
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The method to invoke on failure
+ </li>
+ </ul>
+</div>
+<div class="exceptionlist">
+<p><span class="except">Exceptions:</span></p>
+ <ul class="exception"><li>WebAPIException<ul>
+<li class="list"><p>
+ with error type TypeMismatchError, if any
+input parameter is not compatible with the expected type for that
+parameter.
+ </p></li>
+<li class="list"><p>
+ with error type SecurityError, if the
+application does not have the privilege to call this method.
+ </p></li>
+<li class="list"><p>
+ with error type InvalidStateError, if the
+the service is already started.
+ </p></li>
+<li class="list"><p>
+ with error type AbortError, if the
+other error occurs during start.
+ </p></li>
+</ul>
+</li></ul>
+ </div>
+<div class="example">
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+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);
+</pre>
+</div>
+<div class="output">
+<span class="title"><p>Output example:</p></span><pre> >> 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
+</pre>
+</div>
+</dd>
+<dt class="method" id="RemoteAppControlService::stop">
+<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlService::stop"></a><code><b><span class="methodName">stop</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Stops remote service.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void stop(optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="description">
+ <p>
+This method stops and release internally allocated resources for remote service.
+ </p>
+ </div>
+<div class="description">
+ <p>
+The ErrorCallback is launched with these error types:
+ </p>
+ <ul>
+ <li>
+ AbortError: If any system error occurred </li>
+ </ul>
+ </div>
+<p><span class="privilege">
+ Privilege: </span>
+ http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">successCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The method to invoke on success
+ </li>
+ <li class="param">
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The method to invoke on failure
+ </li>
+ </ul>
+</div>
+<div class="exceptionlist">
+<p><span class="except">Exceptions:</span></p>
+ <ul class="exception"><li>WebAPIException<ul>
+<li class="list"><p>
+ with error type TypeMismatchError, if any
+input parameter is not compatible with the expected type for that
+parameter.
+ </p></li>
+<li class="list"><p>
+ with error type SecurityError, if the
+application does not have the privilege to call this method.
+ </p></li>
+<li class="list"><p>
+ with error type InvalidStateError, if the
+the service is not started yet.
+ </p></li>
+<li class="list"><p>
+ with error type AbortError, if the
+other error occurs during start.
+ </p></li>
+</ul>
+</li></ul>
+ </div>
+<div class="example">
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+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);
+</pre>
+</div>
+<div class="output">
+<span class="title"><p>Output example:</p></span><pre> >> 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
+</pre>
+</div>
+</dd>
<dt class="method" id="RemoteAppControlService::connect">
<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlService::connect"></a><code><b><span class="methodName">connect</span></b></code>
</dt>
Privilege: </span>
http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
</p>
+<p class="warning"><b>Warning:</b>
+ Connecting is only supported for services on devices not connected via WiFi.
+For devices connected via WiFi, <a href="convergence.html#ConnectionState">connectionState</a> will always be <em>"CONNECTED"</em>.
+ </p>
<p><span class="remark"> Remark: </span>
App developers do not need to specify the connectivity type
explicitly. Framework automatically determines which connectivity
function onconnected(service)
{
- console.log('Connected to the service');
- if (service instanceof RemoteAppControlService)
- {
- console.log('Connected to the remote app control service');
- }
- else if (service instanceof AppCommunicationClientService))
- {
- console.log('Connected to the app communication client service');
- }
+ console.log('Connected to the remote app control service');
service.disconnect();
}
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);
- }
- }
- else if (device.services[i] instanceof AppCommunicationClientService)
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
{
if (device.services[i].connectionState != "CONNECTED")
{
}
};
-try
-{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
-}
-catch (err)
-{
- console.log(err.name + ': ' + err.message);
-}
+console.log('>> STARTING DEVICE DISCOVERY');
+tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
</pre>
</div>
<div class="output">
- 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
</pre>
</div>
Privilege: </span>
http://tizen.org/privilege/internet <br>http://tizen.org/privilege/bluetooth
</p>
+<p class="warning"><b>Warning:</b>
+ Disconnecting is only supported for services on devices not connected via WiFi.
+ </p>
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<ul>
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof RemoteAppControlService)
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
{
if (device.services[i].connectionState == "CONNECTED")
{
<div class="brief">
Sends the given application ID to launch an application on the remote device.
</div>
-<div class="synopsis"><pre class="signature prettyprint">void launch(<a href="application.html#ApplicationId">ApplicationId</a> appId, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback);
+<div class="synopsis"><pre class="signature prettyprint">void launch(<a href="application.html#ApplicationId">ApplicationId</a> appId, optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback);
</pre></div>
<p><span class="version">
Since: </span>
Before using this method, the service must be connected
with
<a href="convergence.html#RemoteAppControlService::connect">connect()</a> method
-correspondingly.
+and started with <a href="convergence.html#RemoteAppControlService::start">start()</a> method.
</p>
<div class="parameters">
<p><span class="param">Parameters:</span></p>
console.log(err.name + ': ' + err.message);
}
-function remoteAppControlCallback(data)
+function onsuccess()
{
- console.log('On remote app control service reply');
- console.log('clientId: ' + clientId);
- for (var i = 0; i data.length; i++)
- {
- console.log("key: " + data[i].key + "value: " + data[i].value[0]);
- }
+ console.log('The application has launched successfully');
}
-function onconnected(service)
+function onstarted(service)
{
- console.log('Connected to the 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(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof RemoteAppControlService)
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
{
if (device.services[i].connectionState != "CONNECTED")
{
}
};
-try
-{
- console.log('>> STARTING DEVICE DISCOVERY');
- tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
-}
-catch (err)
-{
- console.log(err.name + ': ' + err.message);
-}
+console.log('>> STARTING DEVICE DISCOVERY');
+tizen.convergence.startDiscovery(discoverySuccessCallback, onerror, 60 * 60);
</pre>
</div>
<div class="output">
- service amount: 2
<< Device discovery has finished
Connected to the service
+ Service started
+ The application has launched successfully
</pre>
</div>
</dd>
<div class="brief">
Sends an app control to launch an application on the remote device.
</div>
-<div class="synopsis"><pre class="signature prettyprint">void launchAppControl(<a href="application.html#ApplicationControl">ApplicationControl</a> appControl, optional <a href="application.html#ApplicationId">ApplicationId</a>? appId, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback);
+<div class="synopsis"><pre class="signature prettyprint">void launchAppControl(<a href="application.html#ApplicationControl">ApplicationControl</a> appControl, optional <a href="application.html#ApplicationId">ApplicationId</a>? appId, optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback, optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? replyCallback);
</pre></div>
<p><span class="version">
Since: </span>
</p>
<p><span class="remark"> Remark: </span>
Before using this method, the service must be connected with
-<a href="convergence.html#RemoteAppControlService::connect">connect()</a> method.
+<a href="convergence.html#RemoteAppControlService::connect">connect()</a> method
+and started with <a href="convergence.html#RemoteAppControlService::start">start()</a> method.
</p>
<div class="parameters">
<p><span class="param">Parameters:</span></p>
<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
The method to invoke on failure.
</li>
+ <li class="param">
+<span class="name">replyCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The method to invoke when the application gets back result from the remote service.
+ </li>
</ul>
</div>
<div class="exceptionlist">
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);
}
-function remoteAppControlCallback(data)
+var remoteAppControlCallback =
{
- console.log('On remote app control service reply');
- for (var i = 0; i data.length; i++)
+ onsuccess: function(data)
{
- console.log("key: " + data[i].key + "value: " + data[i].value[0]);
+ 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');
- /* Send data to the remote service */
- service.launchAppControl(requestAppControl, null, remoteAppControlCallback, onerror);
+ /* Start the service */
+ service.start(onstarted, onerror);
}
var discoverySuccessCallback =
console.log(" - service amount: " + device.services.length);
for (i in device.services)
{
- if (device.services[i] instanceof RemoteAppControlService)
+ if (device.services[i].type === "REMOTE_APP_CONTROL")
{
if (device.services[i].connectionState != "CONNECTED")
{
- service amount: 2
<< Device discovery has finished
Connected to the service
+ Service started
</pre>
</div>
</dd>
</dl>
</div>
</div>
-<div class="dictionary" id="ClientInfo">
+<div class="interface" id="ClientInfo">
<a class="backward-compatibility-anchor" name="::Convergence::ClientInfo"></a><h3>2.12. ClientInfo</h3>
<div class="brief">
- The dictionary that specifies client information.
+ The interface specifies client information.
</div>
-<pre class="webidl prettyprint"> dictionary ClientInfo {
- boolean isHost;
+<pre class="webidl prettyprint"> [NoInterfaceObject] interface ClientInfo {
+ readonly attribute boolean isHost;
- DOMString clientId;
+ readonly attribute DOMString clientId;
- long connectionTime;
+ readonly attribute long connectionTime;
};</pre>
<p><span class="version">
Since: </span>
3.0
</p>
<div class="attributes">
-<h4>Dictionary members</h4>
-<dl>
-<dt class="member" id="ClientInfo::isHost"><span class="attrName">boolean isHost</span></dt>
-<dd>
-<div class="brief">
- The value indicating if the service is local (true) or
-remote (false).
+<h4>Attributes</h4>
+<ul>
+<li class="attribute" id="ClientInfo::isHost">
+<span class="attrName"><span class="readonly"> readonly
+</span><span class="type">boolean </span><span class="name">isHost</span></span><div class="brief">
+ The value indicating if the service is local (true) or remote (false).
</div>
<p><span class="version">
Since: </span>
3.0
</p>
-</dd>
-<dt class="member" id="ClientInfo::clientId"><span class="attrName">DOMString clientId</span></dt>
-<dd>
-<div class="brief">
+</li>
+<li class="attribute" id="ClientInfo::clientId">
+<span class="attrName"><span class="readonly"> readonly
+</span><span class="type">DOMString </span><span class="name">clientId</span></span><div class="brief">
The unique client id.
</div>
<p><span class="version">
Since: </span>
3.0
</p>
-</dd>
-<dt class="member" id="ClientInfo::connectionTime"><span class="attrName">long connectionTime</span></dt>
-<dd>
-<div class="brief">
+</li>
+<li class="attribute" id="ClientInfo::connectionTime">
+<span class="attrName"><span class="readonly"> readonly
+</span><span class="type">long </span><span class="name">connectionTime</span></span><div class="brief">
The connection time in milliseconds.
</div>
<p><span class="version">
Since: </span>
3.0
</p>
-</dd>
-</dl>
+</li>
+</ul>
</div>
</div>
<div class="interface" id="DiscoverySuccessCallback">
<div class="interface" id="RemoteAppControlCallback">
<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlCallback"></a><h3>2.14. RemoteAppControlCallback</h3>
<div class="brief">
- The <em>RemoteAppControlCallback</em> interface defines the
-success method to be invoked when a service sends app control
-successfully.
+ The RemoteAppControlCallback specifies callbacks that are invoked as a reply
+from the requested application control within the application control requester.
</div>
<pre class="webidl prettyprint"> [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlCallback {
void onsuccess(optional <a href="application.html#ApplicationControlData">ApplicationControlData</a>[]? data);
+
+ void onfailure();
};</pre>
<p><span class="version">
Since: </span>
<div class="description">
<p>
The callback of this type is invoked in
-<a href="convergence.html#RemoteAppControlService::launch">launch()</a> and
-<a href="convergence.html#RemoteAppControlService::launchAppControl">launchAppControl()</a> methods.
+<a href="convergence.html#RemoteAppControlService::launchAppControl">launchAppControl()</a> method.
</p>
</div>
<div class="methods">
</dt>
<dd>
<div class="brief">
- The RemoteAppControlCallback callback specifies success callbacks that are invoked as a reply
-from the requested application control within the application control requester.
+ Called when the received reply from the requested application on the remote device has no errors.
</div>
<div class="synopsis"><pre class="signature prettyprint">void onsuccess(optional <a href="application.html#ApplicationControlData">ApplicationControlData</a>[]? data);
</pre></div>
</ul>
</div>
</dd>
+<dt class="method" id="RemoteAppControlCallback::onfailure">
+<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlCallback::onfailure"></a><code><b><span class="methodName">onfailure</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Called when the received reply from the requested application on the remote device contains any error.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void onfailure();
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+</dd>
</dl>
</div>
</div>
<div class="description">
<p>
The callback of this type is invoked in
-<a href="convergence.html#AppCommunicationClientService::connect">connect()</a> and
-<a href="convergence.html#RemoteAppControlService::connect">connect()</a> methods.
+<a href="convergence.html#AppCommunicationClientService::connect">connect()</a> of AppCommunicationClientService and
+<a href="convergence.html#RemoteAppControlService::connect">connect()</a> of RemoteAppControlService methods.
</p>
</div>
<div class="methods">
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
-<span class="name">service</span>:
+<span class="name">service</span>:
+ The connected service on a remote device.
+ </li>
+ </ul>
+</div>
+</dd>
+</dl>
+</div>
+</div>
+<div class="interface" id="RemoteAppControlStartCallback">
+<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlStartCallback"></a><h3>2.16. RemoteAppControlStartCallback</h3>
+<div class="brief">
+ The <em>RemoteAppControlStartCallback</em> interface defines the success method
+to be invoked when a RemoteAppControlService is started.
+ </div>
+<pre class="webidl prettyprint"> [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlStartCallback {
+
+ void onsuccess(<a href="#Service">Service</a> service);
+ };</pre>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="description">
+ <p>
+The callback of this type is invoked in
+<a href="convergence.html#RemoteAppControlService::start">start()</a> of RemoteAppControlService methods.
+ </p>
+ </div>
+<div class="methods">
+<h4>Methods</h4>
+<dl>
+<dt class="method" id="RemoteAppControlStartCallback::onsuccess">
+<a class="backward-compatibility-anchor" name="::Convergence::RemoteAppControlStartCallback::onsuccess"></a><code><b><span class="methodName">onsuccess</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Called when the service connection is established.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void onsuccess(<a href="#Service">Service</a> service);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 3.0
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">service</span>:
The connected service on a remote device.
</li>
</ul>
</div>
</div>
<div class="interface" id="AppCommunicationSuccessCallback">
-<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationSuccessCallback"></a><h3>2.16. AppCommunicationSuccessCallback</h3>
+<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationSuccessCallback"></a><h3>2.17. AppCommunicationSuccessCallback</h3>
<div class="brief">
The <em>AppCommunicationSuccessCallback</em> interface defines the success method
to be invoked when a service operation, such as stop or send is successful.
</div>
</div>
<div class="interface" id="AppCommunicationStartCallback">
-<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationStartCallback"></a><h3>2.17. AppCommunicationStartCallback</h3>
+<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationStartCallback"></a><h3>2.18. AppCommunicationStartCallback</h3>
<div class="brief">
The <em>AppCommunicationStartCallback</em> interface defines the success method
to be invoked when a start service operation is successful.
</div>
</div>
<div class="interface" id="AppCommunicationClientListCallback">
-<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationClientListCallback"></a><h3>2.18. AppCommunicationClientListCallback</h3>
+<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationClientListCallback"></a><h3>2.19. AppCommunicationClientListCallback</h3>
<div class="brief">
The <em>AppCommunicationClientListCallback</em> interface defines the
method to be invoked when requested a list of clients, connected to
</div>
</div>
<div class="interface" id="AppCommunicationListenerCallback">
-<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationListenerCallback"></a><h3>2.19. AppCommunicationListenerCallback</h3>
+<a class="backward-compatibility-anchor" name="::Convergence::AppCommunicationListenerCallback"></a><h3>2.20. AppCommunicationListenerCallback</h3>
<div class="brief">
The <em>AppCommunicationListenerCallback</em> interface defines the
method to be invoked when a service notification is received
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;
[NoInterfaceObject] interface Service {
readonly attribute <a href="#ConnectionState">ConnectionState</a> connectionState;
+
+ readonly attribute <a href="#ServiceType">ServiceType</a> type;
};
[NoInterfaceObject] interface AppCommunicationService : <a href="#Service">Service</a> {
};
[NoInterfaceObject] interface RemoteAppControlService : <a href="#Service">Service</a> {
+ void start(<a href="#RemoteAppControlStartCallback">RemoteAppControlStartCallback</a> successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+
+ void stop(optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void connect(<a href="#ConnectSuccessCallback">ConnectSuccessCallback</a> successCallback,
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void launch(<a href="application.html#ApplicationId">ApplicationId</a> appId,
- optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback,
+ optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
void launchAppControl(<a href="application.html#ApplicationControl">ApplicationControl</a> appControl,
optional <a href="application.html#ApplicationId">ApplicationId</a>? appId,
- optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? successCallback,
- optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ optional <a href="tizen.html#SuccessCallback">SuccessCallback</a>? successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback,
+ optional <a href="#RemoteAppControlCallback">RemoteAppControlCallback</a>? replyCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+
};
dictionary PayloadString {
byte[] value;
};
- dictionary ClientInfo {
- boolean isHost;
+ [NoInterfaceObject] interface ClientInfo {
+ readonly attribute boolean isHost;
- DOMString clientId;
+ readonly attribute DOMString clientId;
- long connectionTime;
+ readonly attribute long connectionTime;
};
[Callback, NoInterfaceObject] interface DiscoverySuccessCallback {
[Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlCallback {
void onsuccess(optional <a href="application.html#ApplicationControlData">ApplicationControlData</a>[]? data);
+
+ void onfailure();
};
[Callback=FunctionOnly, NoInterfaceObject] interface ConnectSuccessCallback {
void onsuccess(<a href="#Service">Service</a> service);
};
+ [Callback=FunctionOnly, NoInterfaceObject] interface RemoteAppControlStartCallback {
+
+ void onsuccess(<a href="#Service">Service</a> service);
+ };
+
[Callback=FunctionOnly, NoInterfaceObject] interface AppCommunicationSuccessCallback {
void onsuccess(<a href="#ChannelInfo">ChannelInfo</a> channelInfo);