Library: UPnP/SSDP
Package: SSDP
Header: Poco/UPnP/SSDP/Advertisement.h
An Advertisement contains all data transferred via a SSDP Discovery message.
Advertisement objects are used with the SSDPResponder and the SSDPBrowser classes.
In addition to UUID, URN, location and lifetime an Advertisement can hold an arbitrary number of attributes. These can provide additional information about an Advertisement, such as the server ID of the device sending the advertisement, as well as the sender's IP address. Attributes can also be used by an application to add application-specific data to an Advertisement.
Direct Base Classes: Poco::RefCountedObject
All Base Classes: Poco::RefCountedObject
Member Functions: attributes, determineType, expired, lastSeen, lifetime, location, notificationType, renew, type, uniqueServiceName
Inherited Functions: duplicate, referenceCount, release
typedef Poco::AutoPtr < Advertisement > Ptr;
DEFAULT_LIFETIME = 120
Default lifetime of advertisements in seconds.
Advertisement(
Type type,
const Poco::UUID & deviceUUID,
const std::string & location,
int lifetime = DEFAULT_LIFETIME
);
Creates an Advertisement for the given root device or embedded device with the given XML device description location (URI) and lifetime in seconds.
Type must be ANNOUNCE_ROOT_DEVICE or ANNOUNCE_DEVICE.
Advertisement(
const Poco::UUID & deviceUUID,
const URN & deviceOrServiceURN,
const std::string & location,
int lifetime = DEFAULT_LIFETIME
);
Creates an Advertisement for a device type or service type.
Advertisement(
const std::string & notificationType,
const std::string & uniqueServiceName,
const std::string & location,
int lifetime = DEFAULT_LIFETIME
);
Creates an Advertisement for the given notificationType, uniqueServiceName and with the given timestamp and lifetime (in seconds).
Advertisement(
const URN & notificationType,
const UniqueServiceName & uniqueServiceName,
const std::string & location,
int lifetime = DEFAULT_LIFETIME
);
Creates an Advertisement for the given notificationType, uniqueServiceName and with the given timestamp and lifetime (in seconds).
~Advertisement();
Destroys the Advertisement.
Poco::Net::NameValueCollection & attributes();
Returns the Advertisement's attributes.
const Poco::Net::NameValueCollection & attributes() const;
Returns the Advertisement's attributes.
bool expired() const;
Returns true if and only if the Advertisement has expired.
Poco::Timestamp lastSeen() const;
Returns the time the Advertisement was last seen.
int lifetime() const;
Returns the lifetime, in seconds, of the Advertisement.
const std::string & location() const;
Returns the URI for obtaining the device or service description.
const URN & notificationType() const;
Returns the notification type.
void renew();
Renews the Advertisement by updating the lastSeen variable.
Type type() const;
Returns the type of the Advertisement.
const UniqueServiceName & uniqueServiceName() const;
Returns the unique service name.
void determineType();