Reading and Writing Resource Data

In WPD Automation, a device can read resource data by using a Resource object that is accessed through the Resource property of a WPDObject. The Resource object has a Resource.Stream property that is an IStream, which can be used with the IXMLHttpRequest.send method to transmit and receive data via XML HTTP Requests.

Writing resource data is supported only when the object is first created. This is done by assigning the Data property of the Creation Container object before calling the AddChild method on the parent object.

The following sections include examples of reading and writing resource data synchronously and asynchronously.

Section Description
Synchronous Reading and Writing Describes reading resource data synchronously by upgrading the firmware of a device with new firmware obtained from a web service, and describes writing resource data synchronously by uploading diagnostic data from a device to a web service.
Asynchronous Functions Describes how to enable asynchronous behavior for certain functions, and demonstrates reading resource data asynchronously by using a completion event, and writing resource data asynchronously by using an XMLHTTPRequest in asynchronous mode.

 

Creation Container Object

Device Object

Resource Object

Service Object

WPDObject

WPD Automation Programming Guide