bluetoothengine/btserviceutil/src/btdevextension.cpp
changeset 31 a0ea99b6fa53
parent 29 48ae3789ce00
child 40 997690c3397a
equal deleted inserted replaced
30:df7a93ede42e 31:a0ea99b6fa53
    88 
    88 
    89 // ---------------------------------------------------------------------------
    89 // ---------------------------------------------------------------------------
    90 // IsBonded
    90 // IsBonded
    91 // ---------------------------------------------------------------------------
    91 // ---------------------------------------------------------------------------
    92 //
    92 //
    93 TBool CBtDevExtension::IsBonded( const TBTNamelessDevice &dev )
    93 EXPORT_C TBool CBtDevExtension::IsBonded( const TBTNamelessDevice &dev )
    94     {
    94     {
    95     // IsValidPaired tells if the paired bit of dev is valid
    95     // IsValidPaired tells if the paired bit of dev is valid
    96     // and IsPaired tells if the device is paired or not:
    96     // and IsPaired tells if the device is paired or not:
    97     return dev.IsValidPaired() && 
    97     return dev.IsValidPaired() && 
    98            dev.IsPaired() && 
    98            dev.IsPaired() && 
   103 
   103 
   104 // ---------------------------------------------------------------------------
   104 // ---------------------------------------------------------------------------
   105 // IsJustWorksBonded
   105 // IsJustWorksBonded
   106 // ---------------------------------------------------------------------------
   106 // ---------------------------------------------------------------------------
   107 //
   107 //
   108 TBool CBtDevExtension::IsJustWorksBonded( const TBTNamelessDevice &dev )
   108 EXPORT_C TBool CBtDevExtension::IsJustWorksBonded( const TBTNamelessDevice &dev )
   109     {
   109     {
   110     return IsBonded( dev ) && 
   110     return IsBonded( dev ) && 
   111          dev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable;
   111          dev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable;
   112     }
   112     }
   113 
   113 
   114 // ---------------------------------------------------------------------------
   114 // ---------------------------------------------------------------------------
   115 // IsUserAwareBonded
   115 // IsUserAwareBonded
   116 // ---------------------------------------------------------------------------
   116 // ---------------------------------------------------------------------------
   117 //
   117 //
   118 TBool CBtDevExtension::IsUserAwareBonded( const TBTNamelessDevice &dev )
   118 EXPORT_C TBool CBtDevExtension::IsUserAwareBonded( const TBTNamelessDevice &dev )
   119     {
   119     {
   120     if ( IsJustWorksBonded( dev ) )
   120     if ( IsJustWorksBonded( dev ) )
   121         {
   121         {
   122         // Just Works bonded devices can happen without user awareness.
   122         // Just Works bonded devices can happen without user awareness.
   123         // For example, authentication due to an incoming service connection request 
   123         // For example, authentication due to an incoming service connection request 
   128         }
   128         }
   129     // Pairing in other mode than Just Works are always user-aware:
   129     // Pairing in other mode than Just Works are always user-aware:
   130     return IsBonded( dev );
   130     return IsBonded( dev );
   131     }
   131     }
   132 
   132 
       
   133 // ---------------------------------------------------------------------------
       
   134 // IsHeadset
       
   135 // ---------------------------------------------------------------------------
       
   136 //
       
   137 EXPORT_C TBool CBtDevExtension::IsHeadset( const TBTDeviceClass &aCod )
       
   138     {
       
   139     if ( ( aCod.MajorServiceClass() & EMajorServiceAudioService ) &&
       
   140          ( aCod.MajorDeviceClass() & EMajorDeviceAudioDevice ) )
       
   141         {
       
   142         if (aCod.MinorDeviceClass() == EMinorDeviceAVHandsfree ||
       
   143             aCod.MinorDeviceClass() == EMinorDeviceAVCarAudio)
       
   144             {
       
   145             // This is the typical CoD setting used by carkits:
       
   146             return false;
       
   147             }
       
   148         return true;
       
   149         }
       
   150     return false;
       
   151     }
   133 
   152 
   134 // ---------------------------------------------------------------------------
   153 // ---------------------------------------------------------------------------
   135 // 
   154 // 
   136 // ---------------------------------------------------------------------------
   155 // ---------------------------------------------------------------------------
   137 //
   156 //
   171 
   190 
   172 // ---------------------------------------------------------------------------
   191 // ---------------------------------------------------------------------------
   173 // ServiceConnectionStatus()
   192 // ServiceConnectionStatus()
   174 // ---------------------------------------------------------------------------
   193 // ---------------------------------------------------------------------------
   175 //
   194 //
   176 TBTEngConnectionStatus CBtDevExtension::ServiceConnectionStatus() const
   195 EXPORT_C TBTEngConnectionStatus CBtDevExtension::ServiceConnectionStatus() const
   177     {
   196     {
   178     return iServiceStatus;
   197     return iServiceStatus;
   179     }
   198     }
   180 
   199 
   181 // ---------------------------------------------------------------------------
   200 // ---------------------------------------------------------------------------
   217         TBTEngConnectionStatus aStatus )
   236         TBTEngConnectionStatus aStatus )
   218     {
   237     {
   219     iServiceStatus = aStatus;
   238     iServiceStatus = aStatus;
   220     }
   239     }
   221 
   240 
   222 
       
   223 
       
   224 // ---------------------------------------------------------------------------
   241 // ---------------------------------------------------------------------------
   225 // UpdateL()
   242 // UpdateL()
   226 // ---------------------------------------------------------------------------
   243 // ---------------------------------------------------------------------------
   227 //
   244 //
   228 void CBtDevExtension::UpdateNameL()
   245 void CBtDevExtension::UpdateNameL()