Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splitting up the discovery and device controllers? #2

Open
benfoxall opened this issue Apr 9, 2013 · 0 comments
Open

Splitting up the discovery and device controllers? #2

benfoxall opened this issue Apr 9, 2013 · 0 comments

Comments

@benfoxall
Copy link
Member

I think it might get confusing for people to understand the process of discovery and connecting to cars when they are first using the library.

It might be easier to split them up, so have a function that performs discovery:

WIRC.discover(function(device){
    // called for each device that responds to the broadcast

    console.log(device); // {deviceName:…,remoteAddress:…,localAddress:…};

});

Then access the car separately with the remote address.

var car = new Car('192.168.0.5', 'optional-serial-number');
car.takeControl();
car.speed(1);

I think the client code could be simplified if it was dealing with one device too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant