184 } |
184 } |
185 __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq); |
185 __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq); |
186 return EFalse; |
186 return EFalse; |
187 } |
187 } |
188 |
188 |
|
189 TBool DUsbClientController::IsInTheChargerTypeList(const TUsbcChargerTypeCallback& aCallback) |
|
190 { |
|
191 const TInt irq = __SPIN_LOCK_IRQSAVE(iUsbLock); |
|
192 TSglQueIter<TUsbcChargerTypeCallback> iter(iChargerTypeCallbacks); |
|
193 TUsbcChargerTypeCallback* p; |
|
194 while ((p = iter++) != NULL) |
|
195 { |
|
196 if (p == &aCallback) |
|
197 { |
|
198 __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq); |
|
199 return ETrue; |
|
200 } |
|
201 } |
|
202 __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq); |
|
203 return EFalse; |
|
204 } |
|
205 |
189 // |
206 // |
190 // --- Misc classes --- |
207 // --- Misc classes --- |
191 // |
208 // |
192 |
209 |
193 // --- TUsbcClientCallback |
210 // --- TUsbcClientCallback |
543 { |
560 { |
544 iDfc.Cancel(); |
561 iDfc.Cancel(); |
545 } |
562 } |
546 |
563 |
547 |
564 |
|
565 // --- TUsbcChargerTypeCallback |
|
566 |
|
567 /** Constructor. |
|
568 */ |
|
569 TUsbcChargerTypeCallback::TUsbcChargerTypeCallback(DBase* aOwner, TDfcFn aCallback, |
|
570 TInt aPriority) |
|
571 : iOwner(aOwner), |
|
572 iDfc(aCallback, aOwner, aPriority), |
|
573 iChargerType(UsbShai::EPortTypeNone), |
|
574 iPendingNotify(EFalse) |
|
575 {} |
|
576 |
|
577 /** Set charger type which is to be notified to client. |
|
578 @param Charger type to be set |
|
579 */ |
|
580 void TUsbcChargerTypeCallback::SetChargerType(TUint aType) |
|
581 { |
|
582 iChargerType = aType; |
|
583 } |
|
584 |
|
585 |
|
586 /** Returns a pointer to the owner of this request. |
|
587 @return A pointer to the owner of this request. |
|
588 */ |
|
589 DBase* TUsbcChargerTypeCallback::Owner() const |
|
590 { |
|
591 return iOwner; |
|
592 } |
|
593 |
|
594 |
|
595 /** Charger type which is to be notified to client. |
|
596 @return Value of Charger Type |
|
597 */ |
|
598 TUint TUsbcChargerTypeCallback::ChargerType() const |
|
599 { |
|
600 return iChargerType; |
|
601 } |
|
602 |
|
603 |
|
604 /** Set whether there is an pending charger type which is to be notified to client. |
|
605 @param whether there is an pending charger type |
|
606 */ |
|
607 void TUsbcChargerTypeCallback::SetPendingNotify(TBool aPendingNotify) |
|
608 { |
|
609 iPendingNotify = aPendingNotify; |
|
610 } |
|
611 |
|
612 /** return whether there is an pending charger type which is to be notified to client. |
|
613 @return whether there is an pending charger type |
|
614 */ |
|
615 TBool TUsbcChargerTypeCallback::PendingNotify() const |
|
616 { |
|
617 return iPendingNotify; |
|
618 } |
|
619 |
|
620 /** Executes the callback function set by the owner of this request. |
|
621 @return KErrNone. |
|
622 */ |
|
623 TInt TUsbcChargerTypeCallback::DoCallback() |
|
624 { |
|
625 if (NKern::CurrentContext() == NKern::EThread) |
|
626 iDfc.Enque(); |
|
627 else |
|
628 iDfc.Add(); |
|
629 return KErrNone; |
|
630 } |
|
631 |
|
632 |
|
633 /** Cancels the callback function set by the owner of this request. |
|
634 */ |
|
635 void TUsbcChargerTypeCallback::Cancel() |
|
636 { |
|
637 iDfc.Cancel(); |
|
638 } |
|
639 |
|
640 |
|
641 /** Set DFC queue. |
|
642 @param aDfcQ DFC queue to be set |
|
643 */ |
|
644 void TUsbcChargerTypeCallback::SetDfcQ(TDfcQue* aDfcQ) |
|
645 { |
|
646 iDfc.SetDfcQ(aDfcQ); |
|
647 } |
|
648 |
|
649 |
548 /** Returns a pointer to the currently selected (active) setting of this interface. |
650 /** Returns a pointer to the currently selected (active) setting of this interface. |
549 |
651 |
550 @return A pointer to the currently selected (active) setting of this interface. |
652 @return A pointer to the currently selected (active) setting of this interface. |
551 */ |
653 */ |
552 const TUsbcInterface* TUsbcInterfaceSet::CurrentInterface() const |
654 const TUsbcInterface* TUsbcInterfaceSet::CurrentInterface() const |