omeryagmurlu / olliejs

A javascript API to control Ollie.
12 stars 5 forks source link

stuck at "sending anti DoS string" #1

Closed mcbrwr closed 8 years ago

mcbrwr commented 8 years ago

I'm really interested in the olliejs functionality, but I can't get it working yet. The process is stuck at the message "Sending anti-DoS string"

I did some debugging logs and it does seem to get into the connection.js/getCharacteristic() function. any idea?

thanks!

omeryagmurlu commented 8 years ago

Can you check whether it enters the p.discoverServices function in getCharacteristics(), if it does not noble may not be able to connect to peripheral at all. And on which platform are you trying to run this code, it should run flawlessly on all platforms but I have tested it on Ubuntu 14.04 and 15.04 yet.

mcbrwr commented 8 years ago

thanks for your reply :-)

platform: osx. it does get into getcharacteristics, but somewhere it gets stuck. noble does make a connection (I think) since in my mac osx bluetooth settings I see it as paired device.

On 1 dec. 2015, at 21:46, Ömer Erdinç Yağmurlu notifications@github.com wrote:

Can you check whether it enters the p.discoverServices function in getCharacteristics(), if it does not noble may not be able to connect to peripheral at all. And on which platform are you trying to run this code, it should run flawlessly on all platforms but I have tested it on Ubuntu 14.04 and 15.04 yet.

— Reply to this email directly or view it on GitHub.

omeryagmurlu commented 8 years ago

Hmm, can you try this code here with your Ollie's UUID: Ubuntu Pastebin Link, and then post its output here?

It must generate an output similar to this:

trying to connect to the ollie with UUID:  ef66143e996d
found peripheral: ef66143e996d
found Ollie with the UUID: ef66143e996d
{ ef66143e996d: 
   { '1800': [ '2a00', '2a01', '2a04' ],
     '1801': [ '2a05' ],
     '180a': [ '2a27', '2a25', '2a24', '2a29', '2a26', '2a50' ],
     '180f': [ '2a19' ],
     '22bb746f2ba075542d6f726568705327': 
      [ '22bb746f2ba175542d6f726568705327',
        '22bb746f2ba675542d6f726568705327' ],
     '22bb746f2bc075542d6f726568705327': 
      [ '22bb746f2bc175542d6f726568705327',
        '22bb746f2bc275542d6f726568705327',
        '22bb746f2bc375542d6f726568705327' ],
     '00001016d10211e19b2300025b00a5a5': 
      [ '00001013d10211e19b2300025b00a5a5',
        '00001017d10211e19b2300025b00a5a5',
        '00001014d10211e19b2300025b00a5a5' ],
     '22bb746f2bb075542d6f726568705327': 
      [ '22bb746f2bb175542d6f726568705327',
        '22bb746f2bb275542d6f726568705327',
        '22bb746f2bb375542d6f726568705327',
        '22bb746f2bb675542d6f726568705327',
        '22bb746f2bb775542d6f726568705327',
        '22bb746f2bb875542d6f726568705327',
        '22bb746f2bb975542d6f726568705327',
        '22bb746f2bba75542d6f726568705327',
        '22bb746f2bbd75542d6f726568705327',
        '22bb746f2bbe75542d6f726568705327',
        '22bb746f2bbf75542d6f726568705327' ] } }
mcbrwr commented 8 years ago

I do get a connection with your script, but I had to change the UUID because osx outputs a hash there. Made a seperate issue for that: https://github.com/omeryagmurlu/olliejs/issues/2

By using the hash I do get to the point right after noble.stopScanning(). A console.log right in peripheral.connect() does not output anything but in my bluetooth trayicon I see a connection with the device.

mcbrwr commented 8 years ago

the output (for the record)

trying to connect to the ollie with UUID:  f432a38f2b16
or ADDRESS:  f4:32:a3:8f:2b:16
---
found peripheral: {"id":"0517f77033a54eeb88d4e89f519bc389","address":"unknown","addressType":"unknown","connectable":true,"advertisement":{"localName":"Sense-04","serviceData":[],"serviceUuids":[]},"rssi":-89,"state":"disconnected"}

---
found peripheral: {"id":"8e0c8828b56942158498c1d6310b4719","address":"f4:32:a3:8f:2b:16","addressType":"unknown","connectable":true,"advertisement":{"localName":"2B-2B16","txPowerLevel":-10,"serviceData":[],"serviceUuids":[]},"rssi":-61,"state":"disconnected"}

found Ollie by ADDRESS: f4:32:a3:8f:2b:16
noble connecting...
{}
omeryagmurlu commented 8 years ago

I think the best solution is removing all colons from peripheral.address and then assigning it to the id property, which is used by noble's bindings. Mac bindings (yosemite at least) and hci-socket binding both use peripheral.id, which is different on Ubuntu and oSx, as argument, so making the id properties equal should do the trick.

can you insert peripheral.id = peripheral.uuid = peripheral.address.replace(/:/g, ''); after noble.stopScanning() (line 25) and try again?

gist here

mcbrwr commented 8 years ago

no go. first I got an error for peripheral.uuid not being declared. When I solved that, again the connection did happen, but noble get's stuck in reading services.

found peripheral: {"id":"0acac76b061d49489713b308b4afeb78","address":"f4:32:a3:8f:2b:16","addressType":"unknown","connectable":true,"advertisement":{"localName":"2B-2B16","txPowerLevel":-10,"serviceData":[],"serviceUuids":[]},"rssi":-67,"state":"disconnected"}
manipulating address to get the same uuid on both OSX and Linux
found Ollie with UUID:  f432a38f2b16  address:  f4:32:a3:8f:2b:16
{}

Can it be something with noble not being able to read data from ollie? I tried the peripheral-explorer.js script supplied with noble and for Ollie it doesn't read anything:

node peripheral-explorer.js 0acac76b061d49489713b308b4afeb78
peripheral with ID 0acac76b061d49489713b308b4afeb78 found
  Local Name        = 2B-2B16
  TX Power Level    = -10
  Service Data      = 
  Service UUIDs     = 

services and characteristics:

but for my iphone it reads a lot more:

node peripheral-explorer.js a534e011485543bb8e2c788485c7e9ba
peripheral with ID a534e011485543bb8e2c788485c7e9ba found
  Manufacturer Data = 4c000c0e001535de24f1ff955194fb4e0eea
  Service Data      = 

services and characteristics:
d0611e78bbb44591a5f8487910ae4366
  8667556c9a374c9184ed54ee27d90049
    properties  write, notify, extendedProperties
180f (Battery Service)
  2a19 (Battery Level)
    properties  read, notify
1805 (Current Time Service)
  2a2b (Current Time)
    properties  read, notify
  2a0f (Local Time Information)
    properties  read
180a (Device Information)
  2a29 (Manufacturer Name String)
    properties  read
    value       4170706c6520496e632e | 'Apple Inc.'
  2a24 (Model Number String)
    properties  read
    value       6950686f6e65352c32 | 'iPhone5,2'
omeryagmurlu commented 8 years ago

peripheral-explorer.js works properly with my Ollie. It outputs all services and characteristics. But this may not be a problem with noble, rather with your Ollie. I remember that I activated Developer Mode on Ollie from my Android Device, but I could control my Ollie even before activating Dev Mode.

But who knows, maybe your Ollie is just not advertising due to a weird problem.

You can try to read services and characteristics from these apps: * iPhone Lightblue bluetooth explorer * Android BLE Scanner

If these programs can't find any info about your Ollie auch, then you might have to activate developer mode on your Ollie manually with an Android App. I have complied this example from Sphero-Android-SDK repo and then enabled the Developer Mode switch there.

Otherwise noble has an issue on Macs.

mcbrwr commented 8 years ago

thanks for all your help! I'll go check dev mode & those apps out :-)

On 5 dec. 2015, at 20:13, Ömer Erdinç Yağmurlu notifications@github.com wrote:

peripheral-explorer.js works properly with my Ollie. It outputs all services and characteristics. But this may not be a problem with noble, rather with your Ollie. I remember that I activated Developer Mode on Ollie from my Android Device, but I could control my Ollie even before activating Dev Mode.

But who knows, maybe your Ollie is just not advertising due to a weird problem.

You can try to read services and characteristics from these apps:

  • iPhone Lightblue bluetooth explorer
  • Android BLE Scanner

If these programs can't find any info about your Ollie auch, then you might have to activate developer mode on your Ollie manually with an Android App. I have complied this example from Sphero-Android-SDK repo and then enabled the Developer Mode switch there.

Otherwise noble has an issue on Macs.

— Reply to this email directly or view it on GitHub.

omeryagmurlu commented 8 years ago

I am closing this for now.

hybridgroup/cylon-ollie#3