本文整理汇总了C++中Brh::Bytes方法的典型用法代码示例。如果您正苦于以下问题:C++ Brh::Bytes方法的具体用法?C++ Brh::Bytes怎么用?C++ Brh::Bytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Brh
的用法示例。
在下文中一共展示了Brh::Bytes方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetProtocolInfoComplete
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();
}
示例2: GetProtocolInfoComplete
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();
}
示例3: Write
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();
}
示例4: 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();
}
}
示例5:
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();
}
示例6: ProcessBinary
void OutputProcessorDv::ProcessBinary(const Brx& aBuffer, Brh& aVal)
{
Bwh tmp(aVal.Bytes() + aBuffer.Bytes());
tmp.Append(aVal);
tmp.Append(aBuffer);
tmp.TransferTo(aVal);
}
示例7: 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;
}
示例8: 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;
}
示例9: uriz
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();
}
}
示例10: 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;
}
示例11: GetPropertyUpdates
void DviProviderSubscriptionLongPoll::GetPropertyUpdates(IDvInvocation& aInvocation, const Brx& aClientId, IDvInvocationResponseString& aUpdates)
{
StartGetPropertyUpdates(aInvocation);
AutoGetPropertyUpdatesComplete a(*this);
Semaphore sem("PSLP", 0);
UpdateReadySignal* updateReadySignal = NULL;
Brh response;
try {
iPropertyUpdateCollection.SetClientSignal(aClientId, &sem);
iLock.Wait();
for (TUint i=0; i<iMaxClientCount; i++) {
if (iUpdateReady[i].IsFree()) {
updateReadySignal = &iUpdateReady[i];
updateReadySignal->Set(sem);
break;
}
}
ASSERT(updateReadySignal != NULL);
iLock.Signal();
sem.Wait(kGetUpdatesMaxDelay);
iPropertyUpdateCollection.SetClientSignal(aClientId, NULL);
if (!iExit) {
WriterBwh writer(1024);
iPropertyUpdateCollection.WriteUpdates(aClientId, writer);
writer.TransferTo(response);
}
}
catch (Timeout&) {
iPropertyUpdateCollection.SetClientSignal(aClientId, NULL);
}
iLock.Wait();
updateReadySignal->Clear();
iLock.Signal();
aInvocation.StartResponse();
if (response.Bytes() > 0) {
aUpdates.Write(response);
}
aUpdates.WriteFlush();
aInvocation.EndResponse();
}
示例12: invocationWrapper
void DvProviderLinnCoUkCloud1C::DoSetAssociated(IDviInvocation& aInvocation)
{
DvInvocationCPrivate invocationWrapper(aInvocation);
IDvInvocationC* invocationC;
void* invocationCPtr;
invocationWrapper.GetInvocationC(&invocationC, &invocationCPtr);
aInvocation.InvocationReadStart();
Brh AesKeyRsaEncrypted;
aInvocation.InvocationReadBinary("AesKeyRsaEncrypted", AesKeyRsaEncrypted);
Brh InitVectorRsaEncrypted;
aInvocation.InvocationReadBinary("InitVectorRsaEncrypted", InitVectorRsaEncrypted);
Brh TokenAesEncrypted;
aInvocation.InvocationReadBinary("TokenAesEncrypted", TokenAesEncrypted);
TBool Associated = aInvocation.InvocationReadBool("Associated");
aInvocation.InvocationReadEnd();
DviInvocation invocation(aInvocation);
ASSERT(iCallbackSetAssociated != NULL);
if (0 != iCallbackSetAssociated(iPtrSetAssociated, invocationC, invocationCPtr, (const char*)AesKeyRsaEncrypted.Ptr(), AesKeyRsaEncrypted.Bytes(), (const char*)InitVectorRsaEncrypted.Ptr(), InitVectorRsaEncrypted.Bytes(), (const char*)TokenAesEncrypted.Ptr(), TokenAesEncrypted.Bytes(), Associated)) {
invocation.Error(502, Brn("Action failed"));
return;
}
invocation.StartResponse();
invocation.EndResponse();
}
示例13: invocationWrapper
void DvProviderAvOpenhomeOrgCredentials1C::DoSet(IDviInvocation& aInvocation)
{
DvInvocationCPrivate invocationWrapper(aInvocation);
IDvInvocationC* invocationC;
void* invocationCPtr;
invocationWrapper.GetInvocationC(&invocationC, &invocationCPtr);
aInvocation.InvocationReadStart();
Brhz Id;
aInvocation.InvocationReadString("Id", Id);
Brhz UserName;
aInvocation.InvocationReadString("UserName", UserName);
Brh Password;
aInvocation.InvocationReadBinary("Password", Password);
aInvocation.InvocationReadEnd();
DviInvocation invocation(aInvocation);
ASSERT(iCallbackSet != NULL);
if (0 != iCallbackSet(iPtrSet, invocationC, invocationCPtr, (const char*)Id.Ptr(), (const char*)UserName.Ptr(), (const char*)Password.Ptr(), Password.Bytes())) {
invocation.Error(502, Brn("Action failed"));
return;
}
invocation.StartResponse();
invocation.EndResponse();
}
示例14: TestSubscription
static void TestSubscription(CpDevice& aDevice)
{
Semaphore sem("TSEM", 0);
Print(" Subscriptions\n");
CpProxyOpenhomeOrgTestBasic1* proxy = new CpProxyOpenhomeOrgTestBasic1(aDevice);
Functor functor = MakeFunctor(&sem, updatesComplete);
proxy->SetPropertyChanged(functor);
proxy->Subscribe();
sem.Wait(); // wait for initial event
/* For each property,
call the setter action it
wait on a property being updated
check that the property matches the value set
check that the getter action matches the property
*/
Print(" Uint...\n");
proxy->SyncSetUint(1);
sem.Wait();
TUint propUint;
proxy->PropertyVarUint(propUint);
ASSERT(propUint == 1);
TUint valUint;
proxy->SyncGetUint(valUint);
ASSERT(propUint == valUint);
Print(" Int...\n");
proxy->SyncSetInt(-99);
sem.Wait();
TInt propInt;
proxy->PropertyVarInt(propInt);
ASSERT(propInt == -99);
TInt valInt;
proxy->SyncGetInt(valInt);
ASSERT(propInt == valInt);
Print(" Bool...\n");
proxy->SyncSetBool(true);
sem.Wait();
TBool propBool;
proxy->PropertyVarBool(propBool);
ASSERT(propBool);
TBool valBool;
proxy->SyncGetBool(valBool);
ASSERT(valBool);
Print(" String...\n");
Brn str("<&'tag\">");
proxy->SyncSetString(str);
sem.Wait();
Brhz propStr;
proxy->PropertyVarStr(propStr);
ASSERT(propStr == str);
// test again to check that PropertyVarStr didn't TransferTo the property
proxy->PropertyVarStr(propStr);
ASSERT(propStr == str);
Brh valStr;
proxy->SyncGetString(valStr);
ASSERT(propStr == valStr);
// change str, check evented update doesn't aggregate previous and new values
Brn str2(str.Ptr(), str.Bytes()/2);
proxy->SyncSetString(str2);
sem.Wait();
Brhz propStr2;
proxy->PropertyVarStr(propStr2);
ASSERT(propStr2 == str2);
ASSERT(propStr2.Bytes() == propStr.Bytes()/2);
Print(" Binary...\n");
char bin[256];
for (TUint i=0; i<256; i++) {
bin[i] = (char)i;
}
Brn bufBin((const TByte*)&bin[0], 256);
proxy->SyncSetBinary(bufBin);
sem.Wait();
Brh propBin;
proxy->PropertyVarBin(propBin);
ASSERT(propBin == bufBin);
// test again to check that PropertyVarBin didn't TransferTo the property
proxy->PropertyVarBin(propBin);
ASSERT(propBin == bufBin);
Brh valBin;
proxy->SyncGetBinary(valBin);
ASSERT(propBin == valBin);
// change bufBin, check evented update doesn't aggregate previous and new values
Brn bufBin2(bufBin.Ptr(), bufBin.Bytes()/2);
proxy->SyncSetBinary(bufBin2);
sem.Wait();
Brh propBin2;
proxy->PropertyVarBin(propBin2);
ASSERT(propBin2 == bufBin2);
ASSERT(propBin2.Bytes() == propBin.Bytes()/2);
Print(" Multiple...\n");
proxy->SyncSetMultiple(15, 658, false);
sem.Wait();
proxy->PropertyVarUint(propUint);
ASSERT(propUint == 15);
//.........这里部分代码省略.........