Partager via


Device Control

UPnP devices are controlled by the services that they expose. A UPnP service is the smallest controllable entity in the UPnP architecture. Devices expose one service for each primary function they perform. Complex devices are typically composed of several simple services and other devices.

A service consists of a set of state variables and a set of actions an application can invoke that operate on those state variables. In the UPnP Control Point API, services are represented by Service objects that expose the IUPnPService:IDispatch interface.

A service type defines the state variables and actions supported by a particular service. For example, the service type for a clock service defines GetTime and SetTime actions, along with a Time state variable.

A service identifier differentiates multiple common service types within a single device. For example, there can be two clock services in an alarm clock, one for the regular clock, and one for the alarm. The two services have identical service types. The service identifier provides a unique way of identify an instance of a service type. Because service type is not a unique identifier, this service identifier is then used to access the correct service from the IUPnPServices:IDispatch collection. The **IUPnPService****interface also allows applications to register a callback interface with the service object. When the value of a service's state variable changes, the service object invokes the registered callback to notify the application of the change. Universal Plug and Play also invokes this callback to notify applications when a service instance has become unavailable. The service may become unavailable for a variety of reasons, including transient network failure.

See Also

Control Point API | IUPnPService:IDispatch | IUPnPServices:IDispatch

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.