Skip to content

Commit

Permalink
Merge pull request #14 from RoonLabs/fix-core_paired
Browse files Browse the repository at this point in the history
call core_paired/core_unpaired when pairing changed, not just lost/found
  • Loading branch information
dannydulai authored Sep 25, 2018
2 parents f2d29d8 + 4735efd commit fc06320
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,14 @@ RoonApi.prototype.init_services = function(o) {
req.send_complete("Success", { paired_core_id: this.paired_core_id });
},
pair: (req) => {
this.paired_core_id = req.moo.core.core_id;
svc.send_continue_all("subscribe_pairing", "Changed", { paired_core_id: this.paired_core_id })
if (this.paired_core_id != req.moo.core.core_id) {
if (this.paired_core) {
this.pairing_service_1.lost_core(this.paired_core);
delete this.paired_core_id;
delete this.paired_core;
}
this.pairing_service_1.found_core(req.moo.core);
}
},
}
});
Expand All @@ -149,6 +155,7 @@ RoonApi.prototype.init_services = function(o) {
this.set_persisted_state(settings);

this.paired_core_id = core.core_id;
this.paired_core = core;
this.is_paired = true;
svc.send_continue_all("subscribe_pairing", "Changed", { paired_core_id: this.paired_core_id })
}
Expand Down

0 comments on commit fc06320

Please sign in to comment.