eep-packet
v0.0.7
Published
Parses an EnOcean Serial Protocol 3 buffer to an EEP packet.
Downloads
4
Maintainers
Readme
eep-packet
This module extracts all information out of an esp3 buffer.
Usage
const EEPPacket = require('eep-packet');
...
const eepPacket = new EEPPacket();
eepPacket.setParser(parser);
const packet = eepPacket.parse(buffer);
Constructor
new EEPPacket(parser);
new EEPPacket(null, knownDevices);
new EEPPacket(parser, knownDevices);
Methods
setParser(parser)
parser
A parser that can parses esp3 buffer like esp3-packet
addKnownDevice(device)
device
An object that has asenderId
key and aneep
key
Throws a TypeError
if the device is missing or invaild.
Device example:
{
senderId: '00000000',
eep: {
rorg: 'd5',
func: '00',
type: '01'
}
}
setKnownDevices(devices)
devices
An array of devices, see Device example
Throws a TypeError
if the devices are not set or have an invaild format.
parse(buffer)
buffer
A vaild buffer like esp3-packet returns.
Throws a TypeError
if the buffer
or the parser
is missing.
Returns:
{
data: {
rorg: String,
senderId: String,
status: String,
userData: Object
},
optionalData: {
subTelNum: Number,
destinationId: String,
dBm: Number,
securityLevel: Number
},
learnMode: Boolean
eep: { // This only exists if learnMode is true
rorg: String,
func: String,
type: String
}
}