Add the ability to remove services/characteristics

This commit is contained in:
Khaos Tian
2016-02-17 13:18:25 -08:00
parent d3c77a4cda
commit 40266af8b2
4 changed files with 36 additions and 1 deletions

View File

@@ -32,6 +32,10 @@ function Server(insecureAccess) {
this._handleRegisterPlatformAccessories(accessories);
}.bind(this));
this._api.on('updatePlatformAccessories', function(accessories) {
this._handleUpdatePlatformAccessories(accessories);
}.bind(this));
this._api.on('unregisterPlatformAccessories', function(accessories) {
this._handleUnregisterPlatformAccessories(accessories);
}.bind(this));
@@ -408,6 +412,11 @@ Server.prototype._handleRegisterPlatformAccessories = function(accessories) {
this._updateCachedAccessories();
}
Server.prototype._handleUpdatePlatformAccessories = function(accessories) {
// Update persisted accessories
this._updateCachedAccessories();
}
Server.prototype._handleUnregisterPlatformAccessories = function(accessories) {
var hapAccessories = [];
for (var index in accessories) {