UNPKG

knxultimate

Version:

KNX IP protocol implementation for Node. This is the ENGINE of Node-Red KNX-Ultimate node.

51 lines 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const KnxLog_1 = require("../KnxLog"); const logger = (0, KnxLog_1.module)('DPT28'); const config = { id: 'DPT28', formatAPDU(value) { if (typeof value !== 'string') { logger.error('Must supply a string value. Autoconversion to string'); try { value = value.toString(); } catch (error) { value = 'DPT Err'; } } try { const buf = Buffer.alloc(14); if (this.subtypeid === '001') buf.write(value, 'utf-8'); return buf; } catch (error) { return error.message; } }, fromBuffer(buf) { if (this.subtypeid === '001') return buf.toString('utf-8'); return null; }, basetype: { bitlength: 14 * 8, valuetype: 'basic', desc: '14-character string', help: `// Send a text to a display msg.payload = "Hello UTF-8!" return msg;`, helplink: '', }, subtypes: { '001': { use: 'G', desc: 'DPT_String_UTF-8', name: 'UTF-8 string', force_encoding: 'UTF-8', }, }, }; exports.default = config; //# sourceMappingURL=dpt28.js.map