Merge pull request #48 from aileo/gethubbymac

Add PoweredUP#getConnectedHubByPrimaryMACAddress
This commit is contained in:
Nathan Kellenicki 2019-11-13 16:08:28 -08:00 committed by GitHub
commit 1d885ff244
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -96,6 +96,17 @@ export class PoweredUP extends EventEmitter {
}
/**
* Retrieve a Powered UP Hub by primary MAC address.
* @method PoweredUP#getConnectedHubByPrimaryMACAddress
* @param {string} address
* @returns {Hub}
*/
public getConnectedHubByPrimaryMACAddress (address: string) {
return Object.keys(this._connectedHubs).map((uuid) => this._connectedHubs[uuid]).filter((hub) => hub.primaryMACAddress === address)[0];
}
/**
* Retrieve a list of Powered UP Hub by name.
* @method PoweredUP#getConnectedHubsByName

View File

@ -114,6 +114,17 @@ export class PoweredUP extends EventEmitter {
}
/**
* Retrieve a Powered UP Hub by primary MAC address.
* @method PoweredUP#getConnectedHubByPrimaryMACAddress
* @param {string} address
* @returns {Hub}
*/
public getConnectedHubByPrimaryMACAddress (address: string) {
return Object.keys(this._connectedHubs).map((uuid) => this._connectedHubs[uuid]).filter((hub) => hub.primaryMACAddress === address)[0];
}
/**
* Retrieve a list of Powered UP Hub by name.
* @method PoweredUP#getConnectedHubsByName