Minor refactor

This commit is contained in:
2023-12-04 08:51:46 +01:00
parent 0799dc6a4d
commit f7976d3738
3 changed files with 48 additions and 39 deletions

View File

@@ -14,4 +14,16 @@ function verifyDefaults(options, definitions) {
}
}
module.exports = { verifyDefaults, verifyExists };
async function sendPdu(session, pdu) {
return new Promise((resolve, reject) => {
session.send(pdu, (respPdu) => {
if (respPdu.command_status === 0) {
resolve(respPdu);
} else {
reject(respPdu);
}
});
});
}
module.exports = { verifyDefaults, verifyExists, sendPdu };