UNPKG

bt-seneca-msc

Version:

A pure Javascript API for the Seneca Multi Smart Calibrator (MSC) device, using web bluetooth.

111 lines (104 loc) 2.33 kB
/** * Command type, aka mode value to be written into MSC current state register * */ const CommandType = { NONE_UNKNOWN: 0, /*** MEASURING FEATURES AFTER THIS POINT *******/ mA_passive: 1, mA_active: 2, V: 3, mV: 4, THERMO_J: 5, // Termocoppie THERMO_K: 6, THERMO_T: 7, THERMO_E: 8, THERMO_L: 9, THERMO_N: 10, THERMO_R: 11, THERMO_S: 12, THERMO_B: 13, PT100_2W: 14, // RTD 2 fili PT100_3W: 15, PT100_4W: 16, PT500_2W: 17, PT500_3W: 18, PT500_4W: 19, PT1000_2W: 20, PT1000_3W: 21, PT1000_4W: 22, Cu50_2W: 23, Cu50_3W: 24, Cu50_4W: 25, Cu100_2W: 26, Cu100_3W: 27, Cu100_4W: 28, Ni100_2W: 29, Ni100_3W: 30, Ni100_4W: 31, Ni120_2W: 32, Ni120_3W: 33, Ni120_4W: 34, LoadCell: 35, // Celle di carico Frequency: 36, // Frequenza PulseTrain: 37, // Conteggio impulsi RESERVED: 38, RESERVED_2: 40, Continuity: 41, OFF: 100, // ********* GENERATION AFTER THIS POINT *****************/ GEN_mA_passive: 101, GEN_mA_active: 102, GEN_V: 103, GEN_mV: 104, GEN_THERMO_J: 105, GEN_THERMO_K: 106, GEN_THERMO_T: 107, GEN_THERMO_E: 108, GEN_THERMO_L: 109, GEN_THERMO_N: 110, GEN_THERMO_R: 111, GEN_THERMO_S: 112, GEN_THERMO_B: 113, GEN_PT100_2W: 114, GEN_PT500_2W: 117, GEN_PT1000_2W: 120, GEN_Cu50_2W: 123, GEN_Cu100_2W: 126, GEN_Ni100_2W: 129, GEN_Ni120_2W: 132, GEN_LoadCell: 135, GEN_Frequency: 136, GEN_PulseTrain: 137, GEN_RESERVED: 138, // Special settings below this points SETTING_RESERVED: 1000, SET_UThreshold_F: 1001, SET_Sensitivity_uS: 1002, SET_ColdJunction: 1003, SET_Ulow: 1004, SET_Uhigh: 1005, SET_ShutdownDelay: 1006 }; const ContinuityImpl = CommandType.Cu50_2W; const ContinuityThresholdOhms = 75; /* * Internal state machine descriptions */ const State = { NOT_CONNECTED: "Not connected", CONNECTING: "Bluetooth device pairing...", DEVICE_PAIRED: "Device paired", SUBSCRIBING: "Bluetooth interfaces connecting...", IDLE: "Idle", BUSY: "Busy", ERROR: "Error", STOPPING: "Closing BT interfaces...", STOPPED: "Stopped", METER_INIT: "Meter connected", METER_INITIALIZING: "Reading meter state..." }; const ResultCode = { FAILED_NO_RETRY: 1, FAILED_SHOULD_RETRY: 2, SUCCESS: 0 }; const MAX_U_GEN = 27.0; // maximum voltage module.exports = {State, CommandType, ResultCode, MAX_U_GEN, ContinuityImpl, ContinuityThresholdOhms};