top

NServiceDeviceManager

Published 2014-10-28 | (Compatible with SDK 4.5,5.0,5.1 and 2012,2013,2014 models)

Interface NServiceDeviceManager
Constants Constant type Constants
  ERROR_CODE

ERROR_CODE_NO_ERR

  • Number
  • Call succeeded.

ERROR_CODE_ERR

  • Number
  • Call failed.
  MANAGER_EVENT

MGR_EVENT_DEV_CONNECT

  • Number
  • A device is connected.

MGR_EVENT_DEV_DISCONNECT

  • Number
  • A device is disconnected
Method

void getNServiceDevices(successCallback, errorCallback)

void registerManagerCallback(callbackFn(ManagerEvent))

Number broadcastMessage(DOMString message)

Number multicastMessage(DOMString groupID, DOMString message)

Method void getNServiceDevices(successCallback, errorCallback)

Request to get NService devices instances.

Parameter
  • successCallback function: callback function name of type callbackFunction(deviceArray), deviceArray is an array of NServiceDevice device instances
  • errorCallback function : callback function name of type callbackFunction()
Return Value None
Example webapis.nservice.getNServiceDevices(successCallback, errorCallback);

Method void registerManagerCallback(callbackFn(ManagerEvent))

Request to set callback function to receive NService device manager events such as MGR_EVENT_DEV_CONNECT or MGR_EVENT_DEV_DISCONNECT.

Parameter
  • callbackFn function : callback function that has prototype given as void callbackFn (ManagerEvent)
Return Value None
Example webapis.nservice.registerManagerCallback(cbFunc);

Method Number broadcastMessage(DOMString message)

broadcasts a message from TV application to all connected NService devices.

Parameter
  • messasge DOMString : message to broadcast
Return Value ERROR_CODE_NO_ERR if call is successful, else ERROR_CODE_ERR (Number)
Example webapis.nservice.broadcastMessage(message);

Method Number multicastMessage(DOMString groupID, DOMString message)

multicasts messages from TV application to all connected NService devices in a specified group.

Parameter

Parameter

  • groupID DOMString : group ID of the group to multicast to
  • messasge DOMString : message to multicast
Return Value ERROR_CODE_NO_ERR if call is successful, else ERROR_CODE_ERR (Number)
Example webapis.nservice.multicastMessage(groupID, message);

Warning

This module is only supported on Samsung Smart TV models for 2013 and later. Samsung SDK 4.1 or higher could be used for development of NService applications.