84 iInterfaceSelector = CRemConInterfaceSelector::NewL(); |
84 iInterfaceSelector = CRemConInterfaceSelector::NewL(); |
85 iVolController = NULL; |
85 iVolController = NULL; |
86 iRegisterVolumeChangeNotificationCounter = 0; |
86 iRegisterVolumeChangeNotificationCounter = 0; |
87 if (iAccObserver.IsAvrcpVolCTSupported()) |
87 if (iAccObserver.IsAvrcpVolCTSupported()) |
88 { |
88 { |
89 iAbsoluteVolController = CBTRCCAbsoluteVolumeLevelController::NewL(*iInterfaceSelector, *this); |
89 TInt err = KErrNone; |
90 TRACE_INFO((_L("CBTRCCLinker::ConstructL, absolute volume controller created."))) |
90 TRAP(err, iAbsoluteVolController = CBTRCCAbsoluteVolumeLevelController::NewL(*iInterfaceSelector, *this)); |
|
91 if( err ) |
|
92 { |
|
93 // Absolute volume controller creation failed, this means that we don't have volume controller |
|
94 // but continue construct linker. |
|
95 iAbsoluteVolController = NULL; |
|
96 TRACE_INFO((_L("CBTRCCLinker::ConstructL, absolute volume controller creation failed %d, continue anyway."), err)) |
|
97 } |
|
98 else |
|
99 { |
|
100 TRACE_INFO((_L("CBTRCCLinker::ConstructL, absolute volume controller created."))) |
|
101 } |
91 |
102 |
92 // If also legacy is configured into use, prepare to use it with legacy devices. |
103 // If also legacy is configured into use, prepare to use it with legacy devices. |
93 if(iAccObserver.IsAvrcpLegacyVolCTSupported()) |
104 if(iAccObserver.IsAvrcpLegacyVolCTSupported()) |
94 { |
105 { |
95 iLegacyVolController = CBTRCCLegacyVolumeLevelController::NewL(*iInterfaceSelector, *this); |
106 TRAP(err, iLegacyVolController = CBTRCCLegacyVolumeLevelController::NewL(*iInterfaceSelector, *this)); |
96 TRACE_INFO((_L("CBTRCCLinker::ConstructL, legacy volume controller created."))) |
107 if( err ) |
|
108 { |
|
109 // Legacy volume controller creation failed, this means that we don't have volume controller |
|
110 // but continue construct linker. |
|
111 iLegacyVolController = NULL; |
|
112 TRACE_INFO((_L("CBTRCCLinker::ConstructL, legacy volume controller creation failed %d, continue anyway."), err)) |
|
113 } |
|
114 else |
|
115 { |
|
116 TRACE_INFO((_L("CBTRCCLinker::ConstructL, legacy volume controller created."))) |
|
117 } |
97 } |
118 } |
98 } |
119 } |
99 else |
120 else |
100 { |
121 { |
101 // If volume control is not supported, we'll need another interface selector session for disconnecting. |
122 // If volume control is not supported, we'll need another interface selector session for disconnecting. |
106 iCoreTarget = CRemConCoreApiTarget::NewL(*iInterfaceSelector, *iPlayerStarter); |
127 iCoreTarget = CRemConCoreApiTarget::NewL(*iInterfaceSelector, *iPlayerStarter); |
107 iPlayerStarter->SetCoreTarget(*iCoreTarget); |
128 iPlayerStarter->SetCoreTarget(*iCoreTarget); |
108 |
129 |
109 iRemConBatteryTgt = CRemConBatteryApiTarget::NewL(*iInterfaceSelector, *this); |
130 iRemConBatteryTgt = CRemConBatteryApiTarget::NewL(*iInterfaceSelector, *this); |
110 |
131 |
111 if (iAccObserver.IsAvrcpVolCTSupported()) |
132 if (iAbsoluteVolController || iLegacyVolController) |
112 { |
133 { |
113 iInterfaceSelector->OpenControllerL(); |
134 iInterfaceSelector->OpenControllerL(); |
114 } |
135 } |
115 iInterfaceSelector->OpenTargetL(); |
136 iInterfaceSelector->OpenTargetL(); |
116 |
137 |
443 { |
464 { |
444 // Choose based on SDP result whether to create |
465 // Choose based on SDP result whether to create |
445 // absolute controller or legacy controller. |
466 // absolute controller or legacy controller. |
446 if(!iVolController) |
467 if(!iVolController) |
447 { |
468 { |
|
469 // iAbsoluteVolController may be NULL, if creation of devsound has |
|
470 // been failed or local max volume provided by devsound is zero. |
|
471 |
|
472 // iLegacyVolController may be NULL, depends on the configuration and |
|
473 // if creation of devsound has been failed or local max volume provided |
|
474 // by devsound is zero. |
448 if (iAccObserver.IsAbsoluteVolumeSupported(iRemoteAddr)) |
475 if (iAccObserver.IsAbsoluteVolumeSupported(iRemoteAddr)) |
449 { |
476 { |
450 iVolController = iAbsoluteVolController; |
477 iVolController = iAbsoluteVolController; |
451 TRACE_INFO(_L("Absolute volume supported, taking it into use.")) |
478 TRACE_INFO(_L("Absolute volume supported, taking it into use.")) |
452 } |
479 } |
453 else |
480 else |
454 { |
481 { |
455 iVolController = iLegacyVolController; // iLegacyVolController may be NULL, depends on the configuration. |
482 iVolController = iLegacyVolController; |
456 } |
483 } |
457 } |
484 } |
458 } |
485 } |
459 if (iVolController) |
486 if (iVolController) |
460 { |
487 { |