rxjs-obd
Version:
RxJS Implementation for OBD (On Board Diagnostics) of vehicles via ELM 327 connections.
12 lines • 478 B
JavaScript
export const isSupportedPID = (data, pid) => {
const integer = parseInt(pid, 16);
// the PIDs that has the bitwise flags of supported PIDs
if (integer % 0x20 == 0) {
return true;
}
const segment = Math.floor(integer / 0x20) * 0x20;
const bitmap = data.supportedPIDs[`segment${segment == 0 ? '00' : segment.toString(16)}`];
const bit = Math.pow(2, 0x20 - (integer % 0x20));
return (bitmap & bit) !== 0;
};
//# sourceMappingURL=utils.js.map