angularjs - Connect/read BluetoothLE devices with password in ngCordova/Ionic -


i'm using https://github.com/randdusing/cordova-plugin-bluetoothle/ firstly scan devices , later connect/read/write data in them.

the devices have connect password protected there no input or parameter include it.

i made connection devices (without password) , seems ok attempt read data different devices imposible. read data encoded (base64) , after converting string result " " hint this?

connection:

$rootscope.connect = function(addressparam) { var params = {address: addressparam};  $cordovabluetoothle.connect(params).then(null, function (obj) {   console.log("conexión error " + obj.status + " con dirección: " + obj.address);   $rootscope.close(addressparam); }, function (obj) {   console.log("conexión success " + obj.status + " con dirección: " + obj.address);   $rootscope.iscon(addressparam);   if(obj.status==="disconnected" || obj.status==="undefined" ){     $rootscope.connect(addressparam);   } }); } 

read:

$scope.readchar = function(){   var params = {address: $scope.device, service: $scope.service.uuid, characteristic: $scope.characteristic, timeout: 5000};   $cordovabluetoothle.read(params).then(function(obj) {     $scope.leer = true;     console.log("comenzando lectura ");     $scope.valueobj = obj.value;     $scope.convertvalue();   }, function(obj) {     console.log("error al leer" + obj);   }); } 

conversion after reading

$scope.convertvalue = function(){   $scope.bytesobj = $cordovabluetoothle.encodedstringtobytes($scope.valueobj);   $scope.strobj = $cordovabluetoothle.bytestostring($scope.bytesobj); } }); 

results: no error:

$scope.bytesobj --> [0, 0]

$scope.strobj --> "

$scope.valueobj --> "aaa="


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

android - CoordinatorLayout, FAB and container layout conflict -