# Service

    @objc public class Service : NSObject

A Service instance represents the multiscreen service root on the remote device Use the class to control top level services of the device

- `discoveryType`

  Undocumented

  #### Declaration

  Swift

      @objc public class Service : NSObject

- `id`

  The id of the service

  #### Declaration

  Swift

      public var id: String

- `uri`

  The uri of the service (http://:/api/v2/)

  #### Declaration

  Swift

      public var uri: String

- `name`

  The name of the service (Living Room TV)

  #### Declaration

  Swift

      public var name: String

- `version`

  The version of the service (x.x.x)

  #### Declaration

  Swift

      public var version: String

- `type`

  The type of the service (Samsung SmartTV)

  #### Declaration

  Swift

      public var type: String

- `description`

  The service description

  #### Declaration

  Swift

      override public var description: String

- `getDeviceInfo(_:completionHandler:)`

  This asynchronously method retrieves a dictionary of additional information about the device the service is running on

  #### Declaration

  Swift

      public func getDeviceInfo(timeout: Int, completionHandler: (deviceInfo: [String:AnyObject]?, error: NSError?) -> Void )

  #### Parameters

  `timeout` | timeout
  `completionHandler` | A block to handle the response dictionary

- `createApplication(_:channelURI:args:)`

  Creates an application instance belonging to that service

  #### Declaration

  Swift

      public func createApplication(id: AnyObject, channelURI: String, args: [String:AnyObject]?) -> Application?

  #### Parameters

  `id` | The id of the application
  `channelURI` | The uri of the Channel (com.samsung.multiscreen.helloworld)
  `args` | A dictionary of command line aruguments to be passed to the Host TV App

  #### Return Value

  An Application instance or nil if application id or channel id is empty

- `createChannel(_:)`

  Creates a channel instance belonging to that service (mychannel)

  #### Declaration

  Swift

      public func createChannel(channelURI: String) -> Channel

  #### Return Value

  A Channel instance

- `createVideoPlayer(_:)`

  Creates video player instance

  #### Declaration

  Swift

      public func createVideoPlayer(appName : String) -> VideoPlayer

  #### Parameters

  `appName` |

  #### Return Value

  VideoPlayer instance

- `createAudioPlayer(_:)`

  Creates audio player instance

  #### Declaration

  Swift

      public func createAudioPlayer(appName : String) -> AudioPlayer

  #### Parameters

  `appName` |

  #### Return Value

  AudioPlayer instance

- `createPhotoPlayer(_:)`

  Creates photo player instance

  #### Declaration

  Swift

      public func createPhotoPlayer(appName : String) -> PhotoPlayer

  #### Parameters

  `appName` |

  #### Return Value

  PhotoPlayer instance

### class methods

- `search()`

  Creates a service search object

  #### Declaration

  Swift

      public class func search() -> ServiceSearch

  #### Return Value

  An instance of ServiceSearch

- `getByURI(_:timeout:completionHandler:)`

  This asynchronous method retrieves a service instance given a service URI

  #### Declaration

  Swift

      public class func getByURI(uri: String, timeout: NSTimeInterval, completionHandler: (service: Service?, error: NSError? ) -> Void)

  #### Parameters

  `uri` | The uri of the service
  `timeOut` |
  `completionHandler` | The completion handler with the service instance or an error

- `getById(_:completionHandler:)`

  This asynchronous method retrieves a service instance given a service id

  #### Declaration

  Swift

      public class func getById(id: String, completionHandler: (service: Service?, error: NSError? ) -> Void)

  #### Parameters

  `id` | The id of the service
  `completionHandler` | The completion handler with the service instance or an error

- `WakeOnWirelessLan(_:)`

  Send a packet for WakeOnWirelessLan.

  #### Declaration

  Swift

      public class func WakeOnWirelessLan(macAddr:String)

  #### Parameters

  `macAddr` | Mac Address of TV

- `WakeOnWirelessAndConnect(_:uri:completionHandler:)`

  Send a packet via WakeOnWirelessLan and create and connect to particular appilcation

  #### Declaration

  Swift

      public class func WakeOnWirelessAndConnect(macAddr:String, uri:String, completionHandler: (service:Service? , error: NSError? ) -> Void) -> Void

  #### Parameters

  `macAddr` | Mac Address of TV
  `uri` | The uri of service
  `service` | The service instance
  `error` | An error info if getByURI fails

- `WakeOnWirelessAndConnect(_:uri:timeOut:completionHandler:)`

  Send a packet via WakeOnWirelessLan and create and connect to particular appilcation

  #### Declaration

  Swift

      public class func WakeOnWirelessAndConnect(macAddr:String, uri:String, timeOut:NSTimeInterval ,completionHandler: (service:Service? , error: NSError? ) -> Void) -> Void

  #### Parameters

  `macAddr` | Mac Address of TV
  `uri` | The uri of service
  `timeOut` | timeout to wakeup
  `service` | The service instance
  `error` | An error info if getByURI fails

© 2016 . All rights reserved. (Last updated: 2016-10-27)

Generated by jazzy ♪♫ v0.7.2, a Realm project.