From OpenHome
Contents |
OpenHome Device Protocol
Overview
OpenHome Device Protocl (ODP) allows a control point to control and receive evented updates from an OpenHome device using a single TCP socket. This has some advantages over UPnP:
- No need to define error handling policy for cases where evented updates cannot be delivered.
If the socket connection is open, it'll be possible to deliver an evented update.
If the socket connection is broken, the device can automatically clean up all subscriptions from that control point. - No need to define additional protocol to allow control points to infer removal of a device.
If the socket connection is open, a control point can assume the device is available.
If the socket connection is broken, the control point is immediately prompted to retry connection; if this fails, it can quickly update its state to show that the device is no longer available. - No danger of TIME_WAIT socket errors when control points invoke very large numbers of actions and/or devices are rebooted.
Discovery
Using mDNS, search for _openhome._odp to identify an ODP endpoint.
Sample Code
ohPipeline contains reference code for control point or device stacks.
Control point authors can instantiate CpiDeviceOdp then use standard ohNet proxy classes to access all OpenHome network services. Proxies can be generated from UPnP service XML; pre-generated versions are available in ohNetGenerated.
See ODP test code for a simple example of a control point invoking actions and receiving evented updates over ODP.
Sample code for mDNS discovery of ODP devices is coming soon.