本文整理汇总了C++中IDvInvocation类的典型用法代码示例。如果您正苦于以下问题:C++ IDvInvocation类的具体用法?C++ IDvInvocation怎么用?C++ IDvInvocation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IDvInvocation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EchoBinary
void ProviderTestBasic::EchoBinary(IDvInvocation& aInvocation, const Brx& aValue, IDvInvocationResponseBinary& aResult)
{
aInvocation.StartResponse();
aResult.Write(aValue);
aResult.WriteFlush();
aInvocation.EndResponse();
}
示例2: GetInt
void ProviderTestBasic::GetInt(IDvInvocation& aInvocation, IDvInvocationResponseInt& aValueInt)
{
aInvocation.StartResponse();
TInt val;
GetPropertyVarInt(val);
aValueInt.Write(val);
aInvocation.EndResponse();
}
示例3: GetBool
void ProviderTestBasic::GetBool(IDvInvocation& aInvocation, IDvInvocationResponseBool& aValueBool)
{
aInvocation.StartResponse();
TBool val;
GetPropertyVarBool(val);
aValueBool.Write(val);
aInvocation.EndResponse();
}
示例4: GetString
void ProviderTestBasic::GetString(IDvInvocation& aInvocation, IDvInvocationResponseString& aValueStr)
{
aInvocation.StartResponse();
Brhz val;
GetPropertyVarStr(val);
aValueStr.Write(val);
aValueStr.WriteFlush();
aInvocation.EndResponse();
}
示例5: GetBinary
void ProviderTestBasic::GetBinary(IDvInvocation& aInvocation, IDvInvocationResponseBinary& aValueBin)
{
aInvocation.StartResponse();
Brh val;
GetPropertyVarBin(val);
aValueBin.Write(val);
aValueBin.WriteFlush();
aInvocation.EndResponse();
}
示例6: SetMultiple
void ProviderTestBasic::SetMultiple(IDvInvocation& aInvocation, TUint aValueUint, TInt aValueInt, TBool aValueBool)
{
PropertiesLock();
SetPropertyVarUint(aValueUint);
SetPropertyVarInt(aValueInt);
SetPropertyVarBool(aValueBool);
PropertiesUnlock();
aInvocation.StartResponse();
aInvocation.EndResponse();
}
示例7: EchoBinary
void ProviderTestBasic::EchoBinary(IDvInvocation& aInvocation, const Brx& aValue, IDvInvocationResponseBinary& aResult)
{
aInvocation.StartResponse();
// validate that binary response can be streamed over multiple calls
Brn start(aValue);
const TUint pos = start.Bytes() / 2;
Brn end = start.Split(pos);
start.Set(start.Ptr(), pos);
aResult.Write(start);
aResult.Write(end);
aResult.WriteFlush();
aInvocation.EndResponse();
}
示例8: WriteFile
void ProviderTestBasic::WriteFile(IDvInvocation& aInvocation, const Brx& aData, const Brx& aFileFullName)
{
TUint len = aFileFullName.Bytes();
char* name = (char*)malloc(len+1);
(void)memcpy(name, aFileFullName.Ptr(), aFileFullName.Bytes());
name[len] = 0;
FILE* fp = fopen(name, "wb");
free(name);
(void)fwrite(aData.Ptr(), aData.Bytes(), 1, fp);
(void)fflush(fp);
(void)fclose(fp);
aInvocation.StartResponse();
aInvocation.EndResponse();
}
示例9: StartGetPropertyUpdates
void DviProviderSubscriptionLongPoll::StartGetPropertyUpdates(IDvInvocation& aInvocation)
{
AutoMutex a(iLock);
if (iExit) {
aInvocation.Error(501, Brx::Empty());
}
if (iClientCount == iMaxClientCount) {
aInvocation.Error(kErrorCodeTooManyRequests, kErrorDescTooManyRequests);
}
if (iClientCount == 0) {
iShutdown.Wait();
}
iClientCount++;
}
示例10: Renew
void DviProviderSubscriptionLongPoll::Renew(IDvInvocation& aInvocation, const Brx& aSid, TUint aRequestedDuration, IDvInvocationResponseUint& aDuration)
{
DviSubscription* subscription = iDvStack.SubscriptionManager().Find(aSid);
if (subscription == NULL) {
aInvocation.Error(kErrorCodeBadSubscription, kErrorDescBadSubscription);
}
TUint timeout = aRequestedDuration;
if (timeout > kTimeoutLongPollSecs) {
timeout = kTimeoutLongPollSecs;
}
subscription->Renew(timeout);
aInvocation.StartResponse();
aDuration.Write(timeout);
aInvocation.EndResponse();
}
示例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: Subscribe
void DviProviderSubscriptionLongPoll::Subscribe(IDvInvocation& aInvocation, const Brx& aClientId, const Brx& aUdn, const Brx& aService, TUint aRequestedDuration,
IDvInvocationResponseString& aSid, IDvInvocationResponseUint& aDuration)
{
if (aRequestedDuration > kTimeoutLongPollSecs) {
aRequestedDuration = kTimeoutLongPollSecs;
}
DviDevice* device = iDvStack.DeviceMap().Find(aUdn);
if (device == NULL) {
aInvocation.Error(kErrorCodeBadDevice, kErrorDescBadDevice);
}
DviService* service = NULL;
const TUint serviceCount = device->ServiceCount();
for (TUint i=0; i<serviceCount; i++) {
DviService* s = &device->Service(i);
if (s->ServiceType().PathUpnp() == aService) {
service = s;
break;
}
}
if (service == NULL) {
aInvocation.Error(kErrorCodeBadService, kErrorDescBadService);
}
Brh sid;
device->CreateSid(sid);
TUint timeout = aRequestedDuration;
DviSubscription* subscription = new DviSubscription(iDvStack, *device, iPropertyUpdateCollection, NULL, sid, timeout);
aInvocation.StartResponse();
aSid.Write(subscription->Sid());
aSid.WriteFlush();
aDuration.Write(timeout);
aInvocation.EndResponse();
// Start subscription, prompting availability of the first update (covering all state variables)
iPropertyUpdateCollection.AddSubscription(aClientId, subscription);
iDvStack.SubscriptionManager().AddSubscription(*subscription);
service->AddSubscription(subscription);
}
示例13: Toggle
void ProviderTestBasic::Toggle(IDvInvocation& aInvocation, TBool aValue, IDvInvocationResponseBool& aResult)
{
aInvocation.StartResponse();
aResult.Write(!aValue);
aInvocation.EndResponse();
}
示例14: SetBinary
void ProviderTestBasic::SetBinary(IDvInvocation& aInvocation, const Brx& aValueBin)
{
SetPropertyVarBin(aValueBin);
aInvocation.StartResponse();
aInvocation.EndResponse();
}
示例15: SetString
void ProviderTestBasic::SetString(IDvInvocation& aInvocation, const Brx& aValueStr)
{
SetPropertyVarStr(aValueStr);
aInvocation.StartResponse();
aInvocation.EndResponse();
}