SOL9 2.0 Class: UPnPServices

 SOL9 C++ Class Library  SOL9 Samples  SOL9 Tutorial  SOL9 FAQ  SOL9 ClassTree 

Source code

/*
 * 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 (...) {

        }
    }
};

}

Last modified: 1 Feb 2012

Copyright (c) 2009-2012 Antillia.com ALL RIGHTS RESERVED.