Skip to content

Commit

Permalink
Added sharedData object in custom parsers, Tag as v1.3.0
Browse files Browse the repository at this point in the history
Updated dependencies
  • Loading branch information
crycode-de committed Feb 7, 2022
1 parent ed77f52 commit 5852f71
Show file tree
Hide file tree
Showing 8 changed files with 1,320 additions and 2,040 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,15 @@ In the scripts you are able to use the following features:
* `async`/`await`
* Adapter log functions `log.warn('something')`, `log.info('something')`, `log.debug('something')`
* `getStateAsync('id')` and `getObjectAsync('id')` where `id` is the full ID of the state/object
* An object `sharedData` which is shared between all custom scripts of an adapter instance

Errors in the scripts will be logged by the adapter.

In both scripts the variables `buffer` and `value` are predefined.
`buffer` always contains the current CAN message content as a Node.js Buffer.

The `sharedData` object is empty by default and may be used to share some data between multiple calls of a single custom parser or even between multiple custom parsers.

#### Custom read script

In a read script you have to read the `value` from the `buffer` variable.
Expand Down Expand Up @@ -150,6 +153,9 @@ By writing JSON data to the `raw.send` state you are able to send CAN messages c

## Changelog

### 1.3.0 (2022-02-07)
* (crycode-de) Added `sharedData` object in custom parsers

### 1.2.3 (2021-10-17)
* (crycode-de) Added missing `autoSet...` parser options to csv export/import
* (crycode-de) Fixed `TypeError: Method Promise.prototype.then called on incompatible receiver [object Object]` triggered by a bug in an old `vm2` version
Expand Down
530 changes: 195 additions & 335 deletions admin/build/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion admin/build/index.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions build/parsers/custom.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
{
"common": {
"name": "canbus",
"version": "1.2.3",
"version": "1.3.0",
"news": {
"1.3.0": {
"en": "Added sharedData object in custom parsers.",
"de": "sharedData-Objekt in benutzerdefinierten Parsern hinzugefügt.",
"ru": "Добавлен объект sharedData в пользовательских парсерах.",
"pt": "Adicionado o objeto sharedData em analisadores personalizados.",
"nl": "sharedData-object toegevoegd in aangepaste parsers.",
"fr": "Ajout d'un objet sharedData dans les analyseurs personnalisés.",
"it": "Aggiunto oggetto sharedData nei parser personalizzati.",
"es": "Se agregó el objeto sharedData en analizadores personalizados.",
"pl": "Dodano obiekt sharedData w niestandardowych parserach.",
"zh-cn": "在自定义解析器中添加了 sharedData 对象。"
},
"1.2.3": {
"en": "Added missing `autoSet...` parser options to csv export/import",
"de": "Fehlende `autoSet...`-Parser-Optionen zum CSV-Export/-Import hinzugefügt",
Expand Down
Loading

0 comments on commit 5852f71

Please sign in to comment.