bluetoothengine/btui/inc/btqtconstants.h
author hgs
Mon, 12 Jul 2010 19:02:35 +0300
changeset 43 7d241e669870
parent 42 b72428996822
child 57 5ebadcda06cb
permissions -rw-r--r--
201025_02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     1
/*
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     3
* All rights reserved.
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     8
*
48ae3789ce00 201017_2
hgs
parents:
diff changeset
     9
* Initial Contributors:
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    11
*
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    12
* Contributors:
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    13
*
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    14
* Description: 
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    15
*
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    16
*/
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    17
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    18
#ifndef BTQTCONSTANTS_H
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    19
#define BTQTCONSTANTS_H
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    20
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    21
#include <btengconstants.h>
42
hgs
parents: 31
diff changeset
    22
#include <btserversdkcrkeys.h>
29
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    23
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    24
31
a0ea99b6fa53 201019_1
hgs
parents: 29
diff changeset
    25
// RSSI value range: -127dB ~ +20dB
a0ea99b6fa53 201019_1
hgs
parents: 29
diff changeset
    26
const int RssiMinRange = -127;
a0ea99b6fa53 201019_1
hgs
parents: 29
diff changeset
    27
a0ea99b6fa53 201019_1
hgs
parents: 29
diff changeset
    28
//const int RssiMaxRange = 20; // maybe useful in the future
a0ea99b6fa53 201019_1
hgs
parents: 29
diff changeset
    29
a0ea99b6fa53 201019_1
hgs
parents: 29
diff changeset
    30
const int RssiMediumStrength = -75;
a0ea99b6fa53 201019_1
hgs
parents: 29
diff changeset
    31
a0ea99b6fa53 201019_1
hgs
parents: 29
diff changeset
    32
const int RssiHighStrength = -46;
a0ea99b6fa53 201019_1
hgs
parents: 29
diff changeset
    33
a0ea99b6fa53 201019_1
hgs
parents: 29
diff changeset
    34
const int RssiInvalid = RssiMinRange - 1;
a0ea99b6fa53 201019_1
hgs
parents: 29
diff changeset
    35
42
hgs
parents: 31
diff changeset
    36
enum PowerStateQtValue {
hgs
parents: 31
diff changeset
    37
    BtPowerOff = 0,
hgs
parents: 31
diff changeset
    38
    BtPowerOn,     
hgs
parents: 31
diff changeset
    39
    BtPowerUnknown  // only for error situations
hgs
parents: 31
diff changeset
    40
};
hgs
parents: 31
diff changeset
    41
hgs
parents: 31
diff changeset
    42
enum DisconnectOption {
hgs
parents: 31
diff changeset
    43
    ServiceLevel = 0,
hgs
parents: 31
diff changeset
    44
    PhysicalLink, 
hgs
parents: 31
diff changeset
    45
    AllOngoingConnections,
hgs
parents: 31
diff changeset
    46
    DisconUnknown
hgs
parents: 31
diff changeset
    47
};
hgs
parents: 31
diff changeset
    48
29
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    49
enum VisibilityMode {
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    50
    BtHidden = 0x10,  // using a different number space than TBTVisibilityMode
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    51
    BtVisible,
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    52
    BtTemporary,
42
hgs
parents: 31
diff changeset
    53
    BtVisibilityUnknown
29
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    54
};
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    55
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    56
// used for mapping between UI row and VisibilityMode item
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    57
enum VisibilityModeUiRowMapping {
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    58
    UiRowBtHidden = 0,
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    59
    UiRowBtVisible,
42
hgs
parents: 31
diff changeset
    60
    UiRowBtTemporary,
hgs
parents: 31
diff changeset
    61
    UiRowBtUnknown
29
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    62
};
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    63
42
hgs
parents: 31
diff changeset
    64
29
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    65
inline VisibilityMode QtVisibilityMode(TBTVisibilityMode btEngMode)
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    66
{
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    67
    VisibilityMode mode; 
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    68
    switch(btEngMode) {
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    69
    case EBTVisibilityModeHidden:
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    70
        mode = BtHidden;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    71
        break;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    72
    case EBTVisibilityModeGeneral:
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    73
        mode = BtVisible;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    74
        break;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    75
    case EBTVisibilityModeTemporary:
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    76
        mode = BtTemporary;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    77
        break;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    78
    default:
42
hgs
parents: 31
diff changeset
    79
        mode = BtVisibilityUnknown;
29
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    80
    }
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    81
    return mode;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    82
}
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    83
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    84
inline TBTVisibilityMode  BtEngVisibilityMode(VisibilityMode btQtMode)
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    85
{
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    86
    TBTVisibilityMode mode; 
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    87
    switch(btQtMode) {
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    88
    case BtHidden:
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    89
        mode = EBTVisibilityModeHidden;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    90
        break;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    91
    case BtVisible:
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    92
        mode = EBTVisibilityModeGeneral;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    93
        break;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    94
    case BtTemporary:
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    95
        mode = EBTVisibilityModeTemporary;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    96
        break;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    97
    default:
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    98
        mode = (TBTVisibilityMode)KErrUnknown;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
    99
    }
48ae3789ce00 201017_2
hgs
parents:
diff changeset
   100
    return mode;
48ae3789ce00 201017_2
hgs
parents:
diff changeset
   101
}
48ae3789ce00 201017_2
hgs
parents:
diff changeset
   102
42
hgs
parents: 31
diff changeset
   103
inline PowerStateQtValue QtPowerMode(TBTPowerStateValue btEngMode)
hgs
parents: 31
diff changeset
   104
{
hgs
parents: 31
diff changeset
   105
    PowerStateQtValue mode; 
hgs
parents: 31
diff changeset
   106
    switch(btEngMode) {
hgs
parents: 31
diff changeset
   107
    case EBTPowerOff:
hgs
parents: 31
diff changeset
   108
        mode = BtPowerOff;
hgs
parents: 31
diff changeset
   109
        break;
hgs
parents: 31
diff changeset
   110
    case EBTPowerOn:
hgs
parents: 31
diff changeset
   111
        mode = BtPowerOn;
hgs
parents: 31
diff changeset
   112
        break;
hgs
parents: 31
diff changeset
   113
    default:
hgs
parents: 31
diff changeset
   114
        mode = BtPowerUnknown;  // error
hgs
parents: 31
diff changeset
   115
    }
hgs
parents: 31
diff changeset
   116
    return mode;
hgs
parents: 31
diff changeset
   117
}
hgs
parents: 31
diff changeset
   118
hgs
parents: 31
diff changeset
   119
inline TBTPowerStateValue BtEngPowerState(PowerStateQtValue qtPowerState)
hgs
parents: 31
diff changeset
   120
{
hgs
parents: 31
diff changeset
   121
    TBTPowerStateValue btEngPowerState;
hgs
parents: 31
diff changeset
   122
    switch (qtPowerState){
hgs
parents: 31
diff changeset
   123
    case BtPowerOff:
hgs
parents: 31
diff changeset
   124
        btEngPowerState = EBTPowerOff;
hgs
parents: 31
diff changeset
   125
        break;
hgs
parents: 31
diff changeset
   126
    case BtPowerOn:
hgs
parents: 31
diff changeset
   127
        btEngPowerState = EBTPowerOn;
hgs
parents: 31
diff changeset
   128
        break;
hgs
parents: 31
diff changeset
   129
    default:
hgs
parents: 31
diff changeset
   130
        btEngPowerState = (TBTPowerStateValue)KErrUnknown;
hgs
parents: 31
diff changeset
   131
    }
hgs
parents: 31
diff changeset
   132
    return btEngPowerState;
hgs
parents: 31
diff changeset
   133
}
29
48ae3789ce00 201017_2
hgs
parents:
diff changeset
   134
48ae3789ce00 201017_2
hgs
parents:
diff changeset
   135
#endif // BTQTCONSTANTS_H