Skip to content

Commit

Permalink
feat!: Standardize ZDO (#1194)
Browse files Browse the repository at this point in the history
* feat!: Standardize ZDO.

* Remove obsolete functions & tests.

* Cleanup imports.

* Debug log for all ZDO responses.

* Improve unknown device identification logic.

* Fix missing emit.
  • Loading branch information
Nerivec committed Sep 22, 2024
1 parent 3f76f1a commit 9bce063
Show file tree
Hide file tree
Showing 21 changed files with 2,667 additions and 4,085 deletions.
40 changes: 3 additions & 37 deletions src/adapter/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ interface AdapterEventMap {
zclPayload: [payload: AdapterEvents.ZclPayload];
zdoResponse: [clusterId: Zdo.ClusterId, response: ZdoTypes.GenericZdoResponse];
disconnected: [];
deviceAnnounce: [payload: AdapterEvents.DeviceAnnouncePayload];
deviceLeave: [payload: AdapterEvents.DeviceLeavePayload];
networkAddress: [payload: AdapterEvents.NetworkAddressPayload];
}

abstract class Adapter extends events.EventEmitter<AdapterEventMap> {
public hasZdoMessageOverhead: boolean;
public manufacturerID: Zcl.ManufacturerCode;
protected networkOptions: TsType.NetworkOptions;
protected adapterOptions: TsType.AdapterOptions;
protected serialPortOptions: TsType.SerialPortOptions;
Expand All @@ -38,6 +37,7 @@ abstract class Adapter extends events.EventEmitter<AdapterEventMap> {
) {
super();
this.hasZdoMessageOverhead = true;
this.manufacturerID = Zcl.ManufacturerCode.RESERVED_10;
this.networkOptions = networkOptions;
this.adapterOptions = adapterOptions;
this.serialPortOptions = serialPortOptions;
Expand Down Expand Up @@ -189,7 +189,7 @@ abstract class Adapter extends events.EventEmitter<AdapterEventMap> {

public abstract stop(): Promise<void>;

public abstract getCoordinator(): Promise<TsType.Coordinator>;
public abstract getCoordinatorIEEE(): Promise<string>;

public abstract getCoordinatorVersion(): Promise<TsType.CoordinatorVersion>;

Expand All @@ -201,8 +201,6 @@ abstract class Adapter extends events.EventEmitter<AdapterEventMap> {

public abstract getNetworkParameters(): Promise<TsType.NetworkParameters>;

public abstract changeChannel(newChannel: number): Promise<void>;

public abstract setTransmitPower(value: number): Promise<void>;

public abstract addInstallCode(ieeeAddress: string, key: Buffer): Promise<void>;
Expand Down Expand Up @@ -246,38 +244,6 @@ abstract class Adapter extends events.EventEmitter<AdapterEventMap> {

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

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

public abstract routingTable(networkAddress: number): Promise<TsType.RoutingTable>;

public abstract nodeDescriptor(networkAddress: number): Promise<TsType.NodeDescriptor>;

public abstract activeEndpoints(networkAddress: number): Promise<TsType.ActiveEndpoints>;

public abstract simpleDescriptor(networkAddress: number, endpointID: number): Promise<TsType.SimpleDescriptor>;

public abstract bind(
destinationNetworkAddress: number,
sourceIeeeAddress: string,
sourceEndpoint: number,
clusterID: number,
destinationAddressOrGroup: string | number,
type: 'endpoint' | 'group',
destinationEndpoint?: number,
): Promise<void>;

public abstract unbind(
destinationNetworkAddress: number,
sourceIeeeAddress: string,
sourceEndpoint: number,
clusterID: number,
destinationAddressOrGroup: string | number,
type: 'endpoint' | 'group',
destinationEndpoint?: number,
): Promise<void>;

public abstract removeDevice(networkAddress: number, ieeeAddr: string): Promise<void>;

/**
* ZCL
*/
Expand Down
Loading

0 comments on commit 9bce063

Please sign in to comment.