Avatar for Ricardo

Ricardo

Member since May 2022 • Last active Nov 2022
  • 1 conversations
  • 4 comments

Most recent activity

  • in Bangle.js
    Avatar for Ricardo

    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?

  • in Bangle.js
    Avatar for Ricardo

    Hi Gordon.

    The 'gattserverdisconnected' reason is : 62 (#define BLE_HCI_CONN_FAILED_TO_BE_ESTABLISHED 0x3E)

    I need to debug : CAN Bus data, One-Wire, Input/Output from GPS device. Not only GPS data.

  • in Bangle.js
    Avatar for Ricardo

    Hi Gordon.

    The GPS device does not require any passkey or similar for connect to my phone.

    This is the link of the device: http://base.galileosky.com/articles/#!en­-documentation/developing-a-mobile-app-f­or-interacting-with-galileosky-tracking-­devices-via-bluetooth

    And this is the script that i used in web ( its work)

        <script>
            const print = (...args) => {
                console.log(...args);
            }
            const UUI_SPS = "0783b03e-8535-b5a0-7140-a304d2495cb7";
            const UUI_SERVER_TX = "0783b03e-8535-b5a0-7140-a304d2495cb8";
            const UUI_SERVER_RX = "0783b03e-8535-b5a0-7140-a304d2495cba";
            const UUI_FLOW_CTRL = "0783b03e-8535-b5a0-7140-a304d2495cb9";
            const DEVICE_NAME = "GS7X 354762118079554";
            const filters = [{ name:  [ DEVICE_NAME ] }];
            const optionalServices = [ UUI_SPS,UUI_SERVER_TX,UUI_SERVER_RX,UUI_­FLOW_CTRL ];
    
            const button = document.querySelector('button');
    
            button.addEventListener('click', demo);
    
            function demo() {
                navigator.bluetooth.requestDevice({ filters, optionalServices })
                    .then(device => device.gatt.connect())
                    .then(server => server.getPrimaryService(UUI_SPS))
                    .then(service => service.getCharacteristic(UUI_SERVER_TX)­)
                    .then(characteristic => characteristic.startNotifications())
                    .then(characteristic => {
                        characteristic.addEventListener('charact­eristicvaluechanged',
                            handleCharacteristicValueChanged);
                        print('Notifications have been started.');
                    })
                    .catch(error => { console.error(error); });
            }
    
    
            function handleCharacteristicValueChanged(event) {
                const value = event.target.value;
                let a = [];
    
                for (let i = 0; i < value.byteLength; i++) {
                   a.push(value.getUint8(i).toString(16));
                }
                console.log('> ' + a);
        }
        </script>
    
  • in Bangle.js
    Avatar for Ricardo

    I have a issue when a trying to connect BangleJS2 to GPS device(BLE).

    In promise 'getPrimaryService' always get Disconnected (in catch)

    I tried with : NRF.findDevices, NRF.connect and NRF.requestDevice but its the same result.

    But, when i use bluetooth web, and NRF App(smartphone) its work.

Actions