Skip to content

Commit

Permalink
Refactor device id query in routing.ts (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan authored Nov 15, 2023
1 parent c4280ea commit 3fcf766
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1379,12 +1379,16 @@ namespace jacdac {

// query based binding
// match device id query, dev=self query + device/service query
const d =
query.device == "self"
? jacdac.bus.selfDevice.deviceId
: this.deviceId
// precise device id match
if (query.device == d) {
if (
// precise device id match
query.device == this.deviceId ||
// short id match
query.device == this.shortId ||
// self device match
(query.device == "self" &&
this.deviceId == jacdac.bus.selfDevice.deviceId)
) {
if (
// precise service index match
// precise service index
Expand Down

0 comments on commit 3fcf766

Please sign in to comment.