Skip to content

Commit

Permalink
updated for sdk 21.89
Browse files Browse the repository at this point in the history
  • Loading branch information
roznet committed Sep 11, 2022
1 parent c08ddd7 commit 38a855a
Show file tree
Hide file tree
Showing 15 changed files with 477 additions and 62 deletions.
146 changes: 142 additions & 4 deletions Sources/FitFileParser/rzfit_swift_map.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import FitFileParserObjc

extension FitFile {
public static let sdkVersion = "21.78"
public static let sdkVersion = "21.89"
}

//MARK: - Module Entry Point Functions
Expand Down Expand Up @@ -878,6 +878,14 @@ func rzfit_swift_unit_for_field( mesg_num : FIT_UINT16, field : String ) -> Stri
case "custom_target_cadence_high": return "rpm"
case "custom_target_power_high": return "% or watts"
case "exercise_weight": return "kg"
case "secondary_custom_target_speed_low": return "m/s"
case "secondary_custom_target_heart_rate_low": return "% or bpm"
case "secondary_custom_target_cadence_low": return "rpm"
case "secondary_custom_target_power_low": return "% or watts"
case "secondary_custom_target_speed_high": return "m/s"
case "secondary_custom_target_heart_rate_high": return "% or bpm"
case "secondary_custom_target_cadence_high": return "rpm"
case "secondary_custom_target_power_high": return "% or watts"
case "timer_time": return "s"
case "elapsed_time": return "s"
case "percent_fat": return "%"
Expand Down Expand Up @@ -1498,7 +1506,6 @@ fileprivate func rzfit_swift_string_from_gender(_ input : FIT_ENUM) -> String
switch input {
case 0: return "female"
case 1: return "male"
case 2: return "unspecified"
default: return "gender_\(input)"
}
}
Expand Down Expand Up @@ -2443,6 +2450,33 @@ fileprivate func rzfit_swift_string_from_course_point(_ input : FIT_ENUM) -> Str
case 23: return "u_turn"
case 24: return "segment_start"
case 25: return "segment_end"
case 27: return "campsite"
case 28: return "aid_station"
case 29: return "rest_area"
case 30: return "general_distance"
case 31: return "service"
case 32: return "energy_gel"
case 33: return "sports_drink"
case 34: return "mile_marker"
case 35: return "checkpoint"
case 36: return "shelter"
case 37: return "meeting_spot"
case 38: return "overlook"
case 39: return "toilet"
case 40: return "shower"
case 41: return "gear"
case 42: return "sharp_curve"
case 43: return "steep_incline"
case 44: return "tunnel"
case 45: return "bridge"
case 46: return "obstacle"
case 47: return "crossing"
case 48: return "store"
case 49: return "transition"
case 50: return "navaid"
case 51: return "transport"
case 52: return "alert"
case 53: return "info"
default: return "course_point_\(input)"
}
}
Expand Down Expand Up @@ -2589,6 +2623,9 @@ fileprivate func rzfit_swift_string_from_manufacturer(_ input : FIT_UINT16) -> S
case 139: return "kinetic_sports"
case 140: return "decathlon_byte"
case 141: return "tq_systems"
case 142: return "tag_heuer"
case 143: return "keiser_fitness"
case 144: return "zwift_byte"
case 255: return "development"
case 257: return "healthandlife"
case 258: return "lezyne"
Expand Down Expand Up @@ -2651,6 +2688,8 @@ fileprivate func rzfit_swift_string_from_manufacturer(_ input : FIT_UINT16) -> S
case 315: return "RGT_cycling"
case 316: return "vasa"
case 317: return "race_republic"
case 318: return "fazua"
case 319: return "oreka_training"
case 5759: return "actigraphcorp"
default: return "manufacturer_\(input)"
}
Expand Down Expand Up @@ -3011,14 +3050,22 @@ fileprivate func rzfit_swift_string_from_garmin_product(_ input : FIT_UINT16) ->
case 3950: return "venu2_asia"
case 3978: return "fr945_lte_asia"
case 3986: return "approach_S12_asia"
case 3990: return "fr255_music"
case 3991: return "fr255_small_music"
case 3992: return "fr255"
case 3993: return "fr255_small"
case 4001: return "approach_g12_asia"
case 4002: return "approach_s42_asia"
case 4005: return "descent_g1"
case 4017: return "venu2_plus_asia"
case 4024: return "fr955"
case 4033: return "fr55_asia"
case 4063: return "vivosmart_5"
case 4071: return "instinct_2_asia"
case 4125: return "d2_air_x10"
case 4130: return "hrm_pro_plus"
case 4132: return "descent_g1_asia"
case 4169: return "edge_explore2"
case 4265: return "tacx_neo_smart"
case 4266: return "tacx_neo2_smart"
case 4267: return "tacx_neo2_t_smart"
Expand All @@ -3031,6 +3078,7 @@ fileprivate func rzfit_swift_string_from_garmin_product(_ input : FIT_UINT16) ->
case 4274: return "tacx_flux_flux_s_smart"
case 4275: return "tacx_flux2_smart"
case 4276: return "tacx_magnum"
case 4135: return "tactix7"
case 10007: return "sdm4"
case 10014: return "edge_remote"
case 20533: return "tacx_training_app_win"
Expand Down Expand Up @@ -6379,6 +6427,7 @@ fileprivate func rzfit_swift_field_num_to_string_for_session( field_num : FIT_UI
case 134: return "avg_step_length"
case 137: return "total_anaerobic_training_effect"
case 139: return "avg_vam"
case 168: return "training_load_peak"
case 181: return "total_grit"
case 182: return "total_flow"
case 183: return "jump_count"
Expand Down Expand Up @@ -7391,6 +7440,45 @@ fileprivate func rzfit_swift_field_num_to_string_for_workout_step( field_num : F
case 11: return "exercise_name"
case 12: return "exercise_weight"
case 13: return "weight_display_unit"
case 19: return "secondary_target_type"
case 20:
if strings["secondary_target_type"] == "speed" {
return "secondary_target_speed_zone"
}else if strings["secondary_target_type"] == "heart_rate" {
return "secondary_target_hr_zone"
}else if strings["secondary_target_type"] == "cadence" {
return "secondary_target_cadence_zone"
}else if strings["secondary_target_type"] == "power" {
return "secondary_target_power_zone"
}else if strings["secondary_target_type"] == "swim_stroke" {
return "secondary_target_stroke_type"
}else{
return "__INCOMPLETE__"
}
case 21:
if strings["secondary_target_type"] == "speed" {
return "secondary_custom_target_speed_low"
}else if strings["secondary_target_type"] == "heart_rate" {
return "secondary_custom_target_heart_rate_low"
}else if strings["secondary_target_type"] == "cadence" {
return "secondary_custom_target_cadence_low"
}else if strings["secondary_target_type"] == "power" {
return "secondary_custom_target_power_low"
}else{
return "__INCOMPLETE__"
}
case 22:
if strings["secondary_target_type"] == "speed" {
return "secondary_custom_target_speed_high"
}else if strings["secondary_target_type"] == "heart_rate" {
return "secondary_custom_target_heart_rate_high"
}else if strings["secondary_target_type"] == "cadence" {
return "secondary_custom_target_cadence_high"
}else if strings["secondary_target_type"] == "power" {
return "secondary_custom_target_power_high"
}else{
return "__INCOMPLETE__"
}
default: return "workout_step_field_num_\(field_num)"
}
}
Expand Down Expand Up @@ -7555,8 +7643,10 @@ fileprivate func rzfit_swift_field_num_to_string_for_memo_glob( field_num : FIT_
switch field_num {
case 250: return "part_index"
case 0: return "memo"
case 1: return "message_number"
case 2: return "message_index"
case 1: return "mesg_num"
case 2: return "parent_index"
case 3: return "field_num"
case 4: return "data"
default: return "memo_glob_field_num_\(field_num)"
}
}
Expand Down Expand Up @@ -11424,6 +11514,51 @@ fileprivate func rzfit_swift_value_dict_for_workout_step( ptr : UnsafePointer<FI
rv[ "custom_target_value_high" ] = val
}
}
if x.secondary_target_value != FIT_UINT32_INVALID {
if x.secondary_target_type == 0 { // speed
let val : Double = Double(x.secondary_target_value)
rv[ "secondary_target_speed_zone" ] = val
}else if x.secondary_target_type == 1 { // heart_rate
let val : Double = Double(x.secondary_target_value)
rv[ "secondary_target_hr_zone" ] = val
}else if x.secondary_target_type == 3 { // cadence
let val : Double = Double(x.secondary_target_value)
rv[ "secondary_target_cadence_zone" ] = val
}else if x.secondary_target_type == 4 { // power
let val : Double = Double(x.secondary_target_value)
rv[ "secondary_target_power_zone" ] = val
}else if x.secondary_target_type != 11 /* swim_stroke */ &&
x.secondary_target_type != 11 /* swim_stroke */ {
let val : Double = Double(x.secondary_target_value)
rv[ "secondary_target_value" ] = val
}
}
if x.secondary_custom_target_value_low != FIT_UINT32_INVALID {
if x.secondary_target_type == 0 { // speed
let val : Double = Double(x.secondary_custom_target_value_low)
rv[ "secondary_custom_target_speed_low" ] = val
}else if x.secondary_target_type == 3 { // cadence
let val : Double = Double(x.secondary_custom_target_value_low)
rv[ "secondary_custom_target_cadence_low" ] = val
}else if x.secondary_target_type != 1 /* heart_rate */ &&
x.secondary_target_type != 4 /* power */ {
let val : Double = Double(x.secondary_custom_target_value_low)
rv[ "secondary_custom_target_value_low" ] = val
}
}
if x.secondary_custom_target_value_high != FIT_UINT32_INVALID {
if x.secondary_target_type == 0 { // speed
let val : Double = Double(x.secondary_custom_target_value_high)
rv[ "secondary_custom_target_speed_high" ] = val
}else if x.secondary_target_type == 3 { // cadence
let val : Double = Double(x.secondary_custom_target_value_high)
rv[ "secondary_custom_target_cadence_high" ] = val
}else if x.secondary_target_type != 1 /* heart_rate */ &&
x.secondary_target_type != 4 /* power */ {
let val : Double = Double(x.secondary_custom_target_value_high)
rv[ "secondary_custom_target_value_high" ] = val
}
}
if x.message_index != FIT_UINT16_INVALID {
rv[ "message_index_value" ] = rzfit_swift_value_from_message_index(x.message_index)
}
Expand Down Expand Up @@ -11464,6 +11599,9 @@ fileprivate func rzfit_swift_string_dict_for_workout_step( ptr : UnsafePointer<F
if( x.equipment != FIT_ENUM_INVALID ) {
rv[ "equipment" ] = rzfit_swift_string_from_workout_equipment(x.equipment)
}
if( x.secondary_target_type != FIT_ENUM_INVALID ) {
rv[ "secondary_target_type" ] = rzfit_swift_string_from_wkt_step_target(x.secondary_target_type)
}
return rv
}
fileprivate func rzfit_swift_date_dict_for_workout_step( ptr : UnsafePointer<FIT_WORKOUT_STEP_MESG>) -> [String:Date] {
Expand Down
Loading

0 comments on commit 38a855a

Please sign in to comment.