User Tools

Site Tools


wiki:decoderupload

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
wiki:decoderupload [2023/07/28 18:08] mbrauerwiki:decoderupload [2023/07/28 18:10] (current) mbrauer
Line 1: Line 1:
 ====== Custom JavaScript Decoder Upload Requirements ====== ====== Custom JavaScript Decoder Upload Requirements ======
  
-To ensure compatibility, follow these guidelines when uploading a custom JavaScript decoder. The decoder function should be denoted as `Decoder(bytes, port)`. The decoder must return an //**object**// that represents the desired tag structure of the UDT.+To ensure compatibility, follow these guidelines when uploading a custom JavaScript decoder.
  
 ===== Example Custom Decoder Function ===== ===== Example Custom Decoder Function =====
Line 17: Line 17:
   // Your decoding logic here   // Your decoding logic here
   let decodedResult = {}; //empty object that holds all UDT tag values   let decodedResult = {}; //empty object that holds all UDT tag values
-  decodedResult.Measurement = bytes[1+  decodedResult.Measurement = bytes[0
-  decodedResult.BatteryLevel = bytes[2+  decodedResult.BatteryLevel = bytes[1
-  decodedResult.Temperature = bytes[3]+  decodedResult.Temperature = bytes[2]
   return decodedResult;   return decodedResult;
 } }
Line 29: Line 29:
       * Other functions can be used in the file can called from the Decoder function, but the Decoder function acts as the main function.        * Other functions can be used in the file can called from the Decoder function, but the Decoder function acts as the main function. 
  
-      * bytesThis parameter represents the input data that needs to be decoded. It is an array of bytes that is gathered from an uplink's payload.+      * **Return Value**The decoder must return an **object** that represents the desired tag structure of the UDT.
  
-      * port: This parameter denotes the port number that might be used within the decoder function or during the decoding process.+      * **bytes**: This parameter represents the input data that needs to be decoded. It is an array of bytes that is gathered from an uplink's payload. 
 + 
 +      * **port**: This parameter denotes the port number that might be used within the decoder function or during the decoding process.
  
 - **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. - **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.
wiki/decoderupload.1690567726.txt.gz · Last modified: 2023/07/28 18:08 by mbrauer