/*
* UPnPServices.h
* Copyright (c) 2011 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// SOL9
// 2009/12/02
#pragma once
#include <sol/upnp/UPnPService.h>
#include <sol/upnp/UPnPCollection.h>
namespace SOL {
class UPnPServices :public UPnPCollection {
public:
UPnPServices(IDispatch* pServ=NULL)
:UPnPCollection(pServ)
{
}
public:
IUPnPServices* get()
{
return (IUPnPServices*)getIDispatch();
}
public:
long getCount()
{
IUPnPServices* pServices = get();
long count = -1;
if (FAILED(pServices->get_Count(&count))) {
throw E_FAIL;
}
return count;
}
public:
HRESULT getCount(long* count)
{
IUPnPServices* pServices = get();
return pServices->get_Count(count);
}
public:
void display()
{
printf("UPnPServices Count = %d\n", getCount());
IUPnPServices* pDevices = get();
HRESULT hr = E_FAIL;
try {
EnumVariant enumVariant = getNewEnum();
IDispatch* pDisp = NULL;
while ((pDisp = enumVariant.next()) !=NULL) {
try {
ComObject dispService = pDisp;
UPnPService service = dispService.queryInterface(IID_IUPnPService);
service.display();
} catch (...) {
}
}
} catch (...) {
}
}
};
}
|