⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bthnscreate.hxx

📁 SDP Search and Record generator OVERVIEW: Recognizing the difficulty in creating an SDP service
💻 HXX
字号:
//
// 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.
//
/**
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.


Abstract:
	Windows CE Bluetooth application sample
	Demonstrates creating an SDP record binary value dynamically.
	
**/


#ifndef _BTHNS_CREATE_H_
#define _BTHNS_CREATE_H_

extern IClassFactory *pCFContainer;

#define SET_GUID_VALUES(guid,data1,data2,data3,d4_0,d4_1,d4_2,d4_3,d4_4,d4_5,d4_6,d4_7) \
        guid.Data1 = data1;   guid.Data2 = data2;   guid.Data3 = data3; \
        guid.Data4[0] = d4_0; guid.Data4[1] = d4_1; guid.Data4[2] = d4_2; \
        guid.Data4[3] = d4_3; guid.Data4[4] = d4_4; guid.Data4[5] = d4_5; \
        guid.Data4[6] = d4_6; guid.Data4[7] = d4_7;

struct NDW : public NodeData {
    inline void Z() { ZeroMemory(&u, sizeof(u)); }

    
    void Boolean(UCHAR val)
    {
        Z();
        type= SDP_TYPE_BOOLEAN;
        specificType = SDP_ST_NONE;
        u.booleanVal = val;
    }

    void Nil(void)
    {
        Z();
        type = SDP_TYPE_NIL;
        specificType = SDP_ST_NONE;
    }
    
    NDW() 
    { 
        Nil();
    }
    
    void Uint8(UCHAR uint8)
    {
        Z();
        type= SDP_TYPE_UINT;
        specificType = SDP_ST_UINT8;
        u.uint8 = uint8;
    }

    void Uint16(USHORT uint16)
    {
        Z();
        type= SDP_TYPE_UINT;
        specificType = SDP_ST_UINT16;
        u.uint16 = uint16;
    }
    
    void Uint32(ULONG uint32)
    {
        Z();
        type= SDP_TYPE_UINT;
        specificType = SDP_ST_UINT32;
        u.uint32 = uint32;
    }
    
    void Uint64(ULONGLONG uint64)
    {
        Z();
        type= SDP_TYPE_UINT;
        specificType = SDP_ST_UINT64;
        u.uint64 = uint64;
    }
    
    void Uint128(PSDP_ULARGE_INTEGER_16 uint128)
    {
        Z();
        type= SDP_TYPE_UINT;
        specificType = SDP_ST_UINT128;
        u.uint128 = *uint128;
    }

    void Int8(CHAR int8)
    {
        Z();
        type=SDP_TYPE_INT;
        specificType = SDP_ST_INT8;
        u.int8 = int8;
    }
    void Int16(SHORT int16)
    {
        Z();
        type= SDP_TYPE_INT;
        specificType = SDP_ST_INT16;
        u.int16 = int16;
    }
    
    void Int32(LONG int32)
    {
        Z();
        type= SDP_TYPE_INT;
        specificType = SDP_ST_INT32;
        u.int32 = int32;
    }
    
    void Int64(LONGLONG int64)
    {
        Z();
        type= SDP_TYPE_INT;
        specificType = SDP_ST_INT64;
        u.int64 = int64;
    }
    
    void Int128(PSDP_LARGE_INTEGER_16 int128)
    {
        Z();
        type= SDP_TYPE_INT;
        specificType = SDP_ST_INT128;
        u.int128 = *int128;
    }

    void String(CHAR *str, ULONG length, UCHAR IsString = TRUE)
    {
        Z();
        type=SDP_TYPE_STRING;
        u.str.val = str;
        u.str.length = length;
        specificType = SDP_ST_NONE;
    }

    void Url(CHAR *str, ULONG length)
    {
        Z();
        type=SDP_TYPE_URL;
        u.url.val = str;
        u.url.length = length;
        specificType = SDP_ST_NONE;
    }

    void SdpNodeContainer(ISdpNodeContainer *c)
    {
        Z();
        type=SDP_TYPE_CONTAINER;
        specificType=SDP_ST_NONE;
        u.container = c;
    }


    void Uuid16(USHORT uuid16)
    {
        Z();
        type=SDP_TYPE_UUID;
        specificType=SDP_ST_UUID16;
        u.uuid16 = uuid16;
    }

    void Uuid32(ULONG uuid32)
    {
        Z();
        type=SDP_TYPE_UUID;
        specificType=SDP_ST_UUID32;
        u.uuid32 = uuid32;
    }

    void Uuid128(GUID& g)
    {
        Z();
        type=SDP_TYPE_UUID;
        specificType=SDP_ST_UUID128;
        u.uuid128 = g;
    }
};
#endif // _BTHNS_CREATE_H_

⌨️ 快捷键说明

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