本文整理汇总了C++中Environment::InitParams方法的典型用法代码示例。如果您正苦于以下问题:C++ Environment::InitParams方法的具体用法?C++ Environment::InitParams怎么用?C++ Environment::InitParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Environment
的用法示例。
在下文中一共展示了Environment::InitParams方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SsdpListener
SsdpListenerUnicast::SsdpListenerUnicast(Environment& aEnv, ISsdpNotifyHandler& aNotifyHandler, TIpAddress aInterface)
: SsdpListener("SsdpListenerU")
, iEnv(aEnv)
, iNotifyHandler(aNotifyHandler)
, iInterface(aInterface)
, iSocket(aEnv, 0, aInterface)
, iSocketWriter(iSocket, Endpoint(Ssdp::kMulticastPort, Ssdp::kMulticastAddress))
, iSocketReader(iSocket)
, iWriteBuffer(iSocketWriter)
, iWriter(iWriteBuffer)
, iReadBuffer(iSocketReader)
, iReaderUntil(iReadBuffer)
, iReaderResponse(aEnv, iReaderUntil)
, iWriterLock("SSLU")
, iExiting(false)
, iRecreateSocket(false)
{
try {
iSocket.SetMulticastIf(aInterface);
}
catch (NetworkError&) {} // risk startup crashes if we don't suppress errors here
iSocket.SetTtl(aEnv.InitParams()->MsearchTtl());
try {
iSocket.SetRecvBufBytes(kRecvBufBytes);
}
catch (NetworkError&) {}
aEnv.AddResumeObserver(*this);
iReaderResponse.AddHeader(iHeaderCacheControl);
iReaderResponse.AddHeader(iHeaderExt);
iReaderResponse.AddHeader(iHeaderLocation);
iReaderResponse.AddHeader(iHeaderServer);
iReaderResponse.AddHeader(iHeaderSt);
iReaderResponse.AddHeader(iHeaderUsn);
}
示例2: WriteMaxAge
void Ssdp::WriteMaxAge(Environment& aEnv, IWriterHttpHeader& aWriter)
{
IWriterAscii& stream = aWriter.WriteHeaderField(Ssdp::kHeaderCacheControl);
stream.Write(kSsdpMaxAge);
stream.Write(kSsdpMaxAgeSeparator);
stream.WriteUint(aEnv.InitParams()->DvMaxUpdateTimeSecs());
stream.WriteFlush();
}
示例3: SocketUdpMulticast
SsdpSocketReader::SsdpSocketReader(Environment& aEnv, TIpAddress aInterface, const Endpoint& aMulticast)
: SocketUdpMulticast(aEnv, aInterface, aMulticast)
{
SetTtl(aEnv.InitParams()->MsearchTtl());
iReader = new UdpReader(*this);
}
示例4: TestSsdpUListen
void TestSsdpUListen(Environment& aEnv, const std::vector<Brn>& aArgs)
{
OptionParser parser;
OptionUint mx("-mx", "--mx", 0, "[1..5] number of second to spread response over");
parser.AddOption(&mx);
OptionUint adapter("-i", "--interface", 0, "index of network adapter to use");
parser.AddOption(&adapter);
OptionBool all("-a", "--all", "Search for all devices and services");
parser.AddOption(&all);
OptionBool root("-r", "--root", "Search for root devices only");
parser.AddOption(&root);
Brn emptyString("");
OptionString uuid("-u", "--uuid", emptyString, "[uuid string] search for a particular device");
parser.AddOption(&uuid);
OptionString urn("-t", "--urn", emptyString, "Search for a device or service of the form [domain:[device|service]:type:ver]");
parser.AddOption(&urn);
if (!parser.Parse(aArgs) || parser.HelpDisplayed()) {
return;
}
//Debug::SetLevel(Debug::kSsdpMulticast);
TBool block = true;
SsdpNotifyLoggerU logger;
SsdpListenerUnicast* uListener = new SsdpListenerUnicast(aEnv, logger, NetworkIf(aEnv, adapter.Value()));
uListener->Start();
if (all.Value()) {
Print("Search all...\n");
uListener->MsearchAll();
}
else if (root.Value()) {
Print("Search root...\n");
uListener->MsearchRoot();
}
else if (uuid.Value().Bytes() > 0) {
Print("Search uuid...\n");
uListener->MsearchUuid(uuid.Value());
}
else if (urn.Value().Bytes() > 0) {
Print("Search device/service...\n");
Brn domainName;
Brn deviceType;
TUint ver;
if (OpenHome::Net::Ssdp::ParseUrnDevice(urn.Value(), domainName, deviceType, ver)) {
uListener->MsearchDeviceType(domainName, deviceType, ver);
}
else if (OpenHome::Net::Ssdp::ParseUrnService(urn.Value(), domainName, deviceType, ver)) {
uListener->MsearchServiceType(domainName, deviceType, ver);
}
else {
parser.DisplayHelp();
block = false;
}
}
else {
parser.DisplayHelp();
block = false;
}
if (block) {
Blocker* blocker = new Blocker(aEnv);
blocker->Wait(aEnv.InitParams()->MsearchTimeSecs());
delete blocker;
}
delete uListener;
}