Add GSS-derived characteristics, array fields, and precise numeric scaling#3
Add GSS-derived characteristics, array fields, and precise numeric scaling#3vkolotov wants to merge 1 commit into
Conversation
9eb2946 to
593e9e9
Compare
Bundled characteristics (191 -> 348): - recover the Fitness Machine profile and other characteristics from the last published Bluetooth SIG characteristic XML (2017) - add 139 characteristics derived from the current GATT Specification Supplement (the SIG retired the machine-readable characteristic XML ~2019); scalars are high fidelity, complex conditional/struct cases carry <!-- REVIEW --> markers Parser: - variable-length array fields via Field.repeats (0 = to end of data, N = fixed); the parser emits indexed holders Name[0], Name[1], ... (e.g. RR-Interval) - register the GSS float type names medfloat16/medfloat32 (IEEE-11073 16/32-bit) Numeric conversion: - exact BigDecimal scaling: decimal exponent via scaleByPowerOfTen, binary exponent via exact powers of two, so getBigDecimal/getBigInteger no longer inherit the rounding error of Math.pow(10, e) - simplify two's-complement int/long deserialization (same results) - implement the previously-unsupported IEEE-11073 serialize + deserializeDouble README refreshed: GSS provenance, array support; fixed stale links/paths. Signed-off-by: Vlad Kolotoff <vkolotoff@pm.me>
593e9e9 to
55ab979
Compare
|
hi @kaikreuzer, this PR is to sync my gatt-parser changes into OH. |
There was a problem hiding this comment.
Pull request overview
This pull request expands the bundled Bluetooth SIG GATT specification set (including GSS-derived additions) and enhances the parser/number-formatting logic to support repeated (array) fields and more precise numeric conversion/serialization.
Changes:
- Add GSS aliases for IEEE-11073 floating-point formats (
medfloat16/medfloat32) and implement IEEE-11073 serialize/deserializeDouble support. - Add repeated-field support via
Field.repeatsand parse-time expansion into indexed field names (Name[0],Name[1], …). - Improve numeric scaling for
BigDecimal/BigIntegerconversion to avoidMath.powrounding artifacts; add/update tests and refresh README.
Reviewed changes
Copilot reviewed 170 out of 170 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/org/openhab/bluetooth/gattparser/spec/FieldFormat.java | Add medfloat16/medfloat32 aliases for IEEE-11073 float formats. |
| src/main/java/org/openhab/bluetooth/gattparser/spec/Field.java | Add repeats attribute and helpers (getRepeats(), isRepeated()) for array fields. |
| src/main/java/org/openhab/bluetooth/gattparser/GenericCharacteristicParser.java | Parse repeated fields into indexed holders and advance bit offsets accordingly. |
| src/main/java/org/openhab/bluetooth/gattparser/num/TwosComplementNumberFormatter.java | Refactor two’s-complement deserialization to shared deserialize(...) logic. |
| src/main/java/org/openhab/bluetooth/gattparser/num/IEEE11073FloatingPointNumberFormatter.java | Implement IEEE-11073 serialize* and deserializeDouble. |
| src/main/java/org/openhab/bluetooth/gattparser/FieldHolder.java | Use exact BigDecimal multiplier scaling for BigDecimal/BigInteger paths. |
| src/test/java/org/openhab/bluetooth/gattparser/spec/FieldFormatTest.java | Add tests for medfloat16/medfloat32 aliases. |
| src/test/java/org/openhab/bluetooth/gattparser/num/IEEE11073FloatingPointNumberFormatterTest.java | Add round-trip tests and deserializeDouble behavior tests. |
| src/test/java/org/openhab/bluetooth/gattparser/MockUtils.java | Add a helper for mocking repeated fields. |
| src/test/java/org/openhab/bluetooth/gattparser/GenericCharacteristicParserTest.java | Add tests for repeat-to-end and fixed-count repeated field parsing. |
| src/test/java/org/openhab/bluetooth/gattparser/FieldHolderTest.java | Add tests proving exact decimal/binary scaling in getBigDecimal. |
| README.md | Refresh usage/examples and document GSS provenance + array support. |
| src/main/resources/gatt/service/org.bluetooth.service.fitness_machine.xml | Add bundled Fitness Machine service spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.volume_flow.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.voltage.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.voltage_statistics.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.voltage_specification.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.voltage_frequency.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.voc_concentration.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.udi_for_medical_devices.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.two_zone_heart_rate_limits.xml | Add bundled characteristic spec (note: duplicates UUID 2A95 with existing definition). |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.treadmill_data.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.training_status.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.torque.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.time_second_8.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.time_second_32.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.time_second_16.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.time_millisecond_24.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.time_hour_24.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.time_exponential_8.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.time_decihour_8.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.temperature_statistics.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.temperature_range.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.temperature_8.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.temperature_8_statistics.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.temperature_8_in_a_period_of_day.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.supported_speed_range.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.supported_resistance_level_range.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.supported_power_range.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.supported_inclination_range.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.supported_heart_rate_range.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.sulfur_hexafluoride_concentration.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.sulfur_dioxide_concentration.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.stride_length.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.step_climber_data.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.stair_climber_data.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.sedentary_interval_notification.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.rower_data.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.rotational_speed.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.resolvable_private_address_only.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.relative_value_in_an_illuminance_range.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.relative_value_in_a_voltage_range.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.relative_value_in_a_temperature_range.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.relative_value_in_a_period_of_day.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.relative_runtime_in_a_generic_level_range.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.relative_runtime_in_a_current_range.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.relative_runtime_in_a_correlated_color_temperature_range.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.recipe_parameters.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.recipe_control.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.pushbutton_status_8.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.preferred_units.xml | Add bundled characteristic spec (note: needs array encoding compatible with parser). |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.precise_acceleration_3d.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.power.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.power_specification.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.percentage_8.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.percentage_8_steps.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.perceived_lightness.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.particulate_matter_pm2_5_concentration.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.particulate_matter_pm10_concentration.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.particulate_matter_pm1_concentration.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.ozone_concentration.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.non-methane_volatile_organic_compounds_concentration.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.noise.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.nitrogen_dioxide_concentration.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.middle_name.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.methane_concentration.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.mass_flow.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.magnetic_flux_density_3d.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.magnetic_flux_density_2d.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.luminous_intensity.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.luminous_flux.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.luminous_flux_range.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.luminous_exposure.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.luminous_energy.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.luminous_efficacy.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.linear_position.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.light_source_type.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.light_output.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.light_distribution.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.length.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.kitchen_appliance_airflow.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.indoor_bike_data.xml | Add bundled characteristic spec (Fitness Machine profile). |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.illuminance.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.illuminance_16.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.humidity_8.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.high_voltage.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.high_temperature.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.high_resolution_height.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.high_intensity_exercise_threshold.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.handedness.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.global_trade_item_number.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.generic_level.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.gap.central_address_resolution.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.four_zone_heart_rate_limits.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.force.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.fixed_string_8.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.fixed_string_64.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.fixed_string_36.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.fixed_string_24.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.fixed_string_16.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.fitness_machine_status.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.fitness_machine_feature.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.fitness_machine_control_point.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.event_statistics.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.estimated_service_date.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.enhanced_intermediate_cuff_pressure.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.enhanced_blood_pressure_measurement.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.energy.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.energy_in_a_period_of_day.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.energy_32.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.electric_current.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.electric_current_statistics.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.electric_current_specification.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.electric_current_range.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.elapsed_time.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.door_window_status.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.device_wearing_position.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.date_utc.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.cross_trainer_data.xml | Add bundled characteristic spec (Fitness Machine profile). |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.country_code.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.count_24.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.count_16.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.cosine_of_the_angle.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.correlated_color_temperature.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.cooking_zone_capabilities.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.cooking_temperature.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.cooking_step_status.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.content_control_id.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.contact_status_8.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.coefficient.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.co2_concentration.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.cie_13_3_1995_color_rendering_index.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.chromaticity_tolerance.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.chromaticity_in_cct_and_duv_values.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.chromaticity_coordinates.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.chromaticity_coordinate.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.chromatic_distance_from_planckian.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.carbon_monoxide_concentration.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.caloric_intake.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.boot_mouse_input_report.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.boolean.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.blood_pressure_record.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.battery_time_status.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.battery_level_status.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.battery_information.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.battery_health_status.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.battery_health_information.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.battery_energy_status.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.battery_critical_status.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.average_voltage.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.average_current.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.apparent_power.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.apparent_energy_32.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.ammonia_concentration.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.aerobic_threshold.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.aerobic_heart_rate_upper_limit.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.activity_goal.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.acceleration.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.acceleration_detection_status.xml | Add bundled characteristic spec. |
| src/main/resources/gatt/characteristic/org.bluetooth.characteristic.acceleration_3d.xml | Add bundled characteristic spec. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <Field name="Units"> | ||
| <Format>uint16 [1-256]</Format> | ||
| </Field> |
| <Enumeration key="1" value="True" requires="C3" /> | ||
| </Enumerations> | ||
| </Bit> | ||
| <Bit index="3" size="1" name="Average Candence present"> |
| <InformativeText>Meters per second with a resolution of | ||
| 0.01</InformativeText> |
| name="Two Zone Heart Rate Limits" type="org.bluetooth.characteristic.two_zone_heart_rate_limits" uuid="2A95" approved="No"> | ||
| <Value> | ||
| <Field name="Two Zone Heart Rate Limit - Fat Burn / Fitness Limit"> | ||
| <Format>uint8</Format> |
| int repeats = field.getRepeats(); | ||
| int index = 0; | ||
| while (repeats == 0 ? offset + elementSize <= raw.length * 8 : index < repeats) { | ||
| result.put(field.getName() + "[" + index + "]", parseField(field, raw, offset)); | ||
| offset += elementSize; | ||
| index++; | ||
| } | ||
| continue; |
| double value = number; | ||
| // Raise the exponent until the mantissa fits the signed range. | ||
| double scaled = value; | ||
| while ((Math.round(scaled) > mantissaMax || Math.round(scaled) < mantissaMin) && exponent < expMax) { | ||
| scaled /= 10.0; | ||
| exponent++; | ||
| } | ||
| // Lower the exponent to keep fractional precision while the mantissa still fits. | ||
| while (exponent > expMin) { | ||
| double finer = scaled * 10.0; | ||
| if (Math.round(finer) > mantissaMax || Math.round(finer) < mantissaMin) { | ||
| break; | ||
| } | ||
| scaled = finer; | ||
| exponent--; | ||
| } | ||
| mantissa = (int) Math.round(scaled); |
|
Hey @vkolotov, what a pleasant surprise to see you here! Should I publish a new version after the merge or do you have any additional changes in the queue for which I should wait? |
|
Hi @kaikreuzer , yes I'm back and I'm working on something trully exciting now - Direct-BT (based on Tinyb lib) transport binding (direct adapter access, no D-Bus and BlueZ). it shows already some great results, so good that I would recommend deprecating BlueZ binding or at least making the Direct-BT to be enabled by default. It will take a few weeks before I publish a new PR, there are some people who can review it but it would be greate if you could take part in it. Cheers! PS. I will fix the found issues in this PR and we should be good to publish a new version. Thanks. |
|
@vkolotov Sounds pretty interesting - looking forward to your PR and I'll do my best to help testing it! |
Summary
Expands the bundled GATT specification set and fills a few gaps in the parser.
Bundled characteristics (191 → 348)
<!-- REVIEW -->marker rather than a fabricated value.Parser
Field.repeats(0= repeat to end of data,N= fixed count); the parser emits indexed holdersName[0],Name[1], … (e.g. the RR-Interval list in Heart Rate Measurement).medfloat16/medfloat32(the IEEE-11073 16/32-bit floats).Numeric conversion
BigDecimalscaling: the decimal exponent is applied viascaleByPowerOfTenand the binary exponent via exact powers of two, sogetBigDecimal/getBigIntegerno longer inherit the rounding error ofMath.pow(10, e).serialize*anddeserializeDouble.Notes
mvn clean test→ 127 passing.