Adding support for enums
kai zhu
kaizhu256 at gmail.com
Tue Jun 12 13:40:06 UTC 2018
hi @peter, appreciate your perspective for embedded-device use-case.
however, as @isiah mentions, there are existing javascript
design-patterns using dicts/lists that are superior to enums. the
primary reason (which was implied) is because they can be easily
stored/shared/parsed as json config-settings, e.g.:
```json
{
"DEVICE_LIST": [
{
"TYPE": "ARDUINO",
"ADFlag": {
"LE_LIMITED_DISCOVERABLE_MODE": 1,
"LE_GENERAL_DISCOVERABLE_MODE": 2,
"LE_GENERAL_DISCOVERABLE_MODE_ARDUINO": 3,
"NO_BR_EDR": 4
},
"ADType": {
"INCOMPLETE_UUID16_LIST": 2,
"COMPLETE_UUID16_LIST": 3,
"INCOMPLETE_UUID128_LIST": 6,
"COMPLETE_UUID128_LIST": 7
}
},
{
"TYPE": "RASPBERRY_PI",
"ADFlag": {
"LE_LIMITED_DISCOVERABLE_MODE": 1,
"LE_GENERAL_DISCOVERABLE_MODE": 2,
"NO_BR_EDR": 4
},
"ADType": {
"INCOMPLETE_UUID16_LIST": 2,
"COMPLETE_UUID16_LIST": 3,
"INCOMPLETE_UUID128_LIST": 6,
"COMPLETE_UUID128_LIST": 7
}
}
]
}
```
you can also save/update these configs to a github-repo (with
encryption like this real-world example [1]), and perhaps have your
iot device poll it every 5 minutes for effortless config-updates in
near-realtime.
-kai
[1] encrypted travis-ci-config-settings hosted on github
https://github.com/kaizhu256/node-utility2/blob/gh-pages/CRYPTO_AES_SH_ENCRYPTED_kaizhu256
More information about the es-discuss
mailing list