Description:
The getServiceObject
method creates an object that
is used to access the services made available through a Service
API. This object is referred to as a "service object".
Syntax:
so = device.getServiceObject(provider, interface);
Arguments:
provider
:
This is a text string that defines the service provider name, that is, the name of the type of service object to create.
interface
:
This is a text string that defines the supported interface for the specified service provider.
Service API |
Provider |
Interface |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Return value:
If the call succeeds, the getServiceObject
method
returns a service object; otherwise it returns undefined
.
Remarks:
The getServiceObject
method is a factory
method found on the device
object.
To ensure backward compatibility, always check in your JavaScript
code that the device
object exists before calling the getServiceObject
method.
For example:
if (device != "undefined") device.getServiceObject("Service.MediaManagement", "IDataSource");
Example code:
The following example creates a service object for the Media Management Service API:
var so = device.getServiceObject("Service.MediaManagement", "IDataSource");