Switch to unified view

a/libupnpp/control/cdirectory.cxx b/libupnpp/control/cdirectory.cxx
...
...
69
    UPnPDeviceDirectory::Visitor visitor = bind(DSAccum, &vds, _1, _2);
69
    UPnPDeviceDirectory::Visitor visitor = bind(DSAccum, &vds, _1, _2);
70
    UPnPDeviceDirectory::getTheDir()->traverse(visitor);
70
    UPnPDeviceDirectory::getTheDir()->traverse(visitor);
71
    return !vds.empty();
71
    return !vds.empty();
72
}
72
}
73
73
74
static bool DSFriendlySelect(const string& friendlyName,
75
                             bool  *found,
76
                             CDSH *out,
77
                             const UPnPDeviceDesc& device, 
78
                             const UPnPServiceDesc& service)
79
{
80
    if (ContentDirectory::isCDService(service.serviceType)) {
81
        if (!friendlyName.compare(device.friendlyName)) {
82
            *out = CDSH(new ContentDirectory(device, service));
83
            *found = true;
84
            return false;
85
        }
86
    }
87
    return true;
88
}
89
90
// Get server by friendly name. 
74
// Get server by friendly name. 
91
bool ContentDirectory::getServerByName(const string& friendlyName,
75
bool ContentDirectory::getServerByName(const string& fname, CDSH& server)
92
                                              CDSH& server)
93
{
76
{
77
    UPnPDeviceDesc ddesc;
78
    bool found = UPnPDeviceDirectory::getTheDir()->getDevByFName(fname, ddesc);
79
    if (!found)
80
        return false;
81
94
    bool found = false;
82
    found = false;
95
    UPnPDeviceDirectory::Visitor visitor = 
83
    for (auto it = ddesc.services.begin(); it != ddesc.services.end(); it++) {
96
        bind(DSFriendlySelect, friendlyName, &found, &server, _1, _2);
84
        if (isCDService(it->serviceType)) {
97
    UPnPDeviceDirectory::getTheDir()->traverse(visitor);
85
            server = CDSH(new ContentDirectory(ddesc, *it));
86
            found = true;
87
            break;
88
        }
89
    }
98
    return found;
90
    return found;
99
}
91
}
100
101
92
102
#if 0
93
#if 0
103
static int asyncReaddirCB(Upnp_EventType et, void *vev, void *cookie)
94
static int asyncReaddirCB(Upnp_EventType et, void *vev, void *cookie)
104
{
95
{
105
    LOGDEB("asyncReaddirCB: " << LibUPnP::evTypeAsString(et) << endl);
96
    LOGDEB("asyncReaddirCB: " << LibUPnP::evTypeAsString(et) << endl);
...
...
123
{
114
{
124
}
115
}
125
116
126
void ContentDirectory::registerCallback()
117
void ContentDirectory::registerCallback()
127
{
118
{
119
    LOGDEB("ContentDirectory::registerCallback"<< endl);
128
    Service::registerCallback(bind(&ContentDirectory::evtCallback, 
120
    Service::registerCallback(bind(&ContentDirectory::evtCallback, 
129
                                   this, _1));
121
                                   this, _1));
130
}
122
}
131
123
132
int ContentDirectory::readDirSlice(const string& objectId, int offset,
124
int ContentDirectory::readDirSlice(const string& objectId, int offset,