Windows 10蓝牙广告API

时间:2015-07-22 13:12:35

标签: bluetooth windows-10

是否可以使用AdvertisementPublisher作为信标发送主要和次要ID,是否也可以使用AdvertisementWatcher发送和接收ID?

干杯

1 个答案:

答案 0 :(得分:1)

是的,这样做是为了发送:

var manufacturerData = new BluetoothLEManufacturerData();

manufacturerData.CompanyId = 0x004c;

byte[] dataArray = new byte[] {
    // last 2 bytes of Apple's iBeacon
    0x02, 0x15,
    // Proximity UUID
    0x44, 0x50, 0x3f, 0x1b,
    0xc0, 0x9c, 0x4a, 0xee,
    0x97, 0x2f, 0x75, 0x0e,
    0x9d, 0x34, 0x67, 0x84,
    // Major
    0x00, 0x01,
    // Minor
    0x00, 0x10,
    // TX power
    0xc5
};

// using System.Runtime.InteropServices.WindowsRuntime;
manufacturerData.Data = dataArray.AsBuffer();

BluetoothLEAdvertisementPublisher publisher =
    new BluetoothLEAdvertisementPublisher();

publisher.Advertisement.ManufacturerData.Add(manufacturerData);

publisher.Start();

要接收,请转到this question