cbs/CbsServer/ClientSrc/RCbsSettings.cpp
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  This module contains the implementation of RCbsSettings class 
       
    15     		 member functions.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 
       
    22 #include "CbsServerConstants.h"
       
    23 #include "RCbsTopicMessages.h"
       
    24 #include "RCbsSettings.h"
       
    25 #include "RCbs.h"
       
    26 
       
    27 // ================= MEMBER FUNCTIONS =======================
       
    28 
       
    29 // C++ default constructor can NOT contain any code, that
       
    30 // might leave.
       
    31 //
       
    32 RCbsSettings::RCbsSettings()
       
    33     : iNotifyEventPtr( NULL, 0, 0 )
       
    34     {
       
    35     }
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // RCbsSettings::Open
       
    39 // Creates a subsession to the server.
       
    40 // (other items were commented in a header).
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 
       
    44 TInt RCbsSettings::Open( 
       
    45     RCbs& aServer )
       
    46     {
       
    47     // Open the subsession.
       
    48     const TIpcArgs args( TIpcArgs::ENothing );
       
    49     return CreateSubSession( aServer, ECbsCreateSettingsSubsession, args );
       
    50     }
       
    51 // -----------------------------------------------------------------------------
       
    52 // RCbsSettings::Close
       
    53 // Closes the subsession.
       
    54 // (other items were commented in a header).
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 
       
    58 TInt RCbsSettings::Close()
       
    59     {
       
    60     // Close the subsession.
       
    61     RSubSessionBase::CloseSubSession( ECbsCloseSettingsSubsession );
       
    62     return KErrNone;
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // RCbsSettings::GetReceptionStatus
       
    67 // Requests the reception status from the server.
       
    68 // (other items were commented in a header).
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 void RCbsSettings::GetReceptionStatus( 
       
    72     TBool& aStatus )
       
    73     {
       
    74     // Send request to the server. Get the current reception status.
       
    75     aStatus = EFalse;
       
    76     TPckgBuf< TBool > pckg( aStatus );
       
    77     const TIpcArgs args( &pckg );
       
    78 
       
    79     SendReceive( ECbsGetReceptionStatus, args );
       
    80 
       
    81     aStatus = pckg();
       
    82     }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // RCbsSettings::SetReceptionStatus
       
    86 // Changes the reception status to aStatus.
       
    87 // (other items were commented in a header).
       
    88 // -----------------------------------------------------------------------------
       
    89 //  
       
    90 TInt RCbsSettings::SetReceptionStatus( 
       
    91     TBool aStatus )
       
    92     {  
       
    93     // Change the reception status
       
    94     TPckgBuf< TBool > pckg( aStatus );
       
    95     const TIpcArgs args( &pckg );
       
    96     return SendReceive( ECbsSetReceptionStatus, args );
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // RCbsSettings::GetTopicDetectionStatus
       
   101 // Requests the current topic detection status.
       
   102 // (other items were commented in a header).
       
   103 // -----------------------------------------------------------------------------
       
   104 //  
       
   105 void RCbsSettings::GetTopicDetectionStatus( 
       
   106     TBool& aStatus )
       
   107     {
       
   108     // Get the current topic detection status.
       
   109     TPckgBuf< TBool > pckg;
       
   110     const TIpcArgs args( &pckg );
       
   111     SendReceive( ECbsGetTopicDetectionStatus, args );
       
   112     aStatus = pckg();
       
   113     }
       
   114 
       
   115 // -----------------------------------------------------------------------------
       
   116 // RCbsSettings::SetTopicDetectionStatus
       
   117 // Sets a new topic detection status.
       
   118 // (other items were commented in a header).
       
   119 // -----------------------------------------------------------------------------
       
   120 //  
       
   121 TInt RCbsSettings::SetTopicDetectionStatus( 
       
   122     TBool aStatus )
       
   123     {
       
   124     // Change the topic detection status.
       
   125     TPckgBuf< TBool > pckg( aStatus );
       
   126     const TIpcArgs args( &pckg );
       
   127     return SendReceive( ECbsSetTopicDetectionStatus, args );
       
   128     }
       
   129 
       
   130 // -----------------------------------------------------------------------------
       
   131 // RCbsSettings::GetLanguages
       
   132 // Returns the preferred languages in aLanguages.
       
   133 // (other items were commented in a header).
       
   134 // -----------------------------------------------------------------------------
       
   135 //  
       
   136 void RCbsSettings::GetLanguages( 
       
   137     TCbsSettingsLanguages& aLanguages )
       
   138     {
       
   139     // Get the preferred languages
       
   140     TPckgBuf< TCbsSettingsLanguages > pckg;
       
   141     const TIpcArgs args( &pckg );
       
   142     SendReceive( ECbsGetLanguages, args );
       
   143     aLanguages = pckg();
       
   144     }
       
   145 
       
   146 // -----------------------------------------------------------------------------
       
   147 // RCbsSettings::SetLanguages
       
   148 // Sets a new set of languages to the server.
       
   149 // (other items were commented in a header).
       
   150 // -----------------------------------------------------------------------------
       
   151 //  
       
   152 TInt RCbsSettings::SetLanguages( 
       
   153     const TCbsSettingsLanguages& aLanguages )
       
   154     {
       
   155     // Change the preferred languages
       
   156     TPckgBuf< TCbsSettingsLanguages > pckg( aLanguages );
       
   157     const TIpcArgs args( &pckg );
       
   158     return SendReceive( ECbsSetLanguages, args );
       
   159     }
       
   160 
       
   161 // -----------------------------------------------------------------------------
       
   162 // RCbsSettings::NotifySettingsChanged
       
   163 // Requests the server to notify the client whenever any settings 
       
   164 // will be changed.
       
   165 // (other items were commented in a header).
       
   166 // -----------------------------------------------------------------------------
       
   167 //  
       
   168 void RCbsSettings::NotifySettingsChanged( 
       
   169     TRequestStatus& aStatus, 
       
   170     TCbsSettingsEvent& aEvent )
       
   171     {
       
   172     // Set up the notify! 
       
   173     iNotifyEventPtr.Set( reinterpret_cast<TText8*>( &aEvent ), 
       
   174                          sizeof( TCbsSettingsEvent ),
       
   175                          sizeof( TCbsSettingsEvent ) );
       
   176 
       
   177     // Server writes through the pointer descriptor
       
   178     const TIpcArgs args( &iNotifyEventPtr );
       
   179     SendReceive( ECbsNotifySettingsChanged, args, aStatus );
       
   180     }
       
   181 
       
   182 // -----------------------------------------------------------------------------
       
   183 // RCbsSettings::NotifySettingsChangedCancel
       
   184 // Cancels the request to notify the client.
       
   185 // (other items were commented in a header).
       
   186 // -----------------------------------------------------------------------------
       
   187 //
       
   188 void RCbsSettings::NotifySettingsChangedCancel()
       
   189     {
       
   190     const TIpcArgs args( TIpcArgs::ENothing );
       
   191     SendReceive( ECbsNotifySettingsChangedCancel, args );
       
   192     }
       
   193 
       
   194 // ================= OTHER EXPORTED FUNCTIONS ==============
       
   195 
       
   196 //  End of File