sdpcommon.h

来自「Windows CE操作系统中适用的蓝牙驱动程序」· C头文件 代码 · 共 56 行

H
56
字号
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
// SdpCommon.h: Commonly used functions...


ISdpRecord *CreateSDPRecordFromStream(UCHAR *szResponse, DWORD cbResponse);

STDMETHODIMP
ServiceAndAttributeSearchParse(
    UCHAR *szResponse,             // in - response returned from SDP ServiceAttribute query
    DWORD cbResponse,            // in - length of response
    ISdpRecord ***pppSdpRecords, // out - array of pSdpRecords
    ULONG *pNumRecords           // out - number of elements in pSdpRecords
    );


// Function type for when printing to PrintRecordInfo
typedef void (*PFN_SDPPRINT)(PVOID pvContext, BOOL fError, WCHAR *szFormat,...);

void PrintRecordInfo(ISdpRecord *pRecord, int iRecordIndex, PFN_SDPPRINT pfnPrint, PVOID pvContext);

const WCHAR *GetAttribFromID(USHORT usAttribId);


void SdpPrintAttribUUIDs(UCHAR *pStream, ULONG size, PFN_SDPPRINT pfnPrint, PVOID pvContext);
const WCHAR *GetErrorFromId(USHORT usErrCode);
const WCHAR *GetPduNameFromId(UCHAR id);



// When calling ISdpRecord::GetAttribute(), if the returned type is to be an URL 
// or STRING the function allocates the string.  This simple wrapper guarantees
// that the string is automatically freed.  Also use this for GetNodeStringData()

class CNodeDataFreeString : public NodeData {
public:
	CNodeDataFreeString() {
		type = SDP_TYPE_NIL;
	}

	~CNodeDataFreeString() {
		if (type == SDP_TYPE_STRING)
			CoTaskMemFree(u.str.val);
		else if (type == SDP_TYPE_URL)
			CoTaskMemFree(u.url.val);
	}
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?