I know the $cordovaBLE plugin isn’t fully documented, but I am experimenting with it and have been able to return an array of devices in the view. The devices show up in the xCode console with full properties when building/running the app so I know the scan is working, and I can ng-repeat the correct number of devices in the view, but I can’t pass the device properties. Can anyone offer any help? I am new to Ionic and AngularJS, so maybe I’ve missed something easy, but I’ve tried a ton of combinations with out luck.
The names, id, and rssi weren’t showing up but I fixed it. I realized this morning that with the code above I was just ng-repeating through the first returned device. I just had to push all of the scan results to a second array.
This worked…
devices.push(result);
$scope.devices = devices;
Next step… connecting to a device.
I’m maintaining a repo of this project here if anyone is interested. I have a simple app based on the tab starter that hooks into ngCordova plugins for Device Motion, Device Orientation, Geolocation, and soon to be BLE.
The “notifyMe” function is hooked to a button click. When I click, I get one value returned to the view, but the value doesn’t update asynchronously even though the data from the device is incrementing. If I click the button again, the value updates in the view but stops.
Any thoughts on why I can’t get the notify function in $cordovaBLE updating asynchronously?
hi, i got the doubt that: why use
scan.then(
null,
function(err) {why error function is the second parameter while success function is third
// error
},
function(result) {
$scope.devices = result;
});
i dig into ng-cordova.js and plugin implementation and didnt find why scan(*).then(null,error_func,success_func)? anything i miss?
your scan code is working,yes, but why? i cannot find any documentation saying that!!