UNPKG

knxultimate

Version:

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

53 lines 1.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const KnxLog_1 = require("../KnxLog"); const logger = (0, KnxLog_1.module)('DPT4'); const config = { id: 'DPT4', formatAPDU: (value) => { if (!value) { logger.warn('cannot write null value'); } else { if (typeof value === 'string') { const apdu_data = value.charCodeAt(0); if (apdu_data > 255) logger.warn('must supply an ASCII character'); return Buffer.from([apdu_data]); } logger.warn('Must supply a character or string'); } return null; }, fromBuffer: (buf) => { if (buf.length !== 1) { logger.warn('Buffer should be 1 byte long, got', buf.length); return null; } return String.fromCharCode(buf[0]); }, basetype: { bitlength: 8, valuetype: 'basic', desc: '8-bit character', help: `// Send a single character in ascii or ISO msg.payload = "A"; return msg;`, helplink: '', }, subtypes: { '001': { name: 'Char ASCII', desc: 'ASCII character (0-127)', range: [0, 127], use: 'G', }, '002': { name: 'Char 8859 1', desc: 'ISO-8859-1 character (0..255)', use: 'G', }, }, }; exports.default = config; //# sourceMappingURL=dpt4.js.map