INNER CODE UNIT · JavaScript
convertValueVariant
riclolsen/json-scada · src/OPC-UA-Server/index.js:1098
function convertValueVariant(rtData) {
let value = null,
dataType = '',
arrayType = null
switch (rtData?.type) {
case 'digital': {
// delegate to the shared scalar converter (see historian.js) so live
// and historical conversion cannot drift
const r = convertHistValue('digital', rtData.protocolSourceASDU, rtData.value)
dataType = r.dataType
value = r.value
break
}
case 'json':
let obj = null
try {
if (rtData?.valueJson) obj = JSON.parse(rtData?.valueJson)
} catch (e) {