void CAttrExtractVisitor::VisitAttributeValueL(CSdpAttrValue &aValue, TSdpElementType aType) { TUint rem=0; switch(aType) { case ETypeNil: rem = iEncoder.WriteNil(); break; case ETypeUint: case ETypeInt: case ETypeUUID: case ETypeString: case ETypeURL: rem = iEncoder.WriteElement(aType, aValue.Des()); break; case ETypeBoolean: rem = iEncoder.WriteBoolean(aValue.Int()); break; case ETypeDES: rem = iEncoder.WriteDES(aValue.DataSize()); break; case ETypeDEA: rem = iEncoder.WriteDEA(aValue.DataSize()); break; case ETypeEncoded: rem= iEncoder.WriteDesc(aValue.Des()); break; } if (rem) User::Leave(rem); }
// ---------------------------------------------------------------------------- // TSdpAttributeParser::CheckValueL() // Check the value of the current node is the same as the specified type. // ---------------------------------------------------------------------------- // void TSdpAttributeParser::CheckValueL( CSdpAttrValue& aValue ) const { switch ( aValue.Type() ) { case ETypeNil: Panic( ESdpAttributeParserNoValue ); break; case ETypeUint: if ( aValue.Uint() != ( TUint )CurrentNode().iValue ) { User::Leave( KErrArgument ); } break; case ETypeInt: if ( aValue.Int() != CurrentNode().iValue ) { User::Leave( KErrArgument ); } break; case ETypeBoolean: if ( aValue.Bool() != CurrentNode().iValue ) { User::Leave( KErrArgument ); } break; case ETypeUUID: if ( aValue.UUID() != TUUID( CurrentNode().iValue ) ) { User::Leave( KErrArgument ); } break; // these are lists, so have to check contents case ETypeDES: case ETypeDEA: Panic( ESdpAttributeParserValueIsList ); break; // these aren't supported - use EReadValue and leave on error //case ETypeString: //case ETypeURL: //case ETypeEncoded: default: Panic( ESdpAttributeParserValueTypeUnsupported ); break; } }
void CResponseSizeVisitor::VisitAttributeValueL(CSdpAttrValue &aValue, TSdpElementType aType) { switch (aType) { case ETypeUUID: FoundUUIDL(aValue.UUID()); break; case ETypeEncoded: // parse out any UUIDs in this encoded attribute iParser->Reset(); /*rem = */iParser->ParseElementsL(aValue.Des()); break; default: return; } }
void CBTGPSDiscovery::VisitAttributeValueL(CSdpAttrValue &aValue, TSdpElementType aType) { if(iValid) { if(aType==ETypeUint) { iChannel = aValue.Uint(); iBTSdpResultReceiver->ServiceAttributeSearchComplete( KErrNone); } iValid = EFalse; } if(aType==ETypeUUID) { if(aValue.UUID() == KRFCommUUID) { iValid = ETrue; } } }
// --------------------------------------------------------------------------- // From class MSdpAttributeValueVisitor. // ?implementation_description // --------------------------------------------------------------------------- // void CBTEngSdpAttrParser::VisitAttributeValueL( CSdpAttrValue& aValue, TSdpElementType aType ) { TBTEngSdpAttrValue attrValue; attrValue.iAttrId = iAttrId; attrValue.iAttrType = aType; switch( aType ) { case ETypeNil: { attrValue.iAttrValue.iValNumeric = 0; // To be checked } break; case ETypeUint: { attrValue.iAttrValue.iValNumeric = aValue.Uint(); } break; case ETypeInt: { attrValue.iAttrValue.iValNumeric = aValue.Int(); } break; case ETypeUUID: { attrValue.iAttrValue.iValString.Set( aValue.UUID().Des() ); } break; case ETypeString: { attrValue.iAttrValue.iValString.Set( aValue.Des() ); } break; case ETypeBoolean: { attrValue.iAttrValue.iValNumeric = aValue.Bool(); } break; case ETypeURL: { attrValue.iAttrValue.iValString.Set( aValue.Des() ); } break; case ETypeDES: case ETypeDEA: case ETypeEncoded: default: // Don't add any value break; } iResultArray->Append( attrValue ); }
void CBuilderAdapterVisitor::VisitAttributeValueL(CSdpAttrValue &aValue, TSdpElementType aType) { if(!iBuilder) return; switch(aType) { case ETypeNil: iBuilder = iBuilder->BuildNilL(); break; case ETypeUint: iBuilder = iBuilder->BuildUintL(aValue.Des()); break; case ETypeInt: iBuilder = iBuilder->BuildIntL(aValue.Des()); break; case ETypeUUID: iBuilder = iBuilder->BuildUUIDL(aValue.UUID()); break; case ETypeString: iBuilder = iBuilder->BuildStringL(aValue.Des()); break; case ETypeEncoded: { CElementParser* parser = CElementParser::NewL(iBuilder); CleanupStack::PushL(parser); parser->ParseElementsL(aValue.Des()); iBuilder = parser->Builder(); CleanupStack::PopAndDestroy();// parser } break; case ETypeURL: iBuilder = iBuilder->BuildURLL(aValue.Des()); break; case ETypeBoolean: iBuilder = iBuilder->BuildBooleanL(aValue.Uint()); break; case ETypeDES: iBuilder = iBuilder->BuildDESL(); break; case ETypeDEA: iBuilder = iBuilder->BuildDEAL(); break; default: User::Leave(ESdpUnexpectedAttributeValueType); } }
void QBluetoothServiceDiscoveryAgentPrivate::VisitAttributeValueL(CSdpAttrValue &aValue, TSdpElementType aType) { qDebug() << "VisitAttributeValueL"; QVariant var; TUint datasize = aValue.DataSize(); switch (aType) { case ETypeNil: break; case ETypeUint: if (datasize == 8) { TUint64 value; aValue.Uint64(value); var = QVariant::fromValue(value); } else var = QVariant::fromValue(aValue.Uint()); break; case ETypeInt: var = QVariant::fromValue(aValue.Int()); break; case ETypeUUID: { TPtrC8 shortForm(aValue.UUID().ShortestForm()); if (shortForm.Size() == 2) { QBluetoothUuid uuid(ntohs(*reinterpret_cast<const quint16 *>(shortForm.Ptr()))); var = QVariant::fromValue(uuid); } else if (shortForm.Size() == 4) { QBluetoothUuid uuid(ntohl(*reinterpret_cast<const quint32 *>(shortForm.Ptr()))); var = QVariant::fromValue(uuid); } else if (shortForm.Size() == 16) { QBluetoothUuid uuid(*reinterpret_cast<const quint128 *>(shortForm.Ptr())); var = QVariant::fromValue(uuid); } break; } case ETypeString: { TPtrC8 stringBuffer = aValue.Des(); var = QVariant::fromValue(QString::fromLocal8Bit(reinterpret_cast<const char *>(stringBuffer.Ptr()), stringBuffer.Size())); break; } case ETypeBoolean: var = QVariant::fromValue(static_cast<bool>(aValue.Bool())); break; case ETypeDES: m_stack.push(QVariant::fromValue(QBluetoothServiceInfo::Sequence())); break; case ETypeDEA: m_stack.push(QVariant::fromValue(QBluetoothServiceInfo::Alternative())); break; case ETypeURL: { TPtrC8 stringBuffer = aValue.Des(); var = QVariant::fromValue(QUrl(QString::fromLocal8Bit(reinterpret_cast<const char *>(stringBuffer.Ptr()), stringBuffer.Size()))); break; } case ETypeEncoded: qWarning() << "Don't know how to handle encoded type."; break; default: qWarning() << "Don't know how to handle type" << aType; } if (aType != ETypeDES && aType != ETypeDEA) { if (m_stack.size() == 0) { // single value attribute, just push onto stack m_stack.push(var); } else if (m_stack.size() >= 1) { // sequence or alternate attribute, add non-DES -DEA values to DES or DEA if (m_stack.top().canConvert<QBluetoothServiceInfo::Sequence>()) { QBluetoothServiceInfo::Sequence *sequence = static_cast<QBluetoothServiceInfo::Sequence *>(m_stack.top().data()); sequence->append(var); } else if (m_stack.top().canConvert<QBluetoothServiceInfo::Alternative>()) { QBluetoothServiceInfo::Alternative *alternative = static_cast<QBluetoothServiceInfo::Alternative *>(m_stack.top().data()); alternative->append(var); } else { qWarning("Unknown type in the QVariant, should be either a QBluetoothServiceInfo::Sequence or an QBluetoothServiceInfo::Alternative"); } } } }
void CPhiObexServiceSearcher::FoundElementL(TInt aKey,CSdpAttrValue& aValue) { if(aKey!=static_cast<TInt>(KRfcommChannel)) User::Invariant(); iPort=aValue.Uint(); }
void CT_DataSdpAttrValue::VisitAttributeValueL(CSdpAttrValue& aValue, TSdpElementType aType) { INFO_PRINTF1(_L("MSdpAttributeValueVisitor VisitAttributeValueL Call")); HBufC16* string16 = HBufC16::NewLC(KAttrValueStringBufLen); switch (aType) { case ETypeNil: INFO_PRINTF1(_L("TSdpElementType is ETypeNil")); iVisitorResult.Append(_L("&type=Nil")); break; case ETypeUint: if( aValue.DataSize() <= (static_cast<TUint>(KMaxDataSize)) ) { INFO_PRINTF2(_L("TSdpElementType is ETypeUint. Value = %d"), aValue.Uint()); iVisitorResult.Append(_L("&type=Uint&value=")); iVisitorResult.AppendNum(aValue.Uint()); } else { string16->Des().Copy(aValue.Des()); TPtrC16 tprStringUint = string16->Des(); INFO_PRINTF1(_L("TSdpElementType is ETypeUint. Value = ")); INFO_PRINTF1(tprStringUint); iVisitorResult.Append(_L("&type=Uint&value=")); iVisitorResult.Append(tprStringUint); } break; case ETypeInt: INFO_PRINTF2(_L("TSdpElementType is ETypeInt. Value = %d"), aValue.Int()); iVisitorResult.Append(_L("&type=Int&value=")); iVisitorResult.AppendNum(aValue.Int()); break; case ETypeUUID: { TUUID uUid = aValue.UUID(); TUint intUUid= CT_BTUtil::ConvertUUID32toInt(uUid); INFO_PRINTF2(_L("TSdpElementType is ETypeUUID: Value is %d"),intUUid); iVisitorResult.Append(_L("&type=UUID&value=")); iVisitorResult.AppendNum(intUUid); } break; case ETypeString: { string16->Des().Copy(aValue.Des()); TPtrC16 tprString = string16->Des(); INFO_PRINTF1(_L("TSdpElementType is ETypeString. Value = ")); INFO_PRINTF1(tprString); iVisitorResult.Append(_L("&type=String&value=")); iVisitorResult.Append(tprString); } break; case ETypeBoolean: INFO_PRINTF2(_L("TSdpElementType is ETypeBoolean. Value = %d"), aValue.Bool()); iVisitorResult.Append(_L("&type=Boolean&value=")); iVisitorResult.AppendNum(aValue.Bool()); break; case ETypeDES: INFO_PRINTF1(_L("TSdpElementType is ETypeDES")); iVisitorResult.Append(_L("&type=DES")); break; case ETypeDEA: INFO_PRINTF1(_L("TSdpElementType is ETypeDEA")); iVisitorResult.Append(_L("&type=DEA")); break; case ETypeURL: { string16->Des().Copy(aValue.Des()); TPtrC16 tprStringURL = string16->Des(); INFO_PRINTF1(_L("TSdpElementType is ETypeURL. Value = ")); INFO_PRINTF1(tprStringURL); iVisitorResult.Append(_L("&type=URL&value=")); iVisitorResult.Append(tprStringURL); } break; case ETypeEncoded: INFO_PRINTF1(_L("TSdpElementType is ETypeEncoded")); iVisitorResult.Append(_L("&type=Encoded")); break; default: INFO_PRINTF2(_L("TSdpElementType is Unknown %d"), aType); iVisitorResult.Append(_L("&type=Unknown")); break; } CleanupStack::PopAndDestroy(string16); }
void Syscall::CBtService::VisitAttributeValueL(CSdpAttrValue& aValue, TSdpElementType aType) { LOGBT("VAV h%i t%i ", mHandle, aType); switch(aType) { case ETypeNil: LOGBT("Nil\n"); break; case ETypeUint: LOGBT("Uint %i\n", aValue.Uint()); //The Uint following the RFCOMM UUID is supposed to be the service's port. if(mUuids.Count() > 0 && mPort == -1) { if(mUuids[mUuids.Count() - 1] == TUUID(KRFCOMM)) { mPort = aValue.Uint(); LOGBT("Port found: %i\n", mPort); } } break; case ETypeInt: LOGBT("Int %i\n", aValue.Int()); break; case ETypeUUID: mUuids.AppendL(aValue.UUID()); #ifdef BLUETOOTH_DEBUGGING_MODE { TBuf8<64> buf; ParseUUID(buf, aValue.UUID()); LOGBT("UUID %S\n", &buf); } #endif break; case ETypeString: { const TDesC8& des = aValue.Des(); LOGBT("String %S\n", &des); if(mName == NULL) { mName = HBufC8::NewL(des.Length()); *mName = des; } break; } case ETypeBoolean: LOGBT("Bool %i\n", aValue.Bool()); break; case ETypeDES: LOGBT("DES %i\n", aValue.DataSize()); break; case ETypeDEA: LOGBT("DEA %i\n", aValue.DataSize()); break; #ifdef BLUETOOTH_DEBUGGING_MODE case ETypeURL: { const TDesC8& des = aValue.Des(); LOGBT("URL %S\n", &des); break; } #endif case ETypeEncoded: LOGBT("Encoded %i\n", aValue.DataSize()); break; default: LOGBT("Unknown %i\n", aValue.DataSize()); } }