epoc32/include/bluetooth/eirdatacodec.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     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
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef EIRDATACODEC_H
    17 #define EIRDATACODEC_H
    18 
    19 #include <e32std.h>
    20 #include <es_sock.h>
    21 
    22 /**
    23 @file
    24 @internalTechnology
    25 */
    26 /**
    27 The state of the EIR data, either partial or complete
    28 */
    29 enum TEIRDataCompleteness
    30 	{
    31 	EDataPartial = 0x1,
    32 	EDataComplete = 0x2,
    33 	};
    34 
    35 const TUint16 KNameRecord8BitMaxLength=248;
    36 
    37 /**
    38 Extended Inquiry Response Data Types
    39 */
    40 enum TExtendedInquiryResponseDataType
    41 	{
    42 // Invalid Data Type
    43 	EEirInvalid 					= 0x00,
    44 // Standard Data Types
    45 	EEirFlags 						= 0x01,
    46 	EEirUUID16Partial 				= 0x02,
    47 	EEirUUID16Complete 				= 0x03,
    48 	EEirUUID32Partial 				= 0x04,
    49 	EEirUUID32Complete 				= 0x05,
    50 	EEirUUID128Partial 				= 0x06,
    51 	EEirUUID128Complete 			= 0x07,
    52 	EEirLocalNamePartial 			= 0x08,
    53 	EEirLocalNameComplete 			= 0x09,
    54 	EEirTxPowerLevel 				= 0x0A,
    55 // OOB Tags: Not used in EIR itself
    56 	EEirOobClassOfDevice			= 0x0D,
    57 	EEirOobSimplePairingHash		= 0x0E,
    58 	EEirOobSimplePairingRandomizerR	= 0x0F,
    59 // Vendor specific
    60 	EEirVendorSpecific 				= 0xFF,
    61 	};
    62 
    63 
    64 class TNameRecord;
    65 /**
    66 @internalTechnology
    67 Extended Inquiry Response Parser Class
    68 This class takes a reference from inquiry result, which could hold both local name and Extended Inquiry Response. It provides API to parse and return the local name and data for any Extended Inquiry Response tag.
    69 */
    70 NONSHARABLE_CLASS(TExtendedInquiryResponseDataCodec)
    71 	{
    72 public:
    73 	IMPORT_C TExtendedInquiryResponseDataCodec();
    74 	IMPORT_C explicit TExtendedInquiryResponseDataCodec(const TNameRecord& aNameRecord);
    75 	IMPORT_C explicit TExtendedInquiryResponseDataCodec(TNameRecord& aNameRecord);
    76 	IMPORT_C explicit TExtendedInquiryResponseDataCodec(const TDesC8& aDes);
    77 	IMPORT_C explicit TExtendedInquiryResponseDataCodec(TDes8& aDes);
    78 	IMPORT_C TInt GetData(TExtendedInquiryResponseDataType aDataType, TPtrC8& aDes) const;
    79 	IMPORT_C TExtendedInquiryResponseDataType GetNextData(TPtrC8& aDes);
    80 	IMPORT_C TBool IsDataTypePresent(TExtendedInquiryResponseDataType aDataType) const;
    81 	IMPORT_C TInt GetDeviceName(TPtrC8& aName) const;
    82 	IMPORT_C TInt SetDeviceName(const TPtrC8& aName, TBool iIsComplete);
    83 	IMPORT_C void Set(const TNameRecord& aNameRecord);
    84 	IMPORT_C void Set(TNameRecord& aNameRecord);
    85 	IMPORT_C void Set(const TDesC8& aDes);
    86 	IMPORT_C void Set(TDes8& aDes);
    87 	IMPORT_C void Copy(TDesC8& aDes);
    88 	IMPORT_C TInt DoSanityCheck(TDes8& aDes);
    89 
    90 private:
    91 	TUint16 ComputeSignificantLength(const TDesC8& aDes);
    92 	TInt NextDataType(TInt aOffs) const;
    93 	TBool IsValideDataType(TInt aDataType);
    94 
    95 private:
    96 	TPtr8			iEir;
    97 	TInt			iOffset;
    98 	TNameRecord*	iNameRecord;
    99 	TUint32			iPadding1;
   100 	TUint32			iPadding2;
   101 	};
   102 
   103 enum TEirCodecPanics
   104 	{
   105 	EEirBadDescriptor = 0,
   106 	EEirBadState = 1,
   107 	EEirCodecDataTooLarge = 2,
   108 	};
   109 _LIT(KEirCodecPanicName, "ExtendedInquiryResponseCodec");
   110 
   111 #endif /*EIRDATACODEC_H*/