コード例 #1
0
ファイル: client.cpp プロジェクト: cdaffara/symbiandump-os2
void RTestExecuteLogServ::AddTime(TDes8& aLogBuffer)
	{
	TTime now;
	now.UniversalTime();
	TDateTime dateTime = now.DateTime();
	_LIT8(KFormat,"%02d:%02d:%02d:%03d ");
	// add the current time 
	aLogBuffer.AppendFormat(KFormat,dateTime.Hour(),dateTime.Minute(),dateTime.Second(),(dateTime.MicroSecond()/1000)); 
	}
コード例 #2
0
void CSerialWriter::AddTime(TDes8& aLogBuffer)
	{
	TTime now;
	now.UniversalTime();
	TDateTime dateTime = now.DateTime();
	_LIT8(KFormat,"%02d:%02d:%02d:%03d ");
	// add the current time 
	aLogBuffer.Append(KTEFNewLine) ; 
	aLogBuffer.AppendFormat(KFormat,dateTime.Hour(),dateTime.Minute(),dateTime.Second(),(dateTime.MicroSecond()/1000)); 
	}
コード例 #3
0
ファイル: mainwindow.cpp プロジェクト: is00hcw/mobile-sdk
void MainWindow::GenerateKey(TDes8& aKey, TInt aLen)
        {
        aKey.Zero();

        TTime currentTime;
        currentTime.HomeTime();

        // ??000Ä꿪ʼ¼Æ??
        TInt startYear = 2000;

        // µ±Ç°Äê·Ý
        TInt currentYear = currentTime.DateTime().Year();
        TTime time(TDateTime(currentYear, EJanuary, 0, 0, 0, 0, 0));

        TTimeIntervalSeconds s;
        currentTime.SecondsFrom(time, s);

        // µÃµ½ÃëÊý
        TInt i = s.Int();

        aKey.AppendFormat(_L8("%X"), i);
        aKey.AppendFormat(_L8("%X"), currentYear - startYear);

        TInt len = aKey.Length();
        if (len > aLen)
                {
                aKey.Mid(0, aLen);
                }
        else
                {
                for (TInt i = 0; i < aLen - len; i++)
                        {
                        TTime theTime;
                        theTime.UniversalTime();
                        TInt64 randSeed(theTime.Int64());
                        TInt number(Math::Rand(randSeed) + i);

                        number = number % 10 + 48;
                        aKey.Append(number);
                        }
                }
        }
コード例 #4
0
void CResourceManager::GetMsgDigestByMd5L(TDes8 &aDest, const TDesC8 &aSrc)
{
    _LIT8( KDigestFormat, "%02x" );
    aDest.Zero();
    CMD5 *md5 = CMD5::NewL();
    CleanupStack::PushL(md5);
    TPtrC8 ptrHash = md5->Hash(aSrc);
    for (TInt i = 0; i < ptrHash.Length(); i++) {
        aDest.AppendFormat(KDigestFormat, ptrHash[i]);
    }
    CleanupStack::PopAndDestroy(md5);
}
コード例 #5
0
ファイル: SS_GLOB.CPP プロジェクト: cdaffara/symbiandump-os1
TBool CSockManData::AddToPerfLog(TAny* aSelf, TDes8& aBuffer, TDes8Overflow* aOverflowHandler)
	{
	CSockManData* self = static_cast<CSockManData*>(aSelf);
	_LIT8(KFormat, "ESock Rx: tot %u; cnt %u; %u, %u, %u, %u, %u, %u; RxBuff: tot %u; %u, %u, %u, %u, %u, %u, Tx: tot %u; cnt %u; %u; %u, %u, %u, %u, %u");
	TXferStats& rx = self->iRxStats;
	TXferStats& rxB = self->iRxBuffStats;
	TXferStats& tx = self->iTxStats;
	aBuffer.AppendFormat(KFormat, aOverflowHandler,
		rx.iTotal, rx.iCount, rx.iBuckets[0], rx.iBuckets[1], rx.iBuckets[2], rx.iBuckets[3], rx.iBuckets[4], rx.iBuckets[5],
		rxB.iTotal, rxB.iBuckets[0], rxB.iBuckets[1], rxB.iBuckets[2], rxB.iBuckets[3], rxB.iBuckets[4], rxB.iBuckets[5],
		tx.iTotal, tx.iCount, tx.iBuckets[0], tx.iBuckets[1], tx.iBuckets[2], tx.iBuckets[3], tx.iBuckets[4], tx.iBuckets[5]
		);
	return EFalse;
	}
コード例 #6
0
TInt TNodeSignalBase::PrintableSignature(TDes8& aResult) const
/**
Generate printable output of signature parameters in the specified buffer

@param aResult buffer to receive printable output.
@return number of parameters output
*/
{
    _LIT8(KArgNumber, "%d");
    _LIT8(KArgNumberNumber, "%d,%d");
    _LIT8(KArgThreeNumbers, "%d,%d,%d");
    _LIT8(KArgHexAndTwoDecimalNumbers, "%08x,%d,%d");
#ifdef SYMBIAN_NETWORKING_UPS
    _LIT8(KArgHexNumber, "%08x");
#endif //SYMBIAN_NETWORKING_UPS

    STypeId id = GetTypeId();
    if (id.iUid.iUid == KESockInternalMessagesImplementationUid)
    {
        switch (id.iType)
        {
        case ESignatureNumber:
            aResult.AppendFormat(KArgNumber(), static_cast<const TSigNumber*>(this)->iValue);
            return 1;
        case ESignatureStateChange:
        {
            const TStateChange& state = static_cast<const TSigStateChange*>(this)->iStateChange;
            aResult.AppendFormat(KArgNumberNumber(), state.iStage, state.iError);
            return 2;
        }
        case ESignatureNumberNumber:
        {
            const TSigNumberNumber* sig = static_cast<const TSigNumberNumber*>(this);
            aResult.AppendFormat(KArgNumberNumber(), sig->iValue1, sig->iValue2);
            return 2;
        }
        case ESignatureErrResponse:
        {
            const TErrResponse& resp = static_cast<const TSigErrResponse*>(this)->iErrResponse;
            aResult.AppendFormat(KArgThreeNumbers(), resp.iAction, resp.iError, resp.iMessageId.MessageId());
            return 3;
        }
        case ESignatureErrContext:
        {
            const TErrContext& ctx = static_cast<const TSigErrContext*>(this)->iErrContext;
            aResult.AppendFormat(KArgHexAndTwoDecimalNumbers(), ctx.iOriginator.Printable(), ctx.iMessageId.MessageId(), ctx.iActivityId);
            return 3;
        }
        case ESignatureMessageIdNumber:
        {
            const TSigMessageIdNumber* sig = static_cast<const TSigMessageIdNumber*>(this);
#ifdef SYMBIAN_NETWORKING_UPS
            _LIT8(KArgStringNumber, "%s,%d");
            // TPrintableMessage is just for printing out a MessageId in human readable form.
            class TPrintableMessage : public TCFSignatureBase
            {
            public:
                TPrintableMessage(const TCFNodeSignalBase::TMessageId& aMessageId)
                    : TCFSignatureBase(aMessageId, *TCommsId::KNullCommsId, ECFActivityNull)
                {
                }
            } msg(sig->iMsgId);
            aResult.AppendFormat(KArgStringNumber(), msg.Printable(), sig->iValue);
#else
            aResult.AppendFormat(KArgNumberNumber(), sig->iMsgId.MessageId(), sig->iValue);
#endif
            return 2;
        }
#ifdef SYMBIAN_NETWORKING_UPS
        case ESignatureCommsBinderNumber:
        {
            const TSigCommsBinderNumber* sig = static_cast<const TSigCommsBinderNumber*>(this);
            aResult.AppendFormat(KArgHexNumber(), sig->iCommsBinder.iCommsId.Printable());
            return 1;
        }

        case ESignatureCommsBinder:
        {
            const TSigCommsBinder* sig = static_cast<const TSigCommsBinder*>(this);
            aResult.AppendFormat(KArgHexNumber(), sig->iCommsBinder.iCommsId.Printable());
            return 1;
        }
        case ESignatureSelectComplete:
        {
            const TSigSelectComplete* sig = static_cast<const TSigSelectComplete*>(this);
            aResult.AppendFormat(KArgHexNumber(), sig->iCommsId.Printable());
            return 1;
        }
        case ESignatureCommsId:
        {
            const TSigCommsId* sig = static_cast<const TSigCommsId*>(this);
            aResult.AppendFormat(KArgHexNumber(), sig->iCommsId.Printable());
            return 1;
        }
#endif

        case ESignatureBundle:
        {
            const TSigBundle* bun = static_cast<const TSigBundle*>(this);
            aResult.AppendFormat(_L8("Bundle (PSCs:%d)"), bun->iBundle->Ptr()->CountParamSetContainers());
            return 1;
        }
        case ESignatureFlowParams:
        {
            const TSigFlowParams* flowParams = static_cast<const TSigFlowParams*>(this);
            aResult.AppendFormat(
                _L8("Flow params: addrFamily:%d, protocol:%d, socketType:%d, flowRequest:%d"),
                flowParams->iFlowParams.iAddrFamily,
                flowParams->iFlowParams.iProtocol,
                flowParams->iFlowParams.iSocketType,
                flowParams->iFlowParams.iFlowRequestType);
            return 4;
        }
        default:
            break;
        }
    }
    return 0;
}