nl::Weave::Profiles::SoftwareUpdate::ImageQueryResponse

#include <src/lib/profiles/software-update/SoftwareUpdateProfile.h>

A class to support creation and decoding of the image query response messages.

Summary

The image query response message has the form:

Length Field Name
variable URI
variable Version specification
variable Integrity specification
1 byte Update scheme
1 byte Update options
The format of the (optional) update options field is as follows:

Bit Meaning
0..2 Update priority
3..4 Update condition
5 Report status. When set, the client is requested to generate the optional DownloadNotify and UpdateNotify messages.
5..7 Reserved
The image query response is only sent in the case where the image query is processed successfully and produces an image to download. The message constitutes download instructions for the node the submitted the query. Note that in cases where the server fails to process the image query, it shall generate an image query status.

Constructors and Destructors

ImageQueryResponse()
The default constructor for ImageQueryResponse.

Public attributes

integritySpec
A field containing the integrity information (integrity type and a hash) for the software update image.
reportStatus
bool
Request to inform the server about the progress of software update via the optional DownloadNotify and UpdateNotify messages.
updateCondition
Instructions as to the conditions under which to proceed with software update.
updatePriority
Instructions directing the device when to perform the software update.
updateScheme
uint8_t
The update scheme to be used to download the software update image.
uri
A variable length UTF-8 string containing the location of the software image.
versionSpec
A variable length UTF-8 string containing a vendor-specific a software version identification.

Public functions

init(ReferencedString &, ReferencedString &, IntegritySpec &, uint8_t, UpdatePriority, UpdateCondition, bool)
Explicitly initialize the ImageQueryResponse object with the provided values.
operator==(const ImageQueryResponse &) const
bool
An equality operator.
pack(PacketBuffer *)
Serialize the ImageQueryResponse into the provided PacketBuffer.
print(void)
void

Public static functions

parse(PacketBuffer *, ImageQueryResponse &)
Deserialize the image query response message provided in a PacketBuffer into a provided ImageQueryResponse.

Public attributes

integritySpec

IntegritySpec integritySpec

A field containing the integrity information (integrity type and a hash) for the software update image.

reportStatus

bool reportStatus

Request to inform the server about the progress of software update via the optional DownloadNotify and UpdateNotify messages.

updateCondition

UpdateCondition updateCondition

Instructions as to the conditions under which to proceed with software update.

updatePriority

UpdatePriority updatePriority

Instructions directing the device when to perform the software update.

updateScheme

uint8_t updateScheme

The update scheme to be used to download the software update image.

Its value is drawn from UpdateSchemes.

uri

ReferencedString uri

A variable length UTF-8 string containing the location of the software image.

The contents of this string must conform to the RFC 3986 specification.  For update schemes corresponding to a well defined Internet Protocol (HTTP, HTTPS, SFTP), the scheme element of the URI MUST conform to the canonical URL encoding for that protocol scheme. The string length must not exceed 65565 and the the string must fit within a single Weave message, which may be subject to MTU limitations.

versionSpec

ReferencedString versionSpec

A variable length UTF-8 string containing a vendor-specific a software version identification.

The string length must not exceed 256 bytes.

Public functions

ImageQueryResponse

 ImageQueryResponse()

The default constructor for ImageQueryResponse.

The ImageQueryResponse may be populated by via the init() method or by deserializing the object from a message.

init

WEAVE_ERROR init(
  ReferencedString &,
  ReferencedString &,
  IntegritySpec &,
  uint8_t,
  UpdatePriority,
  UpdateCondition,
  bool
)

Explicitly initialize the ImageQueryResponse object with the provided values.

Details
Parameters
[in] aUri
The URI at which the new firmware image is to be found.
[in] aVersion
The version string for this image.
[in] aIntegrity
The integrity spec corresponding to the new image.
[in] aScheme
The update scheme to use in downloading.
[in] aPriority
The update priority associated with this update.
[in] aCondition
The condition under which to update.
[in] aReportStatus
If true requests the client to report after download and update, otherwise the client will not report.
Returns
WEAVE_NO_ERROR Unconditionally.

operator==

bool operator==(
  const ImageQueryResponse &
) const 

An equality operator.

Details
Parameters
another
An ImageQueryResponse to check against this ImageQueryResponse
Returns
true if all the fields in both objects are equal, false otherwise

pack

WEAVE_ERROR pack(
  PacketBuffer *
)

Serialize the ImageQueryResponse into the provided PacketBuffer.

Details
Parameters
[in] aBuffer
A packet buffer into which to pack the query response
Return Values
WEAVE_NO_ERROR
On success.
WEAVE_ERROR_BUFFER_TOO_SMALL
If the ImageQueryResponse is too large to fit in the provided buffer.

print

void print(
  void
)

Public static functions

parse

WEAVE_ERROR parse(
  PacketBuffer *,
  ImageQueryResponse &
)

Deserialize the image query response message provided in a PacketBuffer into a provided ImageQueryResponse.

Details
Parameters
[in] aBuffer
A pointer to a packet from which to parse the image query
[in] aResponse
An object in which to put the result
Returns
WEAVE_NO_ERROR On success
Returns
WEAVE_ERROR_BUFFER_TOO_SMALL If the message was too small to contain all the fields of the ImageQuery
Returns
WEAVE_ERROR_INVALID_INTEGRITY_TYPE If the provided integrity type is not one of the values specified in IntegrityTypes