To ensure compatibility, follow these guidelines when uploading a custom JavaScript decoder.
Here's a simple example of a custom JavaScript decoder function conforming to the required function signature:
/** * Custom decoder function for decoding data. * @param bytes - The payload data to be decoded (an array of bytes). * @param port - The port number used during decoding. * @returns {string} - The decoded result as a string. */ function Decoder(bytes, port) { // Your decoding logic here let decodedResult = {}; //empty object that holds all UDT tag values decodedResult.Measurement = bytes[0] decodedResult.BatteryLevel = bytes[1] decodedResult.Temperature = bytes[2] return decodedResult; }
- Runtime Limitations: Be aware of the runtime limitations and constraints of GraalVM. For example, certain features or APIs available in other JavaScript engines may not be present in GraalVM. Refer to the GraalVM documentation for any restrictions you should consider while uploading your custom decoder.
- Testing: Before uploading the custom JavaScript decoder, thoroughly test it in a separate environment. Ensure that it performs as expected and adheres to the function signature mentioned above.