本文整理汇总了C++中TBuf16::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ TBuf16::Append方法的具体用法?C++ TBuf16::Append怎么用?C++ TBuf16::Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBuf16
的用法示例。
在下文中一共展示了TBuf16::Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExecuteL
// From MTest:
void CTestCase::ExecuteL (TTestResult& aResult)
{
TInt error = ExecuteImplL();
aResult.iResult = error;
// add the possible failure or error to the result
if (error == KErrCppUnitAssertionFailed)
{
CAssertFailure* assertFailure = AssertFailureFromTlsL ();
CleanupStack::PushL(assertFailure);
TBuf16 <0x80> convertBuf;
TBuf16 <256> temporaryBuf;
convertBuf.Copy(assertFailure->What());
temporaryBuf.Append(convertBuf);
temporaryBuf.AppendFormat(_L(" at Line %i of "), assertFailure->LineNumber());
convertBuf.Copy(assertFailure->FileName());
if (convertBuf.Length() + temporaryBuf.Length() >= 0x80)
{
TBuf <0x80> printBuf;
printBuf = convertBuf.Right(0x80 - temporaryBuf.Length() - 1 -3 );
convertBuf = _L("...");
convertBuf.Append(printBuf);
}
temporaryBuf.Append(convertBuf);
aResult.iResultDes = temporaryBuf;
CleanupStack::PopAndDestroy(assertFailure);
}
}
示例2: SetEmergencyNumber
void CAknEcsNote::SetEmergencyNumber( const TDesC& aMatchedNumber )
{
TRect screen(iAvkonAppUi->ApplicationRect());
TAknLayoutRect mainPane;
mainPane.LayoutRect(screen, AKN_LAYOUT_WINDOW_main_pane(screen, 0, 1, 1));
TAknLayoutRect popupNoteWindow;
AknLayoutUtils::TAknCbaLocation cbaLocation( AknLayoutUtils::CbaLocation() );
TInt variety( 0 );
if ( cbaLocation == AknLayoutUtils::EAknCbaLocationRight )
{
variety = 5;
}
else if ( cbaLocation == AknLayoutUtils::EAknCbaLocationLeft )
{
variety = 8;
}
else
{
variety = 2;
}
popupNoteWindow.LayoutRect(mainPane.Rect(), AknLayoutScalable_Avkon::popup_note_window( variety ));
TAknLayoutText textRect;
textRect.LayoutText(popupNoteWindow.Rect(), AKN_LAYOUT_TEXT_Note_pop_up_window_texts_Line_1(4));
// Size of a temporary buffer that contains new lines, spaces and
// emergency number for a note.
TBuf16<KAknEcsMaxMatchingLength+80> number;
number.Append('\n');
number.Append('\n');
TInt spaceCharWidthInPixels = textRect.Font()->CharWidthInPixels(' ');
if (spaceCharWidthInPixels < 1)
{
// Avoid divide by zero situation even the space char would have zero length.
spaceCharWidthInPixels = 1;
}
TInt length = (textRect.TextRect().Width() - textRect.Font()->TextWidthInPixels(aMatchedNumber))
/ spaceCharWidthInPixels;
const TInt matchedNumberLength = aMatchedNumber.Length();
const TInt numberLength = number.Length();
const TInt numberMaxLength = number.MaxLength();
if ( numberLength + length + matchedNumberLength > numberMaxLength)
{
// To make sure that buffer overflow does not happen.
length = numberMaxLength - numberLength - matchedNumberLength;
}
for (int i = 0; i < length ; i++)
{
number.Append(' ');
}
number.Append(aMatchedNumber);
TRAP_IGNORE(SetTextL(number));
}
示例3: RunL
void CMobilePhone::RunL(void)
{
TBuf16<128> string;
if(iStatus==KErrNone)
{
string.Append(_L("Success."));
}
else
{
string.Append(_L("Error ("));
string.AppendNum(iStatus.Int());
string.Append(_L(")."));
}
ShowResult(string);
}
示例4:
void CT_ISO2022JP1_2::TestSplittingConvertingFromUnicodeToIso2022Jp(
CCnvCharacterSetConverter& aCharacterSetConverter,
TInt aMaximumLengthLowerLimit,
TInt aMaximumLengthUpperLimit,
TInt aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit,
const TDesC8& aExpectedFirstPartOfIso2022Jp,
const TDesC8& aExpectedSecondPartOfIso2022Jp,
const TDesC16& aOriginalUnicode)
{
INFO_PRINTF1(_L(" TestTruncatedConversionFromUnicodeToIso2022Jp "));
test(aMaximumLengthLowerLimit<=aMaximumLengthUpperLimit);
test(aMaximumLengthUpperLimit<=KBufferLength);
TUint8 iso2022JpBuffer[KBufferLength];
for (TInt i=aMaximumLengthLowerLimit; i<=aMaximumLengthUpperLimit; ++i)
{
TPtr8 generatedFirstPartOfIso2022Jp(iso2022JpBuffer, i);
test(aCharacterSetConverter.ConvertFromUnicode(generatedFirstPartOfIso2022Jp, aOriginalUnicode)==aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit);
test(generatedFirstPartOfIso2022Jp==aExpectedFirstPartOfIso2022Jp);
TBuf8<KBufferLength> generatedSecondPartOfIso2022Jp;
test(aCharacterSetConverter.ConvertFromUnicode(generatedSecondPartOfIso2022Jp, aOriginalUnicode.Right(aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit))==0);
test(generatedSecondPartOfIso2022Jp==aExpectedSecondPartOfIso2022Jp);
TInt state=CCnvCharacterSetConverter::KStateDefault;
TBuf16<KBufferLength> generatedUnicode;
test(aCharacterSetConverter.ConvertToUnicode(generatedUnicode, generatedFirstPartOfIso2022Jp, state)==0);
TBuf16<KBufferLength> generatedSecondPartOfUnicode;
test(aCharacterSetConverter.ConvertToUnicode(generatedSecondPartOfUnicode, generatedSecondPartOfIso2022Jp, state)==0);
generatedUnicode.Append(generatedSecondPartOfUnicode);
test(generatedUnicode==aOriginalUnicode);
}
}
示例5: generatedFirstPartOfEucJpPacked
/**
@SYMTestCaseID SYSLIB-CHARCONV-CT-0536
@SYMTestCaseDesc Splitting and converting from Unicode to EucJpPacked test
@SYMTestPriority Medium
@SYMTestActions Tests for conversion after splitting, from Unicode to EucJpPacked and back to Unicode
@SYMTestExpectedResults Test must not fail
@SYMREQ REQ0000
*/
void CT_EUCJP_PACKED_2::TestSplittingConvertingFromUnicodeToEucJpPacked(CCnvCharacterSetConverter& aCharacterSetConverter, TInt aMaximumLengthLowerLimit, TInt aMaximumLengthUpperLimit, TInt aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit, TInt aExpectedLengthOfFirstPartOfEucJpPacked, const TDesC8& aExpectedEucJpPacked, const TDesC16& aOriginalUnicode)
{
INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0536 "));
test(aMaximumLengthLowerLimit<=aMaximumLengthUpperLimit);
test(aMaximumLengthUpperLimit<=KBufferLength);
TUint8 eucJpPackedBuffer[KBufferLength];
for (TInt i=aMaximumLengthLowerLimit; i<=aMaximumLengthUpperLimit; ++i)
{
TPtr8 generatedFirstPartOfEucJpPacked(eucJpPackedBuffer, i);
test(aCharacterSetConverter.ConvertFromUnicode(generatedFirstPartOfEucJpPacked, aOriginalUnicode)==aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit);
test(generatedFirstPartOfEucJpPacked==aExpectedEucJpPacked.Left(aExpectedLengthOfFirstPartOfEucJpPacked));
TBuf8<KBufferLength> generatedSecondPartOfEucJpPacked;
test(aCharacterSetConverter.ConvertFromUnicode(generatedSecondPartOfEucJpPacked, aOriginalUnicode.Right(aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit))==0);
test(generatedSecondPartOfEucJpPacked==aExpectedEucJpPacked.Mid(aExpectedLengthOfFirstPartOfEucJpPacked));
TInt state=CCnvCharacterSetConverter::KStateDefault;
TBuf16<KBufferLength> generatedUnicode;
test(aCharacterSetConverter.ConvertToUnicode(generatedUnicode, generatedFirstPartOfEucJpPacked, state)==0);
test(state==CCnvCharacterSetConverter::KStateDefault);
TBuf16<KBufferLength> generatedSecondPartOfUnicode;
test(aCharacterSetConverter.ConvertToUnicode(generatedSecondPartOfUnicode, generatedSecondPartOfEucJpPacked, state)==0);
test(state==CCnvCharacterSetConverter::KStateDefault);
generatedUnicode.Append(generatedSecondPartOfUnicode);
test(generatedUnicode==aOriginalUnicode);
}
}
示例6: SetNextPoint
TBool CTe_LbsIniFileReader::SetNextPoint()
{
iIndex++;
TBuf16<128> findText;
findText.Zero();
findText.Append(_L("["));
findText.AppendNum(iIndex);
findText.Append(_L("]"));
iPoint = iPtr.Find(findText);
if (iPoint == KErrNotFound)
{
return(EFalse);
}
return(ETrue);
}
示例7: TestMakeMultDif
/** Tests the creation of a directory with 2 threads accessing different directories
(the current and one with 300 files)
@param aSelector Configuration in case of manual execution
*/
LOCAL_C TInt TestMakeMultDif(TAny* aSelector)
{
TInt i = 100;
TBuf16<50> directory;
TBuf16<50> dirtemp;
TInt testStep;
Validate(aSelector);
CreateDirWithNFiles(300,3);
directory = gSessionPath;
dirtemp.Format(KDirMultipleName2, 3, 300);
directory.Append(dirtemp);
gDelEntryDir2 = directory;
test.Printf(_L("#~TS_Title_%d,%d: MkDir with mult clients accessing dif dirs, RFs::MkDir\n"), gTestHarness, gTestCase);
i = 100;
testStep = 1;
while(i <= KMaxFiles)
{
if(i == 100 || i == 1000 || i == 5000 || i == 10000)
{
directory = gSessionPath;
dirtemp.Format(KDirMultipleName2, 2, i);
directory.Append(dirtemp);
gDelEntryDir = directory;
DoTest2(DeleteEntryAccess);
MakeDir(i, testStep++);
DoTestKill();
}
i += 100;
}
gTestCase++;
return(KErrNone);
}
示例8: DeleteAll
/** Delete content of directory
@param aDir Target directory
@return Error returned if any, otherwise KErrNone
*/
TInt DeleteAll(TDes16& aDir)
{
TBuf16<100> dir;
CFileMan* fMan=CFileMan::NewL(TheFs);
TInt r=0;
dir = aDir;
dir.Append(_L("F*.*"));
r = fMan->Delete(dir);
delete fMan;
return r;
}
示例9:
/**
@SYMTestCaseID SYSLIB-CHARCONV-CT-0537
@SYMTestCaseDesc Tests for truncated conversion from EucJpPacked to Unicode
@SYMTestPriority Medium
@SYMTestActions Tests for truncated conversion from EucJpPacked to Unicode and back to EucJpPacked
@SYMTestExpectedResults Test must not fail
@SYMREQ REQ0000
*/
void CT_EUCJP_PACKED_2::TestTruncatedConversionToUnicodeFromEucJpPacked(CCnvCharacterSetConverter& aCharacterSetConverter, const TDesC16& aExpectedUnicode, const TDesC8& aOriginalEucJpPacked)
{
INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0537 "));
for (TInt i=aOriginalEucJpPacked.Length(); i>=3; --i) // 3 is the length of GBK's longest multi-byte characters
{
TInt state=CCnvCharacterSetConverter::KStateDefault;
TBuf16<KBufferLength> generatedUnicode;
const TInt returnValue=aCharacterSetConverter.ConvertToUnicode(generatedUnicode, aOriginalEucJpPacked.Left(i), state);
test(returnValue>=0);
TBuf16<KBufferLength> generatedsecondPartOfUnicode;
test(aCharacterSetConverter.ConvertToUnicode(generatedsecondPartOfUnicode, aOriginalEucJpPacked.Mid(i-returnValue), state)==0);
generatedUnicode.Append(generatedsecondPartOfUnicode);
test(generatedUnicode==aExpectedUnicode);
}
}
示例10: ptr
void CDebugLogPrint::WriteToLog8L(const TDesC8 &aDes, const TDesC8 &aDes2)
{
TBuf16<256> buf;
TInt pos=aDes.LocateReverse(' ');
if (pos<0)
pos=0;
buf.Copy(aDes.Mid(pos));
buf.Append(' ');
TInt bufLen=buf.Length();
TPtr16 ptr(&buf[bufLen],buf.MaxLength()-bufLen);
ptr.Copy(aDes2);
buf.SetLength(bufLen+aDes2.Length());
_LIT(KDebugFormatString, "%S");
RDebug::Print(KDebugFormatString, &buf);
}
示例11: HandleCommandL
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
{
switch ( aCommand )
{
case EAknSoftkeyExit:
case EEikCmdExit:
Exit();
break;
case ECmdSwitchOutput:
{
HBufC* buffer = HBufC::NewLC( 100 );
TPtr bufferPtr = buffer->Des();
TBool last = ETrue;
bufferPtr.Append(_L("Output switched to "));
iFileOutputOn = !iFileOutputOn;
if (iFileOutputOn)
bufferPtr.Append(_L("file."));
else
bufferPtr.Append(_L("screen."));
ShowL( *buffer, last );
CleanupStack::PopAndDestroy( buffer );
}
break;
case ECmdStatus:
{
ClearL();
// layout
HBufC* buffer = HBufC::NewLC( 100 );
TPtr bufferPtr = buffer->Des();
TBool last = ETrue;
// Orientation
bufferPtr.Append(_L("Orientation: "));
bufferPtr.AppendNum((TInt)iAvkonAppUi->Orientation());
ShowL( *buffer, last );
bufferPtr.Zero();
// Output
bufferPtr.Append(_L("Output: "));
if (iFileOutputOn) bufferPtr.Append(_L("File"));
else bufferPtr.Append(_L("Screen"));
ShowL( *buffer, last );
bufferPtr.Zero();
CAknLayoutConfig::TScreenMode localAppScreenMode = CAknSgcClient::ScreenMode();
TInt hashValue = localAppScreenMode.ScreenStyleHash();
TPixelsTwipsAndRotation pixels = CAknSgcClient::PixelsAndRotation();
TSize pixelSize = pixels.iPixelSize;
bufferPtr.Append(_L("LayoutName: "));
if ( (pixelSize.iWidth == 320 || pixelSize.iWidth == 240 )&&
(pixelSize.iHeight == 320 || pixelSize.iHeight == 240 ))
{
if (hashValue==0x996F7AA7)
bufferPtr.Append(_L("QVGA2"));
else
bufferPtr.Append(_L("QVGA1"));
}
else if ((pixelSize.iWidth == 640 || pixelSize.iWidth == 360 )&&
(pixelSize.iHeight == 360 || pixelSize.iHeight == 640 ))
{
bufferPtr.Append(_L("nHD"));
}
else if ((pixelSize.iWidth == 640 || pixelSize.iWidth == 480 )&&
(pixelSize.iHeight == 480 || pixelSize.iHeight == 640 ))
{
bufferPtr.Append(_L("VGA"));
}
else if ((pixelSize.iWidth == 352 || pixelSize.iWidth == 800 )&&
(pixelSize.iHeight == 800 || pixelSize.iHeight == 352 ))
{
bufferPtr.Append(_L("E90"));
}
else if ((pixelSize.iWidth == 320 || pixelSize.iWidth == 480 ||
pixelSize.iWidth == 240 || pixelSize.iWidth == 640 )&&
(pixelSize.iHeight == 320 || pixelSize.iHeight == 480 ||
pixelSize.iHeight == 240 || pixelSize.iHeight == 640))
{
bufferPtr.Append(_L("HVGA"));
}
else if ((pixelSize.iWidth == 480 || pixelSize.iWidth == 854 ||
pixelSize.iWidth == 848 || pixelSize.iWidth == 800 )&&
(pixelSize.iHeight == 800 || pixelSize.iHeight == 480 ||
pixelSize.iHeight == 848 || pixelSize.iHeight == 854))
{
bufferPtr.Append(_L("WVGA"));
}
else
{
bufferPtr.Append(_L("Unknown"));
}
ShowL( *buffer, last );
bufferPtr.Zero();
//.........这里部分代码省略.........
示例12: find
/** Find last.txt with TFindFile and with two threads accessing the 2 directories
@param aN Number of files in the directory
@param aWild Wildcard string to be used in the search
@param aStep Test step
*/
LOCAL_C void FindFileWild3(TInt aN, const TDesC& aWild, TInt aStep)
{
TBuf16<100> dir1;
TBuf16<100> dir2;
TBuf16<100> dir3;
TBuf16<100> dir4;
TBuf16<100> temp;
TBuf16<100> temp2;
TInt r = 0;
TFindFile find(TheFs);
TTime startTime;
TTime endTime;
TTimeIntervalMicroSeconds timeTaken(0);
TInt timeTaken1 = -1, timeTaken2 = -1, timeTaken3 = -1;
CDir* dir;
if(aN <= gFilesLimit)
{
dir1 = gSessionPath;
dir2 = gSessionPath;
dir3 = gSessionPath;
dir4.Format(KDirMultipleName2, 1, aN);
dir1.Append(dir4);
temp=gSessionPath;
dir4.Format(KDirMultipleName, 3, 300);
temp.Append(dir4);
gFindDir = dir1;
gFindDir2 = temp;
temp2 = gFindDir;
temp2.Append(KCommonFile);
gFindEntryDir = temp2;
temp2 = gFindDir2;
temp2.Append(KCommonFile);
gFindEntryDir2 = temp2;
if(gTypes >= 1)
{
DoTest2(FindEntryAccess);
dir4.Format(KDirMultipleName, 1, aN);
startTime.HomeTime();
r = find.FindWildByPath(aWild, &dir1, dir);
FailIfError(r);
endTime.HomeTime();
DoTestKill();
delete dir;
timeTaken = endTime.MicroSecondsFrom(startTime);
timeTaken1 = I64LOW(timeTaken.Int64() / gTimeUnit);
}
if(gTypes >= 2)
{
dir4.Format(KDirMultipleName2, 2, aN);
dir2.Append(dir4);
temp = dir2;
temp.Append(KCommonFile);
gFindDir = dir2;
gFindEntryDir = temp;
DoTest2(FindEntryAccess);
startTime.HomeTime();
r = find.FindWildByPath(aWild, &dir2, dir);
FailIfError(r);
endTime.HomeTime();
DoTestKill();
delete dir;
timeTaken = endTime.MicroSecondsFrom(startTime);
timeTaken2 = I64LOW(timeTaken.Int64() / gTimeUnit);
}
if(gTypes >= 3)
{
dir4.Format(KDirMultipleName2, 3, aN);
dir3.Append(dir4);
temp = dir3;
temp.Append(KCommonFile);
gFindDir = dir3;
gFindEntryDir = temp;
//.........这里部分代码省略.........
示例13: pCmdNumber
// -----------------------------------------------------------------------------
// CSatNotifyCloseChannel::TerminalResponseL
// Called by ETel server, passes terminal response to DOS
// -----------------------------------------------------------------------------
//
TInt CSatNotifyCloseChannel::TerminalResponseL
(
TDes8* aRsp
)
{
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_TERMINALRESPONSEL_1, "CSAT: CSatNotifyCloseChannel::TerminalResponseL");
TInt ret( KErrNone );
TBuf16<1> additionalInfo;
RSat::TCloseChannelRspV2Pckg* aRspPckg =
reinterpret_cast<RSat::TCloseChannelRspV2Pckg*>( aRsp );
RSat::TCloseChannelRspV2& rspV2 = ( *aRspPckg ) ();
TUint8 pCmdNumber( rspV2.PCmdNumber() );
// Check that general result value is valid
if ( ( RSat::KSuccess != rspV2.iGeneralResult )
&& ( RSat::KPartialComprehension != rspV2.iGeneralResult )
&& ( RSat::KMissingInformation != rspV2.iGeneralResult )
&& ( RSat::KSuccessRequestedIconNotDisplayed != rspV2.iGeneralResult )
&& ( RSat::KPSessionTerminatedByUser != rspV2.iGeneralResult )
&& ( RSat::KMeUnableToProcessCmd != rspV2.iGeneralResult )
&& ( RSat::KCmdBeyondMeCapabilities != rspV2.iGeneralResult )
&& ( RSat::KCmdTypeNotUnderstood != rspV2.iGeneralResult )
&& ( RSat::KCmdDataNotUnderstood != rspV2.iGeneralResult )
&& ( RSat::KCmdNumberNotKnown != rspV2.iGeneralResult )
&& ( RSat::KErrorRequiredValuesMissing != rspV2.iGeneralResult )
&& ( RSat::KBearerIndepProtocolError != rspV2.iGeneralResult )
&& ( RSat::KFramesError != rspV2.iGeneralResult ))
{
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_TERMINALRESPONSEL_2, "CSAT: CSatNotifyCloseChannel::TerminalResponseL Invalid General Result");
// Invalid general result
ret = KErrCorrupt;
}
if ( RSat::KMeProblem == rspV2.iInfoType )
{
if ( rspV2.iAdditionalInfo.Length() )
{
additionalInfo.Append( rspV2.iAdditionalInfo[0] );
}
else
{
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_TERMINALRESPONSEL_3, "CSAT: CSatNotifyCloseChannel::TerminalResponseL Invalid Additional Info");
ret = KErrCorrupt;
}
}
else if (RSat::KNoAdditionalInfo == rspV2.iInfoType )
{
// do nothing
}
else
{
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_TERMINALRESPONSEL_4, "CSAT: CSatNotifyCloseChannel::TerminalResponseL Invalid Additional Info type");
ret = KErrCorrupt;
}
TInt response = CreateTerminalRespL( pCmdNumber, static_cast<TUint8>(
rspV2.iGeneralResult ), additionalInfo );
if ( KErrNone == ret )
ret = response;
return ret;
}
示例14: ret
//.........这里部分代码省略.........
TTsyReqHandle reqHandle = iNotificationsTsy->iSatReqHandleStore->
ResetTsyReqHandle( CSatTsy::ESatNotifyCloseChannelPCmdReqType );
// Get ber tlv
CBerTlv berTlv;
berTlv.SetData( *data );
// Get command details tlv
CTlv commandDetails;
berTlv.TlvByTagValue( &commandDetails, KTlvCommandDetailsTag );
// Store command details tlv
iNotificationsTsy->iTerminalRespData.iCommandDetails.Copy(
commandDetails.Data() );
TUint8 pCmdNumber( commandDetails.GetShortInfo( ETLV_CommandNumber ) );
// In case the request was ongoing, continue..
if ( CSatTsy::ESatReqHandleUnknown != reqHandle )
{
// Complete right away if error has occured, otherwise continue..
if ( KErrNone == aErrorCode )
{
// Fill the Close Channel structure
RSat::TCloseChannelV2& closeChannelV2 =
( *iCloseChannelRspV2Pckg )();
// Store transaction ID
closeChannelV2.SetPCmdNumber( pCmdNumber );
// Store Channel Id
CTlv deviceIds;
TInt returnValue( berTlv.TlvByTagValue( &deviceIds,
KTlvDeviceIdentityTag ) );
if ( KErrNone == returnValue )
{
closeChannelV2.iDestination = (RSat::TDeviceId) deviceIds.
GetShortInfo( ETLV_DestinationDeviceIdentity );
// Alpha Id (Optional)
CTlv alphaIdentifier;
returnValue = berTlv.TlvByTagValue( &alphaIdentifier,
KTlvAlphaIdentifierTag ) ;
closeChannelV2.iAlphaId.iStatus = RSat::EAlphaIdNotPresent;
if ( KErrNotFound != returnValue )
{
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_COMPLETENOTIFYL_2, "CSAT: CSatNotifyCloseChannel::CompleteNotifyL Alpha ID present");
TUint16 alphaIdLength = alphaIdentifier.GetLength();
if ( alphaIdLength )
{
// Get the alpha id
TPtrC8 sourceString;
sourceString.Set(
alphaIdentifier.GetData( ETLV_AlphaIdentifier ) );
// convert and set the alpha id
TSatUtility::SetAlphaId( sourceString ,
closeChannelV2.iAlphaId.iAlphaId );
}
// Set Alpha ID status
if ( closeChannelV2.iAlphaId.iAlphaId.Length() )
{
closeChannelV2.iAlphaId.iStatus = RSat::EAlphaIdProvided;
}
else
{
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_COMPLETENOTIFYL_3, "CSAT: CSatNotifyCloseChannel::CompleteNotifyL Alpha ID is NULL");
closeChannelV2.iAlphaId.iStatus = RSat::EAlphaIdNull;
}
}
// Icon Id (Optional)
TSatUtility::FillIconStructure( berTlv,
closeChannelV2.iIconId );
} // if ( KErrNone == returnValue )
else
{
// Required values missing
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_COMPLETENOTIFYL_4, "CSAT: CSatNotifyCloseChannel::CompleteNotifyL, required values missing (Device Identities)");
ret = KErrCorrupt;
CreateTerminalRespL( pCmdNumber, RSat::KErrorRequiredValuesMissing, KNullDesC16 );
}
} // if ( KErrNone == aErrorCode )
else
{
ret = aErrorCode;
}
// Complete request
iNotificationsTsy->iSatTsy->ReqCompleted( reqHandle, ret );
}
else
{
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYCLOSECHANNEL_COMPLETENOTIFYL_5, "CSAT: CSatNotifyCloseChannel::CompleteNotifyL Request not ongoing");
// Request not on, returning response immediately
TBuf16<1> additionalInfo;
additionalInfo.Append ( RSat::KNoSpecificMeProblem );
CreateTerminalRespL( pCmdNumber,RSat::KMeUnableToProcessCmd,
additionalInfo );
ret = KErrCorrupt;
}
return ret;
}
示例15: CallTestsL
/** Main tests function
*/
void CallTestsL()
{
TBuf16<45> dir;
TInt r = 0;
#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
test.Printf(_L("Disabling Lock Fail simulation ...\n"));
// turn OFF lock failure mode (if cache is enabled)
TBool simulatelockFailureMode = EFalse;
r = controlIo(TheFs, gDrive, KControlIoSimulateLockFailureMode, simulatelockFailureMode);
test_Value(r, r == KErrNone || r == KErrNotSupported);
#endif
// FileNames/File generation
test.Start(_L("Preparing the environment\n"));
FileNameGen(gSmallFile, 8, gNextFile++);
FileNameGen(gBigFile, 8, gNextFile++);
dir = gSessionPath;
dir.Append(gSmallFile);
gSmallFile = dir;
dir = gSessionPath;
dir.Append(gBigFile);
gBigFile = dir;
TRAPD(res,gBuf = HBufC8::NewL(KBigBlockSize));
TEST(res == KErrNone && gBuf != NULL);
gBufWritePtr.Set(gBuf->Des());
FillBuffer(gBufWritePtr, KBigBlockSize, 'B');
TRAPD(res2, gBufSec = HBufC8::NewL(KBlockSize));
TEST(res2 == KErrNone && gBufSec != NULL);
gBufReadPtr.Set(gBufSec->Des());
test.Next(_L("Benchmarking\n"));
TimeTakenToWriteBigFile(0);
TimeTakenToWriteBigFileAsync(0);
test.Printf(_L("second try, second timings account for the last comparison\n"));
TimeTakenToWriteBigFile(0);
TimeTakenToWriteBigFileAsync(0);
TimeTakenToWriteBigBlock();
test.Next(_L("Big file sync written, small file read from the media at the same time\n"));
TestReadingWhileWriting();
test.Next(_L("Big file written, small file written at the same time\n"));
TestWritingWhileWriting();
test.Next(_L("Big file written async, deletion in the meantime\n"));
TestDeletionWhileWriting();
test.Next(_L("Two big files written at the same time\n"));
TestTwoBigOnes();
test.Next(_L("Big file being written, start reading\n"));
TestReadingWhileWritingSameFile();
test.Next(_L("Client dying unexpectedly\n"));
TestClientDies();
test.Next(_L("Ensure write order is preserved\n"));
TestWriteOrder();
// Format the drive to make sure no blocks are left to be erased in LFFS
if (!Is_Win32(TheFs, gDrive))
Format(gDrive);
r = TheFs.MkDirAll(gSessionPath);
TimeTakenToWriteBigFile(1);
TimeTakenToWriteBigFileAsync(1);
// Make sure that the difference between the first time and the last time the files are written doesn't
// differ more than 3%
test.Printf(_L("Abs(gTotalTimeSync[0]-gTotalTimeSync[1]) :%d\n"), Abs(gTotalTimeSync[0]-gTotalTimeSync[1]));
test.Printf(_L("Abs(gTotalTimeAsync[0]-gTotalTimeAsync[1]) :%d\n"), Abs(gTotalTimeAsync[0]-gTotalTimeAsync[1]));
test.Printf(_L("gTotalTimeSync[0] :%d\n"), gTotalTimeSync[0]);
test.Printf(_L("gTotalTimeAsync[0] :%d\n"), gTotalTimeAsync[0]);
#if !defined(__WINS__)
test((Abs(gTotalTimeSync[0]-gTotalTimeSync[1])/gTotalTimeSync[0]) < 0.03);
test((Abs(gTotalTimeAsync[0]-gTotalTimeAsync[1])/gTotalTimeAsync[0]) < 0.03);
#endif
r = DeleteAll(gSessionPath);
TESTERROR(r);
delete gBuf;
delete gBufSec;
#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
//.........这里部分代码省略.........