You are reading a single comment by @Ricardo and its replies. Click here to read the full conversation.
  • I made an apache-cordova app, and I got this object in connect method:

    {
       "name":"GS7X 354762118079554",
       "id":"80:EA:CA:00:3E:4E",
       "advertising":{
          
       },
       "rssi":-61,
       "services":[
          "1800",
          "1801",
          "0783b03e-8535-b5a0-7140-a304d2495cb7"
       ],
       "characteristics":[
          {
             "service":"1800",
             "characteristic":"2a00",
             "properties":[
                "Read"
             ]
          },
          {
             "service":"1800",
             "characteristic":"2a01",
             "properties":[
                "Read"
             ]
          },
          {
             "service":"1801",
             "characteristic":"2a05",
             "properties":[
                "Read",
                "Indicate"
             ],
             "descriptors":[
                {
                   "uuid":"2902"
                }
             ]
          },
          {
             "service":"0783b03e-8535-b5a0-7140-a304d­2495cb7",
             "characteristic":"0783b03e-8535-b5a0-714­0-a304d2495cb8",
             "properties":[
                "Notify"
             ],
             "descriptors":[
                {
                   "uuid":"2902"
                },
                {
                   "uuid":"2901"
                }
             ]
          },
          {
             "service":"0783b03e-8535-b5a0-7140-a304d­2495cb7",
             "characteristic":"0783b03e-8535-b5a0-714­0-a304d2495cba",
             "properties":[
                "WriteWithoutResponse"
             ],
             "descriptors":[
                {
                   "uuid":"2902"
                },
                {
                   "uuid":"2901"
                }
             ]
          },
          {
             "service":"0783b03e-8535-b5a0-7140-a304d­2495cb7",
             "characteristic":"0783b03e-8535-b5a0-714­0-a304d2495cb9",
             "properties":[
                "Read",
                "WriteWithoutResponse",
                "Notify"
             ],
             "descriptors":[
                {
                   "uuid":"2902"
                },
                {
                   "uuid":"2901"
                }
             ]
          }
       ]
    }
    

    Notifications work. And this is the code in apache-cordova:

    ID="80:EA:CA:00:3E:4E";
    document.addEventListener('deviceready',­ onDeviceReady, false);
    
    function onDeviceReady() {
        // Cordova is now initialized. Have fun!
    
        setTimeout(__ =>{
            ble.scan([], 5, device=> console.log(JSON.stringify(device)), failure=> console.log('FAILURE: ',failure));
        },2500);
    
        setTimeout(__ =>{
            ble.connect(ID, device=> console.log(JSON.stringify(device)), failure=> console.log('FAILURE: ',failure));
        },5000)
        document.getElementById('deviceready').c­lassList.add('ready');
    
        setTimeout(__ =>{
            var onData = function(buffer) {
                // Decode the ArrayBuffer into a typed Array based on the data you expect
                var data = new Uint8Array(buffer);
                console.log("Galileo data: " , JSON.stringify(data));
            }
            
            ble.startNotification(ID, "0783b03e-8535-b5a0-7140-a304d2495cb7", "0783b03e-8535-b5a0-7140-a304d2495cb8", onData, failure=> console.log('FAILURE: ',failure));
        },10000);
    }
    

    Do you have an idea?

About

Avatar for Ricardo @Ricardo started