bluetoothengine/btui/inc/btqtconstants.h
branchRCL_3
changeset 55 613943a21004
equal deleted inserted replaced
54:0ba996a9b75d 55:613943a21004
       
     1 /*
       
     2 * Copyright (c) 2010 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef BTQTCONSTANTS_H
       
    19 #define BTQTCONSTANTS_H
       
    20 
       
    21 #include <btengconstants.h>
       
    22 #include <btserversdkcrkeys.h>
       
    23 
       
    24 
       
    25 // RSSI value range: -127dB ~ +20dB
       
    26 const int RssiMinRange = -127;
       
    27 
       
    28 //const int RssiMaxRange = 20; // maybe useful in the future
       
    29 
       
    30 const int RssiMediumStrength = -75;
       
    31 
       
    32 const int RssiHighStrength = -46;
       
    33 
       
    34 const int RssiInvalid = RssiMinRange - 1;
       
    35 
       
    36 enum PowerStateQtValue {
       
    37     BtPowerOff = 0,
       
    38     BtPowerOn,     
       
    39     BtPowerUnknown  // only for error situations
       
    40 };
       
    41 
       
    42 enum DisconnectOption {
       
    43     ServiceLevel = 0,
       
    44     PhysicalLink, 
       
    45     AllOngoingConnections,
       
    46     DisconUnknown
       
    47 };
       
    48 
       
    49 enum VisibilityMode {
       
    50     BtHidden = 0x10,  // using a different number space than TBTVisibilityMode
       
    51     BtVisible,
       
    52     BtTemporary,
       
    53     BtVisibilityUnknown
       
    54 };
       
    55 
       
    56 // used for mapping between UI row and VisibilityMode item
       
    57 enum VisibilityModeUiRowMapping {
       
    58     UiRowBtHidden = 0,
       
    59     UiRowBtVisible,
       
    60     UiRowBtTemporary,
       
    61     UiRowBtUnknown
       
    62 };
       
    63 
       
    64 
       
    65 inline VisibilityMode QtVisibilityMode(TBTVisibilityMode btEngMode)
       
    66 {
       
    67     VisibilityMode mode; 
       
    68     switch(btEngMode) {
       
    69     case EBTVisibilityModeHidden:
       
    70         mode = BtHidden;
       
    71         break;
       
    72     case EBTVisibilityModeGeneral:
       
    73         mode = BtVisible;
       
    74         break;
       
    75     case EBTVisibilityModeTemporary:
       
    76         mode = BtTemporary;
       
    77         break;
       
    78     default:
       
    79         mode = BtVisibilityUnknown;
       
    80     }
       
    81     return mode;
       
    82 }
       
    83 
       
    84 inline TBTVisibilityMode  BtEngVisibilityMode(VisibilityMode btQtMode)
       
    85 {
       
    86     TBTVisibilityMode mode; 
       
    87     switch(btQtMode) {
       
    88     case BtHidden:
       
    89         mode = EBTVisibilityModeHidden;
       
    90         break;
       
    91     case BtVisible:
       
    92         mode = EBTVisibilityModeGeneral;
       
    93         break;
       
    94     case BtTemporary:
       
    95         mode = EBTVisibilityModeTemporary;
       
    96         break;
       
    97     default:
       
    98         mode = (TBTVisibilityMode)KErrUnknown;
       
    99     }
       
   100     return mode;
       
   101 }
       
   102 
       
   103 inline PowerStateQtValue QtPowerMode(TBTPowerStateValue btEngMode)
       
   104 {
       
   105     PowerStateQtValue mode; 
       
   106     switch(btEngMode) {
       
   107     case EBTPowerOff:
       
   108         mode = BtPowerOff;
       
   109         break;
       
   110     case EBTPowerOn:
       
   111         mode = BtPowerOn;
       
   112         break;
       
   113     default:
       
   114         mode = BtPowerUnknown;  // error
       
   115     }
       
   116     return mode;
       
   117 }
       
   118 
       
   119 inline TBTPowerStateValue BtEngPowerState(PowerStateQtValue qtPowerState)
       
   120 {
       
   121     TBTPowerStateValue btEngPowerState;
       
   122     switch (qtPowerState){
       
   123     case BtPowerOff:
       
   124         btEngPowerState = EBTPowerOff;
       
   125         break;
       
   126     case BtPowerOn:
       
   127         btEngPowerState = EBTPowerOn;
       
   128         break;
       
   129     default:
       
   130         btEngPowerState = (TBTPowerStateValue)KErrUnknown;
       
   131     }
       
   132     return btEngPowerState;
       
   133 }
       
   134 
       
   135 #endif // BTQTCONSTANTS_H