Skip to content

Commit

Permalink
feat: Prepare to move specific ZDO requests out of Adapter (#1187)
Browse files Browse the repository at this point in the history
* Prepare to move specific ZDO requests out of Adapter

* Fix prettier.

* Fix zstack tests.

* Fix ember tests.

* More coverage.

* Fix prettier.

* Add tests for zstack ZDO request payload alteration logic.

* Cleanup zstack ZDO response handling & more robust tests.

* Extra zstack edge-case coverage.

* Update zstack to use `sendZdo`.

* zstack: Match AREQ/SREQ logic, cleanup and optimize. More coverage.

* Better condition for IEEE vs nwk matching (avoid possible edge-cases).

* deconz

* ezsp

* Fix prettier.

* ezsp: fix not compatible with 8.x.x.

* zboss

* zboss: fix.

* deconz: fix `deviceJoined` event

* zigate

* zigate: better zdo buffalo patch

* zboss: fix ignore response status in driver (handled upstream)

* zboss: fix non-standard ZDO response payloads

* zboss: fix leftover

* zboss: fix permit join.

* zboss: fix INDICATION payload

* zboss: fix ZDO_DEV_UPDATE_IND.

* zstack: remove `networkAddress` event in favor of `zdoResponse`.

* zboss: revert unsupported join changes.

* Fix prettier.

* Feedback.

* ZStack: only discover route when node descriptor request fails

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
  • Loading branch information
Nerivec and Koenkk authored Sep 21, 2024
1 parent 97b8dc0 commit d84725b
Show file tree
Hide file tree
Showing 41 changed files with 5,403 additions and 4,060 deletions.
25 changes: 25 additions & 0 deletions src/adapter/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import * as Models from '../models';
import {logger} from '../utils/logger';
import {BroadcastAddress} from '../zspec/enums';
import * as Zcl from '../zspec/zcl';
import * as Zdo from '../zspec/zdo';
import * as ZdoTypes from '../zspec/zdo/definition/tstypes';
import * as AdapterEvents from './events';
import * as TsType from './tstype';

Expand All @@ -14,6 +16,7 @@ const NS = 'zh:adapter';
interface AdapterEventMap {
deviceJoined: [payload: AdapterEvents.DeviceJoinedPayload];
zclPayload: [payload: AdapterEvents.ZclPayload];
zdoResponse: [clusterId: Zdo.ClusterId, response: ZdoTypes.GenericZdoResponse];
disconnected: [];
deviceAnnounce: [payload: AdapterEvents.DeviceAnnouncePayload];
deviceLeave: [payload: AdapterEvents.DeviceLeavePayload];
Expand Down Expand Up @@ -219,6 +222,28 @@ abstract class Adapter extends events.EventEmitter<AdapterEventMap> {
* ZDO
*/

public abstract sendZdo(
ieeeAddress: string,
networkAddress: number,
clusterId: Zdo.ClusterId,
payload: Buffer,
disableResponse: true,
): Promise<void>;
public abstract sendZdo<K extends keyof ZdoTypes.RequestToResponseMap>(
ieeeAddress: string,
networkAddress: number,
clusterId: K,
payload: Buffer,
disableResponse: false,
): Promise<ZdoTypes.RequestToResponseMap[K]>;
public abstract sendZdo<K extends keyof ZdoTypes.RequestToResponseMap>(
ieeeAddress: string,
networkAddress: number,
clusterId: K,
payload: Buffer,
disableResponse: boolean,
): Promise<ZdoTypes.RequestToResponseMap[K] | void>;

public abstract permitJoin(seconds: number, networkAddress?: number): Promise<void>;

public abstract lqi(networkAddress: number): Promise<TsType.LQI>;
Expand Down
Loading

0 comments on commit d84725b

Please sign in to comment.