I was working with the BLE scanner sample in the EVO Workbench samples. I modified it a bit to do what I wanted, which was reading the advertisement data from a RAD Dot beacon transmitting in AltBeacon mode on iOS. I wanted to make a standalone version of this not using the workbench in Cordova so as not to have any external dependencies. It seemed to be working pretty well, but I noticed that my code to read the Alt Beacon advertisement data wasn't running.
After looking more closely, I noticed that the device data had the "scanRecord" attribute, which would normally only show up on Android. After debugging a little, there was only basic information coming back from the device data, including Name, Address, rssi, etc. Weird thing is, this attribute normally only shows up on Android, not on iOS, which is the platform I was running on when I saw the issue.
So, I'm thinking that I'm missing a plugin or something. The only BLE plugin I installed was "com.evothings.ble" which is listed on the API page. To try to debug a bit, I un-installed the com.evothings.ble plugin and installed the cordova-ble plugin from git. When I tried to generate the Xcode project from the command line, I got some compile errors. What are the plugins required for BLE to work in a standalone Cordova App?
Standalone Cordova BLE scanner
Re: Standalone Cordova BLE scanner
Hi Anders,
The only plugin needed should be com.evothings.ble.
To get the advertisement data in a consistent way on Android an iOS you can use the "Easy BLE" library. (https://github.com/evothings/evothings- ... easyble.js)
There is code in the Eddystone library that uses this data, for example. (https://github.com/evothings/evothings- ... dystone.js)
The scanRecord field should contain info on Android, but in iOS is should not contain anything useful at least. I thought it would be null/undefined, it is not set in the native iOS code in the BLE plugin.
Let me know how it goes.
Mikael
The only plugin needed should be com.evothings.ble.
To get the advertisement data in a consistent way on Android an iOS you can use the "Easy BLE" library. (https://github.com/evothings/evothings- ... easyble.js)
There is code in the Eddystone library that uses this data, for example. (https://github.com/evothings/evothings- ... dystone.js)
The scanRecord field should contain info on Android, but in iOS is should not contain anything useful at least. I thought it would be null/undefined, it is not set in the native iOS code in the BLE plugin.
Let me know how it goes.
Mikael
Re: Standalone Cordova BLE scanner
"cordova-ble" and "com.evothings.ble" should be the same plugin. It does not depend on any other plugins. Recommended Cordova version is currently 5.4.0.
"advertisementData" should be available natively on iOS, if you're using a sufficiently recent version of the plugin (version 1.0.0 will do). It is available on Android if you use the wrapper library "easyble". "scanRecord" is perhaps less useful in comparison.
"advertisementData" should be available natively on iOS, if you're using a sufficiently recent version of the plugin (version 1.0.0 will do). It is available on Android if you use the wrapper library "easyble". "scanRecord" is perhaps less useful in comparison.
Re: Standalone Cordova BLE scanner
Thanks for the quick reply.
When I installed the plugin, I did a "cordova plugin add com.evothings.ble".
I started digging around in the source code for Obj-C and it doesn't seem to be doing anything with the advertisement data. I added some debug code and was able to verify the info I was expecting was coming through as follows:
2015-11-09 10:14:14.840 DemoApp3[637:227679] key = kCBAdvDataIsConnectable
2015-11-09 10:14:14.840 DemoApp3[637:227679] 0
2015-11-09 10:14:14.840 DemoApp3[637:227679] key = kCBAdvDataManufacturerData
2015-11-09 10:14:14.841 DemoApp3[637:227679] <1801beac 11111111 22223333 44445555 55555555 00010014 c564>
But I'm not seeing this data in the javascript call back.
Is there a different package name, etc on the cordova plugin add that I should be using?
When I installed the plugin, I did a "cordova plugin add com.evothings.ble".
I started digging around in the source code for Obj-C and it doesn't seem to be doing anything with the advertisement data. I added some debug code and was able to verify the info I was expecting was coming through as follows:
2015-11-09 10:14:14.840 DemoApp3[637:227679] key = kCBAdvDataIsConnectable
2015-11-09 10:14:14.840 DemoApp3[637:227679] 0
2015-11-09 10:14:14.840 DemoApp3[637:227679] key = kCBAdvDataManufacturerData
2015-11-09 10:14:14.841 DemoApp3[637:227679] <1801beac 11111111 22223333 44445555 55555555 00010014 c564>
But I'm not seeing this data in the javascript call back.
Is there a different package name, etc on the cordova plugin add that I should be using?
Re: Standalone Cordova BLE scanner
The latest version of the plugin is here. You may run "cordova plugin add https://github.com/evothings/cordova-ble".
The Objective-C code which sends advertiesementData is here.
The Objective-C code which sends advertiesementData is here.
Re: Standalone Cordova BLE scanner
OK, that did it. I was having some trouble with it before, but I had been installing/un-installing plugins to see what's going on. I started a fresh project and installed from git and now it's working just like it was in the viewer.
Thanks!
Thanks!
Return to “Questions and answers”
Who is online
Users browsing this forum: No registered users and 21 guests