Zeroconf::RZeroconfAdvertisement

Zeroconf::RZeroconfAdvertisement Class Reference

RZeroconfAdvertisement is a subsession of the main RZeroconfSession that provides the ability to advertise a service. More...

#include <zeroconfadvertisement.h>


Public Member Functions

void OpenL (RZeroconfSession &aSession)
 Opens a new, blank advertisement.
void CreateServiceL (const TDesC &aServiceName, const TDesC &aServiceType, TServiceProtocol aProtocol, TUint16 aPort)
 Creates a named service advertisement with the given name and type.
void SetPortL (TUint16 aPort)
 Sets the port on which the service will run.
void SetServiceParameterL (const TDesC &aKey, const TDesC &aValue)
 Sets a key-value pair to be transmitted with the service advertisement.
TInt DeleteServiceParameter (const TDesC &aKey)
 Deletes a previously set parameter identified by the passed key.
void Advertise (TRequestStatus &aStatus)
 Advertises the service set up with the CreateServiceL call.
void UpdateServiceL ()
 Updates the service entry, after you have changed some of the service parameters.
void Close ()
 Closes the adverisement subsession.

Detailed Description

RZeroconfAdvertisement is a subsession of the main RZeroconfSession that provides the ability to advertise a service.

RZeroconfAdvertisement is a subsession of the main RZeroconfSession that provides the ability to advertise a service. Users can create an advertisement for a networked service running over TCP or UDP with a friendly name.

In addition, the client can set a sequence of key-value pairs to be transmitted with the service advertisement.


Member Function Documentation

void Zeroconf::RZeroconfAdvertisement::OpenL ( RZeroconfSession aSession  ) 

Opens a new, blank advertisement.

Opens a new, blank advertisement.

Parameters:
aSession An open session to the zeroconf server to open a subsession with.
Precondition:
Zeroconf server clients must have the NetworkServices capability.

void Zeroconf::RZeroconfAdvertisement::CreateServiceL ( const TDesC &  aServiceName,
const TDesC &  aServiceType,
TServiceProtocol  aProtocol,
TUint16  aPort 
)

Creates a named service advertisement with the given name and type.

Creates a named service advertisement with the given name and type. This method may only be called once, and will leave with KErrNotSupported if called a second time.

Parameters:
aServiceName A unicode descriptor containing the name for the service.
aServiceType A unicode descriptor containing the service type with leading underscore.
aProtocol The protocol over which the service runs, either TCP or UDP.
aPort The port on which the service runs on the local host.
Precondition:
Zeroconf server clients must have the NetworkServices capability.

void Zeroconf::RZeroconfAdvertisement::SetPortL ( TUint16  aPort  ) 

Sets the port on which the service will run.

Sets the port on which the service will run.

Parameters:
aPort The port on which the service runs on the local host.
Precondition:
Zeroconf server clients must have the NetworkServices capability.

void Zeroconf::RZeroconfAdvertisement::SetServiceParameterL ( const TDesC &  aKey,
const TDesC &  aValue 
)

Sets a key-value pair to be transmitted with the service advertisement.

Sets a key-value pair to be transmitted with the service advertisement. There may only be one value for a given key, if you already set a value for the supplied key, the old value will be overwritten.

Parameters:
aKey The key to set a value for.
aValue The value to set.
Precondition:
Zeroconf server clients must have the NetworkServices capability.

TInt Zeroconf::RZeroconfAdvertisement::DeleteServiceParameter ( const TDesC &  aKey  ) 

Deletes a previously set parameter identified by the passed key.

Deletes a previously set parameter identified by the passed key.

Parameters:
aKey The key to delete the value for.
Returns:
KErrNotFound if the parameter isn't found, KErrNone if it was sucessfully deleted.
Precondition:
Zeroconf server clients must have the NetworkServices capability.

void Zeroconf::RZeroconfAdvertisement::Advertise ( TRequestStatus &  aStatus  ) 

Advertises the service set up with the CreateServiceL call.

Advertises the service set up with the CreateServiceL call. Will return KErrNotReady if CreateServiceL hasn't yet been called. The call will be completed when the service has been set up and is ready to use. The service will continue to be advertised until the subsession is closed.

Parameters:
aStatus A TRequestStatus object to be signalled when the service is ready to use.
Precondition:
Zeroconf server clients must have the NetworkServices capability.

void Zeroconf::RZeroconfAdvertisement::UpdateServiceL (  ) 

Updates the service entry, after you have changed some of the service parameters.

Updates the service entry, after you have changed some of the service parameters. If called before the service has been advertised, this call will leave with KErrNotReady.

Precondition:
Zeroconf server clients must have the NetworkServices capability.

void Zeroconf::RZeroconfAdvertisement::Close (  ) 

Closes the adverisement subsession.

Closes the advertisement subsession, causing the service to cease to be advertised.

Precondition:
Zeroconf server clients must have the NetworkServices capability.