Windows CE .net SDK - PowerPoint PPT Presentation

1 / 31
About This Presentation
Title:

Windows CE .net SDK

Description:

Device hosting APIs. Allow implementation of UPnP devices. COM (primary SDK API) ... Control point APIs. Discovery and control of remote devices. COM. Bridging ... – PowerPoint PPT presentation

Number of Views:237
Avg rating:3.0/5.0
Slides: 32
Provided by: KathySa5
Category:
Tags: sdk | apis | net | windows

less

Transcript and Presenter's Notes

Title: Windows CE .net SDK


1
Windows CE .net SDK
Miro Juric Software Design Engineer/Test
Microsoft
2
Introduction
  • Overview of UPnP support in Windows CE (device
    side)
  • Overview of UPNP support in Windows CE (control
    point side)
  • IPv6 support
  • Windows CE support for UPnP Internet Gateway
    Device Demo
  • Q/A

3
UPnP support on CE
  • Device hosting APIs
  • Allow implementation of UPnP devices
  • COM (primary SDK API)
  • C ( available to OEMs)
  • Control point APIs
  • Discovery and control of remote devices
  • COM
  • Bridging
  • Expose non-UPnP devices as UPnP
  • No special support required

4
UPnP architecture on CE
5
UPnP Device Host
  • Infrastructure that simplifies building UPnP
    devices and bridges on Windows
  • Allows hosting of multiple devices

6
What does the device host infrastructure do?
  • Announces presence of registered devices
  • Renews the advertisements automatically
  • Responds to search requests as well
  • Responds to requests for device/service
    descriptions
  • Invokes actions requested by control points on
    services
  • Handles eventing
  • Accepts subscription requests
  • Maintains the list of subscribers per service
  • Sends events to all the subscribers

7
So what does the hosted device implement?
  • IUPnPDeviceControl
  • Is the device manager for contained services and
    devices
  • A service object per hosted service. For each
    service object, implement the following
  • IDispatch
  • Service exposes a dispatch interface for its
    exposed actions and state variables
  • IUPnPEventSource Optional
  • Service implements this interface to send state
    variable changes to the device host
    infrastructure
  • Device host infrastructure takes care of
    everything else!

8
UPnP device hosting (COM)
  • Need a XML device description template
  • Need a SCPD XML file for each service
  • Implement a COM object exposing
    IUPnPDeviceControl
  • Implement a Dispatch interface for each service
  • Call IUPnPRegisterRunningDevice to publish the
    device

9
UPnP Device Hosting (COM)
Device Implementation
UPnP COM Device Hosting Layer
Device Description Template .xml
IUPnPDeviceControl
IUPnPRegistrar
Service 2
Service 1 implementation
IDispatch
Scpd2.xml
IUPnPEventSource
Scpd1.xml
IUPnPEventSink
10
UPnP Device Hosting (COM)
  • IUPnPDeviceControl is the top level interface to
    your device
  • Initialize(
  • /in/ BSTR bstrXMLDesc,
  • /in/ BSTR bstrDeviceIdentifier, //
    device to Init (RegisterDevice)
  • /in/ BSTR bstrInitString)
    //identifies the init string specific to device
  • GetServiceObject(
  • /in/ BSTR bstrUDN, //
    Device UDN
  • /in/ BSTR bstrServiceId,
    // Service ID for which to obtain pointer
  • /out, retval/ IDispatch
    ppdispService) //Idispatch pointer to service
    object
  • Each service object exposes IDispatch and
    IUPnPEventSource
  • IDispatch is invoked for every control request
  • IUPnPEventSource is used for outbound event
    notifications when a state variable changes

11
Eventing
  • To support eventing, a service object implements
    IUPnPEventSource
  • Interface has two methods
  • Advise
  • Device host calls this method and gives the
    service object a pointer to an IUPnPEventSink
    interface
  • This gives the service object a way to pass back
    state changes to device host
  • Unadvise
  • Device host calls this method to tear down
    eventing
  • To send an event
  • Service calls IUPnPEventSinkOnStateChanged with
    a list of dispids for state variables that have
    changed
  • Device host queries the dispids, gets the changed
    values and sends an event to the subscribers

12
Device Registration
  • Device Host generates the appropriate URLs in the
    device description template
  • Device Host replaces UDNs in the device
    description template with globally unique
    identifiers
  • Allows the device to be registered on multiple
    machines using the same template
  • Allows the device to be registered on the same
    machine multiple times using the same template
  • Identifier passed back that allows a device to be
    unregistered

13
UPnP Device Hosting (COM)
  • Use UPnPRegistrar object to publish your device
  • RegisterDevice (
  • / in / BSTR bstrXMLDesc,
  • / in / BSTR bstrProgIDDeviceControlClas
    s,
  • / retvalout / BSTR pbstrDeviceIdentifier)
  • Registers the device to run in context of device
    host persists across sys boots
  • RegisterRunningDevice (
  • / in / BSTR bstrXMLDesc,
  • / in / IUnknown punkDeviceControl, //
    IUPnPDeviceControl
  • / retvalout / BSTR pbstrDeviceIdentifier)
  • Returns Device identifier to be used for
    Unregister does not persist across sys boots
  • UnregisterDevice(
  • / in / BSTR bstrDeviceIdentifier,
  • / in / BOOL fPermanent)
  • GetUniqueDeviceName
  • Retrieves the UDN of a device

14
UPnP Device Hosting (C)
  • Using low level C-style API (OEM only)
  • In this approach UPnP stack translates UPnP
    messages for the UPnP device to calls into a
    C-style callback function provided by device
    implementation. UPnP stack doesnt perform any
    encoding/decoding of arguments or state variables
    so device implementation has to deal with values
    in the format mandated by UPnP.
  • Not as full featured, but smaller foot print for
    OEMs making very small devices

15
UPnP Device Hosting (C)
  • UPnPAddDevice to create a named device based on
    your description.
  • Supply a callback function
  • UPnPPublishDevice to announce the device on the
    network
  • Callback function invoked on receiving control
    requests
  • UPnPSetControlResponse to send a response back
  • UPnPSubmitEvent to send event notifications to
    subscribers

16
Control Point API
  • COM interfaces for building UPnP control points
  • IUPnPDeviceFinder
  • IUPnPDevices
  • IUPnPDevice
  • IUPnPServices
  • IUPnPService

17
Object Model
Device Finder
18
Object Model
19
UPnP Control Point
  • Creating Device Finder
  • IUPnPDeviceFinder pDevFind NULL
  • CoCreateInstance(CLSID_UPnPDeviceFinder,
  • IID_IUPnPDeviceFinder,
  • (void ) pDevFind)
  • Search for Device
  • IUPnPDevices pFoundDevices NULL
  • bstrTypeURI SysAllocString
  • (Lurnschemas-upnp-orgdeviceclockdevice)
  • pDevFind-gtFindByType(bstrTypeURI, 0,
    pFoundDevices)
  • FindByType method searches by device or service
    type

20
UPnP Control Point
  • Enumerate Device
  • IUPnPDevices pFoundDevices
  • IUnknwn pUnk NULL
  • pFoundDevices-gtget_NewEnum(pUnk)
  • Device Objects in the collection are contained
    within VARIANT structures these structures
    contain pointers to IDispatch interfaces on the
    device objects
  • // Obtain IUPnPDevice pDevice interface
  • Get IUPnPServices service collection
  • GetService(IUPnPDevice pDevice)
  • IUPnPServices pServices NULL
  • IUPnPService pClockServics NULL
  • pDevice-gtget_Services(pServices)

21
UPnP Control Point
  • Get Service Object
  • We have IUPnPServices pServices
  • IUPnPService pClockService NULL
  • IUPnPService pAlarmService NULL
  • bstrClockSvcId SysAllocString
  • (Lurnupnp-orgserviceIdClockService)
  • pServices-gtget_Item(bstrSvcId, pClockService)
  • pServices-gtget_Item(bstrAlarmSvcID,
    pAlarmService)

22
UPnP Control Point
  • Invoke Actions control
  • IUPnPServiceInvokeAction method
  • pClockService-gtInvokeAction
  • ( bstrActionName,
  • varInArgs,
  • varOutArgs,
  • varReturnVal)
  • VARIANT varInArgs
  • QueryStateVariable
  • Discouraged by UPnP Forum

23
IPv6
  • Windows CE supports UPnP over IPv4 and IPv6
    networks
  • IPv6 support only
  • UPnP devices will use only IPv6 addresses
  • IPv4 IPv6
  • UPnP devices will use IPv6 address with IPv6
    capable hosts on the network and IPv4 address
    with devices supporting only IPv4
  • IPv4 only
  • UPnP devices use IPv4 only - Default

24
IPv6 Scope
  • Link Local  Addresses (begins with FE80..)
  • This means listening and broadcasting on FF02C,
    the link-local scope multicast address for the
    link-local scope multicast address for SSDP
    Default
  • Site Local  Addresses (begins with FEC0.)
  • Link local is used always. Site local is optional
    in addition to link local.
  • Uses scoping of IPv6 addresses to control the
    propagation of SSDP messages instead of Hop Limit
    (equivalent to the TTL limit in IPv4).

25
UPnP Samples
  • Samples in Windows CE .Net
  • Devices
  • Internet Gateway Device
  • Implements required schema and interacts with an
    actual Gateway implementation.
  • Fully functional IGD UPnP certified
  • Control Point
  • Universal Control Point sample

26
Platform Builder 4.10
  • Platform Builder is an integrated development
    environment (IDE) for building customized
    embedded platforms based on the Microsoft
    Windows CE .NET operating system (OS).
  • Platform Builder comes with all the development
    tools necessary for you to design, create, build,
    test, and debug a Windows CEbased platform. The
    IDE provides a single integrated workspace in
    which you can work on both platforms and projects

27
PB Configurations
  • Residential_gateway
  • PDA
  • Web Pad Enterprise

28
Building Windows CE based Residential Gateway
Image with UPnP Internet Gateway Device
Miro JuricSoftware Design Engineer/Test Windows
CE
29
Summary
  • UPnP supported in Windows CE
  • Pocket PC Windowc CE OS
  • Device hosting included in 4.0
  • Control point included in 4.0
  • Same APIs as XP!!
  • Generic Control Point sample
  • Working IGD for Gateways

30
Questions?
31
For the interconnected lifestyle
Write a Comment
User Comments (0)
About PowerShow.com