Skip to content

Trying to connect to 2 tags at once #37

@hardillb

Description

@hardillb

As mentioned over in the Node-Red side of things, I'm having issues connecting to multiple tags at once.

The second discover never happens. I'm wondering if the discovery phase is shutdown by the connect call. If so I guess the only way to do it is to call discover all, save the list of discovered tags and then connect after a suitable time out period?

var SensorTag = require('sensortag');

SensorTag.discoverByUuid("34b1f7d136b9",function(tag){
    console.log("found " + tag.uuid);
    tag.connect(function(){
        tag.discoverServicesAndCharacteristics(function(){
            tag.notifySimpleKey(function(err){
                console.log(err);
            });
            tag.on('simpleKeyChange', function(left, right){
                console.log("button " + left + " 34b");
            });
        })
    });


});

SensorTag.discoverByUuid('1cba8c20caf3',function(tag){
    console.log("found " + tag.uuid);
    tag.connect(function(){
        tag.discoverServicesAndCharacteristics(function(){
            tag.notifySimpleKey(function(err){
                console.log(err);
            });
            tag.on('simpleKeyChange', function(left, right){
                console.log("button " + left + " 1cb");
            });
        })
       });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions