Skip to content

Fix Edge Agent CMD #507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 8, 2025
Merged

Fix Edge Agent CMD #507

merged 2 commits into from
May 8, 2025

Conversation

AlexGodbehere
Copy link
Contributor

This pull request includes several updates across multiple files in the project, focusing on copyright updates, improved functionality for handling commands, and minor refactoring to streamline the code. Below is a summary of the most important changes:

Command Handling Enhancements:

  • Introduced a new optional cmd method in the southbound driver, allowing the handling of device commands with a data object passed as a buffer (lib/js-edge-driver/docs/driver.md, lib/js-edge-driver/lib/driver.js) [1] [2].
  • Updated the Driver class to route command messages (cmd/#) to the appropriate handler, ensuring proper processing of device commands (lib/js-edge-driver/lib/driver.js) [1] [2].

Code Refactoring and Cleanup:

  • Removed unused imports (fs, sparkplugValue, util, Long) and streamlined existing imports to improve code readability (acs-edge/lib/device.ts, acs-edge/lib/devices/driver.ts, acs-edge/lib/sparkplugNode.ts) [1] [2] [3].
  • Simplified writeMetrics in the DriverConnection class by adding logic to find and validate addresses, and to publish payloads (acs-edge/lib/devices/driver.ts).

Minor Functional Updates:

  • Added functionality to handle boolean values in writeValToBuffer by writing 1 or 0 based on the metric value (acs-edge/lib/helpers/typeHandler.ts).
  • Adjusted a regular expression in the DriverBroker class to handle wildcard commands (cmd/#) (acs-edge/lib/driverBroker.ts).

Documentation and Buffer Enhancements:

  • Updated documentation to include details about the new cmd method for southbound drivers (lib/js-edge-driver/docs/driver.md).
  • Enhanced BufferX utilities to include methods for converting buffers to JSON and other types (lib/js-edge-driver/lib/bufferx.js).

@AlexGodbehere AlexGodbehere merged commit 3b34771 into main May 8, 2025
1 check passed
@AlexGodbehere AlexGodbehere deleted the ago/edge-fix branch May 8, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant