Skip to content

README Node.js datalayer.client.bulkread

This Node.js sample reads values in bulk mode from ctrlX Data Layer.

Introduction

The sample demonstrates how to bulk read values from ctrlX Data Layer and write out the values to console. The bulk read is performed every 10 seconds in an endless loop.

Description

The sample datalayer.client.bulkread demonstrates

  • Create and start the 'DatalayerSystem' service
  • Create a client
  • Bulk Read values with method client.BulkRead(addresses)
  • Bulk Read methods are called in an endless loop every 10s.

Prerequisites

Please read the common Node.js docs here, first.

Debug and Run

  1. Run 'npm install' in the terminal.
  2. Launch the app with the debugger attached by pressing F5.

Build and Install

  1. Launch Visual Studio Code
  2. Click on the Remote Explorer from the menu.
  3. Choose Open Folder in QEMU VM.
  4. Open the directory datalayer.client.bulkread.
  5. Build and install snap as described here.
  6. Check the output using Diagnostics:

  7. Login into your ctrlX

  8. Navigate to Diagnostics -> Logbook
  9. Click Settings on the right top corner
  10. Enable Show system messages
  11. Navigate to Filter -> Units and check your snap.sdk-node-client-bulkread.app.service
  12. Now you should the see the app output diagnostics.
  13. Press Refresh to update.

  14. If you have root permissions, you can also watch the output on any ssh console with the command:

    sudo snap logs sdk-node-client-bulkread.app -f | more
    

Console Output

connection string: ipc://
address: framework/metrics/system/cpu-utilisation-percent, value: 27.6, timestamp: 2022-10-18T14:40:15.440Z, result: DL_OK
address: framework/metrics/system/memavailable-mb, value: 401.9296875, timestamp: 2022-10-18T14:40:15.440Z, result: DL_OK
address: framework/metrics/system/membuffers-mb, value: 12.60546875, timestamp: 2022-10-18T14:40:15.440Z, result: DL_OK
address: framework/metrics/system/memcache-mb, value: 400.5859375, timestamp: 2022-10-18T14:40:15.440Z, result: DL_OK
address: framework/metrics/system/memfree-mb, value: 25.640625, timestamp: 2022-10-18T14:40:15.440Z, result: DL_OK
address: framework/metrics/system/memtotal-mb, value: 975.8125, timestamp: 2022-10-18T14:40:15.440Z, result: DL_OK
address: framework/metrics/system/memused-percent, value: 56.3, timestamp: 2022-10-18T14:40:15.440Z, result: DL_OK

Install the App

Login into ctrlX and install the App (Apps).

Gratulations - We're finished - Let's start coding

Support

Developer Community

Please join the Developer Community

SDK Forum

Please visit the SDK Forum

Issues

If you've found an error in these sample, please file an issue

License

SPDX-FileCopyrightText: Bosch Rexroth AG SPDX-License-Identifier: MIT