Help with bluetooth ionic application

3

I'm just starting with Ionic . I am trying to make an application to connect my cell phone with my notebook by bluetooth through plugin cordova-plugin-networking-bluetooth . Using the official plugin website as help: link .

I was able to list the devices that are there, and allow the user to select one, but even if I have the data of the device I want to connect to, I can not do it, I get the following error: read failed, socket might closed or timeout, read ret: -1 .

This is the code of the connect function:

function conectar(seleccionado){

      networking.bluetooth.connect(seleccionado.address, '7c36e530-81cd-11e6-bdf4-0800200c9a66', function (socketId) {
      // Profile implementation here.
    }, function (errorMessage) {

      var alertPopup = $ionicPopup.alert({
        title: 'Error',
        template: errorMessage
      });
    });
<ion-list>
  <ion-item ng-repeat="device in vm.dispositivos" ng-click="vm.conectar({{device}})" href="#">
    {{device.name}}
  </ion-item>
</ion-list>

I use the ionicPopup because I could not make the console run. What I do not know is if I'm doing the connection procedure correctly or if it's a problem that I do not have an app on the notebook to receive the connection. I am looking forward to your response. Thank you very much

    
asked by Martin 25.09.2016 в 06:42
source

1 answer

1

I could do it following a tutorial of a java bluetooth server. My problem was that both had to have the same uuid.

    
answered by 27.09.2016 / 23:55
source