예제 #1
0
void DviDevice::SetAttribute(const TChar* aKey, const TChar* aValue)
{
    Brn key(aKey);
    Parser parser(key);
    Brn name = parser.Next('.');
    aKey += name.Bytes() + 1;
    // assume keys starting 'Test' are a special case which can be updated at any time
    if (strlen(aKey) < 4 || strncmp(aKey, "Test", 4) != 0) {
        ASSERT(iEnabled == eDisabled);
    }
    if (name == Brn("Core")) {
        static const char* longPollEnable = "LongPollEnable";
        if (iProviderSubscriptionLongPoll == NULL && 
            strncmp(aKey, longPollEnable, sizeof(longPollEnable)-1) == 0) {
            iProviderSubscriptionLongPoll = new DviProviderSubscriptionLongPoll(*this);
            ConfigChanged();
        }
    }
    else {
        for (TUint i=0; i<(TUint)iProtocols.size(); i++) {
            IDvProtocol* protocol = iProtocols[i];
            if (protocol->ProtocolName() == name) {
                protocol->SetAttribute(aKey, aValue);
                ConfigChanged();
                break;
            }
        }
    }
}
예제 #2
0
void DviDevice::SetCustomData(const TChar* aProtocol, const TChar* aTag, void* aData)
{
    Brn protocolName(aProtocol);
    for (TUint i=0; i<(TUint)iProtocols.size(); i++) {
        IDvProtocol* protocol = iProtocols[i];
        if (protocol->ProtocolName() == protocolName) {
            protocol->SetCustomData(aTag, aData);
            break;
        }
    }
}
예제 #3
0
void DviDevice::GetResourceManagerUri(const NetworkAdapter& aAdapter, Brh& aUri)
{
    Brn protocolName("Upnp"); // FIXME
    for (TUint i=0; i<(TUint)iProtocols.size(); i++) {
        IDvProtocol* protocol = iProtocols[i];
        if (protocol->ProtocolName() == protocolName) {
            protocol->GetResourceManagerUri(aAdapter, aUri);
            break;
        }
    }
}
예제 #4
0
void DviDevice::GetAttribute(const TChar* aKey, const TChar** aValue) const
{
    Brn key(aKey);
    Parser parser(key);
    Brn name = parser.Next('.');
    for (TUint i=0; i<(TUint)iProtocols.size(); i++) {
        IDvProtocol* protocol = iProtocols[i];
        if (protocol->ProtocolName() == name) {
            aKey += name.Bytes() + 1;
            protocol->GetAttribute(aKey, aValue);
            return;
        }
    }
    *aValue = NULL;
}
예제 #5
0
void DviDevice::WriteResource(const Brx& aUriTail, TIpAddress aInterface, std::vector<char*>& aLanguageList, IResourceWriter& aResourceWriter)
{
    Parser parser(aUriTail);
    Brn dir = parser.Next('/');
    if (dir == kResourceDir) {
        if (iResourceManager != NULL) {
            iResourceManager->WriteResource(parser.Remaining(), aInterface, aLanguageList, aResourceWriter);
        }
    }
    else {
        for (TUint i=0; i<(TUint)iProtocols.size(); i++) {
            IDvProtocol* protocol = iProtocols[i];
            if (protocol->ProtocolName() == dir) {
                protocol->WriteResource(parser.Remaining(), aInterface, aLanguageList, aResourceWriter);
                break;
            }
        }
    }
}
예제 #6
0
void DviDevice::SetAttribute(const TChar* aKey, const TChar* aValue)
{
    Brn key(aKey);
    Parser parser(key);
    Brn name = parser.Next('.');
    aKey += name.Bytes() + 1;
    // assume keys starting 'Test' are a special case which can be updated at any time
    if (strlen(aKey) <4 || strncmp(aKey, "Test", 4) != 0) {
        ASSERT(iEnabled == eDisabled);
    }
    for (TUint i=0; i<(TUint)iProtocols.size(); i++) {
        IDvProtocol* protocol = iProtocols[i];
        if (protocol->ProtocolName() == name) {
            protocol->SetAttribute(aKey, aValue);
            ConfigChanged();
            break;
        }
    }
}
예제 #7
0
void DviDevice::GetUriBase(Bwx& aUriBase, TIpAddress aInterface, TUint aPort, IDvProtocol& aProtocol)
{
    const Brx& name = aProtocol.ProtocolName();
    aUriBase.Append(Http::kUriPrefix);
    Endpoint endpt(aPort, aInterface);
    Endpoint::EndpointBuf buf;
    endpt.AppendEndpoint(buf);
    aUriBase.Append(buf);
    aUriBase.Append('/');
    Uri::Escape(aUriBase, iUdn);
    aUriBase.Append('/');
    aUriBase.Append(name);
    aUriBase.Append('/');
}
예제 #8
0
void DviDevice::GetUriBase(Bwh& aUriBase, TIpAddress aInterface, TUint aPort, IDvProtocol& aProtocol)
{
    static const TUint kMaxAddressBytes = 21; // xxx.xxx.xxx.xxx:xxxxx
    const Brx& name = aProtocol.ProtocolName();
    aUriBase.Grow(Http::kUriPrefix.Bytes() + kMaxAddressBytes + iUdn.Bytes() + name.Bytes() + 3); // +2 for slashes after port, udn & name
    aUriBase.Append(Http::kUriPrefix);
    Endpoint endpt(aPort, aInterface);
    Endpoint::EndpointBuf buf;
    endpt.AppendEndpoint(buf);
    aUriBase.Append(buf);
    aUriBase.Append('/');
    aUriBase.Append(iUdn);
    aUriBase.Append('/');
    aUriBase.Append(name);
    aUriBase.Append('/');
}