radioapp/radiouiengine/src/radiocontrolservice.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 18 Aug 2010 09:49:03 +0300
changeset 41 3a6b55c6390c
parent 33 11b6825f0862
child 50 c44f9bb56771
permissions -rw-r--r--
Revision: 201031 Kit: 201033
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     1
/*
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     8
*
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    11
*
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    12
* Contributors:
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    13
*
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    14
* Description:
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    15
*
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    16
*/
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    17
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    18
// System includes
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    19
#include <xqserviceutil.h>
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
// User includes
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
#include "radiocontrolservice.h"
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
#include "radiouiengine.h"
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
#include "radioservicedef.h"
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    26
// Constants
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    27
const int SERVICE_POWEROFF_DELAY = 5000;
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    28
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    31
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    32
RadioControlService::RadioControlService( RadioUiEngine& engine ) :
32
189d20c34778 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 28
diff changeset
    33
    XQServiceProvider( RADIO_SERVICE +"."+ RADIO_CONTROL_SERVICE, &engine ),
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    34
    mUiEngine( engine )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    35
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
    publishAll();
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
 *
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
RadioControlService::~RadioControlService()
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    43
{
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
}
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
/*!
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
 * Public slot
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
 */
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
void RadioControlService::command( int commandId )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
{
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    51
    //TODO: Uncomment when vendor id can be read from the client
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    52
//    if ( requestInfo().clientVendorId() != NOKIA_VENDORID ) {
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    53
//        return;
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    54
//    }
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    55
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
    switch ( commandId )
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
    {
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    58
        case RadioServiceCommand::PowerOn:
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    59
            mUiEngine.setPowerOn();
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
            break;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    62
        case RadioServiceCommand::PowerOff:
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    63
            mUiEngine.setPowerOff( SERVICE_POWEROFF_DELAY );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    64
            break;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    66
        case RadioServiceCommand::Previous:
41
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    67
            mUiEngine.skipStation( StationSkip::PreviousFavorite, 0, TuneReason::SkipFromWidget );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    68
            break;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    69
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    70
        case RadioServiceCommand::Next:
41
3a6b55c6390c Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    71
            mUiEngine.skipStation( StationSkip::NextFavorite, 0, TuneReason::SkipFromWidget );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    72
            break;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    73
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    74
        case RadioServiceCommand::SeekUp:
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    75
            mUiEngine.seekStation( Seek::Up );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    76
            break;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    77
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    78
        case RadioServiceCommand::SeekDown:
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    79
            mUiEngine.seekStation( Seek::Down );
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
            break;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    81
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    82
        case RadioServiceCommand::Foreground:
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    83
            XQServiceUtil::toBackground( false );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    84
            break;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
        case RadioServiceCommand::Background:
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    87
            XQServiceUtil::toBackground( true );
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    88
            break;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
28
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    90
        case RadioServiceCommand::Mute:
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    91
            mUiEngine.setMute( true );
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    92
            break;
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    93
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    94
        case RadioServiceCommand::UnMute:
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    95
            mUiEngine.setMute( false );
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    96
            break;
075425b8d9a4 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    97
24
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
        default:
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
    99
            break;
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   100
    }
6df133bd92e1 Revert last code drop.
Pat Downey <patd@symbian.org>
parents:
diff changeset
   101
}