public void OnMesg(object sender, MesgEventArgs e)
        {
            // Notify any subscribers of either our general mesg event or specific profile mesg event
            if (MesgEvent != null)
            {
                MesgEvent(sender, e);
            }

            switch (e.mesg.Num)
            {
            case (ushort)MesgNum.FileId:
                if (FileIdMesgEvent != null)
                {
                    FileIdMesg    fileIdMesg    = new FileIdMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = fileIdMesg;
                    FileIdMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.FileCreator:
                if (FileCreatorMesgEvent != null)
                {
                    FileCreatorMesg fileCreatorMesg = new FileCreatorMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = fileCreatorMesg;
                    FileCreatorMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.TimestampCorrelation:
                if (TimestampCorrelationMesgEvent != null)
                {
                    TimestampCorrelationMesg timestampCorrelationMesg = new TimestampCorrelationMesg(e.mesg);
                    MesgEventArgs            mesgEventArgs            = new MesgEventArgs();
                    mesgEventArgs.mesg = timestampCorrelationMesg;
                    TimestampCorrelationMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Software:
                if (SoftwareMesgEvent != null)
                {
                    SoftwareMesg  softwareMesg  = new SoftwareMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = softwareMesg;
                    SoftwareMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.SlaveDevice:
                if (SlaveDeviceMesgEvent != null)
                {
                    SlaveDeviceMesg slaveDeviceMesg = new SlaveDeviceMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = slaveDeviceMesg;
                    SlaveDeviceMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Capabilities:
                if (CapabilitiesMesgEvent != null)
                {
                    CapabilitiesMesg capabilitiesMesg = new CapabilitiesMesg(e.mesg);
                    MesgEventArgs    mesgEventArgs    = new MesgEventArgs();
                    mesgEventArgs.mesg = capabilitiesMesg;
                    CapabilitiesMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.FileCapabilities:
                if (FileCapabilitiesMesgEvent != null)
                {
                    FileCapabilitiesMesg fileCapabilitiesMesg = new FileCapabilitiesMesg(e.mesg);
                    MesgEventArgs        mesgEventArgs        = new MesgEventArgs();
                    mesgEventArgs.mesg = fileCapabilitiesMesg;
                    FileCapabilitiesMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.MesgCapabilities:
                if (MesgCapabilitiesMesgEvent != null)
                {
                    MesgCapabilitiesMesg mesgCapabilitiesMesg = new MesgCapabilitiesMesg(e.mesg);
                    MesgEventArgs        mesgEventArgs        = new MesgEventArgs();
                    mesgEventArgs.mesg = mesgCapabilitiesMesg;
                    MesgCapabilitiesMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.FieldCapabilities:
                if (FieldCapabilitiesMesgEvent != null)
                {
                    FieldCapabilitiesMesg fieldCapabilitiesMesg = new FieldCapabilitiesMesg(e.mesg);
                    MesgEventArgs         mesgEventArgs         = new MesgEventArgs();
                    mesgEventArgs.mesg = fieldCapabilitiesMesg;
                    FieldCapabilitiesMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.DeviceSettings:
                if (DeviceSettingsMesgEvent != null)
                {
                    DeviceSettingsMesg deviceSettingsMesg = new DeviceSettingsMesg(e.mesg);
                    MesgEventArgs      mesgEventArgs      = new MesgEventArgs();
                    mesgEventArgs.mesg = deviceSettingsMesg;
                    DeviceSettingsMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.UserProfile:
                if (UserProfileMesgEvent != null)
                {
                    UserProfileMesg userProfileMesg = new UserProfileMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = userProfileMesg;
                    UserProfileMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.HrmProfile:
                if (HrmProfileMesgEvent != null)
                {
                    HrmProfileMesg hrmProfileMesg = new HrmProfileMesg(e.mesg);
                    MesgEventArgs  mesgEventArgs  = new MesgEventArgs();
                    mesgEventArgs.mesg = hrmProfileMesg;
                    HrmProfileMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.SdmProfile:
                if (SdmProfileMesgEvent != null)
                {
                    SdmProfileMesg sdmProfileMesg = new SdmProfileMesg(e.mesg);
                    MesgEventArgs  mesgEventArgs  = new MesgEventArgs();
                    mesgEventArgs.mesg = sdmProfileMesg;
                    SdmProfileMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.BikeProfile:
                if (BikeProfileMesgEvent != null)
                {
                    BikeProfileMesg bikeProfileMesg = new BikeProfileMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = bikeProfileMesg;
                    BikeProfileMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Connectivity:
                if (ConnectivityMesgEvent != null)
                {
                    ConnectivityMesg connectivityMesg = new ConnectivityMesg(e.mesg);
                    MesgEventArgs    mesgEventArgs    = new MesgEventArgs();
                    mesgEventArgs.mesg = connectivityMesg;
                    ConnectivityMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.WatchfaceSettings:
                if (WatchfaceSettingsMesgEvent != null)
                {
                    WatchfaceSettingsMesg watchfaceSettingsMesg = new WatchfaceSettingsMesg(e.mesg);
                    MesgEventArgs         mesgEventArgs         = new MesgEventArgs();
                    mesgEventArgs.mesg = watchfaceSettingsMesg;
                    WatchfaceSettingsMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.OhrSettings:
                if (OhrSettingsMesgEvent != null)
                {
                    OhrSettingsMesg ohrSettingsMesg = new OhrSettingsMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = ohrSettingsMesg;
                    OhrSettingsMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.ZonesTarget:
                if (ZonesTargetMesgEvent != null)
                {
                    ZonesTargetMesg zonesTargetMesg = new ZonesTargetMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = zonesTargetMesg;
                    ZonesTargetMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Sport:
                if (SportMesgEvent != null)
                {
                    SportMesg     sportMesg     = new SportMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = sportMesg;
                    SportMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.HrZone:
                if (HrZoneMesgEvent != null)
                {
                    HrZoneMesg    hrZoneMesg    = new HrZoneMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = hrZoneMesg;
                    HrZoneMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.SpeedZone:
                if (SpeedZoneMesgEvent != null)
                {
                    SpeedZoneMesg speedZoneMesg = new SpeedZoneMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = speedZoneMesg;
                    SpeedZoneMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.CadenceZone:
                if (CadenceZoneMesgEvent != null)
                {
                    CadenceZoneMesg cadenceZoneMesg = new CadenceZoneMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = cadenceZoneMesg;
                    CadenceZoneMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.PowerZone:
                if (PowerZoneMesgEvent != null)
                {
                    PowerZoneMesg powerZoneMesg = new PowerZoneMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = powerZoneMesg;
                    PowerZoneMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.MetZone:
                if (MetZoneMesgEvent != null)
                {
                    MetZoneMesg   metZoneMesg   = new MetZoneMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = metZoneMesg;
                    MetZoneMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.DiveSettings:
                if (DiveSettingsMesgEvent != null)
                {
                    DiveSettingsMesg diveSettingsMesg = new DiveSettingsMesg(e.mesg);
                    MesgEventArgs    mesgEventArgs    = new MesgEventArgs();
                    mesgEventArgs.mesg = diveSettingsMesg;
                    DiveSettingsMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.DiveAlarm:
                if (DiveAlarmMesgEvent != null)
                {
                    DiveAlarmMesg diveAlarmMesg = new DiveAlarmMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = diveAlarmMesg;
                    DiveAlarmMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.DiveGas:
                if (DiveGasMesgEvent != null)
                {
                    DiveGasMesg   diveGasMesg   = new DiveGasMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = diveGasMesg;
                    DiveGasMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Goal:
                if (GoalMesgEvent != null)
                {
                    GoalMesg      goalMesg      = new GoalMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = goalMesg;
                    GoalMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Activity:
                if (ActivityMesgEvent != null)
                {
                    ActivityMesg  activityMesg  = new ActivityMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = activityMesg;
                    ActivityMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Session:
                if (SessionMesgEvent != null)
                {
                    SessionMesg   sessionMesg   = new SessionMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = sessionMesg;
                    SessionMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Lap:
                if (LapMesgEvent != null)
                {
                    LapMesg       lapMesg       = new LapMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = lapMesg;
                    LapMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Length:
                if (LengthMesgEvent != null)
                {
                    LengthMesg    lengthMesg    = new LengthMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = lengthMesg;
                    LengthMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Record:
                if (RecordMesgEvent != null)
                {
                    RecordMesg    recordMesg    = new RecordMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = recordMesg;
                    RecordMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Event:
                if (EventMesgEvent != null)
                {
                    EventMesg     eventMesg     = new EventMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = eventMesg;
                    EventMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.DeviceInfo:
                if (DeviceInfoMesgEvent != null)
                {
                    DeviceInfoMesg deviceInfoMesg = new DeviceInfoMesg(e.mesg);
                    MesgEventArgs  mesgEventArgs  = new MesgEventArgs();
                    mesgEventArgs.mesg = deviceInfoMesg;
                    DeviceInfoMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.TrainingFile:
                if (TrainingFileMesgEvent != null)
                {
                    TrainingFileMesg trainingFileMesg = new TrainingFileMesg(e.mesg);
                    MesgEventArgs    mesgEventArgs    = new MesgEventArgs();
                    mesgEventArgs.mesg = trainingFileMesg;
                    TrainingFileMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Hrv:
                if (HrvMesgEvent != null)
                {
                    HrvMesg       hrvMesg       = new HrvMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = hrvMesg;
                    HrvMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.WeatherConditions:
                if (WeatherConditionsMesgEvent != null)
                {
                    WeatherConditionsMesg weatherConditionsMesg = new WeatherConditionsMesg(e.mesg);
                    MesgEventArgs         mesgEventArgs         = new MesgEventArgs();
                    mesgEventArgs.mesg = weatherConditionsMesg;
                    WeatherConditionsMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.WeatherAlert:
                if (WeatherAlertMesgEvent != null)
                {
                    WeatherAlertMesg weatherAlertMesg = new WeatherAlertMesg(e.mesg);
                    MesgEventArgs    mesgEventArgs    = new MesgEventArgs();
                    mesgEventArgs.mesg = weatherAlertMesg;
                    WeatherAlertMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.GpsMetadata:
                if (GpsMetadataMesgEvent != null)
                {
                    GpsMetadataMesg gpsMetadataMesg = new GpsMetadataMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = gpsMetadataMesg;
                    GpsMetadataMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.CameraEvent:
                if (CameraEventMesgEvent != null)
                {
                    CameraEventMesg cameraEventMesg = new CameraEventMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = cameraEventMesg;
                    CameraEventMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.GyroscopeData:
                if (GyroscopeDataMesgEvent != null)
                {
                    GyroscopeDataMesg gyroscopeDataMesg = new GyroscopeDataMesg(e.mesg);
                    MesgEventArgs     mesgEventArgs     = new MesgEventArgs();
                    mesgEventArgs.mesg = gyroscopeDataMesg;
                    GyroscopeDataMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.AccelerometerData:
                if (AccelerometerDataMesgEvent != null)
                {
                    AccelerometerDataMesg accelerometerDataMesg = new AccelerometerDataMesg(e.mesg);
                    MesgEventArgs         mesgEventArgs         = new MesgEventArgs();
                    mesgEventArgs.mesg = accelerometerDataMesg;
                    AccelerometerDataMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.MagnetometerData:
                if (MagnetometerDataMesgEvent != null)
                {
                    MagnetometerDataMesg magnetometerDataMesg = new MagnetometerDataMesg(e.mesg);
                    MesgEventArgs        mesgEventArgs        = new MesgEventArgs();
                    mesgEventArgs.mesg = magnetometerDataMesg;
                    MagnetometerDataMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.BarometerData:
                if (BarometerDataMesgEvent != null)
                {
                    BarometerDataMesg barometerDataMesg = new BarometerDataMesg(e.mesg);
                    MesgEventArgs     mesgEventArgs     = new MesgEventArgs();
                    mesgEventArgs.mesg = barometerDataMesg;
                    BarometerDataMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.ThreeDSensorCalibration:
                if (ThreeDSensorCalibrationMesgEvent != null)
                {
                    ThreeDSensorCalibrationMesg threeDSensorCalibrationMesg = new ThreeDSensorCalibrationMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = threeDSensorCalibrationMesg;
                    ThreeDSensorCalibrationMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.OneDSensorCalibration:
                if (OneDSensorCalibrationMesgEvent != null)
                {
                    OneDSensorCalibrationMesg oneDSensorCalibrationMesg = new OneDSensorCalibrationMesg(e.mesg);
                    MesgEventArgs             mesgEventArgs             = new MesgEventArgs();
                    mesgEventArgs.mesg = oneDSensorCalibrationMesg;
                    OneDSensorCalibrationMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.VideoFrame:
                if (VideoFrameMesgEvent != null)
                {
                    VideoFrameMesg videoFrameMesg = new VideoFrameMesg(e.mesg);
                    MesgEventArgs  mesgEventArgs  = new MesgEventArgs();
                    mesgEventArgs.mesg = videoFrameMesg;
                    VideoFrameMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.ObdiiData:
                if (ObdiiDataMesgEvent != null)
                {
                    ObdiiDataMesg obdiiDataMesg = new ObdiiDataMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = obdiiDataMesg;
                    ObdiiDataMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.NmeaSentence:
                if (NmeaSentenceMesgEvent != null)
                {
                    NmeaSentenceMesg nmeaSentenceMesg = new NmeaSentenceMesg(e.mesg);
                    MesgEventArgs    mesgEventArgs    = new MesgEventArgs();
                    mesgEventArgs.mesg = nmeaSentenceMesg;
                    NmeaSentenceMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.AviationAttitude:
                if (AviationAttitudeMesgEvent != null)
                {
                    AviationAttitudeMesg aviationAttitudeMesg = new AviationAttitudeMesg(e.mesg);
                    MesgEventArgs        mesgEventArgs        = new MesgEventArgs();
                    mesgEventArgs.mesg = aviationAttitudeMesg;
                    AviationAttitudeMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Video:
                if (VideoMesgEvent != null)
                {
                    VideoMesg     videoMesg     = new VideoMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = videoMesg;
                    VideoMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.VideoTitle:
                if (VideoTitleMesgEvent != null)
                {
                    VideoTitleMesg videoTitleMesg = new VideoTitleMesg(e.mesg);
                    MesgEventArgs  mesgEventArgs  = new MesgEventArgs();
                    mesgEventArgs.mesg = videoTitleMesg;
                    VideoTitleMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.VideoDescription:
                if (VideoDescriptionMesgEvent != null)
                {
                    VideoDescriptionMesg videoDescriptionMesg = new VideoDescriptionMesg(e.mesg);
                    MesgEventArgs        mesgEventArgs        = new MesgEventArgs();
                    mesgEventArgs.mesg = videoDescriptionMesg;
                    VideoDescriptionMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.VideoClip:
                if (VideoClipMesgEvent != null)
                {
                    VideoClipMesg videoClipMesg = new VideoClipMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = videoClipMesg;
                    VideoClipMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Set:
                if (SetMesgEvent != null)
                {
                    SetMesg       setMesg       = new SetMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = setMesg;
                    SetMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Jump:
                if (JumpMesgEvent != null)
                {
                    JumpMesg      jumpMesg      = new JumpMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = jumpMesg;
                    JumpMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Course:
                if (CourseMesgEvent != null)
                {
                    CourseMesg    courseMesg    = new CourseMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = courseMesg;
                    CourseMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.CoursePoint:
                if (CoursePointMesgEvent != null)
                {
                    CoursePointMesg coursePointMesg = new CoursePointMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = coursePointMesg;
                    CoursePointMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.SegmentId:
                if (SegmentIdMesgEvent != null)
                {
                    SegmentIdMesg segmentIdMesg = new SegmentIdMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = segmentIdMesg;
                    SegmentIdMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.SegmentLeaderboardEntry:
                if (SegmentLeaderboardEntryMesgEvent != null)
                {
                    SegmentLeaderboardEntryMesg segmentLeaderboardEntryMesg = new SegmentLeaderboardEntryMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = segmentLeaderboardEntryMesg;
                    SegmentLeaderboardEntryMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.SegmentPoint:
                if (SegmentPointMesgEvent != null)
                {
                    SegmentPointMesg segmentPointMesg = new SegmentPointMesg(e.mesg);
                    MesgEventArgs    mesgEventArgs    = new MesgEventArgs();
                    mesgEventArgs.mesg = segmentPointMesg;
                    SegmentPointMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.SegmentLap:
                if (SegmentLapMesgEvent != null)
                {
                    SegmentLapMesg segmentLapMesg = new SegmentLapMesg(e.mesg);
                    MesgEventArgs  mesgEventArgs  = new MesgEventArgs();
                    mesgEventArgs.mesg = segmentLapMesg;
                    SegmentLapMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.SegmentFile:
                if (SegmentFileMesgEvent != null)
                {
                    SegmentFileMesg segmentFileMesg = new SegmentFileMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = segmentFileMesg;
                    SegmentFileMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Workout:
                if (WorkoutMesgEvent != null)
                {
                    WorkoutMesg   workoutMesg   = new WorkoutMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = workoutMesg;
                    WorkoutMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.WorkoutSession:
                if (WorkoutSessionMesgEvent != null)
                {
                    WorkoutSessionMesg workoutSessionMesg = new WorkoutSessionMesg(e.mesg);
                    MesgEventArgs      mesgEventArgs      = new MesgEventArgs();
                    mesgEventArgs.mesg = workoutSessionMesg;
                    WorkoutSessionMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.WorkoutStep:
                if (WorkoutStepMesgEvent != null)
                {
                    WorkoutStepMesg workoutStepMesg = new WorkoutStepMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = workoutStepMesg;
                    WorkoutStepMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.ExerciseTitle:
                if (ExerciseTitleMesgEvent != null)
                {
                    ExerciseTitleMesg exerciseTitleMesg = new ExerciseTitleMesg(e.mesg);
                    MesgEventArgs     mesgEventArgs     = new MesgEventArgs();
                    mesgEventArgs.mesg = exerciseTitleMesg;
                    ExerciseTitleMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Schedule:
                if (ScheduleMesgEvent != null)
                {
                    ScheduleMesg  scheduleMesg  = new ScheduleMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = scheduleMesg;
                    ScheduleMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Totals:
                if (TotalsMesgEvent != null)
                {
                    TotalsMesg    totalsMesg    = new TotalsMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = totalsMesg;
                    TotalsMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.WeightScale:
                if (WeightScaleMesgEvent != null)
                {
                    WeightScaleMesg weightScaleMesg = new WeightScaleMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = weightScaleMesg;
                    WeightScaleMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.BloodPressure:
                if (BloodPressureMesgEvent != null)
                {
                    BloodPressureMesg bloodPressureMesg = new BloodPressureMesg(e.mesg);
                    MesgEventArgs     mesgEventArgs     = new MesgEventArgs();
                    mesgEventArgs.mesg = bloodPressureMesg;
                    BloodPressureMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.MonitoringInfo:
                if (MonitoringInfoMesgEvent != null)
                {
                    MonitoringInfoMesg monitoringInfoMesg = new MonitoringInfoMesg(e.mesg);
                    MesgEventArgs      mesgEventArgs      = new MesgEventArgs();
                    mesgEventArgs.mesg = monitoringInfoMesg;
                    MonitoringInfoMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Monitoring:
                if (MonitoringMesgEvent != null)
                {
                    MonitoringMesg monitoringMesg = new MonitoringMesg(e.mesg);
                    MesgEventArgs  mesgEventArgs  = new MesgEventArgs();
                    mesgEventArgs.mesg = monitoringMesg;
                    MonitoringMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Hr:
                if (HrMesgEvent != null)
                {
                    HrMesg        hrMesg        = new HrMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = hrMesg;
                    HrMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.StressLevel:
                if (StressLevelMesgEvent != null)
                {
                    StressLevelMesg stressLevelMesg = new StressLevelMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = stressLevelMesg;
                    StressLevelMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.MemoGlob:
                if (MemoGlobMesgEvent != null)
                {
                    MemoGlobMesg  memoGlobMesg  = new MemoGlobMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = memoGlobMesg;
                    MemoGlobMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.AntChannelId:
                if (AntChannelIdMesgEvent != null)
                {
                    AntChannelIdMesg antChannelIdMesg = new AntChannelIdMesg(e.mesg);
                    MesgEventArgs    mesgEventArgs    = new MesgEventArgs();
                    mesgEventArgs.mesg = antChannelIdMesg;
                    AntChannelIdMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.AntRx:
                if (AntRxMesgEvent != null)
                {
                    AntRxMesg     antRxMesg     = new AntRxMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = antRxMesg;
                    AntRxMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.AntTx:
                if (AntTxMesgEvent != null)
                {
                    AntTxMesg     antTxMesg     = new AntTxMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = antTxMesg;
                    AntTxMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.ExdScreenConfiguration:
                if (ExdScreenConfigurationMesgEvent != null)
                {
                    ExdScreenConfigurationMesg exdScreenConfigurationMesg = new ExdScreenConfigurationMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = exdScreenConfigurationMesg;
                    ExdScreenConfigurationMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.ExdDataFieldConfiguration:
                if (ExdDataFieldConfigurationMesgEvent != null)
                {
                    ExdDataFieldConfigurationMesg exdDataFieldConfigurationMesg = new ExdDataFieldConfigurationMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = exdDataFieldConfigurationMesg;
                    ExdDataFieldConfigurationMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.ExdDataConceptConfiguration:
                if (ExdDataConceptConfigurationMesgEvent != null)
                {
                    ExdDataConceptConfigurationMesg exdDataConceptConfigurationMesg = new ExdDataConceptConfigurationMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = exdDataConceptConfigurationMesg;
                    ExdDataConceptConfigurationMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.FieldDescription:
                if (FieldDescriptionMesgEvent != null)
                {
                    FieldDescriptionMesg fieldDescriptionMesg = new FieldDescriptionMesg(e.mesg);
                    MesgEventArgs        mesgEventArgs        = new MesgEventArgs();
                    mesgEventArgs.mesg = fieldDescriptionMesg;
                    FieldDescriptionMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.DeveloperDataId:
                if (DeveloperDataIdMesgEvent != null)
                {
                    DeveloperDataIdMesg developerDataIdMesg = new DeveloperDataIdMesg(e.mesg);
                    MesgEventArgs       mesgEventArgs       = new MesgEventArgs();
                    mesgEventArgs.mesg = developerDataIdMesg;
                    DeveloperDataIdMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.DiveSummary:
                if (DiveSummaryMesgEvent != null)
                {
                    DiveSummaryMesg diveSummaryMesg = new DiveSummaryMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = diveSummaryMesg;
                    DiveSummaryMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.ClimbPro:
                if (ClimbProMesgEvent != null)
                {
                    ClimbProMesg  climbProMesg  = new ClimbProMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = climbProMesg;
                    ClimbProMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Pad:
                if (PadMesgEvent != null)
                {
                    PadMesg       padMesg       = new PadMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = padMesg;
                    PadMesgEvent(sender, mesgEventArgs);
                }
                break;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Demonstrate the encoding of a 'Settings File' by writing a 'Settings File' containing a 'User Profile' Message.
        /// This example is simpler than the 'Monitoring File' example.
        /// </summary>
        static void EncodeSettingsFile()
        {
            // Generate some FIT messages
             FileIdMesg fileIdMesg = new FileIdMesg(); // Every FIT file MUST contain a 'File ID' message as the first message
             fileIdMesg.SetType(Dynastream.Fit.File.Settings);
             fileIdMesg.SetManufacturer(Manufacturer.Dynastream);  // Types defined in the profile are available
             fileIdMesg.SetProduct(1000);
             fileIdMesg.SetSerialNumber(12345);

             UserProfileMesg myUserProfile = new UserProfileMesg();
             myUserProfile.SetGender(Gender.Female);
             float myWeight = 63.1F;
             myUserProfile.SetWeight(myWeight);
             myUserProfile.SetAge(99);
             myUserProfile.SetFriendlyName(Encoding.UTF8.GetBytes("TestUser"));

             FileStream fitDest = new FileStream("ExampleSettings.fit", FileMode.Create, FileAccess.ReadWrite, FileShare.Read);

             // Create file encode object
             Encode encodeDemo = new Encode();

             // Write our header
             encodeDemo.Open(fitDest);

             // Encode each message, a definition message is automatically generated and output if necessary
             encodeDemo.Write(fileIdMesg);
             encodeDemo.Write(myUserProfile);

             // Update header datasize and file CRC
             encodeDemo.Close();
             fitDest.Close();

             Console.WriteLine("Encoded FIT file ExampleSettings.fit");
             return;
        }
Ejemplo n.º 3
0
        public void OnMesg(object sender, MesgEventArgs e)
        {
            // Notify any subscribers of either our general mesg event or specific profile mesg event
            if (MesgEvent != null)
            {
                MesgEvent(sender, e);
            }

            switch (e.mesg.Num)
            {
            case (ushort)MesgNum.FileId:
                if (FileIdMesgEvent != null)
                {
                    FileIdMesg    fileIdMesg    = new FileIdMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = fileIdMesg;
                    FileIdMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.FileCreator:
                if (FileCreatorMesgEvent != null)
                {
                    FileCreatorMesg fileCreatorMesg = new FileCreatorMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = fileCreatorMesg;
                    FileCreatorMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Software:
                if (SoftwareMesgEvent != null)
                {
                    SoftwareMesg  softwareMesg  = new SoftwareMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = softwareMesg;
                    SoftwareMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.SlaveDevice:
                if (SlaveDeviceMesgEvent != null)
                {
                    SlaveDeviceMesg slaveDeviceMesg = new SlaveDeviceMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = slaveDeviceMesg;
                    SlaveDeviceMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Capabilities:
                if (CapabilitiesMesgEvent != null)
                {
                    CapabilitiesMesg capabilitiesMesg = new CapabilitiesMesg(e.mesg);
                    MesgEventArgs    mesgEventArgs    = new MesgEventArgs();
                    mesgEventArgs.mesg = capabilitiesMesg;
                    CapabilitiesMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.FileCapabilities:
                if (FileCapabilitiesMesgEvent != null)
                {
                    FileCapabilitiesMesg fileCapabilitiesMesg = new FileCapabilitiesMesg(e.mesg);
                    MesgEventArgs        mesgEventArgs        = new MesgEventArgs();
                    mesgEventArgs.mesg = fileCapabilitiesMesg;
                    FileCapabilitiesMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.MesgCapabilities:
                if (MesgCapabilitiesMesgEvent != null)
                {
                    MesgCapabilitiesMesg mesgCapabilitiesMesg = new MesgCapabilitiesMesg(e.mesg);
                    MesgEventArgs        mesgEventArgs        = new MesgEventArgs();
                    mesgEventArgs.mesg = mesgCapabilitiesMesg;
                    MesgCapabilitiesMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.FieldCapabilities:
                if (FieldCapabilitiesMesgEvent != null)
                {
                    FieldCapabilitiesMesg fieldCapabilitiesMesg = new FieldCapabilitiesMesg(e.mesg);
                    MesgEventArgs         mesgEventArgs         = new MesgEventArgs();
                    mesgEventArgs.mesg = fieldCapabilitiesMesg;
                    FieldCapabilitiesMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.DeviceSettings:
                if (DeviceSettingsMesgEvent != null)
                {
                    DeviceSettingsMesg deviceSettingsMesg = new DeviceSettingsMesg(e.mesg);
                    MesgEventArgs      mesgEventArgs      = new MesgEventArgs();
                    mesgEventArgs.mesg = deviceSettingsMesg;
                    DeviceSettingsMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.UserProfile:
                if (UserProfileMesgEvent != null)
                {
                    UserProfileMesg userProfileMesg = new UserProfileMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = userProfileMesg;
                    UserProfileMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.HrmProfile:
                if (HrmProfileMesgEvent != null)
                {
                    HrmProfileMesg hrmProfileMesg = new HrmProfileMesg(e.mesg);
                    MesgEventArgs  mesgEventArgs  = new MesgEventArgs();
                    mesgEventArgs.mesg = hrmProfileMesg;
                    HrmProfileMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.SdmProfile:
                if (SdmProfileMesgEvent != null)
                {
                    SdmProfileMesg sdmProfileMesg = new SdmProfileMesg(e.mesg);
                    MesgEventArgs  mesgEventArgs  = new MesgEventArgs();
                    mesgEventArgs.mesg = sdmProfileMesg;
                    SdmProfileMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.BikeProfile:
                if (BikeProfileMesgEvent != null)
                {
                    BikeProfileMesg bikeProfileMesg = new BikeProfileMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = bikeProfileMesg;
                    BikeProfileMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.ZonesTarget:
                if (ZonesTargetMesgEvent != null)
                {
                    ZonesTargetMesg zonesTargetMesg = new ZonesTargetMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = zonesTargetMesg;
                    ZonesTargetMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Sport:
                if (SportMesgEvent != null)
                {
                    SportMesg     sportMesg     = new SportMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = sportMesg;
                    SportMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.HrZone:
                if (HrZoneMesgEvent != null)
                {
                    HrZoneMesg    hrZoneMesg    = new HrZoneMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = hrZoneMesg;
                    HrZoneMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.SpeedZone:
                if (SpeedZoneMesgEvent != null)
                {
                    SpeedZoneMesg speedZoneMesg = new SpeedZoneMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = speedZoneMesg;
                    SpeedZoneMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.CadenceZone:
                if (CadenceZoneMesgEvent != null)
                {
                    CadenceZoneMesg cadenceZoneMesg = new CadenceZoneMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = cadenceZoneMesg;
                    CadenceZoneMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.PowerZone:
                if (PowerZoneMesgEvent != null)
                {
                    PowerZoneMesg powerZoneMesg = new PowerZoneMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = powerZoneMesg;
                    PowerZoneMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.MetZone:
                if (MetZoneMesgEvent != null)
                {
                    MetZoneMesg   metZoneMesg   = new MetZoneMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = metZoneMesg;
                    MetZoneMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Goal:
                if (GoalMesgEvent != null)
                {
                    GoalMesg      goalMesg      = new GoalMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = goalMesg;
                    GoalMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Activity:
                if (ActivityMesgEvent != null)
                {
                    ActivityMesg  activityMesg  = new ActivityMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = activityMesg;
                    ActivityMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Session:
                if (SessionMesgEvent != null)
                {
                    SessionMesg   sessionMesg   = new SessionMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = sessionMesg;
                    SessionMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Lap:
                if (LapMesgEvent != null)
                {
                    LapMesg       lapMesg       = new LapMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = lapMesg;
                    LapMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Length:
                if (LengthMesgEvent != null)
                {
                    LengthMesg    lengthMesg    = new LengthMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = lengthMesg;
                    LengthMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Record:
                if (RecordMesgEvent != null)
                {
                    RecordMesg    recordMesg    = new RecordMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = recordMesg;
                    RecordMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Event:
                if (EventMesgEvent != null)
                {
                    EventMesg     eventMesg     = new EventMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = eventMesg;
                    EventMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.DeviceInfo:
                if (DeviceInfoMesgEvent != null)
                {
                    DeviceInfoMesg deviceInfoMesg = new DeviceInfoMesg(e.mesg);
                    MesgEventArgs  mesgEventArgs  = new MesgEventArgs();
                    mesgEventArgs.mesg = deviceInfoMesg;
                    DeviceInfoMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Hrv:
                if (HrvMesgEvent != null)
                {
                    HrvMesg       hrvMesg       = new HrvMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = hrvMesg;
                    HrvMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Course:
                if (CourseMesgEvent != null)
                {
                    CourseMesg    courseMesg    = new CourseMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = courseMesg;
                    CourseMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.CoursePoint:
                if (CoursePointMesgEvent != null)
                {
                    CoursePointMesg coursePointMesg = new CoursePointMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = coursePointMesg;
                    CoursePointMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Workout:
                if (WorkoutMesgEvent != null)
                {
                    WorkoutMesg   workoutMesg   = new WorkoutMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = workoutMesg;
                    WorkoutMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.WorkoutStep:
                if (WorkoutStepMesgEvent != null)
                {
                    WorkoutStepMesg workoutStepMesg = new WorkoutStepMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = workoutStepMesg;
                    WorkoutStepMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Schedule:
                if (ScheduleMesgEvent != null)
                {
                    ScheduleMesg  scheduleMesg  = new ScheduleMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = scheduleMesg;
                    ScheduleMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Totals:
                if (TotalsMesgEvent != null)
                {
                    TotalsMesg    totalsMesg    = new TotalsMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = totalsMesg;
                    TotalsMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.WeightScale:
                if (WeightScaleMesgEvent != null)
                {
                    WeightScaleMesg weightScaleMesg = new WeightScaleMesg(e.mesg);
                    MesgEventArgs   mesgEventArgs   = new MesgEventArgs();
                    mesgEventArgs.mesg = weightScaleMesg;
                    WeightScaleMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.BloodPressure:
                if (BloodPressureMesgEvent != null)
                {
                    BloodPressureMesg bloodPressureMesg = new BloodPressureMesg(e.mesg);
                    MesgEventArgs     mesgEventArgs     = new MesgEventArgs();
                    mesgEventArgs.mesg = bloodPressureMesg;
                    BloodPressureMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.MonitoringInfo:
                if (MonitoringInfoMesgEvent != null)
                {
                    MonitoringInfoMesg monitoringInfoMesg = new MonitoringInfoMesg(e.mesg);
                    MesgEventArgs      mesgEventArgs      = new MesgEventArgs();
                    mesgEventArgs.mesg = monitoringInfoMesg;
                    MonitoringInfoMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Monitoring:
                if (MonitoringMesgEvent != null)
                {
                    MonitoringMesg monitoringMesg = new MonitoringMesg(e.mesg);
                    MesgEventArgs  mesgEventArgs  = new MesgEventArgs();
                    mesgEventArgs.mesg = monitoringMesg;
                    MonitoringMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.MemoGlob:
                if (MemoGlobMesgEvent != null)
                {
                    MemoGlobMesg  memoGlobMesg  = new MemoGlobMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = memoGlobMesg;
                    MemoGlobMesgEvent(sender, mesgEventArgs);
                }
                break;

            case (ushort)MesgNum.Pad:
                if (PadMesgEvent != null)
                {
                    PadMesg       padMesg       = new PadMesg(e.mesg);
                    MesgEventArgs mesgEventArgs = new MesgEventArgs();
                    mesgEventArgs.mesg = padMesg;
                    PadMesgEvent(sender, mesgEventArgs);
                }
                break;
            }
        }
Ejemplo n.º 4
0
        public void OnMesg(object sender, MesgEventArgs e)
        {
            // Notify any subscribers of either our general mesg event or specific profile mesg event
             if (MesgEvent != null)
             {
            MesgEvent(sender, e);
             }

             switch (e.mesg.Num)
             {
            case (ushort)MesgNum.FileId:
               if (FileIdMesgEvent != null)
               {
                  FileIdMesg fileIdMesg = new FileIdMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = fileIdMesg;
                  FileIdMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.FileCreator:
               if (FileCreatorMesgEvent != null)
               {
                  FileCreatorMesg fileCreatorMesg = new FileCreatorMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = fileCreatorMesg;
                  FileCreatorMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.Software:
               if (SoftwareMesgEvent != null)
               {
                  SoftwareMesg softwareMesg = new SoftwareMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = softwareMesg;
                  SoftwareMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.SlaveDevice:
               if (SlaveDeviceMesgEvent != null)
               {
                  SlaveDeviceMesg slaveDeviceMesg = new SlaveDeviceMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = slaveDeviceMesg;
                  SlaveDeviceMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.Capabilities:
               if (CapabilitiesMesgEvent != null)
               {
                  CapabilitiesMesg capabilitiesMesg = new CapabilitiesMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = capabilitiesMesg;
                  CapabilitiesMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.FileCapabilities:
               if (FileCapabilitiesMesgEvent != null)
               {
                  FileCapabilitiesMesg fileCapabilitiesMesg = new FileCapabilitiesMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = fileCapabilitiesMesg;
                  FileCapabilitiesMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.MesgCapabilities:
               if (MesgCapabilitiesMesgEvent != null)
               {
                  MesgCapabilitiesMesg mesgCapabilitiesMesg = new MesgCapabilitiesMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = mesgCapabilitiesMesg;
                  MesgCapabilitiesMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.FieldCapabilities:
               if (FieldCapabilitiesMesgEvent != null)
               {
                  FieldCapabilitiesMesg fieldCapabilitiesMesg = new FieldCapabilitiesMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = fieldCapabilitiesMesg;
                  FieldCapabilitiesMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.DeviceSettings:
               if (DeviceSettingsMesgEvent != null)
               {
                  DeviceSettingsMesg deviceSettingsMesg = new DeviceSettingsMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = deviceSettingsMesg;
                  DeviceSettingsMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.UserProfile:
               if (UserProfileMesgEvent != null)
               {
                  UserProfileMesg userProfileMesg = new UserProfileMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = userProfileMesg;
                  UserProfileMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.HrmProfile:
               if (HrmProfileMesgEvent != null)
               {
                  HrmProfileMesg hrmProfileMesg = new HrmProfileMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = hrmProfileMesg;
                  HrmProfileMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.SdmProfile:
               if (SdmProfileMesgEvent != null)
               {
                  SdmProfileMesg sdmProfileMesg = new SdmProfileMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = sdmProfileMesg;
                  SdmProfileMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.BikeProfile:
               if (BikeProfileMesgEvent != null)
               {
                  BikeProfileMesg bikeProfileMesg = new BikeProfileMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = bikeProfileMesg;
                  BikeProfileMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.ZonesTarget:
               if (ZonesTargetMesgEvent != null)
               {
                  ZonesTargetMesg zonesTargetMesg = new ZonesTargetMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = zonesTargetMesg;
                  ZonesTargetMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.Sport:
               if (SportMesgEvent != null)
               {
                  SportMesg sportMesg = new SportMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = sportMesg;
                  SportMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.HrZone:
               if (HrZoneMesgEvent != null)
               {
                  HrZoneMesg hrZoneMesg = new HrZoneMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = hrZoneMesg;
                  HrZoneMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.SpeedZone:
               if (SpeedZoneMesgEvent != null)
               {
                  SpeedZoneMesg speedZoneMesg = new SpeedZoneMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = speedZoneMesg;
                  SpeedZoneMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.CadenceZone:
               if (CadenceZoneMesgEvent != null)
               {
                  CadenceZoneMesg cadenceZoneMesg = new CadenceZoneMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = cadenceZoneMesg;
                  CadenceZoneMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.PowerZone:
               if (PowerZoneMesgEvent != null)
               {
                  PowerZoneMesg powerZoneMesg = new PowerZoneMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = powerZoneMesg;
                  PowerZoneMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.MetZone:
               if (MetZoneMesgEvent != null)
               {
                  MetZoneMesg metZoneMesg = new MetZoneMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = metZoneMesg;
                  MetZoneMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.Goal:
               if (GoalMesgEvent != null)
               {
                  GoalMesg goalMesg = new GoalMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = goalMesg;
                  GoalMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.Activity:
               if (ActivityMesgEvent != null)
               {
                  ActivityMesg activityMesg = new ActivityMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = activityMesg;
                  ActivityMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.Session:
               if (SessionMesgEvent != null)
               {
                  SessionMesg sessionMesg = new SessionMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = sessionMesg;
                  SessionMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.Lap:
               if (LapMesgEvent != null)
               {
                  LapMesg lapMesg = new LapMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = lapMesg;
                  LapMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.Length:
               if (LengthMesgEvent != null)
               {
                  LengthMesg lengthMesg = new LengthMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = lengthMesg;
                  LengthMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.Record:
               if (RecordMesgEvent != null)
               {
                  RecordMesg recordMesg = new RecordMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = recordMesg;
                  RecordMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.Event:
               if (EventMesgEvent != null)
               {
                  EventMesg eventMesg = new EventMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = eventMesg;
                  EventMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.DeviceInfo:
               if (DeviceInfoMesgEvent != null)
               {
                  DeviceInfoMesg deviceInfoMesg = new DeviceInfoMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = deviceInfoMesg;
                  DeviceInfoMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.Hrv:
               if (HrvMesgEvent != null)
               {
                  HrvMesg hrvMesg = new HrvMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = hrvMesg;
                  HrvMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.Course:
               if (CourseMesgEvent != null)
               {
                  CourseMesg courseMesg = new CourseMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = courseMesg;
                  CourseMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.CoursePoint:
               if (CoursePointMesgEvent != null)
               {
                  CoursePointMesg coursePointMesg = new CoursePointMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = coursePointMesg;
                  CoursePointMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.Workout:
               if (WorkoutMesgEvent != null)
               {
                  WorkoutMesg workoutMesg = new WorkoutMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = workoutMesg;
                  WorkoutMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.WorkoutStep:
               if (WorkoutStepMesgEvent != null)
               {
                  WorkoutStepMesg workoutStepMesg = new WorkoutStepMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = workoutStepMesg;
                  WorkoutStepMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.Schedule:
               if (ScheduleMesgEvent != null)
               {
                  ScheduleMesg scheduleMesg = new ScheduleMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = scheduleMesg;
                  ScheduleMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.Totals:
               if (TotalsMesgEvent != null)
               {
                  TotalsMesg totalsMesg = new TotalsMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = totalsMesg;
                  TotalsMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.WeightScale:
               if (WeightScaleMesgEvent != null)
               {
                  WeightScaleMesg weightScaleMesg = new WeightScaleMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = weightScaleMesg;
                  WeightScaleMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.BloodPressure:
               if (BloodPressureMesgEvent != null)
               {
                  BloodPressureMesg bloodPressureMesg = new BloodPressureMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = bloodPressureMesg;
                  BloodPressureMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.MonitoringInfo:
               if (MonitoringInfoMesgEvent != null)
               {
                  MonitoringInfoMesg monitoringInfoMesg = new MonitoringInfoMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = monitoringInfoMesg;
                  MonitoringInfoMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.Monitoring:
               if (MonitoringMesgEvent != null)
               {
                  MonitoringMesg monitoringMesg = new MonitoringMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = monitoringMesg;
                  MonitoringMesgEvent(sender, mesgEventArgs);
               }
               break;

             case (ushort)MesgNum.Pad:
               if (PadMesgEvent != null)
               {
                  PadMesg padMesg = new PadMesg(e.mesg);
                  MesgEventArgs mesgEventArgs = new MesgEventArgs();
                  mesgEventArgs.mesg = padMesg;
                  PadMesgEvent(sender, mesgEventArgs);
               }
               break;

             }
        }