Core JavaScript API
These objects are available to every connector function, whatever protocol the device speaks. Start with the JavaScript API — it explains what your script receives and what it must produce — and come back here for the object you need.
What you get and what you return
| Page | Object | Use it to |
|---|---|---|
| JavaScript API | — | Understand the input variables, the expected output per connector function type, and how executions concatenate |
| Entity | entity, gateway |
Read data stream values, timestamps and source fields of the device |
| Inner Collections | collection |
Collect data points and set fields from inside the script |
| Operation Steps | response |
Build operation steps and set result codes |
Reaching back into the platform
| Page | Object | Use it to |
|---|---|---|
| Operation | operation |
Read and activate the device’s pending operations |
| Provision | provision |
Retrieve and create entities through the provisioning API |
| Concatenated Connector Functions | cf |
Chain RESPONSE and COLLECTION executions together |
Helpers
| Page | Object | Use it to |
|---|---|---|
| Utils | utils |
AT commands, date handling, context, encryption and HTTP helpers |
| Cryptography | — | Encrypt and decrypt with AES, hash with HMAC |
One more global is always there and is documented outside this section, because rules use the very same
object: logger, for writing TRACE, DEBUG, INFO, WARN and ERROR traces. It is the way to see
what a running function is doing — see Debugging, which covers both the
logger API and the
WebSocket service that streams the traces live.
Reserved names
Because these helpers are injected as globals, their names are reserved. Do not declare variables called
cf, collection, response, snmp, utils, dlms, dlms_gas, provision or operation in your
script.