private void updateRide_v10(configSettings_v10 configSettings, byte[] receivedData, int offset, Rider rider) { byte[] uuid = (configSettings.uuidSend) ? getUUID(receivedData, offset + configSettings.uuidOffset()) : new byte[6]; UInt16 major = Convert.ToUInt16((configSettings.versionSend) ? receivedData[offset + configSettings.majorOffset()] : 0); UInt16 minor = Convert.ToUInt16((configSettings.versionSend) ? receivedData[offset + configSettings.minorOffset()] : 0); UInt16 rpm = Convert.ToUInt16(receivedData[offset + configSettings.rpmOffset()]); UInt16 hr = Convert.ToUInt16(receivedData[offset + configSettings.hrOffset()]); UInt16 power = Convert.ToUInt16(twoByteConcat(receivedData[offset + configSettings.powerOffset()], receivedData[offset + configSettings.powerOffset() + 1])); UInt16 interval = Convert.ToUInt16((configSettings.intervalSend) ? receivedData[offset + configSettings.intervalOffset()] : 0); UInt16 kcal = Convert.ToUInt16((configSettings.intervalSend) ? twoByteConcat(receivedData[offset + configSettings.kcalOffset()], receivedData[offset + configSettings.kcalOffset() + 1]) : 0); UInt16 clock = Convert.ToUInt16((configSettings.intervalSend) ? twoByteConcat(receivedData[offset + configSettings.clockOffset()], receivedData[offset + configSettings.clockOffset() + 1]) : 0); UInt16 trip = Convert.ToUInt16((configSettings.intervalSend) ? twoByteConcat(receivedData[offset + configSettings.tripOffset()], receivedData[offset + configSettings.tripOffset() + 1]) : 0); trip = (UInt16)(trip & (UInt16)32767); Int16 rssi = Convert.ToInt16((configSettings.rssiSend) ? receivedData[offset + configSettings.rssiOffset()] : 0); UInt16 gear = Convert.ToUInt16((configSettings.gearSend) ? receivedData[offset + configSettings.gearOffset()] : 0); rider.update_v10(uuid, major, minor, rpm, hr, power, interval, kcal, clock, trip, rssi, gear); }
private void updateRide_v08(configSettings_v08 configSettings, byte[] receivedData, int offset, Rider rider) { UInt16 rpm = Convert.ToUInt16((configSettings.rpmLong) ? twoByteConcat(receivedData[offset + configSettings.rpmOffset()], receivedData[offset + configSettings.rpmOffset() + 1]) / 10 : receivedData[offset + configSettings.rpmOffset()]); UInt16 hr = Convert.ToUInt16((configSettings.hrLong) ? twoByteConcat(receivedData[offset + configSettings.hrOffset()], receivedData[offset + configSettings.hrOffset() + 1]) / 10 : receivedData[offset + configSettings.hrOffset()]); UInt16 power = twoByteConcat(receivedData[offset + configSettings.powerOffset()], receivedData[offset + configSettings.powerOffset() + 1]); UInt16? kcal = null; if (configSettings.kcalSend) { kcal = twoByteConcat(receivedData[offset + configSettings.kcalOffset()], receivedData[offset + configSettings.kcalOffset() + 1]); } UInt16? clock = null; if (configSettings.clockSend) { clock = twoByteConcat(receivedData[offset + configSettings.clockOffset()], receivedData[offset + configSettings.clockOffset() + 1]); } Int16? rssi = null; if (configSettings.rssiSend) { rssi = Convert.ToInt16((sbyte)receivedData[offset + configSettings.rssiOffset()]); } rider.update_v08(rpm, hr, power, kcal, clock, rssi); }