1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
10 // |
10 // |
11 // Contributors: |
11 // Contributors: |
398 /** Controller toy device **/ |
392 /** Controller toy device **/ |
399 EMinorDeviceToyController = 0x04, //000100 |
393 EMinorDeviceToyController = 0x04, //000100 |
400 /** Game toy device **/ |
394 /** Game toy device **/ |
401 EMinorDeviceToyGame = 0x05, //000101 |
395 EMinorDeviceToyGame = 0x05, //000101 |
402 }; |
396 }; |
403 |
|
404 |
|
405 /** Minor Device class headset. |
|
406 @deprecated |
|
407 @internalComponent |
|
408 @see TBTMinorDeviceClassAV |
|
409 **/ |
|
410 enum TBTMinorDeviceClassHeadset |
|
411 { //7 2 |
|
412 EHeadsetUnclassified = 0x0, //000000 |
|
413 EHeadsetProfile = 0x1, //000001 |
|
414 }; |
|
415 |
397 |
416 /** Encapsulation of device class definitions. |
398 /** Encapsulation of device class definitions. |
417 |
399 |
418 Contains a single TInt as member data and methods to extract the major, minor and service |
400 Contains a single TInt as member data and methods to extract the major, minor and service |
419 class information from that TInt. |
401 class information from that TInt. |
439 IMPORT_C void ExternalizeL(RWriteStream& aStream) const; |
421 IMPORT_C void ExternalizeL(RWriteStream& aStream) const; |
440 IMPORT_C void InternalizeL(RReadStream& aStream); |
422 IMPORT_C void InternalizeL(RReadStream& aStream); |
441 private: |
423 private: |
442 static const TUint32 KStreamVersion = 0x00000001; |
424 static const TUint32 KStreamVersion = 0x00000001; |
443 private: |
425 private: |
444 TUint32 iDeviceClass; |
426 TUint32 iDeviceClass; |
445 |
427 |
446 // This data padding has been added to help prevent future binary compatibility breaks |
428 // This data padding has been added to help prevent future binary compatibility breaks |
447 // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used |
429 // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used |
448 TUint32 iPadding1; |
430 TUint32 iPadding1; |
449 TUint32 iPadding2; |
431 TUint32 iPadding2; |
450 }; |
432 }; |
451 |
433 |
452 /** Class to store the security override parameters for a particular remote device. |
434 /** Class to store the security override parameters for a particular remote device. |
453 |
435 |
454 @publishedAll |
436 @publishedAll |
498 |
480 |
499 public: |
481 public: |
500 /** Enumeration to assist in parsing of security settings. */ |
482 /** Enumeration to assist in parsing of security settings. */ |
501 enum TBTDeviceSecuritySettings |
483 enum TBTDeviceSecuritySettings |
502 { |
484 { |
503 ENoAuthenticate = 0x01, /*!< Don't authenticate the link */ |
485 ENoAuthenticate = 0x01, /*!< Don't authenticate the link @deprecated */ |
504 ENoAuthorise = 0x02, /*!< Don't authorise the connection */ |
486 ENoAuthorise = 0x02, /*!< Don't authorise the connection */ |
505 EEncrypt = 0x04, /*!< Encrypt the link */ |
487 EEncrypt = 0x04, /*!< Encrypt the link */ |
506 EBanned = 0x08, /*!< Don't connect to the device */ |
488 EBanned = 0x08, /*!< Don't connect to the device */ |
507 EMitmProtectionRequired = 0x10, /*!< Require the link is MITM protected */ |
489 EMitmProtectionRequired = 0x10, /*!< Require the link is MITM protected */ |
508 }; |
490 }; |
509 |
491 |
510 private: |
492 private: |
511 static const TUint32 KStreamVersion = 0x00000001; |
493 static const TUint32 KStreamVersion = 0x00000001; |
512 |
494 |
513 private: |
495 private: |
514 TUint8 iSecurity; |
496 TUint8 iSecurity; |
515 TUint iPasskeyMinLength; |
497 TUint iPasskeyMinLength; |
516 |
498 |
517 // This data padding has been added to help prevent future binary compatibility breaks |
499 // This data padding has been added to help prevent future binary compatibility breaks |
518 // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used |
500 // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used |
519 TUint32 iPadding1; |
501 TUint32 iPadding1; |
520 TUint32 iPadding2; |
502 TUint32 iPadding2; |
521 }; |
503 }; |
522 |
504 |
523 /** Class to tie a service uid with a device security setting. |
505 /** Class to tie a service uid with a device security setting. |
524 |
506 |
525 This allows us to have service-specific security settings for a device. |
507 This allows us to have service-specific security settings for a device. |
552 TBTDevAddr iDeviceAddress; /*!< the address of the device for the overriding security **/ |
534 TBTDevAddr iDeviceAddress; /*!< the address of the device for the overriding security **/ |
553 TBTDeviceSecurity iDeviceSecurity; /*!< the overriding security */ |
535 TBTDeviceSecurity iDeviceSecurity; /*!< the overriding security */ |
554 |
536 |
555 // This data padding has been added to help prevent future binary compatibility breaks |
537 // This data padding has been added to help prevent future binary compatibility breaks |
556 // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used |
538 // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used |
557 TUint32 iPadding1; |
539 TUint32 iPadding1; |
558 TUint32 iPadding2; |
540 TUint32 iPadding2; |
559 }; |
541 }; |
560 |
|
561 /** For Symbian use only |
|
562 @internalAll |
|
563 */ |
|
564 NONSHARABLE_CLASS(TBTBasebandParameters) |
|
565 { |
|
566 public: |
|
567 IMPORT_C void ExternalizeL(RWriteStream& aStream) const; |
|
568 IMPORT_C void InternalizeL(RReadStream& aStream); |
|
569 |
|
570 TUint8 iPageScanRepetitionMode; /*!< Page Scan repetition mode of remote device ( valid if > 0 ) */ |
|
571 TUint8 iPageScanPeriodMode; /*!< Page scan period mode of remote device */ |
|
572 TUint8 iPageScanMode; /*!< Page scan mode of remote device ( valid if > 0 ) */ |
|
573 TUint16 iClockOffset; /*!< clock off set of remote device ( valid if > 0 ) */ |
|
574 |
|
575 private: |
|
576 static const TUint32 KStreamVersion = 0x00000001; |
|
577 }; |
|
578 |
|
579 |
|
580 |
542 |
581 /** Stores parameters for a nameless device. |
543 /** Stores parameters for a nameless device. |
582 |
544 |
583 A class which stores useful parameters concerning a remote device |
545 A class which stores useful parameters concerning a remote device |
584 But *not* including names |
546 But *not* including names |
587 @released |
549 @released |
588 */ |
550 */ |
589 NONSHARABLE_CLASS(TBTNamelessDevice) |
551 NONSHARABLE_CLASS(TBTNamelessDevice) |
590 { |
552 { |
591 friend class CBTDevice; |
553 friend class CBTDevice; |
592 public: |
554 |
593 |
555 private: |
594 IMPORT_C TBTNamelessDevice(); |
556 /** For Symbian use only |
595 IMPORT_C const TBTDevAddr& Address() const; |
557 @internalComponent |
596 IMPORT_C const TBTDeviceClass& DeviceClass() const; |
558 */ |
597 IMPORT_C const TBTLinkKey& LinkKey() const; |
559 NONSHARABLE_CLASS(TBTBasebandParameters) |
|
560 { |
|
561 public: |
|
562 void ExternalizeL(RWriteStream& aStream) const; |
|
563 void InternalizeL(RReadStream& aStream); |
|
564 |
|
565 TUint8 iPageScanRepetitionMode; /*!< Page Scan repetition mode of remote device ( valid if > 0 ) */ |
|
566 TUint8 iPageScanPeriodMode; /*!< Page scan period mode of remote device */ |
|
567 TUint8 iPageScanMode; /*!< Page scan mode of remote device ( valid if > 0 ) */ |
|
568 TUint16 iClockOffset; /*!< clock off set of remote device ( valid if > 0 ) */ |
|
569 |
|
570 private: |
|
571 static const TUint32 KStreamVersion = 0x00000001; |
|
572 }; |
|
573 public: |
|
574 |
|
575 IMPORT_C TBTNamelessDevice(); |
|
576 IMPORT_C const TBTDevAddr& Address() const; |
|
577 IMPORT_C const TBTDeviceClass& DeviceClass() const; |
|
578 IMPORT_C const TBTLinkKey& LinkKey() const; |
598 IMPORT_C TBTLinkKeyType LinkKeyType() const; |
579 IMPORT_C TBTLinkKeyType LinkKeyType() const; |
599 IMPORT_C TUint8 PageScanRepMode() const; |
580 IMPORT_C TUint8 PageScanRepMode() const; |
600 IMPORT_C TUint8 PageScanMode() const; |
581 IMPORT_C TUint8 PageScanMode() const; |
601 IMPORT_C TUint8 PageScanPeriodMode() const; |
582 IMPORT_C TUint8 PageScanPeriodMode() const; |
602 IMPORT_C TUint16 ClockOffset() const; |
583 IMPORT_C TUint16 ClockOffset() const; |
603 IMPORT_C const TTime& Seen() const; |
584 IMPORT_C const TTime& Seen() const; |
604 IMPORT_C const TTime& Used() const; |
585 IMPORT_C const TTime& Used() const; |
605 IMPORT_C const TBTDeviceSecurity& GlobalSecurity() const; |
586 IMPORT_C const TBTDeviceSecurity& GlobalSecurity() const; |
606 IMPORT_C void SetAddress(const TBTDevAddr& aBDAddr); |
587 IMPORT_C void SetAddress(const TBTDevAddr& aBDAddr); |
607 IMPORT_C void SetDeviceClass(TBTDeviceClass aDeviceClass); |
588 IMPORT_C void SetDeviceClass(TBTDeviceClass aDeviceClass); |
608 IMPORT_C void SetLinkKey(const TBTLinkKey& aLinkKey); |
589 IMPORT_C void SetLinkKey(const TBTLinkKey& aLinkKey); |
609 IMPORT_C void SetLinkKey(const TBTLinkKey& aLinkKey, TBTLinkKeyType aLinkKeyType); |
590 IMPORT_C void SetLinkKey(const TBTLinkKey& aLinkKey, TBTLinkKeyType aLinkKeyType); |
610 IMPORT_C void SetPageScanRepMode(TUint8 aPageScanRepMode); |
591 IMPORT_C void SetPageScanRepMode(TUint8 aPageScanRepMode); |
611 IMPORT_C void SetPageScanPeriodMode(TUint8 aPageScanPeriodMode); |
592 IMPORT_C void SetPageScanPeriodMode(TUint8 aPageScanPeriodMode); |
612 IMPORT_C void SetPageScanMode(TUint8 aPageScanMode); |
593 IMPORT_C void SetPageScanMode(TUint8 aPageScanMode); |
613 IMPORT_C void SetClockOffset(TUint16 aClockOffSet); |
594 IMPORT_C void SetClockOffset(TUint16 aClockOffSet); |
614 IMPORT_C void SetGlobalSecurity(const TBTDeviceSecurity& aSetting); |
595 IMPORT_C void SetGlobalSecurity(const TBTDeviceSecurity& aSetting); |
615 IMPORT_C void SetUsed(const TTime& aDateTime); |
596 IMPORT_C void SetUsed(const TTime& aDateTime); |
616 IMPORT_C void SetSeen(const TTime& aDateTime); |
597 IMPORT_C void SetSeen(const TTime& aDateTime); |
617 IMPORT_C TBool IsValidAddress() const; |
598 IMPORT_C TBool IsValidAddress() const; |
618 IMPORT_C TBool IsValidDeviceClass() const; |
599 IMPORT_C TBool IsValidDeviceClass() const; |
619 IMPORT_C TBool IsValidLinkKey() const; |
600 IMPORT_C TBool IsValidLinkKey() const; |
632 IMPORT_C TUint CompareTo(const TBTNamelessDevice& aDevice) const; |
613 IMPORT_C TUint CompareTo(const TBTNamelessDevice& aDevice) const; |
633 IMPORT_C TBool IsPaired() const; |
614 IMPORT_C TBool IsPaired() const; |
634 IMPORT_C void SetPaired(TBool aPaired); |
615 IMPORT_C void SetPaired(TBool aPaired); |
635 IMPORT_C void SetPaired(TBTLinkKeyType aLinkKeyType); |
616 IMPORT_C void SetPaired(TBTLinkKeyType aLinkKeyType); |
636 IMPORT_C TBool IsValidPaired() const; |
617 IMPORT_C TBool IsValidPaired() const; |
637 IMPORT_C const TBTPinCode& PassKey() const; |
618 IMPORT_C const TBTPinCode& PassKey() const; |
638 IMPORT_C void SetPassKey(const TBTPinCode& aPassKey); |
619 IMPORT_C void SetPassKey(const TBTPinCode& aPassKey); |
639 IMPORT_C TBool IsValidPassKey() const; |
620 IMPORT_C TBool IsValidPassKey() const; |
640 IMPORT_C TUint PassKeyLength() const; |
621 IMPORT_C TUint PassKeyLength() const; |
641 IMPORT_C TBool IsValidUiCookie() const; |
622 IMPORT_C TBool IsValidUiCookie() const; |
642 IMPORT_C void SetUiCookie(TUint32 aUiCookie); |
623 IMPORT_C void SetUiCookie(TUint32 aUiCookie); |
643 IMPORT_C TUint32 UiCookie() const; |
624 IMPORT_C TUint32 UiCookie() const; |
644 |
625 |
645 /** Bitfield of TBTNamelessDevice attributes |
626 /** Bitfield of TBTNamelessDevice attributes |
|
627 This enum is to only be used by phone manufacturers, not by application developers. |
646 @publishedPartner |
628 @publishedPartner |
647 @released |
629 @released |
648 */ |
630 */ |
649 enum TBTDeviceSet |
631 enum TBTDeviceSet |
650 { |
632 { |
651 EAddress = 0x000001, /*!< Device address */ |
633 EAddress = 0x000001, /*!< Device address */ |
652 EDeviceClass = 0x000002, /*!< Device class */ |
634 EDeviceClass = 0x000002, /*!< Device class */ |
653 ELinkKey = 0x000004, /*!< Link key */ |
635 ELinkKey = 0x000004, /*!< Link key */ |
654 EGlobalSecurity = 0x000008, /*!< Global security settings */ |
636 EGlobalSecurity = 0x000008, /*!< Global security settings */ |
655 EPageScanRepMode = 0x000010, /*!< Page scan repition mode */ |
637 EPageScanRepMode = 0x000010, /*!< Page scan repition mode */ |
656 EPageScanMode = 0x000020, /*!< Page scan mode */ |
638 EPageScanMode = 0x000020, /*!< Page scan mode */ |
657 EPageScanPeriodMode = 0x000040, /*!< Page scan period */ |
639 EPageScanPeriodMode = 0x000040, /*!< Page scan period */ |
658 EClockOffset = 0x000080, /*!< Clock offset */ |
640 EClockOffset = 0x000080, /*!< Clock offset */ |
659 EUsed = 0x000100, /*!< Last used */ |
641 EUsed = 0x000100, /*!< Last used */ |
660 ESeen = 0x000200, /*!< Last seen */ |
642 ESeen = 0x000200, /*!< Last seen */ |
661 EIsPaired = 0x000400, /*!< Is paired */ |
643 EIsPaired = 0x000400, /*!< Is paired */ |
662 EPassKey = 0x000800, /*!< PassKey */ |
644 EPassKey = 0x000800, /*!< PassKey */ |
663 EUiCookie = 0x001000, /*!< User interface specific cookie */ |
645 EUiCookie = 0x001000, /*!< User interface specific cookie */ |
664 |
646 |
665 EAllNamelessProperties = 0x00ffffff, /*!< All nameless properties set */ |
647 EAllNamelessProperties = 0x00ffffff, /*!< All nameless properties set */ |
666 // Two highest nibbles used by CBTDevice |
648 // Two highest nibbles used by CBTDevice |
667 }; |
649 }; |
674 TBTDeviceSecurity iGlobalSecurity;/*!< The overall security criteria for all services which this device may wish to use */ |
656 TBTDeviceSecurity iGlobalSecurity;/*!< The overall security criteria for all services which this device may wish to use */ |
675 TBTBasebandParameters iBasebandParams;/*!< The baseband parameters */ |
657 TBTBasebandParameters iBasebandParams;/*!< The baseband parameters */ |
676 TTime iUsed; /*!< when last connect from/to */ |
658 TTime iUsed; /*!< when last connect from/to */ |
677 TTime iSeen; /*!< when last seen in inquiry */ |
659 TTime iSeen; /*!< when last seen in inquiry */ |
678 TBool iPaired; /*!< Whether this device is paired */ |
660 TBool iPaired; /*!< Whether this device is paired */ |
679 TBTPinCode iPassKey; /*!< PassKey */ |
661 TBTPinCode iPassKey; /*!< PassKey */ |
680 TBTLinkKeyType iLinkKeyType; /*!< Link Key Type */ |
662 TBTLinkKeyType iLinkKeyType; /*!< Link Key Type */ |
681 TUint32 iUiCookie; /*!< The cookie attached to this device by the UI */ |
663 TUint32 iUiCookie; /*!< The cookie attached to this device by the UI */ |
682 |
664 |
683 // This data padding has been added to help prevent future binary compatibility breaks |
665 // This data padding has been added to help prevent future binary compatibility breaks. |
684 // iPadding1 has been used for iLinkKeyType |
666 // iPadding1 has been used for iLinkKeyType |
685 // iPadding2 has been used for iUiCookie |
667 // iPadding2 has been used for iUiCookie |
686 TUint32 iPadding3; |
668 TUint32 iPadding3; |
687 TUint32 iPadding4; |
669 TUint32 iPadding4; |
688 }; |
670 }; |
689 |
671 |
690 |
672 |
691 /** Encapsulates all information that must be known about a device. |
673 /** Encapsulates all information that must be known about a device. |
698 NONSHARABLE_CLASS(CBTDevice) : public CBase |
680 NONSHARABLE_CLASS(CBTDevice) : public CBase |
699 { |
681 { |
700 friend class TBTNamelessDevice; |
682 friend class TBTNamelessDevice; |
701 public: |
683 public: |
702 |
684 |
703 IMPORT_C static CBTDevice* NewL(const TBTDevAddr& aBDAddr); |
685 IMPORT_C static CBTDevice* NewL(const TBTDevAddr& aBDAddr); |
704 IMPORT_C static CBTDevice* NewLC(const TBTDevAddr& aBDAddr); |
686 IMPORT_C static CBTDevice* NewLC(const TBTDevAddr& aBDAddr); |
705 IMPORT_C static CBTDevice* NewL(const TBTNamelessDevice& aNamelessDevice); |
687 IMPORT_C static CBTDevice* NewL(const TBTNamelessDevice& aNamelessDevice); |
706 IMPORT_C static CBTDevice* NewLC(const TBTNamelessDevice& aNamelessDevice); |
688 IMPORT_C static CBTDevice* NewLC(const TBTNamelessDevice& aNamelessDevice); |
707 IMPORT_C static CBTDevice* NewL(); |
689 IMPORT_C static CBTDevice* NewL(); |
708 IMPORT_C static CBTDevice* NewLC(); |
690 IMPORT_C static CBTDevice* NewLC(); |
709 IMPORT_C ~CBTDevice(); |
691 IMPORT_C ~CBTDevice(); |
710 IMPORT_C CBTDevice* CopyL() const; |
692 IMPORT_C CBTDevice* CopyL() const; |
711 IMPORT_C void UpdateL(const CBTDevice& aDevice); |
693 IMPORT_C void UpdateL(const CBTDevice& aDevice); |
915 EPowerSetting = 0x0008, |
897 EPowerSetting = 0x0008, |
916 EScanEnable = 0x0010, |
898 EScanEnable = 0x0010, |
917 ELimitedDiscoverable = 0x0020, |
899 ELimitedDiscoverable = 0x0020, |
918 EAFHChannelAssessmentMode = 0x0040, |
900 EAFHChannelAssessmentMode = 0x0040, |
919 EAcceptPairedOnlyMode = 0x0080, |
901 EAcceptPairedOnlyMode = 0x0080, |
920 }; ///< Used for indicating if a setting has been set (i.e. not a default/random value) @see iBitMask |
902 }; //< Used for indicating if a setting has been set (i.e. not a default/random value) @see iBitMask |
921 |
903 |
922 private: |
904 private: |
923 enum |
905 enum |
924 { |
906 { |
925 EAFHChannelAssessmentModeValue = 0x0001, |
907 EAFHChannelAssessmentModeValue = 0x0001, |
926 EAcceptPairedOnlyModeValue = 0x0002, |
908 EAcceptPairedOnlyModeValue = 0x0002, |
927 }; ///< Used for settings requiring little space: allows new settings ot be introduced without increasing the size of this class @see iSimpleSettings |
909 }; //< Used for settings requiring little space: allows new settings ot be introduced without increasing the size of this class @see iSimpleSettings |
928 |
910 |
929 |
911 |
930 |
912 |
931 TUint iSetMask; ///< Bit mask indicating the data members that have been set |
913 TUint iSetMask; //< Bit mask indicating the data members that have been set |
932 TBTDevAddr iAddress; |
914 TBTDevAddr iAddress; |
933 TUint32 iCod; |
915 TUint32 iCod; |
934 TBTDeviceName8 iLocalName; |
916 TBTDeviceName8 iLocalName; |
935 TUint8 iPowerSetting; |
917 TUint8 iPowerSetting; |
936 THCIScanEnable iScanEnable; |
918 THCIScanEnable iScanEnable; |
937 TBool iLimitedDiscoverable; |
919 TBool iLimitedDiscoverable; |
938 TUint32 iSimpleSettings; ///< Only first two bits currently used - for AFH Channel Assessment Mode, and Accept Paired Only Mode |
920 TUint32 iSimpleSettings; //< Only first two bits currently used - for AFH Channel Assessment Mode, and Accept Paired Only Mode |
939 }; |
921 }; |
940 |
922 |
941 |
923 |
942 #endif |
924 #endif |