Skip to content

Commit

Permalink
fix: Fix EZSP group binding (#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbedrich authored Jun 21, 2023
1 parent cc5fa9a commit 2977e42
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/adapter/ezsp/adapter/ezspAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,10 +529,15 @@ class EZSPAdapter extends Adapter {
return this.driver.queue.execute<void>(async () => {
this.checkInterpanLock();
const ieee = new EmberEUI64(sourceIeeeAddress);
const addrmode = (type === 'group') ? 1 : 3;
const ieeeDst = (type === 'group') ? destinationAddressOrGroup :
new EmberEUI64(destinationAddressOrGroup as string);
if (type !== 'group') {
let addrmode, ieeeDst;
if (type === 'group') {
// 0x01 = 16-bit group address for DstAddr and DstEndpoint not present
addrmode = 0x01;
ieeeDst = uint16_t.serialize(uint16_t, destinationAddressOrGroup as number);
} else {
// 0x03 = 64-bit extended address for DstAddr and DstEndpoint present
addrmode = 0x03;
ieeeDst = new EmberEUI64(destinationAddressOrGroup as string);
this.driver.setNode(destinationNetworkAddress, ieeeDst as EmberEUI64);
}
await this.driver.zdoRequest(
Expand All @@ -551,10 +556,15 @@ class EZSPAdapter extends Adapter {
return this.driver.queue.execute<void>(async () => {
this.checkInterpanLock();
const ieee = new EmberEUI64(sourceIeeeAddress);
const addrmode = (type === 'group') ? 1 : 3;
const ieeeDst = (type === 'group') ? destinationAddressOrGroup :
new EmberEUI64(destinationAddressOrGroup as string);
if (type !== 'group') {
let addrmode, ieeeDst;
if (type === 'group') {
// 0x01 = 16-bit group address for DstAddr and DstEndpoint not present
addrmode = 0x01;
ieeeDst = uint16_t.serialize(uint16_t, destinationAddressOrGroup as number);
} else {
// 0x03 = 64-bit extended address for DstAddr and DstEndpoint present
addrmode = 0x03;
ieeeDst = new EmberEUI64(destinationAddressOrGroup as string);
this.driver.setNode(destinationNetworkAddress, ieeeDst as EmberEUI64);
}
await this.driver.zdoRequest(
Expand Down

0 comments on commit 2977e42

Please sign in to comment.