コード例 #1
0
 private int sizeOfData_v10(configSettings_v10 configSettings)
 {
     int size = 5; //BikeID, RPM, HR, Power
     size += (configSettings.uuidSend) ? 6 : 0;
     size += (configSettings.versionSend) ? 2 : 0;
     size += (configSettings.intervalSend) ? 7 : 0;
     size += (configSettings.rssiSend) ? 1 : 0;
     size += (configSettings.gearSend) ? 1 : 0;
     return size;
 }
コード例 #2
0
 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);
 }