📄 btserviceseng.h
字号:
// BtServicesEng.h
//
// Copyright (c) 2003 Symbian Ltd. All rights reserved.
//
#ifndef BTSERVICESENG_H_
#define BTSERVICESENG_H_
#include <btsdp.h>
#include <es_sock.h>
#include "btserviceslistview.h"
const enum TBtPanicCode
{
EBtEngineNotCreated = 1,
EBtEngineAlreadyExists = 2,
EBtIndentationZeroInStartList = 3,
EBtIndentationZeroInLineFinished = 4
};
class CBtAttributeBuilder;
/**
This provides the main application functionality, specifically
setting up the SDP agent and implementing the notifier interface
to build the results into an array, displayed by the main View
(CBtServicesListView) in the case of services, or by the attribute
dialog in the case of attributes for a selected service.
*/
class CBtServicesEng : public CBase, public MSdpAgentNotifier
{
public:
static CBtServicesEng* NewL();
~CBtServicesEng();
void SetView(CBtServicesListView& aView);
CDesCArrayFlat* GetTextArray() const;
// defined in MSdpAgentNotifier
void AttributeRequestComplete(TSdpServRecordHandle aHandle, TInt aError);
void AttributeRequestResult(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue* aAttrValue);
void NextRecordRequestComplete(TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount);
TInt BluetoothReady();
void NewDeviceSelectedL(const TBTDevAddr& aAddress,const TBTDeviceName& aDeviceName,const TBTDeviceClass& aClass);
void GetDeviceServicesL();
void GetAttributesL(TInt aIndex);
TBool GettingAllAttributes() const;
void AddAttributeLineL(const TDesC& aDes);
void SetUUIDsL();
void DisplayDeviceInfoL();
void DisplayLocalInfoL();
void CancelSdpAgent();
void DeleteSdpAgent();
void AppendUUIDText(TDes& aBuf, TUUID aUUID) const;
static void Panic(TBtPanicCode aPanicCode);
private:
CBtServicesEng();
void ConstructL();
void GetServiceNamesL();
void SdpCompletedWithError(const TInt aError);
void AppendErrorMessage(const TInt aError, TDes& aBuf) const;
void DoAttributeRequestCompleteL();
void DoAttributeRequestResultL(CSdpAttrValue* aAttrValue);
void DoNextRecordRequestCompleteL(TSdpServRecordHandle aHandle, TInt aError);
private:
// Values of iCurrentAttributeRequest
enum TAttributeRequests
{
ENoOutstandingRequests,
EGettingNamesOnly,
EGettingAllAttributes
};
CSdpAgent* iSdpAgent;
CSdpSearchPattern* iSearchPattern;
CDesCArrayFlat* iTextArray;
CDesCArrayFlat* iAttributeArray;
RArray<TSdpServRecordHandle> iHandleArray;
CSdpAttrIdMatchList* iAttributeMatchList;
CBtAttributeBuilder* iAttributeBuilder;
CBtServicesListView* iView; // iView is not "owned" by this
CEikonEnv* iEikon;
TInt iHandleCounter;
TAttributeRequests iCurrentAttributeRequest;
TBTDeviceName iDeviceName;
TBTDevAddr iDeviceAddress;
TBTDeviceClass iDeviceClass;
TPtrC iServiceName;
TUint32 iUUIDFilter;
RArray<TUUID> iUUIDs;
RPointerArray<HBufC> iUUIDsAsText;
RArray<TInt> iErrorCodes;
RPointerArray<HBufC> iErrorMessages;
RSocketServ iSocketServ;
};
/**
Receives and parses the results from an SDP Attribute Request, and builds
them into a table (array for listbox) for displaying in
the attributes dialog.
*/
class CBtAttributeBuilder : public CBase, public MSdpElementBuilder
{
public:
static CBtAttributeBuilder* NewL(CBtServicesEng& aEngine);
void SetHandle(TSdpServRecordHandle aHandle);
void Reset();
~CBtAttributeBuilder();
private:
// defined in MSdpElementBuilder
MSdpElementBuilder* BuildUnknownL(TUint8 aType, TUint8 aSizeDesc, const TDesC8& aData);
MSdpElementBuilder* BuildNilL();
MSdpElementBuilder* BuildUintL(const TDesC8& aUint);
MSdpElementBuilder* BuildIntL(const TDesC8& aInt);
MSdpElementBuilder* BuildUUIDL(const TUUID& aUUID);
MSdpElementBuilder* BuildBooleanL(TBool aBool);
MSdpElementBuilder* BuildStringL(const TDesC8& aString);
MSdpElementBuilder* BuildDESL(); // Must not return NULL
MSdpElementBuilder* BuildDEAL(); // ditto
MSdpElementBuilder* StartListL(); // ditto
MSdpElementBuilder* EndListL();
MSdpElementBuilder* BuildURLL(const TDesC8& aURL);
private:
CBtAttributeBuilder(CBtServicesEng& aEngine);
void AppendAttrMnemonic(TDes& aBuf, TUint aAttrID) const;
void LineFinishedL();
void ConstructL();
private:
enum TCurrentStatus {
EExpectingAttrID,
EExpectingAttrValue
};
RArray<TUint> iAttrIDs;
RPointerArray<HBufC> iAttrMnemonics;
CBtServicesEng& iEngine;
TBuf<KMaxDescriptorLength> iCurrentLine;
TInt iIndentation;
TCurrentStatus iStatus;
TSdpServRecordHandle iHandle;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -