Skip to content

Commit

Permalink
Skipping XOFF and XON byte in uart package. (#669)
Browse files Browse the repository at this point in the history
Adding address pair to mapping on bind/unbind/remove request.
  • Loading branch information
kirovilya committed Feb 20, 2023
1 parent b587fb3 commit c254ff3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/adapter/ezsp/adapter/ezspAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,9 @@ class EZSPAdapter extends Adapter {
const addrmode = (type === 'group') ? 1 : 3;
const ieeeDst = (type === 'group') ? destinationAddressOrGroup :
new EmberEUI64(destinationAddressOrGroup as string);
if (type !== 'group') {
this.driver.setNode(destinationNetworkAddress, ieeeDst as EmberEUI64);
}
await this.driver.zdoRequest(
destinationNetworkAddress, EmberZDOCmd.Bind_req, EmberZDOCmd.Bind_rsp,
{sourceEui: ieee, sourceEp: sourceEndpoint, clusterId: clusterID,
Expand All @@ -551,6 +554,9 @@ class EZSPAdapter extends Adapter {
const addrmode = (type === 'group') ? 1 : 3;
const ieeeDst = (type === 'group') ? destinationAddressOrGroup :
new EmberEUI64(destinationAddressOrGroup as string);
if (type !== 'group') {
this.driver.setNode(destinationNetworkAddress, ieeeDst as EmberEUI64);
}
await this.driver.zdoRequest(
destinationNetworkAddress, EmberZDOCmd.Unbind_req, EmberZDOCmd.Unbind_rsp,
{sourceEui: ieee, sourceEp: sourceEndpoint, clusterId: clusterID,
Expand All @@ -563,6 +569,7 @@ class EZSPAdapter extends Adapter {
return this.driver.queue.execute<void>(async () => {
this.checkInterpanLock();
const ieee = new EmberEUI64(ieeeAddr);
this.driver.setNode(networkAddress, ieee);
await this.driver.zdoRequest(
networkAddress, EmberZDOCmd.Mgmt_Leave_req, EmberZDOCmd.Mgmt_Leave_rsp,
{destAddr: ieee, removechildrenRejoin: 0x00}
Expand Down
4 changes: 3 additions & 1 deletion src/adapter/ezsp/driver/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ export class Parser extends stream.Transform {
out.writeUInt8(c ^ consts.STUFF, outIdx++);
escaped = false;
} else {
if ((c === consts.ESCAPE)) {
if (c === consts.ESCAPE) {
escaped = true;
} else if (c === consts.XOFF || c === consts.XON) {
// skip
} else {
out.writeUInt8(c, outIdx++);
}
Expand Down

0 comments on commit c254ff3

Please sign in to comment.