public FitDeviceInfo(DeviceInfoMesg msg) { AntDeviceNumber = msg.GetAntDeviceNumber(); AntDeviceType = msg.GetAntDeviceType(); AntNetwork = msg.GetAntNetwork(); AntplusDeviceType = msg.GetAntplusDeviceType(); AntTransmissionType = msg.GetAntTransmissionType(); BatteryStatus = msg.GetBatteryStatus(); BatteryVoltage = msg.GetBatteryVoltage(); CumOperatingTime = FitFile.GetTimeSpan(msg.GetCumOperatingTime()); Descriptor = msg.GetDescriptorAsString(); DeviceIndex = msg.GetDeviceIndex(); DeviceType = msg.GetDeviceType(); FaveroProduct = msg.GetFaveroProduct(); GarminProduct = msg.GetGarminProduct(); HardwareVersion = msg.GetHardwareVersion(); Manufacturer = msg.GetManufacturer(); Product = msg.GetProduct(); ProductName = msg.GetProductNameAsString(); SensorPosition = msg.GetSensorPosition(); SerialNumber = msg.GetSerialNumber(); SoftwareVersion = msg.GetSoftwareVersion(); SourceType = msg.GetSourceType(); Timestamp = FitFile.GetDateTime(msg.GetTimestamp()); }
public static void OnDeviceInfoMesg(object sender, MesgEventArgs e) { DeviceInfoValues values = new DeviceInfoValues(); DeviceInfoMesg mesg = (DeviceInfoMesg)e.mesg; try { values._deviceIndex = mesg.GetDeviceIndex(); values._deviceType = mesg.GetDeviceType(); values._manufacturer = mesg.GetManufacturer(); values._serialNumber = mesg.GetSerialNumber(); values._product = mesg.GetProduct(); values._softwareVersion = mesg.GetSoftwareVersion(); values._batteryVoltage = mesg.GetBatteryVoltage(); values._batteryStatus = mesg.GetBatteryStatus(); values._descriptor = mesg.GetDescriptorAsString(); values._antDeviceNumber = mesg.GetAntDeviceNumber(); values._sourceType = mesg.GetSourceType(); values._productName = mesg.GetProductNameAsString(); //Make sure properties with sub properties arent null before trying to create objects based on them if (mesg.GetTimestamp() != null) { //values.timestamp = new Dynastream.Fit.DateTime(mesg.GetTimestamp().GetTimeStamp()); uint tc = (uint)mesg.GetTimestamp().GetTimeStamp(); values._timestamp = FitConvert.ToLocalDateTime(tc); } } catch (FitException exception) { Console.WriteLine("\tOnFileIDMesg Error {0}", exception.Message); Console.WriteLine("\t{0}", exception.InnerException); } DataManager.Instance.DeviceInfoValues.Add(values); }