Windows Universal App Support


#1

Hello, I just saw that on this page:
https://community.estimote.com/hc/en-us/articles/201027523-Which-devices-are-compatible-with-Estimote-Beacons-
it says that Windows Phone 8.1 is supported but not no tooling.

I’m just wondering if the new Windows Universal App platform with Windows.Devices.Bluetooth.Advertisement namespace if an Estimote beacon can work with one of the samples such as:

Is tooling needed or is this something that can be used with the built in tools Microsoft provides?

Thanks

EDIT: The new link to “which devices are compatible” is https://community.estimote.com/hc/en-us/articles/200848266-Estimote-Beacons-Stickers-requirements-and-compatible-devices@heypiotr


Windows10 and C#
#2

AFAIK, Windows Phone 8.1 support Bluetooth LE, but doesn’t actually expose any APIs which developers could use to discover BLE devices.

Windows 10 does introduce such an API (the “Windows.Devices.Bluetooth.Advertisement” you mentioned), so you can write an app which will detect beacons yourself, yup (:


#3

Thanks, yeah I looked up the Estimote Company ID and tried to use the samples provided, and it’s not working, but I’m not sure if anyone else has been able to get this working. In this sample:

I just changed in the ForeGroundWatcher example the code to be:

//// First, let create a manufacturer data section we wanted to match for. These are the same as the one 
        //// created in Scenario 2 and 4.
        var manufacturerData = new BluetoothLEManufacturerData();

        // Then, set the company ID for the manufacturer data. Here we picked an unused value: 0xFFFE
        manufacturerData.CompanyId = 0x015D;
        
        // Finally set the data payload within the manufacturer-specific section
        // Here, use a 16-bit UUID: 0x1234 -> {0x34, 0x12} (little-endian)
        var writer = new DataWriter();
        writer.WriteUInt16(0x1234);

        // Make sure that the buffer length can fit within an advertisement payload. Otherwise you will get an exception.
        manufacturerData.Data = writer.DetachBuffer();

        // Add the manufacturer data to the advertisement filter on the watcher:
        watcher.AdvertisementFilter.Advertisement.ManufacturerData.Add(manufacturerData);



        // Part 1B: Configuring the signal strength filter for proximity scenarios

        // Configure the signal strength filter to only propagate events when in-range
        // Please adjust these values if you cannot receive any advertisement 
        // Set the in-range threshold to -70dBm. This means advertisements with RSSI >= -70dBm 
        // will start to be considered "in-range".
        watcher.SignalStrengthFilter.InRangeThresholdInDBm = -70;

        // Set the out-of-range threshold to -75dBm (give some buffer). Used in conjunction with OutOfRangeTimeout
        // to determine when an advertisement is no longer considered "in-range"
        watcher.SignalStrengthFilter.OutOfRangeThresholdInDBm = -75;

        // Set the out-of-range timeout to be 2 seconds. Used in conjunction with OutOfRangeThresholdInDBm
        // to determine when an advertisement is no longer considered "in-range"
        watcher.SignalStrengthFilter.OutOfRangeTimeout = TimeSpan.FromMilliseconds(2000);

        // By default, the sampling interval is set to zero, which means there is no sampling and all
        // the advertisement received is returned in the Received event

        // End of watcher configuration. There is no need to comment out any code beyond this point.

This doesn’t appear to be working and never receives any messages from the beacons.

I know this isn’t supported, but does anyone see anything that I’m not?

Thanks.


#4

If you want to detect iBeacon devices, then you’ll need to use Apple’s Manufacturer ID, not Estimote’s.


#5

Thanks, yeah I actually want to detect Estimote’s beacons. So I changed the company ID property to Estimote, but it doesn’t ever pick up any beacons. The beacons are functioning and pick up on iOS, and I can get it to work with other beacons on Windows, just not the Estimote beacons on Windows.

Anyway, if anyone knows anything about how to get this working it would be greatly appreciated.


#6

I also changed the company ID to 0x004C too which is Apple’s with no luck. If I want to detect an Estimote beacon do I use Apple’s company ID?

Thanks


#7

I ended up getting this working, the only issue was the company ID was wrong. The below is the updated code:

// Then, set the company ID for the manufacturer data. Here we picked an unused value: 0xFFFE
manufacturerData.CompanyId = 349; //Estimote 349 (Use for stamps) 
manufacturerData.CompanyId = 76;  //Apple 76 (Use for the old Estimote iBeacon compatible beacons)

// Finally set the data payload within the manufacturer-specific section
// Here, use a 16-bit UUID: 0x1234 -> {0x34, 0x12} (little-endian)
//var writer = new DataWriter();
//writer.WriteUInt16(0x1234);

// Make sure that the buffer length can fit within an advertisement payload. Otherwise you will get an exception.
//manufacturerData.Data = writer.DetachBuffer();

// Add the manufacturer data to the advertisement filter on the watcher:
//watcher.AdvertisementFilter.Advertisement.ManufacturerData.Add(manufacturerData);

Otherwise the samples provided by Microsoft for the UAP apps on GitHub work perfect with the Estimote beacons.


#8

Cool, thanks so much for sharing!


#9

Hi,

I tried with company id 76 and 349, and I commented the lines you suggested, but the UAP app sample on github didn’t work(The received event is not firing). Anything else you did to make the example work ?

I’m using the 3 beacon dev kit as is. Is any configuration needed ?

Thanks,


#10

I think 76 is the correct one. Just make sure in your Package.Appmanifest file you view it in XML mode and then enable bluetooth. It should look like this at the end of the file:

indent preformatted text by 4 spaces
<Capabilities>
  <Capability Name="InternetClient" />
  <DeviceCapability Name="bluetooth" />
</Capabilities>

If that doesn’t work, let me know, I think I found 2 ways to do this - the above source code is probably more efficient, but if you can’t find any beacons I have a second way that ignores the manufacturer ID and just listens for anything.


#11

Thanks a lot. The received event is firing now. I guess the event argument should have the UUID and the strength of the triggering beacon. The company id 76 is the correct one.

Thanks again.


#12

Great, glad it’s working, that tripped me up for a while too, thanks.


#13

Hi again,

The advertisement receive event is triggering now and I’m able to get the beacon data.Also, I read that by default estimote beacons fire advertisements every 950 ms. However, the advertisement receive event in the GitHub example doesn’t get triggered every 950 ms. It get’s triggered couple of times, and then it stops. What should I do to catch all the advertisements with the regular intervals of 950 ms ?


#14

You shouldn’t expect the advertisements coming in in regular intervals. Sometimes packets get lost on the way, sometimes the Bluetooth stack of the device itself takes longer to process the packets, etc.


#15

@hratch

One think I noticed by playing with Estimotes from Win 10 Phone, is that every now and then it receives advertisement package with RRSI reading of -127 and get really confused by it. Not sure if it’s Estimote’s fault or just bad read on Windows side.When it gets this reading, it freezes for some time; sometimes half a second, sometimes half a minute.

What I do to fix it is just restart watcher, but it’s hacky and not always helping.


#16

RSSI is not something that’s included in the advertising packet, it’s measured by the phone itself. -127 most commonly means that the RSSI couldn’t have been established—either the signal was too weak, or something went wrong in the Bluetooth stack itself.


Win10 and IOT CORE
#17

Oh yeah, you’re right :slight_smile: I badly express my thoughts in words. Thanks for clearing that up.


#18

So that code only comments out the filter, and in turn will detect all Bluetooth beacons in range. You can try this by running a second Win10 device on foreground publisher (using the same sample) within proximity of your Estimotes and receive signals from all of them.

In order to filter for your beacons, use the following code:

        var manufacturerData = new BluetoothLEManufacturerData();
        // Then, set the company ID for the manufacturer data. 
        manufacturerData.CompanyId = 0x004C; //Hexidecimal for 76. Use 0x015D for 349 for the stamps
        // Finally set the data payload within the manufacturer-specific section
        // Here, use a 16-bit UUID: 0x1234 -> {0x34, 0x12} (little-endian)
        var writer = new DataWriter();
        writer.WriteUInt16(0x0215); //02 I believe is the data type, 15 specifies the remaining data length of 21 bytes, this is fixed.
        writer.WriteUInt64(0xB9407F30F5F8466E); //First half of your beacons' UUID, this is the Estimote out of the box UUID
        writer.WriteUInt64(0xAFF925556B57FE6D); //Second half of your beacons' UUID, this is the Estimote out of the box UUID
        // Make sure that the buffer length can fit within an advertisement payload. Otherwise you will get an exception.
        manufacturerData.Data = writer.DetachBuffer(); 
        // Add the manufacturer data to the advertisement filter on the watcher:
        watcher.AdvertisementFilter.Advertisement.ManufacturerData.Add(manufacturerData); //This loads the bytes into the filter. CompanyId + 2 bytes + UUID 16 bytes

I’ve added comments that try to explain the mechanics of what’s going on, but if anyone has any further questions, don’t hesitate to ask.

This works for Windows10 Phones as well.


#19

Hi

I have a request, would you mind sharing your code. I am trying to read estimote from my Winodws IoT device Raspberry Pi. I have very new to windows development especially UWP Apps.

You help will be greatly appreciated.

Dharmesh