From 5a99cb06efbf4073fe956ce114e99a9164639266 Mon Sep 17 00:00:00 2001 From: Antonio Luiz Date: Fri, 17 May 2024 23:39:26 -0300 Subject: [PATCH] v2.12.0 --- docs/modules/cs/index.ts.md | 9 +++++++++ package.json | 2 +- src/cs/index.ts | 6 +++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/modules/cs/index.ts.md b/docs/modules/cs/index.ts.md index 1157ba3..e27c37c 100644 --- a/docs/modules/cs/index.ts.md +++ b/docs/modules/cs/index.ts.md @@ -14,6 +14,7 @@ Sets up a central system, that can communicate with charge points - [Central System](#central-system) - [CentralSystem (class)](#centralsystem-class) + - [getConnectedChargePoints (method)](#getconnectedchargepoints-method) - [addConnectionListener (method)](#addconnectionlistener-method) - [close (method)](#close-method) - [sendRequest (method)](#sendrequest-method) @@ -64,6 +65,14 @@ const centralSystem = new CentralSystem(3000, (req, { chargePointId }) => { }) ``` +### getConnectedChargePoints (method) + +**Signature** + +```ts +public getConnectedChargePoints(): string[] +``` + ### addConnectionListener (method) **Signature** diff --git a/package.json b/package.json index 23b08fc..e215d76 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@voltbras/ts-ocpp", "description": "OCPP (Open Charge Point Protocol) implemented in Typescript", - "version": "2.11.1", + "version": "2.12.0", "main": "dist/index.js", "types": "dist/index.d.ts", "homepage": "https://github.com/voltbras/ts-ocpp", diff --git a/src/cs/index.ts b/src/cs/index.ts index 9aad8c9..b57cd19 100644 --- a/src/cs/index.ts +++ b/src/cs/index.ts @@ -144,6 +144,10 @@ export default class CentralSystem { this.websocketsServer = this.setupWebsocketsServer(); } + public getConnectedChargePoints(): string[] { + return Object.keys(this.connections); + } + public addConnectionListener(listener: ConnectionListener) { this.listeners.push(listener); } @@ -363,4 +367,4 @@ export default class CentralSystem { this.listeners.forEach((f) => f(chargePointId, 'disconnected')); }); } -} \ No newline at end of file +}