Filtering beacons by mac address in Android Beacon Library - ibeacon

I am using Android Beacon Library, and I would like to know how to filter the detected beacons by the mac addresses given by the method startDiscovery from Android SDK.

The Android Beacon Library allows you to filter on all beacons with a specific mac address. This relatively new feature is available as of version 2.6 of the library. Setting up a Region to match all beacons with a known mac address is as simple as follows:
Region region = new Region("regionForMacAddress", "01:02:03:04:05:06");
beaconManager.startRangingBeaconsInRegion(region);
The above code will provide ranging callbacks for any beacon with any identifier matching the given mac address. If you want to look for multiple mac addresses at the same time, just duplicate the above code for each mac.

Related

Nordic Semi Conductor Advertisement from nrf528040

I am trying to broadcast an advertisement packet from a Nordic board nrf52840.
I have downloaded the latest nordic sdk and am loading the ble beacon example to the device. However, using nrf connect I can not see any advertisement being broadcast. I wish to know where my setup is wrong. The PCA is 10056. At the moment I just want to broadcast the device's name and see it. I am using sdk version 16.0.
Is there a decent setup guide anywhere as I tried to follow : https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-advertising-a-beginners-tutorial
But I never go an advertisement out from my device.

Chrome Bluetooth Low Energy API - Cross-Platform Support

I accessed the Chrome BLE API page (5/7/2016). there seem to be conflicting information messages (see image below). Does this work on Chrome OS only, or OS X and Windows also?
EDIT/UPDATE:
I tried the demo application (demo BLE API) on Windows 10. It was able to see paired devices, but not unpaired devices. I got an error message: Battery device not supported on this platform. I'm not sure if this is because of the test vector I used (LightBlue), or another issue.
System:
Windows 10 64 bit
Surface Pro 3
The chrome.bluetoothLowEnergy API works only for paired devices on Windows as it still uses (at that time) Windows 8 APIs to retrieve paired devices only: https://chromium.googlesource.com/chromium/src/+/08c9d69b0c0d625d2ce38e3d8402f36e1226f0fc/device/bluetooth/bluetooth_low_energy_win.h#117
For info, the Web Bluetooth team plans to support Windows 10 as much as feasible: https://github.com/WebBluetoothCG/web-bluetooth/blob/gh-pages/implementation-status.md#chrome
Reading through your given documentation wherein you referenced the use of navigator.bluetooth, Interact with BLE devices on the Web also states that:
Web Bluetooth API is at the time of writing partially implemented in Chrome OS and Chrome Dev for Android behind an experimental flag.
Hence, you got undefined as a return value.
Functionalities were provided by Bluetooth Low Energy (BLE) through key/value pairs provided by the Generic Attribute Profile (GATT).

How to detect every storage USB device connected to mac os x?

I'm working on a cocoa app that detects any USB storage device (flash disk, Smartphone...) connected to the Mac and then use its files. In all the tutorials I've yet read, I have to specify the vendor id and the product id however, I want my app to detect ANY storage USB device. I'm working on Mac os x.
You probably want to use IOKit to inspect all services matching kIOUSBDeviceClassName, and then call IORegistryEntryCreateCFProperties() on each, and inspect the value of kUSBDeviceClass, going by the Device Class Codes described at https://developer.apple.com/library/mac/documentation/IOKit/Reference/USBSpec_header_reference/#//apple_ref/doc/constant_group/Device_Class_Codes

How can I make an application on pc as a bluetooth low energy device?

I try to make an app on iPhone which can receive date from ble device.
I've read the api from Apple.
But I want to send this data from PC with ble dongle.
There are some samples for receiving data from ble device.
But I need to make the pc simulate ble device.
Is that possible? And if it is, how can I do taht?
If you own a Mac(, considering that you are making an iPhone app), you can create a OS X project that provides GATT and GAP with CoreBluetooth. See the sample code CoreBluetooth: Health Thermometer. Note that the sample code serves as a Central, however, you need to implement a Peripheral with a CBPeripheralManager instance and other delegates.
In your Mac OS X app, you need to provide a characteristic with CBCharacteristicPropertyIndicate or CBCharacteristicPropertyNotify.
In your iPhone app, you need to set this characteristic notifying.

Opening an FTDI device based on bus location ID

I have a few FTDI devices connected to my Mac. They all have the same description, PID, and VID. I want to be able to specify to FT_OpenEx() which one I want to open.
I can use the IO Kit APIs to get the bus location ID of the device I'm interested. The FT_OpenEX() API allows me to pass in a location instead of a description or serial number.
However, the FT APIs that return location IDs return values that look nothing like bus location IDs. One of the devices I have connected has a bus location ID of 0x1a127000, bus when I use the FT APIs to get the locations of all devices, it will say things like 0x1a051 and 0x1a052.
Is there any way to convert from IO Kit bus location ID and the FT location, or otherwise specify which device to use?
I recently had a similar problem: on some locations and devices I got 0 as location id. I wrote a request for assistance to FTDI and this is what I got:
We tested a USB 3.0 host PCI card found it not compatible with our
drivers for the following reason.
Existing host ports on a Windows machine are given a name in the
format: \device\usbfdo-# where # is a number.
The USB 3.0 card is known as a \device\device# where # is a number.
The USB 3.0 host port does not follow the standard naming convention
on a windows machine we do not attempt to open this port to send
device ID to when enumerating and trying to load drivers.
As we expect Microsoft to follow convention when they add support for
3.0, we expect the problem to go away from our point of view. As such we are still of the opinion the problem lies with the 3.0 host and not
our drivers.
Even if it was possible to make changes to support this host
controller it is highly probable that the next host device you try
(different manufacturer) will have another variant requiring a
different modification. This would not be a sustainable model and goes
against the PnP ethos of USB.
We believe this issue has been resolved in Windows 8. We are currently
working on the certification of our new windows 8 driver, I expect
this to be available by the end of February.
This is not very satisfying but at least it describes why it is not working. When I have time I will try to get the location id by using libusbX and then opening it with the FTDI API routines.
Not sure when that will be, though...
Veit
Since I already did this for linux once and have a working solution, I thought I'd try to figure it out for the mac as well.
I am not sure if I did this correctly but here's what I came up with:
Basically, you take the MacOSX location id right shift 16 bits, binary & with 0xff00 and add the device address.
That should be equal to the location ID you get from the ftdi driver.
Example:
In the "System Information" program I can find my USB device and see something like this:
Location ID: 0x14100000 / 21
That seems to be the "location id / device number".
Now plug it into that formula:
0x141000000>>16 = 0x1410
0x1410&0xff00 = 0x1400
0x1400|21 = 0x1415
So in decimal notation the location id is: 5141 which matches what FTDI returned. Note that 21 used above is 0x15 in hex.
I just figured this out 30 minutes ago so if there are problems with this implementation let me know. I need this to work reliably as well. I tried putting a hub between the mac and the device and the formula still applies.
The IOKit calls are:
kr = (*dev)->GetLocationID(dev, &locationid);
kr = (*dev)->GetDeviceAddress(dev, &address);
described at the apple developer reference website.
EDIT
since you have 5 digits in your FTDI location id, I would be interested in what your device device number is. Maybe my method doesn't hold up under your circumstances?

Resources