Public Member Functions | Friends | Related Functions

HDiscoveryResponse Class Reference
[Ssdp]

A class that represents a response to a HDiscoveryRequest. More...

#include <HDiscoveryResponse>

List of all members.

Public Member Functions

 HDiscoveryResponse ()
 HDiscoveryResponse (qint32 cacheControlMaxAge, const QDateTime &date, const QUrl &location, const HProductTokens &serverTokens, const HDiscoveryType &usn, qint32 bootId=-1, qint32 configId=0, qint32 searchPort=-1)
 HDiscoveryResponse (const HDiscoveryResponse &)
HDiscoveryResponseoperator= (const HDiscoveryResponse &)
 ~HDiscoveryResponse ()
bool isValid (HValidityCheckLevel level) const
const HProductTokensserverTokens () const
QDateTime date () const
const HDiscoveryTypeusn () const
QUrl location () const
qint32 cacheControlMaxAge () const
qint32 bootId () const
qint32 configId () const
qint32 searchPort () const

Friends

H_UPNP_CORE_EXPORT bool operator== (const HDiscoveryResponse &, const HDiscoveryResponse &)

Related Functions

(Note that these are not member functions.)


H_UPNP_CORE_EXPORT bool operator!= (const HDiscoveryResponse &, const HDiscoveryResponse &)

Detailed Description

Usually, you create instances of this class to be sent by the Herqq::Upnp::HSsdp, or you receive instances of this class from the Herqq::Upnp::HSsdp.

Remarks:
the class provides an assignment operator, which is not thread-safe.
See also:
HSsdp

Constructor & Destructor Documentation

Constructs a new, empty instance.

The constructed object is not valid, i.e isValid() returns false.

See also:
isValid()
HDiscoveryResponse ( qint32  cacheControlMaxAge,
const QDateTime &  date,
const QUrl &  location,
const HProductTokens serverTokens,
const HDiscoveryType usn,
qint32  bootId = -1,
qint32  configId = 0,
qint32  searchPort = -1 
)

Constructs a new instance using the specified parameters.

The constructed object will be invalid, i.e. isValid() returns false in case the provided information is invalid.

Parameters:
cacheControlMaxAgespecifies the number of seconds the advertisement is valid.
date
locationspecifies the URL to the UPnP description of the root device. If the location is invalid or empty the created object will be invalid.
serverTokensspecifies information about the host, the UPnP version used and of the product. Note that if this parameter specifies UPnP version 1.1 or later, bootId and configId have to be properly defined. Otherwise the created object will be invalid.
Note:
Although server tokens are mandatory according to the UDA, this is not enforced by this class for interoperability reasons.
Parameters:
usnspecifies the Unique Service Name. The created object is valid only if the provided USN is valid.
bootIdspecifies the BOOTID.UPNP.ORG header value. Note that this is mandatory in UDA v1.1, whereas it is not specified at all in UDA v1.0. Because of this the class requires a valid value (>= 0) only in case the serverTokens identify UPnP v1.1 or later.
configIdspecifies the CONFIGID.UPNP.ORG header value. Note that this is mandatory in UDA v1.1, whereas it is not specified at all in UDA v1.0. Because of this, the class requires a valid value (>= 0) only in case the serverTokens identify UPnP v1.1 or later.
searchPortspecifies the SEARCHPORT.UPNP.ORG header value. Note that this is optional in UDA v1.1, whereas it is not specified at all in UDA v1.0. If specified, this is the port at which the device must listen for unicast M-SEARCH messages. Otherwise the port is the default 1900. This parameter is optional.
Remarks:
  • if cacheControlMaxAge is smaller than 5, it it set to 5 or if it is larger than 60 * 60 * 24 (a day in seconds), it is set to a day measured in seconds.
  • if searchPort is smaller than 49152 or larger than 65535 it is set to -1. The range is specified in UDA v1.1.
See also:
isValid()
HDiscoveryResponse ( const HDiscoveryResponse other )

Copy constructor.

Copies the contents of other to this.

Destroys the instance.


Member Function Documentation

HDiscoveryResponse & operator= ( const HDiscoveryResponse other )

Assigns the contents of the other to this.

Makes a deep copy.

Returns:
reference to this object.
bool isValid ( HValidityCheckLevel  level ) const

Indicates whether or not the object contains valid announcement information.

Parameters:
levelindicates whether the check should be strictly according to the UDA specification. If set to false some checks are omitted that are known to be poorly implemented in some UPnP software.
Returns:
true in case the objects contains valid announcement information in terms of the requested strictness.
const HProductTokens & serverTokens (  ) const

Returns the server tokens.

Returns:
the server tokens.
QDateTime date (  ) const

Returns the date when the response was generated.

Returns:
the date when the response was generated.
const HDiscoveryType & usn (  ) const

Returns the Unique Service Name.

The Unique Service Name identifies a unique device or service instance.

Returns:
the Unique Service Name. The returned object is invalid if this object is invalid.
See also:
isValid()
QUrl location (  ) const

Returns the location of the announced device.

Returns:
the location of the announced device. This is the URL where the device description can be retrieved. The returned object will be empty if this object is invalid.
See also:
isValid()
qint32 cacheControlMaxAge (  ) const

Returns the number of seconds the advertisement is valid.

Returns:
the number of seconds the advertisement is valid.
qint32 bootId (  ) const

Returns the value of BOOTID.UPNP.ORG.

Returns:
the value of BOOTID.UPNP.ORG. If the value is not specified -1 is returned.
qint32 configId (  ) const

Returns the value of CONFIGID.UPNP.ORG.

Returns:
the value of CONFIGID.UPNP.ORG. If the value is not specified -1 is returned.
qint32 searchPort (  ) const

Returns the value of SEARCHPORT.UPNP.ORG header field.

Returns:
the value of SEARCHPORT.UPNP.ORG header field. If the value is not specified -1 is returned.

Friends And Related Function Documentation

H_UPNP_CORE_EXPORT bool operator== ( const HDiscoveryResponse ,
const HDiscoveryResponse  
) [friend]

Compares the two objects for equality.

Returns:
true in case the objects are logically the equivalent.
H_UPNP_CORE_EXPORT bool operator!= ( const HDiscoveryResponse ,
const HDiscoveryResponse  
) [related]

Compares the two objects for inequality.

Returns:
true in case the objects are not logically the equivalent.