std::string KeyWrapData(
    uint16_t keyLengthBytes,
    uint8_t keyRepeatValue,
    std::string keyStatusMsg
)
{
	Buffer key(keyLengthBytes);
	key.GetWSlice().SetAllTo(keyRepeatValue);
	auto keyHex = ToHex(key.ToRSlice());
	HexSequence statusBuffer(keyStatusMsg);

	Buffer lengthBuff(2);
	auto lenDest = lengthBuff.GetWSlice();
	UInt16::WriteBuffer(lenDest, keyLengthBytes);
	auto lengthHex = ToHex(lengthBuff.ToRSlice());

	return AppendHex({lengthHex, keyHex, keyHex, keyStatusMsg});
}
// -----------------------------------------------------------------------------
// RMediatorServer::IssueResponse
// Synchronous function to send command request to Mediator Server
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TInt RMediatorServer::IssueResponse( TUid aDomain, 
                                     TUid aCategory, 
                                     TInt aCommandId,
                                     TInt aStatus,
                                     const TDesC8& aData )
    {
    LOG(_L("[Mediator Server]\t RMediatorServer::IssueResponse\n")); 
    
    //  Check that session is open.
    __ASSERT_DEBUG( Handle(), User::Panic( KMediatorServerPanic, 
                                           EMediatorClientNoSessionActive ));
    
    // Fill category
    TMediatorCategory category;
    category.iDomain = aDomain;
    category.iCategory = aCategory;
    TMediatorCategoryBuffer categoryBuffer( category );
        
    // And command
    TCommand command;
    command.iCommandId = aCommandId;
    //All the remaining parameters of TCommand are initiatilized to 0 as its not used on the server side.  
    //this is just to suppress the tool warnings.
    command.iVersion = TVersion(0,0,0);
	command.iCaps.SetEmpty();
    command.iTimeout = 0;

    TCommandBuffer commandBuffer( command );
        
    // Status
    TPckgBuf<TInt> statusBuffer( aStatus );
        
    // Send the command                                 
    return SendReceive( EIssueResponse, 
                        TIpcArgs( &categoryBuffer, 
                                  &commandBuffer, 
                                  &statusBuffer,
                                  &aData ) );
    }