当前位置: 首页>>代码示例>>C++>>正文


C++ Brh类代码示例

本文整理汇总了C++中Brh的典型用法代码示例。如果您正苦于以下问题:C++ Brh类的具体用法?C++ Brh怎么用?C++ Brh使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Brh类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DvProviderAvOpenhomeOrgRadio1SetPropertyIdArray

int32_t STDCALL DvProviderAvOpenhomeOrgRadio1SetPropertyIdArray(THandle aProvider, const char* aValue, uint32_t aValueLen, uint32_t* aChanged)
{
    Brh buf;
    buf.Set((const TByte*)aValue, aValueLen);
    *aChanged = (reinterpret_cast<DvProviderAvOpenhomeOrgRadio1C*>(aProvider)->SetPropertyIdArray(buf)? 1 : 0);
    return 0;
}
开发者ID:astaykov,项目名称:ohNet,代码行数:7,代码来源:DvAvOpenhomeOrgRadio1C.cpp

示例2: MakeFunctorAsync

void DeviceListTI::GetProtocolInfoComplete(IAsync& aAsync)
{
    if (Os::TimeInMs(iEnv.OsCtx()) > iStopTimeMs) {
        return;
    }
    FunctorAsync callback = MakeFunctorAsync(*this, &DeviceListTI::GetProtocolInfoComplete);
    iConnMgr->BeginGetProtocolInfo(callback);

    Brh source;
    Brh sink;
    iConnMgr->EndGetProtocolInfo(aAsync, source, sink); // throws if invocation failed
    iLock.Wait();
    gActionCount++;
    if (sink.Bytes() == 0) {
        ASSERT(iExpectedSink.Bytes() == 0);
    }
    else {
        if (iExpectedSink.Bytes() == 0) {
            sink.TransferTo(iExpectedSink);
        }
        else {
            //ASSERT(sink == iExpectedSink);
            // can't use the above assertion.  aVia Media Renderer sometimes responds with two copies of its supported protocols
        }
    }
    iLock.Signal();
}
开发者ID:MatthewMiddleweek,项目名称:ohNet,代码行数:27,代码来源:TestInvocation.cpp

示例3: invocationWrapper

void DvProviderAvOpenhomeOrgRadio1C::DoIdArray(IDviInvocation& aInvocation)
{
    DvInvocationCPrivate invocationWrapper(aInvocation);
    IDvInvocationC* invocationC;
    void* invocationCPtr;
    invocationWrapper.GetInvocationC(&invocationC, &invocationCPtr);
    aInvocation.InvocationReadStart();
    aInvocation.InvocationReadEnd();
    DviInvocation invocation(aInvocation);
    uint32_t Token;
    char* Array;
    uint32_t ArrayLen;
    ASSERT(iCallbackIdArray != NULL);
    if (0 != iCallbackIdArray(iPtrIdArray, invocationC, invocationCPtr, &Token, &Array, &ArrayLen)) {
        invocation.Error(502, Brn("Action failed"));
        return;
    }
    DviInvocationResponseUint respToken(aInvocation, "Token");
    DviInvocationResponseBinary respArray(aInvocation, "Array");
    invocation.StartResponse();
    respToken.Write(Token);
    Brh bufArray;
    bufArray.Set((const TByte*)Array, ArrayLen);
    OhNetFreeExternal(Array);
    respArray.Write(bufArray);
    respArray.WriteFlush();
    invocation.EndResponse();
}
开发者ID:astaykov,项目名称:ohNet,代码行数:28,代码来源:DvAvOpenhomeOrgRadio1C.cpp

示例4: DvProviderAvOpenhomeOrgRadio1GetPropertyIdArray

void STDCALL DvProviderAvOpenhomeOrgRadio1GetPropertyIdArray(THandle aProvider, char** aValue, uint32_t* aValueLen)
{
    Brh buf;
    reinterpret_cast<DvProviderAvOpenhomeOrgRadio1C*>(aProvider)->GetPropertyIdArray(buf);
    *aValueLen = buf.Bytes();
    *aValue = (char*)buf.Extract();
}
开发者ID:astaykov,项目名称:ohNet,代码行数:7,代码来源:DvAvOpenhomeOrgRadio1C.cpp

示例5: MakeFunctorAsync

void DeviceListTI::GetProtocolInfoComplete(IAsync& aAsync)
{
    if (Os::TimeInMs() > iStopTimeMs) {
        return;
    }
    FunctorAsync callback = MakeFunctorAsync(*this, &DeviceListTI::GetProtocolInfoComplete);
    iConnMgr->BeginGetProtocolInfo(callback);

    Brh source;
    Brh sink;
    iConnMgr->EndGetProtocolInfo(aAsync, source, sink); // throws if invocation failed
    iLock.Wait();
    gActionCount++;
    if (sink.Bytes() == 0) {
        ASSERT(iExpectedSink.Bytes() == 0);
    }
    else {
        if (iExpectedSink.Bytes() == 0) {
            sink.TransferTo(iExpectedSink);
        }
        else {
            ASSERT(sink == iExpectedSink);
        }
    }
    iLock.Signal();
}
开发者ID:tata-,项目名称:ohNet-1,代码行数:26,代码来源:TestInvocation.cpp

示例6: TestInvocation

static void TestInvocation(CpDevice& aDevice)
{
    static const TUint kTestIterations = 10;
    
    Print("  Actions\n");
    CpProxyOpenhomeOrgTestBasic1* proxy = new CpProxyOpenhomeOrgTestBasic1(aDevice);
    TUint i;

    Print("    Unsigned integer arguments...\n");
    TUint valUint = 15;
    for (i=0; i<kTestIterations; i++) {
        TUint result;
        proxy->SyncIncrement(valUint, result);
        ASSERT(result == valUint+1);
        valUint = result;
    }

    Print("    Integer arguments...\n");
    TInt valInt = 3;
    for (i=0; i<kTestIterations; i++) {
        TInt result;
        proxy->SyncDecrement(valInt, result);
        ASSERT(result == valInt-1);
        valInt = result;
    }

    Print("    Boolean arguments...\n");
    TBool valBool = true;
    for (i=0; i<kTestIterations; i++) {
        TBool result;
        proxy->SyncToggle(valBool, result);
        ASSERT(result == !valBool);
        valBool = result;
    }

    Print("    String arguments...\n");
    Brn valStr("<&'tag\">");
    for (i=0; i<kTestIterations; i++) {
        Brh result;
        proxy->SyncEchoString(valStr, result);
        ASSERT(result == valStr);
    }

    Print("    Binary arguments...\n");
    char bin[256];
    for (i=0; i<256; i++) {
        bin[i] = (char)i;
    }
    Brn valBin((const TByte*)&bin[0], 256);
    for (i=0; i<kTestIterations; i++) {
        Brh result;
        proxy->SyncEchoBinary(valBin, result);
        ASSERT(result == valBin);
        ASSERT(result.Bytes() == 256);
    }

    delete proxy;
}
开发者ID:Montellese,项目名称:ohNet,代码行数:58,代码来源:TestCpDeviceDv.cpp

示例7: THROW

void CpiSubscription::DoSubscribe()
{
    CpStack& cpStack = iDevice.GetCpStack();
    Bws<Uri::kMaxUriBytes> uri;
    uri.Append(Http::kSchemeHttp);
    NetworkAdapter* nif = cpStack.Env().NetworkAdapterList().CurrentAdapter("CpiSubscription::DoSubscribe");
    if (nif == NULL) {
        THROW(NetworkError);
    }
    TIpAddress nifAddr = nif->Address();
    nif->RemoveRef("CpiSubscription::DoSubscribe");
    Endpoint endpt(cpStack.SubscriptionManager().EventServerPort(), nifAddr);
    Endpoint::EndpointBuf buf;
    endpt.AppendEndpoint(buf);
    uri.Append(buf);
    uri.Append('/');
    Uri subscriber(uri);

    LOG(kEvent, "Subscribing - service = ");
    LOG(kEvent, iServiceType.FullName());
    LOG(kEvent, "\n    subscriber = ");
    LOG(kEvent, subscriber.AbsoluteUri());
    LOG(kEvent, "\n");

    iNextSequenceNumber = 0;
    TUint renewSecs;
    try {
        renewSecs = iDevice.Subscribe(*this, subscriber);
    }
    catch (XmlError&) {
        // we don't expect to ever get here.  Its worth capturing some debug info if we do.
        Brh deviceXml;
        if (!iDevice.GetAttribute("Upnp.DeviceXml", deviceXml)) {
            deviceXml.Set("[missing]");
        }
        const Brx& udn = iDevice.Udn();
        cpStack.Env().Mutex().Wait();
        Log::Print("XmlError attempting to subscribe to device ");
        Log::Print(udn);
        Log::Print(", with xml\n\n");
        Log::Print(deviceXml);
        Log::Print("\n\n");
        cpStack.Env().Mutex().Signal();
        THROW(XmlError);
    }

    cpStack.SubscriptionManager().Add(*this);

    LOG(kEvent, "Subscription for ");
    LOG(kEvent, iServiceType.FullName());
    LOG(kEvent, " completed\n    Sid is ");
    LOG(kEvent, iSid);
    LOG(kEvent, "\n    Renew in %u secs\n", renewSecs);

    SetRenewTimer(renewSecs);
}
开发者ID:broonie,项目名称:ohNet,代码行数:56,代码来源:CpiSubscription.cpp

示例8: writer

void DviProtocolUpnpServiceXmlWriter::Write(const DviService& aService, const DviProtocolUpnp& aDevice, IResourceWriter& aResourceWriter)
{
    WriterBwh writer(1024);
    WriteServiceXml(writer, aService, aDevice);
    Brh xml;
    writer.TransferTo(xml);
    aResourceWriter.WriteResourceBegin(xml.Bytes(), kOhNetMimeTypeXml);
    aResourceWriter.WriteResource(xml.Ptr(), xml.Bytes());
    aResourceWriter.WriteResourceEnd();
}
开发者ID:Jacik,项目名称:ohNet,代码行数:10,代码来源:DviProtocolUpnp.cpp

示例9: GetAttribute

TBool CpDeviceCpp::GetAttribute(const char* aKey, std::string& aValue) const
{
    Brh val;
    aValue.erase(aValue.begin(), aValue.end());
    if (iDevice.GetAttribute(aKey, val)) {
        aValue.append((const char*)val.Ptr(), val.Bytes());
        return true;
    }
    return false;
}
开发者ID:wifigeek,项目名称:ohNet,代码行数:10,代码来源:CpDeviceStd.cpp

示例10: ServicePropertySetValueBinary

uint32_t STDCALL ServicePropertySetValueBinary(ServiceProperty aProperty, uint8_t* aValue, uint32_t aLen)
{
    PropertyBinary* prop = reinterpret_cast<PropertyBinary*>(aProperty);
    ASSERT(prop != NULL);
    Brh data;
    data.Set(aValue, aLen);
    if (prop->SetValue(data)) {
        return 1;
    }
    return 0;
}
开发者ID:MatthewMiddleweek,项目名称:ohNet,代码行数:11,代码来源:ServiceC.cpp

示例11: DvDeviceStandardResourceManagerUri

char* STDCALL DvDeviceStandardResourceManagerUri(DvDeviceC aDevice, THandle aAdapter)
{
    Brh uri;
    NetworkAdapter* nif = (NetworkAdapter*)aAdapter;
    ASSERT(nif != NULL);
    reinterpret_cast<DvDeviceStandard*>(DviDeviceC::DeviceFromHandle(aDevice))->GetResourceManagerUri(*nif, uri);
    if (uri.Bytes() == 0) {
        return NULL;
    }
    else {
        Brhz uriz(uri);
        return (char*)uriz.Transfer();
    }
}
开发者ID:DoomHammer,项目名称:ohNet,代码行数:14,代码来源:DvDeviceC.cpp

示例12: GetAttribute

TBool CpiDeviceUpnp::GetAttribute(const char* aKey, Brh& aValue) const
{
    Brn key(aKey);
    
    Parser parser(key);
    
    if (parser.Next('.') == Brn("Upnp")) {
        Brn property = parser.Remaining();

        if (property == Brn("Location")) {
            aValue.Set(iLocation);
            return (true);
        }
        if (property == Brn("DeviceXml")) {
            aValue.Set(iXml);
            return (true);
        }

        const DeviceXml* device = iDeviceXml;
        
        if (parser.Next('.') == Brn("Root")) {
            device = &iDeviceXmlDocument->Root();
            property.Set(parser.Remaining());
        }
        
        try {
            if (property == Brn("FriendlyName")) {
                device->GetFriendlyName(aValue);
                return (true);
            }
            if (property == Brn("PresentationUrl")) {
                device->GetPresentationUrl(aValue);
                return (true);
            }
            
            Parser parser(property);
            
            Brn token = parser.Next('.');
            
            if (token == Brn("Service")) {
                aValue.Set(device->ServiceVersion(parser.Remaining()));
                return (true);
            }
        }
        catch (XmlError&) {
        }
    }

    return (false);
}
开发者ID:DoomHammer,项目名称:ohNet,代码行数:50,代码来源:CpiDeviceUpnp.cpp

示例13: DvInvocationReadBinary

int32_t DvInvocationReadBinary(DvInvocationC aInvocation, const char* aName, uint8_t** aData, uint32_t* aLen)
{
    IDviInvocation* invocation = InvocationFromHandle(aInvocation);
    try {
        Brh value;
        invocation->InvocationReadBinary(aName, value);
        *aLen = value.Bytes();
        *aData = (uint8_t*)value.Extract();
    }
    catch (InvocationError&) {
        return -1;
    }
    return 0;
}
开发者ID:wifigeek,项目名称:ohNet,代码行数:14,代码来源:DvProviderC.cpp

示例14: DvDeviceStandardGetResourceManagerUri

void STDCALL DvDeviceStandardGetResourceManagerUri(DvDeviceC aDevice, THandle aAdapter, char** aUri, uint32_t* aLen)
{
    Brh uri;
    NetworkAdapter* nif = (NetworkAdapter*)aAdapter;
    ASSERT(nif != NULL);
    reinterpret_cast<DvDeviceStandard*>(DviDeviceC::DeviceFromHandle(aDevice))->GetResourceManagerUri(*nif, uri);
    if (uri.Bytes() == 0) {
        *aUri = NULL;
        *aLen = 0;
    }
    else {
        *aLen = uri.Bytes();
        *aUri = (char*)uri.Extract();
    }
}
开发者ID:DoomHammer,项目名称:ohNet,代码行数:15,代码来源:DvDeviceC.cpp

示例15: ASSERT

void CpDevices::WaitForDeviceDiscovery()
{
    (void)iAddedSem.Clear();
    iAddedSem.Wait(30*1000); // allow up to 30 seconds to issue the msearch and receive a response
    // check that we not only have a device but that its at a different location from previously
    ASSERT(iDevices.size() == 1);
    CpDevice* device = iDevices[0];
    Brh locationBuf;
    ASSERT(device->GetAttribute("Upnp.Location", locationBuf));
    const TChar* location = locationBuf.Extract();
    if (iLocation != NULL) {
        ASSERT(strcmp(location, iLocation) != 0);
    }
    iLocation = location;
}
开发者ID:Montellese,项目名称:ohNet,代码行数:15,代码来源:TestAdapterChange.cpp


注:本文中的Brh类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。