com.samsung.multiscreen

## Class Service

- java.lang.Object
- - com.samsung.multiscreen.Service

-     public class Service
      extends Object

  Encapsulates a MultiScreen-enabled service. Also provides the entry point for communication with services. May be created when services are discovered via `Search`, or by `getByURI(Uri, Result)` and `getById(Context, String, Result)`, if the service url or id are known and specified, respectively.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `SUPPORT_DMP`
    `static String` | `TYPE_SMART_TV`
    `static String` | `TYPE_SPEAKER`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Application` | `createApplication(String id, String channelId)` Create an application with the given app and channel id.
    `Application` | `createApplication(String id, String channelId, Map<String,Object> startArgs)` Create an application with the given app and channel id.
    `Application` | `createApplication(Uri uri, String channelId)` Create an application with the given uri and channel id.
    `Application` | `createApplication(Uri uri, String channelId, Map<String,Object> startArgs)` Create an application with the given uri and channel id.
    `AudioPlayer` | `createAudioPlayer(String appName)` Create an Audio Player with the service id
    `Channel` | `createChannel(Uri uri)` Create a channel with the given uri.
    `PhotoPlayer` | `createPhotoPlayer(String appName)` Create an Photo Player with the service id
    `VideoPlayer` | `createVideoPlayer(String appName)` Create an Video Player with the service id
    `boolean` | `equals(Object o)`
    `static void` | `getById(Context context, String id, Result<Service> result)` Retrieve the service given by the specified id.
    `static void` | `getByURI(Uri uri, int timeout, Result<Service> result)` Retrieve the service given by the specified uri.
    `static void` | `getByURI(Uri uri, Result<Service> result)` Retrieve the service given by the specified uri.
    `void` | `getDeviceInfo(Result<Device> callback)` Retrieve the underlying device information for the specified service.
    `String` | `getId()` Returns the id for this service.
    `com.samsung.multiscreen.Service.SecureModeState` | `getIsSecureModeSupported()` Returns whether secure mode is supported by service.
    `Boolean` | `getIsStandbyService()` Returns if this service is a service for standby device or not.
    `Map<String,Object>` | `getIsSupport()` Returns the support features for this service.
    `String` | `getName()` Returns the name for this service.
    `String` | `getType()` Returns the type for this service.
    `Uri` | `getUri()` Returns the endpoint uri for this service.
    `String` | `getVersion()` Returns the version for this service.
    `int` | `hashCode()`
    `void` | `isDMPSupported(Result<Boolean> result)` Checks whether support for DMP feature is provided or not
    `void` | `remove()` Removes standby device service from standby device list.
    `static Search` | `search(Context context)` Get an instance of `Search` for service discovery.
    `void` | `setIsSecureModeSupported(com.samsung.multiscreen.Service.SecureModeState isSecureModeSupported)` Returns whether secure mode is supported by service.
    `String` | `toString()`
    `static void` | `WakeOnWirelessAndConnect(String macAddr, Uri uri, int timeout, Result<Service> connectCallback)` Send a packet via WakeOnWirelessLan and create and connect to particular appilcation
    `static void` | `WakeOnWirelessAndConnect(String macAddr, Uri uri, Result<Service> connectCallback)` Send a packet via WakeOnWirelessLan and create and connect to particular appilcation
    `static void` | `WakeOnWirelessLan(String macAddr)` Send a packet for WakeOnWirelessLan.

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### SUPPORT_DMP

          public static final String SUPPORT_DMP

      See Also:
        Constant Field Values

    - #### TYPE_SMART_TV

          public static final String TYPE_SMART_TV

      See Also:
        Constant Field Values

    - #### TYPE_SPEAKER

          public static final String TYPE_SPEAKER

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### search

          public static Search search(Context context)

      Get an instance of `Search` for service discovery.
      Parameters:
        `context` - the context for the search
      Returns:
        an `Search` instance

    - #### getByURI

          public static void getByURI(Uri uri,
                      Result<Service> result)

      Retrieve the service given by the specified uri.
      Parameters:
        `uri` - the uri of the service
        `result` - the callback to invoke, if the service is retrieved.

    - #### getByURI

          public static void getByURI(Uri uri,
                      int timeout,
                      Result<Service> result)

      Retrieve the service given by the specified uri.
      Parameters:
        `uri` - the uri of the service
        `timeout` - the timeout in milliseconds
        `result` - the callback to invoke, if the service is retrieved.

    - #### getById

          public static void getById(Context context,
                     String id,
                     Result<Service> result)

      Retrieve the service given by the specified id.
      Parameters:
        `context` - the context for execution
        `id` - the id for the service to retrieve
        `result` - the callback to invoke, if the service is retrieved

    - #### WakeOnWirelessLan

          public static void WakeOnWirelessLan(String macAddr)

      Send a packet for WakeOnWirelessLan.
      Parameters:
        `macAddr` - Mac Address of TV

    - #### WakeOnWirelessAndConnect

          public static void WakeOnWirelessAndConnect(String macAddr,
                                      Uri uri,
                                      Result<Service> connectCallback)

      Send a packet via WakeOnWirelessLan and create and connect to particular appilcation
      Parameters:
        `macAddr` - Mac Address of TV
        `uri` - the uri of service
        `connectCallback` - the callback to invoke with the result of the connect request

    - #### WakeOnWirelessAndConnect

          public static void WakeOnWirelessAndConnect(String macAddr,
                                      Uri uri,
                                      int timeout,
                                      Result<Service> connectCallback)

      Send a packet via WakeOnWirelessLan and create and connect to particular appilcation
      Parameters:
        `macAddr` - Mac Address of TV
        `uri` - the uri of service
        `timeout` - the timeout for service connect request
        `connectCallback` - the callback to invoke with the result of the connect request

    - #### getDeviceInfo

          public void getDeviceInfo(Result<Device> callback)

      Retrieve the underlying device information for the specified service.
      Parameters:
        `callback` - the callback to invoke, if the device info is retrieved

    - #### createChannel

          public Channel createChannel(Uri uri)

      Create a channel with the given uri.
      Parameters:
        `uri` - the uri for the channel
      Returns:
        a channel instance for the given uri

    - #### createApplication

          public Application createApplication(Uri uri,
                                      String channelId)

      Create an application with the given uri and channel id.
      Parameters:
        `uri` - the uri for the application
        `channelId` - the id to use for the channel
      Returns:
        an application instance for the given uri

    - #### createApplication

          public Application createApplication(Uri uri,
                                      String channelId,
                                      Map<String,Object> startArgs)

      Create an application with the given uri and channel id.
      Parameters:
        `uri` - the uri for the application
        `channelId` - the id to use for the channel
        `startArgs` - arguments to pass to the application on start
      Returns:
        an application instance for the given uri

    - #### createApplication

          public Application createApplication(String id,
                                      String channelId)

      Create an application with the given app and channel id.
      Parameters:
        `id` - the id for the application
        `channelId` - the id to user for the channel
      Returns:
        an application instance for the given id

    - #### createVideoPlayer

          public VideoPlayer createVideoPlayer(String appName)

      Create an Video Player with the service id
      Parameters:
        `appName` - Name of the application
      Returns:
        an Video Player instance for the given id

    - #### createPhotoPlayer

          public PhotoPlayer createPhotoPlayer(String appName)

      Create an Photo Player with the service id
      Parameters:
        `appName` - Name of the application
      Returns:
        an Photo Player instance for the given id

    - #### createAudioPlayer

          public AudioPlayer createAudioPlayer(String appName)

      Create an Audio Player with the service id
      Parameters:
        `appName` - Name of the application
      Returns:
        an Audio Player instance for the given id

    - #### createApplication

          public Application createApplication(String id,
                                      String channelId,
                                      Map<String,Object> startArgs)

      Create an application with the given app and channel id.
      Parameters:
        `id` - the id for the application
        `channelId` - the id to use for the channel
        `startArgs` - arguments to pass to the application on start
      Returns:
        an application instance for the given id

    - #### remove

          public void remove()

      Removes standby device service from standby device list.

    - #### isDMPSupported

          public void isDMPSupported(Result<Boolean> result)

      Checks whether support for DMP feature is provided or not
      Parameters:
        `result` - : result to return whether DMP is supported by this service or not

    - #### getIsSecureModeSupported

          public com.samsung.multiscreen.Service.SecureModeState getIsSecureModeSupported()

      Returns whether secure mode is supported by service.

    - #### getId

          public String getId()

      Returns the id for this service.

    - #### getVersion

          public String getVersion()

      Returns the version for this service.

    - #### getName

          public String getName()

      Returns the name for this service.

    - #### getType

          public String getType()

      Returns the type for this service.

    - #### getIsSupport

          public Map<String,Object> getIsSupport()

      Returns the support features for this service.

    - #### getUri

          public Uri getUri()

      Returns the endpoint uri for this service.

    - #### getIsStandbyService

          public Boolean getIsStandbyService()

      Returns if this service is a service for standby device or not.

    - #### setIsSecureModeSupported

          public void setIsSecureModeSupported(com.samsung.multiscreen.Service.SecureModeState isSecureModeSupported)

      Returns whether secure mode is supported by service.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`