Samsung Electronics logo

Samsung Web API: NService


Introduction

This API provides the communication channel with any client devices which will be attached to Smart TV.

It supports N-Screen service by allowing a client application running on a mobile device (such as mobile phone, tablet and laptop) to communicate with a TV application to synchronize state, exchange data and files. N-Screen service is realized by providing N-Service API allowing TV and other devices to exchange messages.

N-Service API Architecture

It can be operated with the Samsung Smart TV manufactured since 2013.

There will be a webapis.nservice object that allows accessing the functionality of the communication among client devices and TV host device.

For more information on the N-Service features, see N-Service Guide.


Table of Contents


Summary of Interfaces and Methods

Interface Method
WebAPIsNServiceManager
NServiceOwnDeviceInfoInit
NServiceOwnDeviceInfo
NServiceHostInfoInit
NServiceHostInfo
NServiceDeviceListSuccessCallback void onsuccess(NServiceDeviceArray devices)
NServiceDeviceManagerCallback void ondetected(ManagerEvent event)
NServiceDeviceCallback void onreceived(NServiceDeviceEventInfo message)
NServiceHostConnectSuccessCallback void onsuccess(NServiceHost host)
NServiceMessageCallback void onreceive(DOMString message)
NServiceGroupSuccessCallback void onjoin(NServiceDeviceGroup group)
NServiceFileUploadSuccessCallback void onuploaded(DOMString filePath)
ManagerEvent
NServiceDeviceEventInfo
NServiceDeviceMessageInfo
NServiceDeviceGroup NServiceDeviceArray getMembers()
void leave(SuccessCallback onsuccess, ErrorCallback? onerror)
NServiceHost void disconnect(SuccessCallback onsuccess, ErrorCallback? onerror)
NServiceHostInfo getHostInfo()
void uploadFile(DOMString filePath, NServiceFileUploadSuccessCallback onsuccess, ErrorCallback? onerror)
void deleteFile(DOMString filePath, SuccessCallback? onsuccess, ErrorCallback? onerror)
void registerMessageCallback(NServiceMessageCallback messageCallback)
void unregisterMessageCallback()
NServiceDevice DOMString getName()
unsigned short getType()
unsigned short sendMessage(DOMString message)
void registerDeviceCallback(NServiceDeviceCallback eventCallback)
void unregisterDeviceCallback()
NServiceManager boolean setOwnDeviceInfo(NServiceOwnDeviceInfo info)
NServiceOwnDeviceInfo? getOwnDeviceInfo()
void connectNServiceHost(NServiceHostInfo hostInfo, NServiceHostConnectSuccessCallback onsuccess, ErrorCallback? onerror)
void joinGroup(DOMString groupName, NServiceGroupSuccessCallback onsuccess, ErrorCallback? onerror)
void getNServiceDevices(NServiceDeviceListSuccessCallback onsuccess, ErrorCallback onerror)
unsigned short multicastMessage(DOMString groupID, DOMString message)
unsigned short broadcastMessage(DOMString message)
unsigned short sendMessageToHost(DOMString message)
void registerManagerCallback(NServiceDeviceManagerCallback monitorCallback)

1. Type Definitions

1.1. NServiceDeviceArray

Array of NServiceDevice object.

    typedef sequence<NServiceDeviceNServiceDevice> NServiceDeviceArray;

1.2. NServiceHostStatus

Indicate the status of N-Service host application.

    enum NServiceHostStatus { "RUNNING", "INSTALLING", "LAUNCHING", "UNKNOWN" };
  • "RUNNING" : host application is running.
  • "INSTALLING" : host application is being installed.
  • "LAUNCHING" : host applicaiton is launching.
  • "UNKNOWN" : the status of host application is not distingushed.

2. Interfaces

2.1. WebAPIsNServiceManager

Defines what instantiated in the webapis object is.

    [NoInterfaceObject] interface WebAPIsNServiceManager {
        readonly attribute NServiceManagerNServiceManager nservice;
    };
    WebAPIs implements WebAPIsNServiceManagerWebAPIsNServiceManager;

There will be a webapis.nservice object that allows accessing the functionality of the N-Service module.

2.2. NServiceOwnDeviceInfoInit

Provides specifying own device attributes upon own device information creation.

    dictionary NServiceOwnDeviceInfoInit {
        DOMString deviceID;

        DOMString deviceName;
    };

This interface is used to input parameters when own device information is created using the NServiceOwnDeviceInfo constructor.

All the attributes are optional and are undefined by default, unless otherwise stated in the parameter description.

Dictionary members

DOMString deviceID

The device identification.

DOMString deviceName

The device name.

It has to be less then 64 characters.

2.3. NServiceOwnDeviceInfo

Defines the own device information.

    [Constructor (NServiceOwnDeviceInfoInitNServiceOwnDeviceInfoInit init)]
    interface NServiceOwnDeviceInfo {
        attribute DOMString deviceID;

        attribute DOMString vendorID;

        attribute DOMString deviceName;

        attribute DOMString productID;
    };
Code example
     // Create my own device information
     var myDeviceInfo = new webapis.NServiceOwnDeviceInfo({
         deviceID : "12345",
         deviceName : "Samsung Mobile",
     });
 

ATTRIBUTES

DOMString deviceID

The device identification.

This property is the unique identifier for own device.

DOMString vendorID

The vendor identification.

This property is the unique identifier for vendor. It has to be any 8 characters exactly. "MyVendor" is the default value.

DOMString deviceName

The device name.

This property is the description of device. It has to be less then 64 characters.

DOMString productID

The product identification.

This property is the unique identifier for the product. It has to be started with "SMART" and it has to be 8 characters exactly. "SMARTDev" is the default value.

2.4. NServiceHostInfoInit

Provides specifying N-Service host device attributes upon N-Service host information creation.

    dictionary NServiceHostInfoInit {

        DOMString ipAddress;

        DOMString appID;
    };

This interface is used to input parameters when N-Service host device information is created using the NServiceHostInfo constructor.

All the attributes are optional and are undefined by default, unless otherwise stated in the parameter description.

Dictionary members

DOMString ipAddress

The IP address of host application.

IP addresses are canonically represented in dot-decimal notation, which consists of four decimal numbers, each ranging from 0 to 255, separated by dots, e.g., 172.16.254.1. Each part represents a group of 8 bits (octet) of the address. In some cases of technical writing, IP addresses may be presented in various hexadecimal, octal, or binary representations.

DOMString appID

The host application identification.

2.5. NServiceHostInfo

Defines the N-Service host information which will be connected.

    [Constructor (NServiceHostInfoInitNServiceHostInfoInit init)]
    interface NServiceHostInfo {

        attribute DOMString ipAddress;

        attribute unsigned short portNumber;

        attribute DOMString appID;

        readonly attribute DOMString? version;

        readonly attribute DOMString? appName;

        readonly attribute NServiceHostStatusNServiceHostStatus status;

    };
Code example
     // Create N-Service host information
     var hostInfo = new webapis.NServiceHostInfo({
         ipAddress : "192.168.129.2",
         appID : "sample"
    });
 

ATTRIBUTES

DOMString ipAddress

The IP address of host application.

IP addresses are canonically represented in dot-decimal notation, which consists of four decimal numbers, each ranging from 0 to 255, separated by dots, e.g., 172.16.254.1. Each part represents a group of 8 bits (octet) of the address. In some cases of technical writing, IP addresses may be presented in various hexadecimal, octal, or binary representations.

unsigned short portNumber

The port number of host application.

It is 80 by default.

DOMString appID

The host application identification.

readonly DOMString? version

The version information.

If this information had not retrieved from host application yet, null will be returns.

This attribute is read-only.

readonly DOMString? appName

The name of host application.

If this information had not retrieved from host application yet, null will be returns.

This attribute is read-only.

readonly NServiceHostStatus status

The status of host application.

If this information had not retrieved from host application yet, "UNKNOWN" will be returns.

This attribute is read-only.

2.6. NServiceDeviceListSuccessCallback

Callback for getting the list of N-Service client devices which are attached.

    [Callback=FunctionOnly, NoInterfaceObject]
    interface NServiceDeviceListSuccessCallback {
        void onsuccess(NServiceDeviceArrayNServiceDeviceArray devices);
  };

METHODS

onsuccess

Method invoked when getting N-Service devices request completes successfully.

Signature
void onsuccess(NServiceDeviceArray devices);
Parameters
  • devices
    • Optional: No.
    • Nullable: No.
    • Type: NServiceDeviceArray.
    • Description: The list of N-Service client devices

2.7. NServiceDeviceManagerCallback

Callback for receiving the event when notify a N-Service client device connection or disconnection.

    [Callback=FunctionOnly, NoInterfaceObject]
    interface NServiceDeviceManagerCallback {
        void ondetected(ManagerEventManagerEvent event);
    };

METHODS

ondetected

Method invoked when a N-Service client device is joined or leaved.

Signature
void ondetected(ManagerEvent event);
Parameters
  • event
    • Optional: No.
    • Nullable: No.
    • Type: ManagerEvent.
    • Description: The detail information which notifies the client device changes.

2.8. NServiceDeviceCallback

Callback for handling messages from a N-Service client device.

    [Callback=FunctionOnly, NoInterfaceObject]
    interface NServiceDeviceCallback {

        void onreceived(NServiceDeviceEventInfoNServiceDeviceEventInfo message);
    };

METHODS

onreceived

Method invoked when a message is coming from a N-Service client device.

Signature
void onreceived(NServiceDeviceEventInfo message);
Parameters
  • message
    • Optional: No.
    • Nullable: No.
    • Type: NServiceDeviceEventInfo.
    • Description: The message which contains the event.

2.9. NServiceHostConnectSuccessCallback

Callback for connecting the N-Service host application.

    [Callback=FunctionOnly, NoInterfaceObject]
    interface NServiceHostConnectSuccessCallback {

        void onsuccess(NServiceHostNServiceHost host);
    };

METHODS

onsuccess

Method invoked when the host application has been successfully connected.

Signature
void onsuccess(NServiceHost host);
Parameters
  • host
    • Optional: No.
    • Nullable: No.
    • Type: NServiceHost.
    • Description: The N-Service host which has been connected.

2.10. NServiceMessageCallback

Callback for listening the message from the N-Service host.

    [Callback=FunctionOnly, NoInterfaceObject]
    interface NServiceMessageCallback {

        void onreceive(DOMString message);
    };

METHODS

onreceive

Method invoked when a message is arrived to client.

Signature
void onreceive(DOMString message);
Parameters
  • message
    • Optional: No.
    • Nullable: No.
    • Type: DOMString.
    • Description: The incomming message. The message format is user defined.

2.11. NServiceGroupSuccessCallback

Callback for joining a group.

    [Callback=FunctionOnly, NoInterfaceObject]
    interface NServiceGroupSuccessCallback {

        void onjoin(NServiceDeviceGroupNServiceDeviceGroup group);
    };

METHODS

onjoin

Method invoked when this device has successfully joined to a group.

Signature
void onjoin(NServiceDeviceGroup group);
Parameters
  • group
    • Optional: No.
    • Nullable: No.
    • Type: NServiceDeviceGroup.
    • Description: The group which has been joined.

2.12. NServiceFileUploadSuccessCallback

Callback for notifying when a file has successfully uploaded.

    [Callback=FunctionOnly, NoInterfaceObject]
    interface NServiceFileUploadSuccessCallback {

        void onuploaded(DOMString filePath);

    };

METHODS

onuploaded

Method invoked when the file has successfully uploaded to host application.

Signature
void onuploaded(DOMString filePath);
Parameters
  • filePath
    • Optional: No.
    • Nullable: No.
    • Type: DOMString.
    • Description: The full path of uploaded file, For instance, for a file, if the beach file is located at 'sampleApp' host application running on 127.0.0.1, then the fullPath is http://127.0.0.1:80/ws/apps/sampleApp/file/beach.jpg.

2.13. ManagerEvent

Interface which provides the notification when a N-Service client device is attached or detached.

    [NoInterfaceObject] interface ManagerEvent {

       readonly attribute unsigned short eventType; 

       readonly attribute DOMString deviceName; 

       readonly attribute DOMString uniqueID; 
    };
Code example
  function managerCallback(event) {
      switch (event.eventType) {
          webapis.nservice.MGR_EVENT_DEV_CONNECT:
              alert(event.deviceName + " with " + event.uniqueID + " joins");
              break;
          webapis.nservice.MGR_EVENT_DEV_DISCONNECT:
              alert(event.deviceName + " with " + event.uniqueID + " leaves");
              break;
      }
  }
  webapis.nservice.registerManagerCallback(managerCallback);
 
 

ATTRIBUTES

readonly unsigned short eventType

The event type which specifies whether a client device is connected or disconnected.

The value is the one of below types :

  • webapis.nservice.MGR_EVENT_DEV_CONNECT: A N-Service client device has been joined.
  • webapis.nservice.MGR_EVENT_DEV_DISCONNECT: A N-Service client device has been leaved.
This attribute is read-only.

readonly DOMString deviceName

The name of N-Service client device which sent this event.

The name will be same as 'DeviceName' value of the client device which is connected with N-Service REST API.

This attribute is read-only.

readonly DOMString uniqueID

The unique ID of client device which sent this event.

The name will be same as SLDeviceID value of the client device which is connected with N-Service REST API.

This attribute is read-only.

2.14. NServiceDeviceEventInfo

Interface which provides change notification from the connected client device.

    [NoInterfaceObject] interface NServiceDeviceEventInfo {

        readonly attribute unsigned short eventType;  


        readonly attribute (NServiceDeviceMessageInfoNServiceDeviceMessageInfo or NServiceDeviceGroupNServiceDeviceGroup) eventData;  

    };
Code example
 function deviceListSuccessCB(devices) {
     function deviceCallback(msg) {
         switch (msg.eventType) {
             webapis.nservice.DEV_EVENT_MESSAGE_RECEIVED:
                 alert(msg.eventData.message); 
                 break;

             webapis.nservice.DEV_EVENT_JOINED_GROUP:
                 alert("A device is joined to " + msg.eventData.groupName);
                 break;

             webapis.nservice.DEV_EVENT_LEFT_GROUP:     
                 alert("A device is left from " + msg.eventData.groupName);
                 break;
          }
     }

     // If any N-Service client device is already connected, register a message handler to a device found firstly.
     if (devices.length > 0) {
         devices[0].registerDeviceCallback(deviceCallback);
     }
 }
 
 function errorCB(error) {
     alert(error.name + " : " + error.message);
 }

 webapis.nservice.getNServiceDevices(deviceListSuccessCB, errorCB);
 

ATTRIBUTES

readonly unsigned short eventType

The message data which is delivered.

The value is the one of below types :

  • webapis.nservice.DEV_EVENT_MESSAGE_RECEIVED: A message received from a N-Service client device.
  • webapis.nservice.DEV_EVENT_JOINED_GROUP: A N-Service client device has been joined.
  • webapis.nservice.DEV_EVENT_LEFT_GROUP: A N-Service client device has been leaved.
This attribute is read-only.

readonly (NServiceDeviceMessageInfo or NServiceDeviceGroup) eventData

The message data which is delivered.

If the eventType attribute contains webapis.nservice.DEV_EVENT_MESSAGE_RECEIVED value, The type of data attribute will be NServiceDeviceMessageInfo. Otherwise, the type of data attribute will be NServiceDeviceGroup.

This attribute is read-only.

2.15. NServiceDeviceMessageInfo

Interface which provides message body and context.

    [NoInterfaceObject] interface NServiceDeviceMessageInfo {

        readonly attribute DOMString message;  

        readonly attribute DOMString context; 

    };

This interface will be referred only when a NServiceDeviceEventInfo with webapis.nservice.DEV_EVENT_MESSAGE_RECEIVED eventType is arrived.

Code example
 function deviceListSuccessCB(devices) {
     function deviceCallback(msg) {
         switch (msg.eventType) {
             webapis.nservice.DEV_EVENT_MESSAGE_RECEIVED:
                 alert(msg.eventData.message);
                 alert(msg.eventData.context); 
                 break;
          }
     }

     // If any N-Service client device is already connected, register a message handler to a device found firstly.
     if (devices.length > 0) {
         devices[0].registerDeviceCallback(deviceCallback);
     }
 }
 
 function errorCB(error) {
     alert(error.name + " : " + error.message);
 }

 webapis.nservice.getNServiceDevices(deviceListSuccessCB, errorCB);
 

ATTRIBUTES

readonly DOMString message

The message body.

This attribute is read-only.

readonly DOMString context

The message context.

This attribute is read-only.

2.16. NServiceDeviceGroup

Interface which provides group information.

    [NoInterfaceObject] interface NServiceDeviceGroup {

        readonly attribute DOMString groupName; 

        NServiceDeviceArrayNServiceDeviceArray getMembers();  

        void leave(SuccessCallback onsuccess, optional ErrorCallback? onerror);  

    };

In the host side, this interface will be referred only when a NServiceDeviceEventInfo with webapis.nservice.DEV_EVENT_JOINED_GROUP or webapis.nservice.DEV_EVENT_LEFT_GROUP eventType is incomming.

In the client side, this interface will be referred as the return paramter when invoking webapis.nservice.joinGroup() API.

Code example
 // when the client devices have been retrieved properly in the host side application.
 function deviceListSuccessCB(devices) {
     function deviceCallback(msg) {
         switch (msg.eventType) {

             webapis.nservice.DEV_EVENT_JOINED_GROUP:
             webapis.nservice.DEV_EVENT_LEFT_GROUP:     
                 alert(msg.groupName + " group has been changed");
                 break;
          }
     }

     // If any N-Service client device is already connected, register a message handler to a device found firstly.
     if (devices.length > 0) {
         devices[0].registerDeviceCallback(deviceCallback);
     }
 }
 
 function errorCB(error) {
     alert(error.name + " : " + error.message);
 }

 try {
    // Invoking API on host side.
     webapis.nservice.getNServiceDevices(deviceListSuccessCB, errorCB);
 } catch (err) {
     if (err.name == "NotSupportedError") {
        // invoking API on client side
        // assume that the connection to host has successfully completed.
        webapis.nservice.joinGroup("alpha", 
            function (group) {
               console.log("Joining to " + group.groupName + " is complete.");

                var members = group.getMembers();
                // communicate with a group member 
                members[0].sendMessage("Hi!, " + members[0].getName());

                // leave the group
                group.leave(function () {
                    console.log("I leaved the group");
                });    
            }
        }
     }
 }
 

ATTRIBUTES

readonly DOMString groupName

The group name which any device is joined or left.

This attribute is read-only.

METHODS

getMembers

Get the members of group.

Signature
NServiceDeviceArray getMembers();
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported. This feature is provided from client side only.

    with error type SecurityError, if this functionality is not allowed.

leave

Leave this group.

Signature
void leave(SuccessCallback onsuccess, optional ErrorCallback? onerror);

The onerror is launched with these error types:

  • UnknownError: In any other error case.
Parameters
  • onsuccess
    • Optional: No.
    • Nullable: No.
    • Type: SuccessCallback.
    • Description: Invoked if the leaving the group is successfully operated.
  • onerror
    • Optional: Yes.
    • Nullable: Yes.
    • Type: ErrorCallback.
    • Description: Function called when an error occurs.
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported. This feature is provided from client side only.

    with error type SecurityError, if this functionality is not allowed.

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

2.17. NServiceHost

Interface which provides operations to host application

    [NoInterfaceObject] interface NServiceHost {


        void disconnect(SuccessCallback onsuccess, optional ErrorCallback? onerror); 


        NServiceHostInfoNServiceHostInfo getHostInfo(); 

        void uploadFile(DOMString filePath, NServiceFileUploadSuccessCallbackNServiceFileUploadSuccessCallback onsuccess, optional ErrorCallback? onerror); 


        void deleteFile(DOMString filePath,
                    optional SuccessCallback? onsuccess,
                    optional ErrorCallback? onerror);

        void registerMessageCallback(NServiceMessageCallbackNServiceMessageCallback messageCallback); 


        void unregisterMessageCallback(); 

    };
Code example
 var myDeviceInfo = new webapis.NServiceOwnDeviceInfo({
     deviceID : "12345",
     deviceName : "Samsung Mobile",
 });

 var hostInfo = new webapis.NServiceHostInfo({
     ipAddress : "192.168.129.2",
     appID : "sample"
 });

 function onMsgReceived(msg) {
     console.log("message is arrived : " + msg);
 };

 function connectSCB(host) {
     var hostInfo = host.getHostInfo();    

     // Register message listener
     host.registerMessageCallback(onMsgReceived);
 };

 try {
     webapis.nservice.setOwnDeviceInfo(myDeviceInfo);
     webapis.nservice.connectNServiceHost(hostInfo, connectSCB);
 } catch (err) {     
     console.error(err.name);
 }
 

METHODS

disconnect

Request to disconnect with host.

Signature
void disconnect(SuccessCallback onsuccess, optional ErrorCallback? onerror);

The onerror is launched with these error types:

  • UnknownError: In any other error case.
Parameters
  • onsuccess
    • Optional: No.
    • Nullable: No.
    • Type: SuccessCallback.
    • Description: Invoked if the host is successfully disconnected.
  • onerror
    • Optional: Yes.
    • Nullable: Yes.
    • Type: ErrorCallback.
    • Description: Function called when an error occurs.
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported. This feature is provided from client side only.

    with error type SecurityError, if this functionality is not allowed.

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

    with error type InvalidStateError, if the connection between the client and the host is not established, or is invalid.

getHostInfo

Get current host application.

Signature
NServiceHostInfo getHostInfo();
Return value
the current host information
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported. This feature is provided from client side only.

    with error type SecurityError, if this functionality is not allowed.

    with error type InvalidStateError, if the connection between the client and the host is not established, or is invalid.

uploadFile

Upload a file to host.

Signature
void uploadFile(DOMString filePath, NServiceFileUploadSuccessCallback onsuccess, optional ErrorCallback? onerror);

An image file (jpeg, png, gif), an audio file (mp3) or a plain text file can be uploaded to host. The uploading file size can't be exceeded over 3MB.

The onerror is launched with these error types:

  • InvalidValuesError: If any of the input parameters contain an invalid value, the file path is not valid.
  • QuotaExceededError: If the uploading file size is exceeded over 3MB.
  • UnknownError: In any other error case.
Parameters
  • filePath
    • Optional: No.
    • Nullable: No.
    • Type: DOMString.
    • Description: The file path to be uploaded to host.
  • onsuccess
    • Optional: No.
    • Nullable: No.
    • Type: NServiceFileUploadSuccessCallback.
    • Description: Invoked if the file is successfully uploaded to host.
  • onerror
    • Optional: Yes.
    • Nullable: Yes.
    • Type: ErrorCallback.
    • Description: Function called when an error occurs.
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported. This feature is provided from client side only.

    with error type SecurityError, if this functionality is not allowed.

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

    with error type InvalidStateError, if the connection between the client and the host is not established, or is invalid.

Code example
 var myDeviceInfo = new webapis.NServiceOwnDeviceInfo({
     deviceID : "12345",
     deviceName : "Samsung Mobile",
 });

 var hostInfo = new webapis.NServiceHostInfo({
     ipAddress : "192.168.129.2",
     appID : "sample"
 });

 function onUploadSCB(filePath) {
     console.log("A file is uploaded to  " + filePath);
 };

 function connectSCB(host) {
     var fileObj; // assume that this file object has been set properly.    
    hostObj = host;

     // Register message listener
     host.uploadFile(fileObj, onUploadSCB, 
         function (error) {
             console.errror(error.name);
     });
 };

 try {
     webapis.nservice.setOwnDeviceInfo(myDeviceInfo);
     webapis.nservice.connectNServiceHost(hostInfo, connectSCB);
 } catch (err) {     
     console.error(err.name);
 }
 

deleteFile

Deletes a uploaded file.

Signature
void deleteFile(DOMString filePath, optional SuccessCallback? onsuccess, optional ErrorCallback? onerror);

This function attempts to asynchronously delete a file which already uploaded to host application.

The ErrorCallback is launched with these error types:

  • InvalidValuesError: If any of the input parameters contain an invalid value.
  • NotFoundError: The file does not correspond to a valid file.
  • UnknownError: In any other error case.
Parameters
  • filePath
    • Optional: No.
    • Nullable: No.
    • Type: DOMString.
    • Description: The full path to the uploaded file to be deleted.
  • onsuccess
    • Optional: Yes.
    • Nullable: Yes.
    • Type: SuccessCallback.
    • Description: Called if the file is successfully deleted.
  • onerror
    • Optional: Yes.
    • Nullable: Yes.
    • Type: ErrorCallback.
    • Description: Called if an error occurred.
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if the feature is not supported. This feature is provided from client side only.

    with error type SecurityError, if this functionality is not allowed.

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

    with error type InvalidStateError, if the connection between the client and the host is not established, or is invalid.

Code example
 var myDeviceInfo = new webapis.NServiceOwnDeviceInfo({
     deviceID : "12345",
     deviceName : "Samsung Mobile",
 });

 var hostInfo = new webapis.NServiceHostInfo({
     ipAddress : "192.168.129.2",
     appID : "sample"
 });
 var hostObj = null;

 function onUploadSCB(filePath) {
     console.log("A file is uploaded to  " + filePath);
    // delete the uploaded file
    host.deleteFile(fullPath,
        function () {
            console.log("file is successfully deleted");
        },
       function (err) {
           console.error(error.name);
       }); 
 };

 function connectSCB(host) {
     var fileObj; // assume that this file object has been set properly.    
    hostObj = host;

     // Register message listener
     host.uploadFile(fileObj, onUploadSCB, 
         function (error) {
             console.errror(error.name);
     });
 };

 try {
     webapis.nservice.setOwnDeviceInfo(myDeviceInfo);
     webapis.nservice.connectNServiceHost(hostInfo, connectSCB);
 } catch (err) {     
     console.error(err.name);
 }
 

registerMessageCallback

Register a listener to receive host sent messages.

Signature
void registerMessageCallback(NServiceMessageCallback messageCallback);
Parameters
  • messageCallback
    • Optional: No.
    • Nullable: No.
    • Type: NServiceMessageCallback.
    • Description: Invoked whenever a message is arrived.
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported. This feature is provided from client side only.

    with error type SecurityError, if this functionality is not allowed.

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

    with error type InvalidStateError, if the connection between the client and the host is not established, or is invalid.

unregisterMessageCallback

Unregister the message listener.

Signature
void unregisterMessageCallback();
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported. This feature is provided from client side only.

    with error type SecurityError, if this functionality is not allowed.

    with error type InvalidStateError, if the connection between the client and the host is not established, or is invalid.

2.18. NServiceDevice

Interface which provides transaction operations to the N-Service client device.

    [NoInterfaceObject] interface NServiceDevice {

       DOMString getName(); 


       unsigned short getType();  

        unsigned short sendMessage(DOMString message);

        void registerDeviceCallback(NServiceDeviceCallbackNServiceDeviceCallback eventCallback) ;


        void unregisterDeviceCallback();
    };
Code example
 function deviceListSuccessCB(devices) {

     // If any N-Service client device is already connected
     if (devices.length > 0) {
 
        // Print out the properties of the N-Service device
         alert("N-Service client unique ID : " + devices[0].getType());
         alert("N-Service client device name : " + devices[0].getName());
     }
 }
 
 function errorCB(error) {
     alert(error.name + " : " + error.message);
 }

 webapis.nservice.getNServiceDevices(deviceListSuccessCB, errorCB);
 

METHODS

getName

Retrieves the name of N-Service client device.

Signature
DOMString getName();

In the host side, DeviceName value of the client device which is connected with N-Service REST API will be returned. Otherwise, SLDeviceID value of the client device will be returned in the client side.

Return value
The name or ID of N-Service device
Exceptions
  • WebAPIException:

    with error type SecurityError, if this functionality is not allowed.

getType

Retrieves the type of N-Service client device.

Signature
unsigned short getType();

Only webapis.nservice.DEV_SMART_DEVICE will be returned when retrieving it.

Return value
The type of N-Service client device
Exceptions
  • WebAPIException:

    with error type SecurityError, if this functionality is not allowed.

sendMessage

Send a message to the N-Service client device

Signature
unsigned short sendMessage(DOMString message);
Parameters
  • message
    • Optional: No.
    • Nullable: No.
    • Type: DOMString.
    • Description: The message buffer which will be delivered to a client device.
Return value
if it is successful, return webapis.nservice.ERROR_CODE_NO_ERR. Otherwise, webapis.nservice.ERROR_CODE_ERR.
Exceptions
  • WebAPIException:

    with error type SecurityError, if this functionality is not allowed.

    with error type InvalidStateError, if the connection between the client and the host is not established, or is invalid.

Code example
 function deviceListSuccessCB(devices) {

     // If any N-Service client device is already connected
     if (devices.length > 0) {
 
        // Send a message to first found device
         var result = devices[0].sendMessage("greeting! we have made communication channel properly.");
         if (result == webapis.nservice.ERROR_CODE_ERR) {
             alert("Error!, the message is not sent properly.");
         }
     }
 }
 
 function errorCB(error) {
     alert(error.name + " : " + error.message);
 }

 webapis.nservice.getNServiceDevices(deviceListSuccessCB, errorCB);
 

registerDeviceCallback

Register a callback function to be invoked when a message comes.

Signature
void registerDeviceCallback(NServiceDeviceCallback eventCallback);
Parameters
  • eventCallback
    • Optional: No.
    • Nullable: No.
    • Type: NServiceDeviceCallback.
    • Description: Callback which will be invoked when a message is comming
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported. This feature is provided from host side only.

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

Code example
 function deviceListSuccessCB(devices) {
     function deviceCallback(msg) {
         // Handle msg argument here. Refers to the sample code of NServiceDeviceEventInfo
     }

     // If any N-Service client device is already connected, register a message handler to a device found firstly.
     if (devices.length > 0) {
         devices[0].registerDeviceCallback(deviceCallback);
     }
 }
 
 function errorCB(error) {
     alert(error.name + " : " + error.message);
 }

 webapis.nservice.getNServiceDevices(deviceListSuccessCB, errorCB);
 

unregisterDeviceCallback

Unregister the listener for receiving a message from the client device.

Signature
void unregisterDeviceCallback();
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported. This feature is provided from host side only.

Code example
 function deviceListSuccessCB(devices) {

     // If any N-Service client device is already connected, register a message handler to a device found firstly.
     if (devices.length > 0) {
        // assume that a device callback of device has been attached.
         devices[0].unregisterDeviceCallback();
     }
 }
 
 function errorCB(error) {
     alert(error.name + " : " + error.message);
 }

 webapis.nservice.getNServiceDevices(deviceListSuccessCB, errorCB);
 

2.19. NServiceManager

Interface which provides the N-Service operations.

    [NoInterfaceObject] interface NServiceManager {
   
        const unsigned short ERROR_CODE_NO_ERR = 0; 

        const unsigned short ERROR_CODE_ERR = 9999; 

        const unsigned short DEV_EVENT_MESSAGE_RECEIVED = 150; 

        const unsigned short DEV_EVENT_JOINED_GROUP = 151;

        const unsigned short DEV_EVENT_LEFT_GROUP = 152;

        const unsigned short MGR_EVENT_DEV_CONNECT = 11; 

        const unsigned short MGR_EVENT_DEV_DISCONNECT = 12; 

        const unsigned short MGR_EVENT_DEV_STATUS = 13; 

        const unsigned short DEV_SMART_DEVICE = 33; 


        boolean setOwnDeviceInfo(NServiceOwnDeviceInfoNServiceOwnDeviceInfo info);

        NServiceOwnDeviceInfoNServiceOwnDeviceInfo? getOwnDeviceInfo();

        void connectNServiceHost(NServiceHostInfoNServiceHostInfo hostInfo, 
            NServiceHostConnectSuccessCallbackNServiceHostConnectSuccessCallback onsuccess,
            optional ErrorCallback? onerror);

        void joinGroup(DOMString groupName,
            NServiceGroupSuccessCallbackNServiceGroupSuccessCallback onsuccess, 
            optional ErrorCallback? onerror);

        void getNServiceDevices(NServiceDeviceListSuccessCallbackNServiceDeviceListSuccessCallback onsuccess, optional ErrorCallback onerror);

        unsigned short multicastMessage(DOMString groupID, DOMString message);

        unsigned short broadcastMessage(DOMString message);

        unsigned short sendMessageToHost(DOMString message);

        void registerManagerCallback(NServiceDeviceManagerCallbackNServiceDeviceManagerCallback monitorCallback);
        
   };

Supported operations are as below:

  • Common : send a multicast message or broadcast message.
  • Host : connect client devices and to monitor a device's status.
  • Client : set own device information, connect to host device and join a group.

CONSTANTS

unsigned short ERROR_CODE_NO_ERR

The identifier when no error occurred on sending message.

unsigned short ERROR_CODE_ERR

The identifier when an error occurred on sending message.

unsigned short DEV_EVENT_MESSAGE_RECEIVED

The identifier for a message received from a N-Service client device.

unsigned short DEV_EVENT_JOINED_GROUP

The identifier for the event when a N-Service client device joined a group.

unsigned short DEV_EVENT_LEFT_GROUP

The identifier for the event when a N-Service client device leaved a group.

unsigned short MGR_EVENT_DEV_CONNECT

The identifier for the event when a N-Service device joins.

unsigned short MGR_EVENT_DEV_DISCONNECT

The identifier for the event when a N-Service device leaves.

unsigned short MGR_EVENT_DEV_STATUS

The identifier for the event when a N-Service device status retrieves.

unsigned short DEV_SMART_DEVICE

The identifier for the device type which are currently connected.

METHODS

setOwnDeviceInfo

Set own device information

Signature
boolean setOwnDeviceInfo(NServiceOwnDeviceInfo info);
Parameters
  • info
    • Optional: No.
    • Nullable: No.
    • Type: NServiceOwnDeviceInfo.
    • Description: The own device information which will be notified to host.
Return value
true if setting own device information is completed properly, otherwise false.
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported. This feature is provided from client side only.

    with error type SecurityError, if this functionality is not allowed.

    with error type InvalidValuesError, if the own device information to be set has an invalid value.

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

Code example
 var myDeviceInfo = new webapis.NServiceOwnDeviceInfo({
     deviceID : "12345",
     deviceName : "Samsung Mobile"
 });

 try {
     webapis.nservice.setOwnDeviceInfo(myDeviceInfo);
 } catch (err) {     
     console.error(err.name);
 }
 

getOwnDeviceInfo

Get the own device information

Signature
NServiceOwnDeviceInfo? getOwnDeviceInfo();
Exceptions
  • WebAPIException:

    with error type SecurityError, if this functionality is not allowed.

    with error type NotSupportedError, if this feature is not supported. This feature is provided from client side only.

Code example
 try {
     var myInfo = webapis.nservice.getOwnDeviceInfo();
     if (myInfo == null)  {
         console.log("own device information is not set yet.");
     }
 } catch (err) {     
     console.error(err.name);
 }
 

connectNServiceHost

Connect to N-Service host application. N-Screen supports a client application to connect to only one host(TV) at a time.

Signature
void connectNServiceHost(NServiceHostInfo hostInfo, NServiceHostConnectSuccessCallback onsuccess, optional ErrorCallback? onerror);

The onerror is launched with these error types:

  • InvalidValuesError: If the host information is invalid.
  • SecurityError: If the optional operations such as launching or installing the host application are not permitted.
  • UnknownError: In any other error case.
Parameters
  • hostInfo
    • Optional: No.
    • Nullable: No.
    • Type: NServiceHostInfo.
    • Description: The host information to be connected.
  • onsuccess
    • Optional: No.
    • Nullable: No.
    • Type: NServiceHostConnectSuccessCallback.
    • Description: Invoked if the connection are successfully operated.
  • onerror
    • Optional: Yes.
    • Nullable: Yes.
    • Type: ErrorCallback.
    • Description: Function called when an error occurs.
Exceptions
  • WebAPIException:

    with error type SecurityError, if this functionality is not allowed.

    with error type NotSupportedError, if this feature is not supported. This feature is provided from client side only.

    with error type InvalidStateError, if client side tries to connect to other host before disconnecting previous connection.

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

joinGroup

Join a specific group.

Signature
void joinGroup(DOMString groupName, NServiceGroupSuccessCallback onsuccess, optional ErrorCallback? onerror);

If there is no such a group available, the group will be automatically created and joined.

The onerror is launched with these error types:

  • UnknownError: In any other error case.
Parameters
  • groupName
    • Optional: No.
    • Nullable: No.
    • Type: DOMString.
    • Description: The group name which will be joined.
  • onsuccess
    • Optional: No.
    • Nullable: No.
    • Type: NServiceGroupSuccessCallback.
    • Description: Invoked if the joining group is successfully operated.
  • onerror
    • Optional: Yes.
    • Nullable: Yes.
    • Type: ErrorCallback.
    • Description: Function called when an error occurs.
Exceptions
  • WebAPIException:

    with error type SecurityError, if this functionality is not allowed.

    with error type NotSupportedError, if this feature is not supported. This feature is provided from client side only.

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

    with error type InvalidStateError, if the connection between the client and the host is not established, or is invalid.

getNServiceDevices

Request to get N-Service client devices which are currently connected.

Signature
void getNServiceDevices(NServiceDeviceListSuccessCallback onsuccess, optional ErrorCallback onerror);

The error callback is launched with these error types:

  • UnknownError: In any other error case.
Parameters
  • onsuccess
    • Optional: No.
    • Nullable: No.
    • Type: NServiceDeviceListSuccessCallback.
    • Description: Success callback which will be invoked when getting N-Service client devices is complete successfully
  • onerror
    • Optional: Yes.
    • Nullable: No.
    • Type: ErrorCallback.
    • Description: Error callback when getting client device is failed
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported. This feature is provided from host side only.

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

    with error type InvalidStateError, if the connection between the client and the host is not established, or is invalid.

Code example
 function deviceListSuccessCB(devices) {
     alert (devices.length + " devices are connected");
 }
 
 function errorCB(error) {
     alert(error.name + " : " + error.message);
 }

 try {
     webapis.nservice.getNServiceDevices(deviceListSuccessCB, errorCB);
 } catch (err) {
     if (err.name == "NotSupportedError") {
         console.errror("getNServiceDevices() is not supported in this device. ");
     }
 }
 

multicastMessage

Multicasts a message to N-Service client devices which joined the same group.

Signature
unsigned short multicastMessage(DOMString groupID, DOMString message);
Parameters
  • groupID
    • Optional: No.
    • Nullable: No.
    • Type: DOMString.
    • Description: the group ID which a message will be sent.
  • message
    • Optional: No.
    • Nullable: No.
    • Type: DOMString.
    • Description: The message which will be broadcasted to the group of client devices.
Return value
if it is successful, return webapis.nservice.ERROR_CODE_NO_ERR. Otherwise, webapis.nservice.ERROR_CODE_ERR.
Exceptions
  • WebAPIException:

    with error type SecurityError, if this functionality is not allowed.

    with error type InvalidStateError, if the connection between the client and the host is not established, or is invalid.

Code example
 // In the client side, assume that the connection with host has been completed.
 var result = webapis.nservice.multicastMessage("group1", "Welcome to members of group 1!");

 if (result == webapis.nservice.ERROR_CODE_ERR) {
     alert("multi-casting a message failed to group1.");
  }  
 

broadcastMessage

Broadcast a message to all client devices.

Signature
unsigned short broadcastMessage(DOMString message);
Parameters
  • message
    • Optional: No.
    • Nullable: No.
    • Type: DOMString.
    • Description: The message which will be broadcasted to all client devices.
Return value
if it is successful, return webapis.nservice.ERROR_CODE_NO_ERR. Otherwise, webapis.nservice.ERROR_CODE_ERR.
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported. This feature is provided from host side only.

    with error type SecurityError, if this functionality is not allowed.

    with error type InvalidStateError, if the connection between the client and the host is not established, or is invalid.

Code example
 var result = webapis.nservice.broadcastMessage("Welcome everyone!");

 if (result == webapis.nservice.ERROR_CODE_ERR) {
     alert("Broadcasting a message failed.");
  }  
 

sendMessageToHost

Send a message to host device.

Signature
unsigned short sendMessageToHost(DOMString message);
Parameters
  • message
    • Optional: No.
    • Nullable: No.
    • Type: DOMString.
    • Description: The message which will be transacted to host devices.
Return value
if it is successful, return webapis.nservice.ERROR_CODE_NO_ERR. Otherwise, webapis.nservice.ERROR_CODE_ERR.
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported. This feature is provided from client side only.

    with error type SecurityError, if this functionality is not allowed.

    with error type InvalidStateError, if the connection between the client and the host is not established, or is invalid.

Code example
 // Assume that the connection with host has been completed.
 var result = webapis.nservice.sendMessageHost("Welcome everyone!");

 if (result == webapis.nservice.ERROR_CODE_ERR) {
     alert("Sending a message to TV is failed.");        
  }  
 

registerManagerCallback

Register the listener callback which will be invoked when a N-Service client device joined or leaved.

Signature
void registerManagerCallback(NServiceDeviceManagerCallback monitorCallback);
Parameters
  • monitorCallback
    • Optional: No.
    • Nullable: No.
    • Type: NServiceDeviceManagerCallback.
    • Description: Callback which will be registered to monitor client device connection changes.
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported. This feature is provided from host side only.

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

Code example
  function managerCallback(event) {
      switch (event.eventType) {
          webapis.nservice.MGR_EVENT_DEV_CONNECT:
              alert(event.name + " with " + event.uniqueID + " joins");
              break;
          webapis.nservice.MGR_EVENT_DEV_DISCONNECT:
              alert(event.name + " with " + event.uniqueID + " leaves");
              break;
      }
  }
  webapis.nservice.registerManagerCallback(managerCallback);
 
 

3. Full WebIDL

module NService {


    typedef sequence<NServiceDeviceNServiceDevice> NServiceDeviceArray;


    enum NServiceHostStatus { "RUNNING", "INSTALLING", "LAUNCHING", "UNKNOWN" };


    [NoInterfaceObject] interface WebAPIsNServiceManager {
        readonly attribute NServiceManagerNServiceManager nservice;
    };
    WebAPIs implements WebAPIsNServiceManagerWebAPIsNServiceManager;


    dictionary NServiceOwnDeviceInfoInit {
        DOMString deviceID;

        DOMString deviceName;
    };


    [Constructor (NServiceOwnDeviceInfoInitNServiceOwnDeviceInfoInit init)]
    interface NServiceOwnDeviceInfo {
        attribute DOMString deviceID;

        attribute DOMString vendorID;

        attribute DOMString deviceName;

        attribute DOMString productID;
    };


    dictionary NServiceHostInfoInit {

        DOMString ipAddress;

        DOMString appID;
    };


    [Constructor (NServiceHostInfoInitNServiceHostInfoInit init)]
    interface NServiceHostInfo {

        attribute DOMString ipAddress;

        attribute unsigned short portNumber;

        attribute DOMString appID;

        readonly attribute DOMString? version;

        readonly attribute DOMString? appName;

        readonly attribute NServiceHostStatusNServiceHostStatus status;

    };


    [Callback=FunctionOnly, NoInterfaceObject]
    interface NServiceDeviceListSuccessCallback {
        void onsuccess(NServiceDeviceArrayNServiceDeviceArray devices);
  };    


    [Callback=FunctionOnly, NoInterfaceObject]
    interface NServiceDeviceManagerCallback {
        void ondetected(ManagerEventManagerEvent event);
    };    


    [Callback=FunctionOnly, NoInterfaceObject]
    interface NServiceDeviceCallback {

        void onreceived(NServiceDeviceEventInfoNServiceDeviceEventInfo message);
    };


    [Callback=FunctionOnly, NoInterfaceObject]
    interface NServiceHostConnectSuccessCallback {

        void onsuccess(NServiceHostNServiceHost host);
    };


    [Callback=FunctionOnly, NoInterfaceObject]
    interface NServiceMessageCallback {

        void onreceive(DOMString message);
    };

    [Callback=FunctionOnly, NoInterfaceObject]
    interface NServiceGroupSuccessCallback {

        void onjoin(NServiceDeviceGroupNServiceDeviceGroup group);
    };

    [Callback=FunctionOnly, NoInterfaceObject]
    interface NServiceFileUploadSuccessCallback {

        void onuploaded(DOMString filePath);

    };

    [NoInterfaceObject] interface ManagerEvent {

       readonly attribute unsigned short eventType; 

       readonly attribute DOMString deviceName; 

       readonly attribute DOMString uniqueID; 
    };

    [NoInterfaceObject] interface NServiceDeviceEventInfo {

        readonly attribute unsigned short eventType;  


        readonly attribute (NServiceDeviceMessageInfoNServiceDeviceMessageInfo or NServiceDeviceGroupNServiceDeviceGroup) eventData;  

    };

    [NoInterfaceObject] interface NServiceDeviceMessageInfo {

        readonly attribute DOMString message;  

        readonly attribute DOMString context; 

    };

    [NoInterfaceObject] interface NServiceDeviceGroup {

        readonly attribute DOMString groupName; 

        NServiceDeviceArrayNServiceDeviceArray getMembers();  

        void leave(SuccessCallback onsuccess, optional ErrorCallback? onerror);  

    };

    [NoInterfaceObject] interface NServiceHost {


        void disconnect(SuccessCallback onsuccess, optional ErrorCallback? onerror); 


        NServiceHostInfoNServiceHostInfo getHostInfo(); 

        void uploadFile(DOMString filePath, NServiceFileUploadSuccessCallbackNServiceFileUploadSuccessCallback onsuccess, optional ErrorCallback? onerror); 


        void deleteFile(DOMString filePath,
                    optional SuccessCallback? onsuccess,
                    optional ErrorCallback? onerror);

        void registerMessageCallback(NServiceMessageCallbackNServiceMessageCallback messageCallback); 


        void unregisterMessageCallback(); 

    }; 

    [NoInterfaceObject] interface NServiceDevice {

       DOMString getName(); 


       unsigned short getType();  

        unsigned short sendMessage(DOMString message);

        void registerDeviceCallback(NServiceDeviceCallbackNServiceDeviceCallback eventCallback) ;


        void unregisterDeviceCallback();
    };

    [NoInterfaceObject] interface NServiceManager {
   
        const unsigned short ERROR_CODE_NO_ERR = 0; 

        const unsigned short ERROR_CODE_ERR = 9999; 

        const unsigned short DEV_EVENT_MESSAGE_RECEIVED = 150; 

        const unsigned short DEV_EVENT_JOINED_GROUP = 151;

        const unsigned short DEV_EVENT_LEFT_GROUP = 152;

        const unsigned short MGR_EVENT_DEV_CONNECT = 11; 

        const unsigned short MGR_EVENT_DEV_DISCONNECT = 12; 

        const unsigned short MGR_EVENT_DEV_STATUS = 13; 

        const unsigned short DEV_SMART_DEVICE = 33; 


        boolean setOwnDeviceInfo(NServiceOwnDeviceInfoNServiceOwnDeviceInfo info);

        NServiceOwnDeviceInfoNServiceOwnDeviceInfo? getOwnDeviceInfo();

        void connectNServiceHost(NServiceHostInfoNServiceHostInfo hostInfo, 
            NServiceHostConnectSuccessCallbackNServiceHostConnectSuccessCallback onsuccess,
            optional ErrorCallback? onerror);

        void joinGroup(DOMString groupName,
            NServiceGroupSuccessCallbackNServiceGroupSuccessCallback onsuccess, 
            optional ErrorCallback? onerror);

        void getNServiceDevices(NServiceDeviceListSuccessCallbackNServiceDeviceListSuccessCallback onsuccess, optional ErrorCallback onerror);

        unsigned short multicastMessage(DOMString groupID, DOMString message);

        unsigned short broadcastMessage(DOMString message);

        unsigned short sendMessageToHost(DOMString message);

        void registerManagerCallback(NServiceDeviceManagerCallbackNServiceDeviceManagerCallback monitorCallback);
        
   };

};