Herqq

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Friends | Related Functions

# HResourceAvailable Class Reference
Ssdp

This is a class that represents the resource available (ssdp:alive) message. More...

`#include <HResourceAvailable>`

List of all members.

## Public Member Functions
| HResourceAvailable ()
| HResourceAvailable (qint32 cacheControlMaxAge, const QUrl &location, const HProductTokens &serverTokens, const HDiscoveryType &usn, qint32 bootId=-1, qint32 configId=-1, qint32 searchPort=-1)
| ~HResourceAvailable ()
| HResourceAvailable (const HResourceAvailable &)
HResourceAvailable & | operator= (const HResourceAvailable &)
bool | isValid (HValidityCheckLevel level) const
const HProductTokens & | serverTokens () const
QUrl | location () const
const HDiscoveryType & | usn () const
qint32 | cacheControlMaxAge () const
qint32 | bootId () const
qint32 | configId () const
qint32 | searchPort () const
## Friends
H_UPNP_CORE_EXPORT bool | operator== (const HResourceAvailable &, const HResourceAvailable &)
## Related Functions
(Note that these are not member functions.)
bool | operator!= (const HResourceAvailable &obj1, const HResourceAvailable &obj2)

## Detailed Description

This is a class that represents the resource available (ssdp:alive) message.

According to the UDA, When a device is added to the network, it MUST multicast discovery messages to advertise its root device, any embedded devices, and any services. In HUPnP this class represents such an advertisement.

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

HResourceAvailable | ( |  | ) |

Constructs a new, empty instance.

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

See also:
  isValid()

HResourceAvailable | ( | qint32 | cacheControlMaxAge,
|  | const QUrl & | location,
|  | const HProductTokens & | serverTokens,
|  | const HDiscoveryType & | usn,
|  | qint32 | bootId = `-1`,
|  | qint32 | configId = `-1`,
|  | qint32 | searchPort = `-1`
| ) |  |

Constructs a new instance using the specified parameters.

Parameters:

  cacheControlMaxAge | specifies the number of seconds the advertisement is valid.
  location | specifies the URL to the UPnP description of the root device. If the location is invalid or empty the created object will be invalid.
  serverTokens | specifies 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:

  usn | specifies the Unique Service Name. The created object is valid only if the provided USN is valid.
  bootId | specifies 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.
  configId | specifies 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.
  searchPort | specifies 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 by 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()

~HResourceAvailable | ( |  | ) |

Destroys the instance.

HResourceAvailable | ( | const HResourceAvailable & | other | ) |

Copy constructor.

Copies the contents of the other object instance to this.

## Member Function Documentation

HResourceAvailable & operator= | ( | const HResourceAvailable & | other | ) |

Assigns the contents of the other object instance to this.

Remarks:
  This is not thread-safe.

bool isValid | ( | HValidityCheckLevel | level | ) | const

Indicates whether or not the object contains valid announcement information.

Parameters:

  level | indicates 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. 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 is empty if this object is invalid.

See also:
  isValid()

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()

qint32 cacheControlMaxAge | ( |  | ) | const

Returns the number of seconds the advertisement is valid.

Returns:
  The number of seconds the advertisement is valid. If the object is valid the return value is never smaller than 5.

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 HResourceAvailable & | ,
|  | const HResourceAvailable & |
| ) |  | `[friend]`

Compares the two objects for equality.

Returns:
  true in case the objects are logically equivalent.

bool operator!= | ( | const HResourceAvailable & | obj1,
|  | const HResourceAvailable & | obj2
| ) |  | `[related]`

Compares the two objects for inequality.

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