Example #1
0
// -----------------------------------------------------------------------------
// CEcmtMMCEvent::SendMMCStatusLC
// Send MMC status
// -----------------------------------------------------------------------------
//
HBufC8* CEcmtMMCEvent::SendMMCStatusLC() 
	{
    // MMC Status
    TBuf8<2> mmcId;
    mmcId.AppendNum(EWrapperMMC);
	//length comes from longes status value
	//which can be REMOVE (6), INSERT (6) or CORRUPTED (9)
	TBuf8<9> bufStatus; 
	GetMMCStatus( bufStatus );
		
	//drive srting looks like "A: B: "
	HBufC8* drives = HBufC8::NewL(NumOfWinsRemovableDrives() * 3);
	CleanupStack::PushL(drives);
	TPtr8 ptrDrives = drives->Des();
		
	WinsRemovableDrivesL(ptrDrives);
	ptrDrives.TrimRight();
		
	//send status <STATUS><blank><WINS_DRIVES><blank><drives...><blank><emul_drive><blank><drive>
	HBufC8 *msg = HBufC8::NewL(mmcId.Length()			//<ID>
		+ KBlank().Length()      //<BLANK>
		+ bufStatus.Length()      //<STATUS>
		+ KBlank().Length()      //<BLANK>
		+ KWINSDrives().Length() //<WINS_DRIVES>
		+ KBlank().Length()      //<BLANK>
		+ drives->Length()       //<DRIVES> ...
		);
		
		CleanupStack::PushL(msg);
		TPtr8 msgPtr = msg->Des();
		msgPtr += mmcId;		 //<ID>
		msgPtr += KBlank;        //<BLANK>
		msgPtr += bufStatus;     //<STATUS>
		msgPtr += KBlank;        //<BLANK>
		msgPtr += KWINSDrives;   //<WINS_DRIVES>
		msgPtr += KBlank;        //<BLANK>
		msgPtr += drives->Des(); //<DRIVES> ...
		const TPtrC8 msgPtrC(msgPtr);
		CleanupStack::Pop(); //msg
		CleanupStack::PopAndDestroy();//drives
		CleanupStack::PushL(msg);//set back to cleanupstack
			
		//pass msg pointer as return value
		return msg;		
		
	}
Example #2
0
void DeleteBlank(TDes8& aData){
  if(aData.Length()<=0) return;
  _LIT8(KBlank," ");
  TInt pos=aData.FindF(KBlank);
  if(-1!=pos){
    aData.Delete(pos,KBlank().Length());
    DeleteBlank(aData);
  }
}