// Convert byte to Analog Status private void UnMarshall() { for (int i = 0, idx = 0; i < _numBytes; i += 2, idx++) { _status[idx] = SerialMessage.PackWord(_payload, i + 2); } }
public SwitchStatusEvent(LcDataPacket packet) : base(packet) { if (null != packet) { _sw = (SwitchID)packet.Data[0]; _status = SerialMessage.PackWord(packet.Data, 1); } }
public VersionEvent(byte[] Data) : base(CmdIDType.GET_VERSION) { UIMajor = SerialMessage.PackWord(Data, 0); UIMinor = SerialMessage.PackWord(Data, 2); UIBuild = SerialMessage.PackWord(Data, 4); CtlMajor = SerialMessage.PackWord(Data, 6); CtlMinor = SerialMessage.PackWord(Data, 8); CtlBuild = SerialMessage.PackWord(Data, 10); }
public LedDataInfo(byte[] data, int start) { response_Low_mA = (UInt16)SerialMessage.PackWord(data, start); start += 2; response_High_mA = (UInt16)SerialMessage.PackWord(data, start); start += 2; slope = (float)SerialMessage.GetFloat(data, start); start += 4; intercept = (float)SerialMessage.GetFloat(data, start); start += 4; lowCurrent = (UInt16)SerialMessage.PackWord(data, start); start += 2; highCurrent = (UInt16)SerialMessage.PackWord(data, start); start += 2; nomCurrent = (UInt16)SerialMessage.PackWord(data, start); start += 2; }
public VersionEvent(LcDataPacket packet) : base(CmdIDType.GET_VERSION, null) { UIMajor = SerialMessage.PackWord(packet.Data, 0); UIMinor = SerialMessage.PackWord(packet.Data, 2); UIBuild = SerialMessage.PackWord(packet.Data, 4); CtlMajor = SerialMessage.PackWord(packet.Data, 6); CtlMinor = SerialMessage.PackWord(packet.Data, 8); CtlBuild = SerialMessage.PackWord(packet.Data, 10); }
// Convert Analog data to send private void Marshall() { short idx = 0; // Need 2 bytes for each channel _payload = new byte[_numChannels * 2]; foreach (short ch in _status) { SerialMessage.SplitWord(ch, ref _payload, idx); idx += 2; } }
public PatientResult(byte[] data) { int idx = 0; sample_status = (UInt32)SerialMessage.PackDWord(data, idx); idx += 4; // Pb Results[0] = new MeasuredResults(); Results[0].mask = (UInt16)SerialMessage.PackWord(data, idx); idx += 2; Results[0].result = (UInt16)SerialMessage.PackWord(data, idx); idx += 2; // Hgb Results[1] = new MeasuredResults(); Results[1].mask = (UInt16)SerialMessage.PackWord(data, idx); idx += 2; Results[1].result = (UInt16)SerialMessage.PackWord(data, idx); idx += 2; // Hct Results[2] = new MeasuredResults(); Results[2].mask = (UInt16)SerialMessage.PackWord(data, idx); idx += 2; Results[2].result = (UInt16)SerialMessage.PackWord(data, idx); idx += 2; LotCode = Encoding.ASCII.GetString(data, idx, 6); idx += 6; PID = Encoding.ASCII.GetString(data, idx, 20); idx += 20; OID = Encoding.ASCII.GetString(data, idx, 15); idx += 15; HgbMultApplied = data[idx]; idx += 1; DiagFlags = SerialMessage.PackWord(data, idx); idx += 2; timestamp = (int)SerialMessage.PackDWord(data, idx); idx += 4; timeOffsetMins = (Int16)SerialMessage.PackWord(data, idx); idx += 2; crc = (UInt16)SerialMessage.PackWord(data, idx); idx += 2; }
public OpticalCalEvent(LcDataPacket packet) : base(CmdIDType.GET_OPTICAL_CAL, null) { target = (UInt16)SerialMessage.PackWord(packet.Data, 0); int idx = 2; // 8 LED Data Info for (int i = 0; i < 8; i++, idx += 18) { ledData[i] = new LedDataInfo(packet.Data, idx); ledData[i].LED = i; } //idx += 14; CRC = (UInt16)SerialMessage.PackWord(packet.Data, idx); }
public ADCData(byte[] Data) { VDAC2 = SerialMessage.PackWord(Data, 0); TEMP = SerialMessage.PackWord(Data, 2); OPTICAL = SerialMessage.PackWord(Data, 4); IMEAS2 = SerialMessage.PackWord(Data, 6); FBK1 = SerialMessage.PackWord(Data, 8); VDAC1 = SerialMessage.PackWord(Data, 10); IMEAS1 = SerialMessage.PackWord(Data, 12); FBK2 = SerialMessage.PackWord(Data, 14); VDRIVE1 = SerialMessage.PackWord(Data, 16); OPTICAL_DIAG = SerialMessage.PackWord(Data, 18); STRAY = SerialMessage.PackWord(Data, 20); EMPTY = SerialMessage.PackWord(Data, 22); FILLED = SerialMessage.PackWord(Data, 24); }
protected string Flag(ushort mask) { if (SerialMessage.IsBitSet(mask, Constants.RESULT_HIGH_BIT)) { return("High"); } if (SerialMessage.IsBitSet(mask, Constants.RESULT_LOW_BIT)) { return("Low"); } if (SerialMessage.IsBitSet(mask, Constants.RESULT_INCALC_BIT)) { return("InCalc"); } return("None"); }
protected UnitsEnum ToUnits(ushort mask) { if (SerialMessage.IsBitSet(mask, Constants.G_DL_BIT)) { return(UnitsEnum.g_dL); } if (SerialMessage.IsBitSet(mask, Constants.MMOL_L_BIT)) { return(UnitsEnum.mm_L); } if (SerialMessage.IsBitSet(mask, Constants.UG_DL_BIT)) { return(UnitsEnum.ug_dL); } if (SerialMessage.IsBitSet(mask, Constants.PER_EST_BIT)) { return(UnitsEnum.per_est); } if (SerialMessage.IsBitSet(mask, Constants.MG_DL_BIT)) { return(UnitsEnum.mg_dL); } if (SerialMessage.IsBitSet(mask, Constants.NG_ML_BIT)) { return(UnitsEnum.ng_mL); } if (SerialMessage.IsBitSet(mask, Constants.UMOL_L_BIT)) { return(UnitsEnum.umol_L); } if (SerialMessage.IsBitSet(mask, Constants.PMOL_L_BIT)) { return(UnitsEnum.pmol_L); } return(UnitsEnum.None); }
protected string Units(ushort mask) { if (SerialMessage.IsBitSet(mask, Constants.G_DL_BIT)) { return("g/dL"); } if (SerialMessage.IsBitSet(mask, Constants.MMOL_L_BIT)) { return("mmol/L"); } if (SerialMessage.IsBitSet(mask, Constants.UG_DL_BIT)) { return("ug/dL"); } if (SerialMessage.IsBitSet(mask, Constants.PER_EST_BIT)) { return("% est."); } if (SerialMessage.IsBitSet(mask, Constants.MG_DL_BIT)) { return("mg/dL"); } if (SerialMessage.IsBitSet(mask, Constants.NG_ML_BIT)) { return("ng/mL"); } if (SerialMessage.IsBitSet(mask, Constants.UMOL_L_BIT)) { return("umol/L"); } if (SerialMessage.IsBitSet(mask, Constants.PMOL_L_BIT)) { return("pmol/L"); } return("None"); }
protected FlagsEnum ToFlags(ushort mask) { if (SerialMessage.IsBitSet(mask, Constants.RESULT_HIGH_BIT)) { return(FlagsEnum.High); } else if (SerialMessage.IsBitSet(mask, Constants.RESULT_LOW_BIT)) { return(FlagsEnum.Low); } else if (SerialMessage.IsBitSet(mask, Constants.RESULT_INCALC_BIT)) { return(FlagsEnum.Incalc); } else { return(FlagsEnum.None); } }
public EventLog(byte[] data) { int idx = 0; time = (Int32)SerialMessage.PackDWord(data, idx); idx += 4; timeOffsetMins = (Int16)SerialMessage.PackWord(data, idx); idx += 2; eventID = data[idx]; idx += 1; parameter = Encoding.ASCII.GetString(data, idx, 21); idx += 21; result = (UInt16)SerialMessage.PackWord(data, idx); idx += 2; crc = (UInt16)SerialMessage.PackWord(data, idx); }
public MFGLog(byte[] data) { int idx = 0; serialNumber = Encoding.ASCII.GetString(data, idx, 12); idx += 12; numSerialNumberUpdates = (UInt32)SerialMessage.PackDWord(data, idx); idx += 4; UIVerMajor = (UInt16)SerialMessage.PackWord(data, idx); idx += 2; UIVerMinor = (UInt16)SerialMessage.PackWord(data, idx); idx += 2; UIVerBuild = (UInt16)SerialMessage.PackWord(data, idx); idx += 2; numUIFirmwareUpdates = (UInt32)SerialMessage.PackDWord(data, idx); idx += 4; RTVerMajor = (UInt16)SerialMessage.PackWord(data, idx); idx += 2; RTVerMinor = (UInt16)SerialMessage.PackWord(data, idx); idx += 2; RTVerBuild = (UInt16)SerialMessage.PackWord(data, idx); idx += 2; numRTFirmwareUpdates = (UInt32)SerialMessage.PackDWord(data, idx); idx += 4; BT_FirmwareVersion = Encoding.ASCII.GetString(data, idx, 30); idx += 30; masterResetDateTime = (int)SerialMessage.PackDWord(data, idx); idx += 4; numMasterResets = (UInt32)SerialMessage.PackDWord(data, idx); idx += 4; mfgResetDateTime = (int)SerialMessage.PackDWord(data, idx); idx += 4; numMfgResets = (UInt32)SerialMessage.PackDWord(data, idx); idx += 4; numOnTimeMins = (UInt32)SerialMessage.PackDWord(data, idx); idx += 4; numOnTimeMinsSinceMfgReset = (UInt32)SerialMessage.PackDWord(data, idx); idx += 4; // CRC Of Manufacturing Info crc = (UInt16)SerialMessage.PackWord(data, idx); idx += 2; for (int i = 0; i < 25; i++) { events[i] = (UInt32)SerialMessage.PackDWord(data, idx); idx += 4; } totalNonFatalSystemErrors = (UInt32)SerialMessage.PackDWord(data, idx); idx += 4; totalFatalSystemErrors = (UInt32)SerialMessage.PackDWord(data, idx); idx += 4; for (int i = 0; i < 50; i++) { nonFatalErrors[i] = (UInt32)SerialMessage.PackDWord(data, idx); idx += 4; } for (int i = 0; i < 50; i++) { fatalErrors[i] = (UInt32)SerialMessage.PackDWord(data, idx); idx += 4; } // CRC Of Manufacturing Counter Data crc = (UInt16)SerialMessage.PackWord(data, idx); idx += 2; // CRC Of Entire Manufacturing Data Log crc = (UInt16)SerialMessage.PackWord(data, idx); }
public LEDStatusType(byte[] Data) { State = Data[26]; Color = (OpticalLedID)Data[27]; Current = SerialMessage.PackWord(Data, 28); }
public int Marshall(ref byte[] Payload) { ushort idx = 3; // Button Type Payload[idx] = (byte)_Type; idx += 1; //ushort day=5, month=11, year=2015; SerialMessage.SplitWord((ushort)_Expiration.Day, ref Payload, idx); idx += 2; SerialMessage.SplitWord((ushort)_Expiration.Month, ref Payload, idx); idx += 2; SerialMessage.SplitWord((ushort)_Expiration.Year, ref Payload, idx); idx += 2; byte[] ascii = Encoding.ASCII.GetBytes(_LotCode); foreach (Byte b in ascii) { Payload[idx++] = b; } // idx += (short)Constants.LOT_LEN; // 12 SerialMessage.SplitWord(MeasureTime, ref Payload, idx); idx += 2; // target values and ranges // Level 1 SerialMessage.SplitWord(_Pb_Level1_target, ref Payload, idx); idx += 2; SerialMessage.SplitWord(_Pb_Level1_range, ref Payload, idx); idx += 2; // Level2 SerialMessage.SplitWord(_Pb_Level2_target, ref Payload, idx); idx += 2; SerialMessage.SplitWord(_Pb_Level2_range, ref Payload, idx); idx += 2; if (_Type == QCType.QC_PB_HGB) { // Level 1 SerialMessage.SplitWord(_Hgb_Level1_target, ref Payload, idx); idx += 2; SerialMessage.SplitWord(_Hgb_Level1_range, ref Payload, idx); idx += 2; // Level2 SerialMessage.SplitWord(_Hgb_Level2_target, ref Payload, idx); idx += 2; SerialMessage.SplitWord(_Hgb_Level2_range, ref Payload, idx); idx += 2; // Level3 SerialMessage.SplitWord(_Hgb_Level3_target, ref Payload, idx); idx += 2; SerialMessage.SplitWord(_Hgb_Level3_range, ref Payload, idx); idx += 2; } return(idx); } // Marshall()
public POSTLog(byte[] data) { int idx = 0; time = (Int32)SerialMessage.PackDWord(data, idx); idx += 4; timeOffsetMins = (short)SerialMessage.PackWord(data, idx); idx += 2; UIConfig = (short)SerialMessage.PackWord(data, idx); idx += 2; RTConfig = (short)SerialMessage.PackWord(data, idx); idx += 2; temp = (Int16)SerialMessage.PackWord(data, idx); idx += 2; dacaPosRail = (short)SerialMessage.PackWord(data, idx); idx += 2; dacaZero = (short)SerialMessage.PackWord(data, idx); idx += 2; dacaNegRail = (short)SerialMessage.PackWord(data, idx); idx += 2; meas1SingleElectrodePos = (short)SerialMessage.PackWord(data, idx); idx += 2; meas1SingleElectrodeZero = (short)SerialMessage.PackWord(data, idx); idx += 2; meas1SingleElectrodeNeg = (short)SerialMessage.PackWord(data, idx); idx += 2; meas1DummyElectrodeGain3Pos = (short)SerialMessage.PackWord(data, idx); idx += 2; meas1DummyElectrodeGain2Pos = (short)SerialMessage.PackWord(data, idx); idx += 2; meas1DummyElectrodeGain1Pos = (short)SerialMessage.PackWord(data, idx); idx += 2; meas1DummyElectrodeGain0Pos = (short)SerialMessage.PackWord(data, idx); idx += 2; meas1DummyElectrodeGain3Neg = (short)SerialMessage.PackWord(data, idx); idx += 2; meas1DummyElectrodeGain2Neg = (short)SerialMessage.PackWord(data, idx); idx += 2; meas1DummyElectrodeGain1Neg = (short)SerialMessage.PackWord(data, idx); idx += 2; meas1DummyElectrodeGain0Neg = (short)SerialMessage.PackWord(data, idx); idx += 2; opticalOffIntensity = (short)SerialMessage.PackWord(data, idx); idx += 2; opticalCurrentViolet = (short)SerialMessage.PackWord(data, idx); idx += 2; opticalIntensityViolet = (short)SerialMessage.PackWord(data, idx); idx += 2; opticalCurrentBlue = (short)SerialMessage.PackWord(data, idx); idx += 2; opticalIntensityBlue = (short)SerialMessage.PackWord(data, idx); idx += 2; opticalCurrentGreen = (short)SerialMessage.PackWord(data, idx); idx += 2; opticalIntensityGreen = (short)SerialMessage.PackWord(data, idx); idx += 2; opticalCurrentRed = (short)SerialMessage.PackWord(data, idx); idx += 2; opticalIntensityRed = (short)SerialMessage.PackWord(data, idx); idx += 2; opticalCurrentLed4 = (short)SerialMessage.PackWord(data, idx); idx += 2; opticalIntensityLed4 = (short)SerialMessage.PackWord(data, idx); idx += 2; opticalCurrentLed5 = (short)SerialMessage.PackWord(data, idx); idx += 2; opticalIntensityLed5 = (short)SerialMessage.PackWord(data, idx); idx += 2; opticalCurrentLed6 = (short)SerialMessage.PackWord(data, idx); idx += 2; opticalIntensityLed6 = (short)SerialMessage.PackWord(data, idx); idx += 2; opticalCurrentLed7 = (short)SerialMessage.PackWord(data, idx); idx += 2; opticalIntensityLed7 = (short)SerialMessage.PackWord(data, idx); idx += 2; fanSpeed = (short)SerialMessage.PackWord(data, idx); idx += 2; crc = (UInt16)SerialMessage.PackWord(data, idx); }
public ConfigData(byte[] data) { crc = (UInt16)SerialMessage.PackWord(data, 0); settings = (ushort)SerialMessage.PackWord(data, 2); }