Udostępnij za pośrednictwem


IPacket

Holds data and is used by objects that implement IDevicePacketStream to transfer data between a device agent application and a desktop computer.

IPacket : public IUnknown

Methods

Method

Description

IPacket::get_Count

Gets the total number of data objects in the packet.

IPacket::IsEndOfPacket

Checks if the internal iterator has reached the end of the packet.

IPacket::ReadBool

Reads a Boolean value from the object and points the internal iterator to the next data object in the packet.

IPacket::ReadByte

Reads a byte from the object and points the internal iterator to the next data object in the packet.

IPacket::ReadBytes

Reads an array of bytes from the object and points the internal iterator to the next data object in the packet.

IPacket::ReadInt32

Reads an integer from the object and points the internal iterator to the next data object in the packet.

IPacket::ReadChar

Reads a character from the object and points the internal iterator to the next data object in the packet.

IPacket::ReadDataType

Returns the data type of the current object in the packet as an enumeration value.

IPacket::ReadString

Reads a string from the object and points the internal iterator to the next data object in the packet.

IPacket::Reset

Resets the packet's internal iterator to point to the first data object in the packet. The next read operation reads the first data object in the packet.

IPacket::WriteBool

Writes a Boolean value to the object.

IPacket::WriteByte

Writes a byte to the object.

IPacket::WriteBytes

Writes an array of bytes to the object.

IPacket::WriteChar

Writes a character to the object.

IPacket::WriteInt32

Writes an integer to the object.

IPacket::WriteString

Writes a string to the object.

Remarks

To get an object that implements this interface, use GetNewPacket.

Objects that implement this interface can only hold objects of type byte, byte[], string, int, and char. It is not extensible to read and write custom objects. However, users can still transfer custom objects across the stream by either splitting the custom data type into basic data types or serializing the custom data types into a byte array.

Example

The following example is a device agent application that writes one packet to the desktop and reads one packet from the desktop.

Managed Equivalent

Microsoft.SmartDevice.DeviceAgentTransport..::.IPacket

Requirements

DeviceAgentTransport.h

See Also

Other Resources

Unmanaged Device-Side Smart Device Connectivity API