Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EZSP] Fix group binding #721

Merged
merged 1 commit into from
Jun 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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