This package contains JavaScript source files for communicating with the Arendi WebSocket server.
An instance of the WebSocket server must be running in order for the following sample code to run. To install the WebSocket server, download and execute the installer from https://www.arendi.ch/blt2450
Node.js (at least v16) must be installed on the target machine: https://nodejs.org
Install with npm:
npm install "git+https://bitbucket.org/arendiag/arendi_testing_npm.git"
const {
Interface,
WsInterface,
Blt24,
Blt24List,
Blt24Mode,
DtmChannel,
DtmLength,
DtmPattern,
DtmPhy
} = require('@arendi/testing');
// Create WebSocket interface and Blt24 list
const wsInterface = new WsInterface();
const blt24List = new Blt24List(wsInterface);
/* inside async function */
// Open interface and get list of all Blt24 tester
await wsInterface.Open('ws://localhost:5000/blt24/');
await blt24List.Refresh(); // optional
console.log('Blt24 tester list:', blt24List.list);
// Get Blt24 tester with a given serial number
const blt24 = blt24List.Get('123456789ABC-DE');
if (blt24) {
// Activate DTM mode and start Rx test with an interval of 1000ms
blt24.SetMode(Blt24Mode.Dtm);
blt24.DtmRxStart(DtmChannel.Ch19, DtmLength.L37, DtmPattern.Prbs9, DtmPhy.Phy1Mbps, null, 1000);
// Receive Dtm test results
while (true) {
const dtmData = blt24.Read('DtmResultIndication');
console.log(`Packet Error Rate (PER): ${dtmData.per}`);
}
}
To build the project from source, perform the following steps:
- clone the repository to a local folder:
git clone https://Raesche@bitbucket.org/Raesche/arendi_testing.git
- Open the created folder and run
```bash
npm install
npm run build
```
The 'npm run build' command described above must be executed in order to compile and copy any changes made to the source files located in the src directory
#### Test
- Run server application
```bash
npm run server
```
- Run production test (cons testerSerialNumber inside Test/Production.js must be set to current tester)
```bash
npm run productiontest
```