### Display GNSS Measurement Data in a ListView Source: https://pub.dev/packages/raw_gnss Example of using a StreamBuilder to display GNSS measurement data, specifically satellite IDs, in a ListView. This requires the raw_gnss package and a running stream of GnssMeasurementEvents. ```dart StreamBuilder( builder: (context, snapshot) { if (snapshot.data == null) { return CircularProgressIndicator(); } return ListView.builder( itemBuilder: (context, position) { return ListTile( title: Text( "Satellite: ${snapshot.data!.measurements![position].svid}"), ); }, itemCount: snapshot.data!.measurements?.length ?? 0, ); }, stream: RawGnss().gnssMeasurementEvents, ), ``` -------------------------------- ### Get GnssMeasurement Events Stream Source: https://pub.dev/documentation/raw_gnss/latest/raw_gnss/RawGnss/gnssMeasurementEvents.html This getter provides a stream of GnssMeasurementModel objects. It initializes the stream if it's null by receiving broadcast events from a channel and mapping them to GnssMeasurementModel.fromJson. ```dart Stream get gnssMeasurementEvents { if (_gnssMeasurementEvents == null) { _gnssMeasurementEvents = _gnssMeasurementEventChannel .receiveBroadcastStream() .map((event) => GnssMeasurementModel.fromJson( (event as Map).cast())); } return _gnssMeasurementEvents!; } ``` -------------------------------- ### Get GnssNavigationMessage Events Stream Source: https://pub.dev/documentation/raw_gnss/latest/raw_gnss/RawGnss/gnssNavigationMessageEvents.html This getter provides a broadcast stream for GnssNavigationMessage events. It initializes the stream if it hasn't been already. ```dart Stream get gnssNavigationMessageEvents { if (_gnssNavigationMessageEvents == null) { _gnssNavigationMessageEvents = _gnssNavigationMessageEventChannel.receiveBroadcastStream(); } return _gnssNavigationMessageEvents!; } ``` -------------------------------- ### Get GnssStatusEvents Stream Source: https://pub.dev/documentation/raw_gnss/latest/raw_gnss/RawGnss/gnssStatusEvents.html This getter provides a stream of GnssStatusModel events. It initializes the stream if it hasn't been already, by receiving broadcast stream events from a channel and mapping them to GnssStatusModel objects. ```dart Stream get gnssStatusEvents { if (_gnssMeasurementEvents == null) { _gnssStatusEvents = _gnssStatusEventChannel.receiveBroadcastStream().map( (event) => GnssStatusModel.fromJson( (event as Map).cast())); } return _gnssStatusEvents!; } ``` -------------------------------- ### Clock Constructors Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/Clock-class.html Provides information on how to instantiate the Clock class. ```APIDOC ## Clock Constructors Clock({int? contents, double? biasNanos, double? biasUncertaintyNanos, double? driftNanosPerSecond, double? driftUncertaintyNanosPerSecond, int? fullBiasNanos, int? hardwareClockDiscontinuityCount, int? leapSecond, int? timeNanos, double? timeUncertaintyNanos}) Clock.fromJson(Map json) ``` -------------------------------- ### RawGnss Constructor Source: https://pub.dev/documentation/raw_gnss/latest/raw_gnss/RawGnss-class.html Initializes a new instance of the RawGnss class. ```APIDOC ## RawGnss() ### Description Initializes a new instance of the RawGnss class. ### Method Constructor ``` -------------------------------- ### Measurement Class Constructors Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/Measurement-class.html Demonstrates the available constructors for the Measurement class, including the default constructor and a constructor for creating a Measurement object from JSON. ```APIDOC ## Constructors Measurement({int? contents, double? accumulatedDeltaRangeMeters, int? accumulatedDeltaRangeState, double? accumulatedDeltaRangeUncertaintyMeters, double? automaticGainControlLevelDb, double? carrierFrequencyHz, double? cn0DbHz, int? constellationType, int? multipathIndicator, double? pseudorangeRateMetersPerSecond, double? pseudorangeRateUncertaintyMetersPerSecond, int? receivedSvTimeNanos, int? receivedSvTimeUncertaintyNanos, double? snrInDb, int? state, int? svid, double? timeOffsetNanos, String? string}) Measurement.fromJson(Map json) ``` -------------------------------- ### Status Constructor Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/Status/Status.html Initializes a new Status object with optional GNSS parameters. ```APIDOC ## Status Constructor ### Description Initializes a new Status object with optional GNSS parameters. ### Parameters #### Named Parameters - **azimuthDegrees** (double?) - Optional - The azimuth angle in degrees. - **carrierFrequencyHz** (double?) - Optional - The carrier frequency in Hertz. - **cn0DbHz** (double?) - Optional - The carrier-to-noise density ratio in dB-Hz. - **constellationType** (int?) - Optional - The type of satellite constellation. - **elevationDegrees** (double?) - Optional - The elevation angle in degrees. - **svid** (int?) - Optional - The satellite vehicle ID. - **hasAlmanacData** (bool?) - Optional - Indicates if almanac data is available. - **hasCarrierFrequencyHz** (bool?) - Optional - Indicates if carrier frequency is available. - **hasEphemerisData** (bool?) - Optional - Indicates if ephemeris data is available. - **usedInFix** (bool?) - Optional - Indicates if the satellite was used in the fix. ### Implementation ```dart Status({ this.azimuthDegrees, this.carrierFrequencyHz, this.cn0DbHz, this.constellationType, this.elevationDegrees, this.svid, this.hasAlmanacData, this.hasCarrierFrequencyHz, this.hasEphemerisData, this.usedInFix, }); ``` ``` -------------------------------- ### GnssStatusModel Constructor Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/GnssStatusModel/GnssStatusModel.html Initializes a new GnssStatusModel with optional satellite count, hash codec, and status list. ```APIDOC ## GnssStatusModel Constructor ### Description Constructs a GnssStatusModel with optional parameters. ### Parameters #### Named Parameters - **satelliteCount** (int?) - Optional - The number of satellites. - **hashCodec** (int?) - Optional - The hash codec value. - **status** (List?) - Optional - A list of Status objects. ``` -------------------------------- ### Status Constructor Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/Status-class.html Initializes a new Status object with optional GNSS status parameters. ```APIDOC ## Status({double? azimuthDegrees, double? carrierFrequencyHz, double? cn0DbHz, int? constellationType, double? elevationDegrees, int? svid, bool? hasAlmanacData, bool? hasCarrierFrequencyHz, bool? hasEphemerisData, bool? usedInFix}) ### Description Constructs a Status object with detailed GNSS satellite information. ### Parameters - **azimuthDegrees** (double?) - The azimuth angle of the satellite in degrees. - **carrierFrequencyHz** (double?) - The carrier frequency of the satellite signal in Hz. - **cn0DbHz** (double?) - The carrier-to-noise density ratio in dBHz. - **constellationType** (int?) - The type of satellite constellation (e.g., GPS, GLONASS). - **elevationDegrees** (double?) - The elevation angle of the satellite in degrees. - **svid** (int?) - The satellite vehicle ID. - **hasAlmanacData** (bool?) - Indicates if almanac data is available. - **hasCarrierFrequencyHz** (bool?) - Indicates if carrier frequency information is available. - **hasEphemerisData** (bool?) - Indicates if ephemeris data is available. - **usedInFix** (bool?) - Indicates if the satellite was used in the current fix. ``` -------------------------------- ### GnssMeasurementModel Constructor Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/GnssMeasurementModel/GnssMeasurementModel.html Initializes a new instance of the GnssMeasurementModel class with optional parameters. ```APIDOC ## GnssMeasurementModel Constructor ### Description Initializes a new instance of the GnssMeasurementModel class. ### Parameters #### Named Parameters - **contents** (int?) - Optional - An integer representing contents. - **string** (String?) - Optional - A string value. - **measurements** (List?) - Optional - A list of Measurement objects. - **clock** (Clock?) - Optional - A Clock object. ### Implementation ```dart GnssMeasurementModel({ this.contents, this.string, this.measurements, this.clock, }); ``` ``` -------------------------------- ### GnssStatusModel Constructor Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/GnssStatusModel-class.html Initializes a new instance of the GnssStatusModel class. ```APIDOC ## GnssStatusModel ### Description Initializes a new instance of the GnssStatusModel class. ### Parameters - **satelliteCount** (int?) - Optional - The count of satellites. - **hashCodec** (int?) - Optional - The hash codec. - **status** (List?) - Optional - The list of statuses. ``` -------------------------------- ### GnssMeasurementModel Constructors Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/GnssMeasurementModel-class.html Constructors for creating instances of the GnssMeasurementModel class. ```APIDOC ## Constructors GnssMeasurementModel({int? contents, String? string, List? measurements, Clock? clock}) GnssMeasurementModel.fromJson(Map json) ``` -------------------------------- ### Clock Constructor Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/Clock/Clock.html Initializes a new Clock object with various GNSS clock measurement parameters. ```APIDOC ## Clock constructor ### Description Initializes a new Clock object with various GNSS clock measurement parameters. ### Parameters #### Constructor Parameters - **contents** (int?) - Optional - Represents the contents of the clock measurement. - **biasNanos** (double?) - Optional - The clock bias in nanoseconds. - **biasUncertaintyNanos** (double?) - Optional - The uncertainty of the clock bias in nanoseconds. - **driftNanosPerSecond** (double?) - Optional - The clock drift in nanoseconds per second. - **driftUncertaintyNanosPerSecond** (double?) - Optional - The uncertainty of the clock drift in nanoseconds per second. - **fullBiasNanos** (int?) - Optional - The full clock bias in nanoseconds. - **hardwareClockDiscontinuityCount** (int?) - Optional - The count of hardware clock discontinuities. - **leapSecond** (int?) - Optional - The current leap second value. - **timeNanos** (int?) - Optional - The time of the measurement in nanoseconds. - **timeUncertaintyNanos** (double?) - Optional - The uncertainty of the time measurement in nanoseconds. ### Implementation ```dart Clock({ this.contents, this.biasNanos, this.biasUncertaintyNanos, this.driftNanosPerSecond, this.driftUncertaintyNanosPerSecond, this.fullBiasNanos, this.hardwareClockDiscontinuityCount, this.leapSecond, this.timeNanos, this.timeUncertaintyNanos, }); ``` ``` -------------------------------- ### Clock Methods Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/Clock-class.html Lists the methods available for the Clock class. ```APIDOC ## Clock Methods tojSon() → Map ``` -------------------------------- ### toString Method Source: https://pub.dev/documentation/raw_gnss/latest/raw_gnss/RawGnss-class.html Returns a string representation of the RawGnss object. ```APIDOC ## toString() ### Description Returns a string representation of this object. ### Returns String - A string representation of the object. ### Inherited Yes ``` -------------------------------- ### GnssMeasurementModel Constructor Implementation Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/GnssMeasurementModel/GnssMeasurementModel.html This is the implementation of the GnssMeasurementModel constructor. It initializes the class properties with the provided values. ```dart GnssMeasurementModel({ this.contents, this.string, this.measurements, this.clock, }); ``` -------------------------------- ### GnssMeasurementModel Methods Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/GnssMeasurementModel-class.html Methods available on the GnssMeasurementModel class. ```APIDOC ## Methods noSuchMethod(Invocation invocation) → dynamic ttoJson() → Map tosTring() → String ``` -------------------------------- ### Measurement Constructor Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/Measurement/Measurement.html Initializes a new Measurement object with various GNSS measurement parameters. All parameters are optional. ```dart Measurement({ this.contents, this.accumulatedDeltaRangeMeters, this.accumulatedDeltaRangeState, this.accumulatedDeltaRangeUncertaintyMeters, this.automaticGainControlLevelDb, this.carrierFrequencyHz, this.cn0DbHz, this.constellationType, this.multipathIndicator, this.pseudorangeRateMetersPerSecond, this.pseudorangeRateUncertaintyMetersPerSecond, this.receivedSvTimeNanos, this.receivedSvTimeUncertaintyNanos, this.snrInDb, this.state, this.svid, this.timeOffsetNanos, this.string, }); ``` -------------------------------- ### GnssStatusModel Constructor Implementation Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/GnssStatusModel/GnssStatusModel.html This is the implementation of the GnssStatusModel constructor, which initializes the class properties. ```dart GnssStatusModel({ this.satelliteCount, this.hashCodec, this.status, }); ``` -------------------------------- ### GnssStatusModel.fromJson Factory Constructor Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/GnssStatusModel-class.html Creates a GnssStatusModel instance from a JSON map. ```APIDOC ## GnssStatusModel.fromJson ### Description Creates a GnssStatusModel instance from a JSON map. ### Parameters - **json** (Map) - Required - The JSON map to parse. ``` -------------------------------- ### Measurement Constructor Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/Measurement/Measurement.html The Measurement constructor allows for the initialization of a Measurement object with various GNSS measurement-related properties. ```APIDOC ## Measurement Constructor ### Description Initializes a new instance of the Measurement class with specified GNSS measurement parameters. ### Parameters - **contents** (int?) - Optional - Represents the contents of the measurement. - **accumulatedDeltaRangeMeters** (double?) - Optional - The accumulated delta range in meters. - **accumulatedDeltaRangeState** (int?) - Optional - The state of the accumulated delta range. - **accumulatedDeltaRangeUncertaintyMeters** (double?) - Optional - The uncertainty of the accumulated delta range in meters. - **automaticGainControlLevelDb** (double?) - Optional - The automatic gain control level in dB. - **carrierFrequencyHz** (double?) - Optional - The carrier frequency in Hz. - **cn0DbHz** (double?) - Optional - The carrier-to-noise density ratio in dB-Hz. - **constellationType** (int?) - Optional - The type of the satellite constellation. - **multipathIndicator** (int?) - Optional - Indicates multipath presence. - **pseudorangeRateMetersPerSecond** (double?) - Optional - The pseudorange rate in meters per second. - **pseudorangeRateUncertaintyMetersPerSecond** (double?) - Optional - The uncertainty of the pseudorange rate in meters per second. - **receivedSvTimeNanos** (int?) - Optional - The time of the received satellite signal in nanoseconds. - **receivedSvTimeUncertaintyNanos** (int?) - Optional - The uncertainty of the received satellite signal time in nanoseconds. - **snrInDb** (double?) - Optional - The signal-to-noise ratio in dB. - **state** (int?) - Optional - The state of the measurement. - **svid** (int?) - Optional - The satellite vehicle ID. - **timeOffsetNanos** (double?) - Optional - The time offset in nanoseconds. - **string** (String?) - Optional - A string representation of the measurement. ### Implementation ```dart Measurement({ this.contents, this.accumulatedDeltaRangeMeters, this.accumulatedDeltaRangeState, this.accumulatedDeltaRangeUncertaintyMeters, this.automaticGainControlLevelDb, this.carrierFrequencyHz, this.cn0DbHz, this.constellationType, this.multipathIndicator, this.pseudorangeRateMetersPerSecond, this.pseudorangeRateUncertaintyMetersPerSecond, this.receivedSvTimeNanos, this.receivedSvTimeUncertaintyNanos, this.snrInDb, this.state, this.svid, this.timeOffsetNanos, this.string, }); ``` ``` -------------------------------- ### Listen to GNSS Measurement Events Source: https://pub.dev/packages/raw_gnss Use this snippet to subscribe to a stream of GNSS measurement events. Ensure the raw_gnss package is initialized. ```dart RawGnss().gnssMeasurementEvents.listen((e) {}); ``` -------------------------------- ### Status.fromJson Constructor Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/Status-class.html Creates a Status object from a JSON map. ```APIDOC ## Status.fromJson(Map json) ### Description Factory constructor to create a Status object by parsing a JSON map. ### Parameters - **json** (Map) - A map containing the GNSS status data in JSON format. ``` -------------------------------- ### Status Constructor Implementation Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/Status/Status.html This is the implementation of the Status constructor, used to initialize a Status object with provided GNSS status parameters. ```dart Status({ this.azimuthDegrees, this.carrierFrequencyHz, this.cn0DbHz, this.constellationType, this.elevationDegrees, this.svid, this.hasAlmanacData, this.hasCarrierFrequencyHz, this.hasEphemerisData, this.usedInFix, }); ``` -------------------------------- ### Clock.fromJson Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/Clock/Clock.fromJson.html Creates a Clock instance by parsing a JSON map. It handles potential null values for each field and converts specific fields to double where appropriate. ```APIDOC ## Clock.fromJson constructor ### Description Parses a JSON map to create a Clock object. This factory constructor handles the conversion of JSON data into the corresponding Clock object properties, including type casting for numerical values. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **json** (Map) - Required - A map containing the clock data, where keys are property names and values are their corresponding data. ### Request Example ```json { "contents": "some_content", "biasNanos": 123.45, "biasUncertaintyNanos": 0.1, "driftNanosPerSecond": 0.001, "driftUncertaintyNanosPerSecond": 0.0001, "fullBiasNanos": 67890, "hardwareClockDiscontinuityCount": 5, "leapSecond": 18, "timeNanos": 1678886400000000000, "timeUncertaintyNanos": 0.05 } ``` ### Response #### Success Response (200) - **Clock** (object) - A Clock object populated with data from the provided JSON map. #### Response Example ```json { "contents": "some_content", "biasNanos": 123.45, "biasUncertaintyNanos": 0.1, "driftNanosPerSecond": 0.001, "driftUncertaintyNanosPerSecond": 0.0001, "fullBiasNanos": 67890, "hardwareClockDiscontinuityCount": 5, "leapSecond": 18, "timeNanos": 1678886400000000000, "timeUncertaintyNanos": 0.05 } ``` ``` -------------------------------- ### Clock Constructor Signature Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/Clock/Clock.html Defines the parameters accepted by the Clock constructor. Use this to initialize a Clock object with specific GNSS measurement properties. ```dart Clock({ 1. int? contents, 2. double? biasNanos, 3. double? biasUncertaintyNanos, 4. double? driftNanosPerSecond, 5. double? driftUncertaintyNanosPerSecond, 6. int? fullBiasNanos, 7. int? hardwareClockDiscontinuityCount, 8. int? leapSecond, 9. int? timeNanos, 10. double? timeUncertaintyNanos, }) ``` -------------------------------- ### Status.fromJson Factory Constructor Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/Status/Status.fromJson.html The `fromJson` factory constructor takes a `Map` and returns a `Status` object. It parses various GNSS status fields from the JSON, handling potential null values and type conversions. ```APIDOC ## Status.fromJson Factory Constructor ### Description Creates a `Status` object by parsing a JSON map. This constructor is useful for deserializing GNSS status data from external sources. ### Method Signature ```dart factory Status.fromJson(Map json) ``` ### Parameters - **json** (Map) - A map containing the GNSS status data. ### Returns - **Status** - A `Status` object populated with data from the JSON map. ### Implementation Details The constructor maps JSON keys to `Status` object properties, performing type conversions (e.g., to `double`) and handling null values by assigning `null` if the JSON value is absent or null. ### Example Usage ```dart final Map jsonData = { "azimuthDegrees": 45.5, "carrierFrequencyHz": 1575420000.0, "cn0DbHz": 35.2, "constellationType": 1, "elevationDegrees": 60.1, "svid": 12, "hasAlmanacData": true, "hasCarrierFrequencyHz": true, "hasEphemerisData": true, "usedInFix": true }; final Status status = Status.fromJson(jsonData); print(status.azimuthDegrees); // Output: 45.5 print(status.svid); // Output: 12 ``` ``` -------------------------------- ### GnssMeasurementModel.fromJson Factory Constructor Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/GnssMeasurementModel/GnssMeasurementModel.fromJson.html Use this factory constructor to parse a JSON map and create a GnssMeasurementModel instance. It handles nested objects and lists, converting them to their respective model types. ```dart factory GnssMeasurementModel.fromJson(Map json) => GnssMeasurementModel( contents: json["contents"] == null ? null : json["contents"], string: json["string"] == null ? null : json["string"], measurements: json["measurements"] == null ? null : List.from(json["measurements"].map( (x) => Measurement.fromJson(Map.from(x)))), clock: json["clock"] == null ? null : Clock.fromJson(Map.from(json["clock"])), ); ``` -------------------------------- ### Measurement Class Methods Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/Measurement-class.html Details the methods available for the Measurement class, including `toJson` for serialization and `toString` for string representation. ```APIDOC ## Methods noSuchMethod(Invocation invocation) → dynamic Invoked when a nonexistent method or property is accessed. inherited ttoJson() → Map toString() → String A string representation of this object. inherited ``` -------------------------------- ### Clock.fromJson Factory Constructor Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/Clock/Clock.fromJson.html Use this factory constructor to parse a JSON map and create a Clock instance. It handles null checks and type conversions for various clock parameters. ```dart factory Clock.fromJson(Map json) => Clock( contents: json["contents"] == null ? null : json["contents"], biasNanos: json["biasNanos"] == null ? null : json["biasNanos"].toDouble(), biasUncertaintyNanos: json["biasUncertaintyNanos"] == null ? null : json["biasUncertaintyNanos"].toDouble(), driftNanosPerSecond: json["driftNanosPerSecond"] == null ? null : json["driftNanosPerSecond"].toDouble(), driftUncertaintyNanosPerSecond: json["driftUncertaintyNanosPerSecond"] == null ? null : json["driftUncertaintyNanosPerSecond"].toDouble(), fullBiasNanos: json["fullBiasNanos"] == null ? null : json["fullBiasNanos"], hardwareClockDiscontinuityCount: json["hardwareClockDiscontinuityCount"] == null ? null : json["hardwareClockDiscontinuityCount"], leapSecond: json["leapSecond"] == null ? null : json["leapSecond"], timeNanos: json["timeNanos"] == null ? null : json["timeNanos"], timeUncertaintyNanos: json["timeUncertaintyNanos"] == null ? null : json["timeUncertaintyNanos"].toDouble(), ); ``` -------------------------------- ### Clock Properties Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/Clock-class.html Details the properties available on the Clock class. ```APIDOC ## Clock Properties biasNanos → double? biasUncertaintyNanos → double? contents → int? driftNanosPerSecond → double? driftUncertaintyNanosPerSecond → double? fullBiasNanos → int? hardwareClockDiscontinuityCount → int? leapSecond → int? timeNanos → int? timeUncertaintyNanos → double? ``` -------------------------------- ### Clock Constructor Implementation Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/Clock/Clock.html The implementation of the Clock constructor, assigning the provided parameters to the object's properties. Ensure all relevant properties are passed during initialization. ```dart Clock({ this.contents, this.biasNanos, this.biasUncertaintyNanos, this.driftNanosPerSecond, this.driftUncertaintyNanosPerSecond, this.fullBiasNanos, this.hardwareClockDiscontinuityCount, this.leapSecond, this.timeNanos, this.timeUncertaintyNanos, }); ``` -------------------------------- ### GnssStatusModel.fromJson Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/GnssStatusModel/GnssStatusModel.fromJson.html Creates a `GnssStatusModel` instance by parsing a JSON map. It handles the conversion of satellite count, hash code, and a list of statuses from the JSON. ```APIDOC ## GnssStatusModel.fromJson ### Description Parses a JSON map to create a `GnssStatusModel` object. This factory constructor is used to deserialize JSON data into a structured model. ### Method Signature ```dart factory GnssStatusModel.fromJson(Map json) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **json** (Map) - Required - A map representing the JSON data to be parsed. - **satelliteCount** (int?) - Optional - The number of satellites. - **hashCode** (int?) - Optional - The hash code of the model. - **status** (List?) - Optional - A list of status objects, where each object is a map that will be converted to a `Status` object. ### Request Example ```json { "satelliteCount": 10, "hashCode": 123456789, "status": [ { "code": "OK", "message": "All systems nominal" }, { "code": "WARNING", "message": "Low signal strength" } ] } ``` ### Response #### Success Response (GnssStatusModel) - **satelliteCount** (int?) - The number of satellites. - **hashCodec** (int?) - The hash code. - **status** (List?) - A list of `Status` objects. #### Response Example ```json { "satelliteCount": 10, "hashCodec": 123456789, "status": [ { "code": "OK", "message": "All systems nominal" }, { "code": "WARNING", "message": "Low signal strength" } ] } ``` ``` -------------------------------- ### GnssMeasurementModel.fromJson Factory Constructor Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/GnssMeasurementModel/GnssMeasurementModel.fromJson.html This factory constructor allows you to create a GnssMeasurementModel object by parsing a JSON map. It handles the conversion of nested JSON structures into corresponding Dart objects. ```APIDOC ## GnssMeasurementModel.fromJson(Map json) ### Description Creates a GnssMeasurementModel instance from a JSON map. This factory constructor is responsible for deserializing the JSON data, including nested objects like `contents`, `string`, `measurements`, and `clock`. ### Method factory ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **json** (Map) - Required - A map representing the JSON data to be parsed. - **contents** (dynamic) - Optional - The contents field from the JSON. - **string** (dynamic) - Optional - The string field from the JSON. - **measurements** (List) - Optional - A list of measurements, where each item is a JSON map that will be converted to a `Measurement` object. - **clock** (Map) - Optional - A map representing the clock data, which will be converted to a `Clock` object. ### Request Example ```json { "contents": "some content", "string": "some string", "measurements": [ { "latitude": 34.0, "longitude": -118.0 } ], "clock": { "time": 1678886400000 } } ``` ### Response #### Success Response (GnssMeasurementModel) - **contents** (dynamic) - The deserialized contents. - **string** (dynamic) - The deserialized string. - **measurements** (List) - The deserialized list of Measurement objects. - **clock** (Clock) - The deserialized Clock object. #### Response Example (Instance of GnssMeasurementModel with parsed data) ``` -------------------------------- ### Implementation of usedInFix Property Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/Status/usedInFix.html This snippet shows the declaration of the nullable boolean `usedInFix` property. ```dart bool? usedInFix; ``` -------------------------------- ### GnssStatusModel.fromJson Factory Constructor Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/GnssStatusModel/GnssStatusModel.fromJson.html Use this factory constructor to create a GnssStatusModel instance from a JSON map. It handles null checks for 'satelliteCount' and 'hashCode', and parses a list of 'status' objects using the Status.fromJson constructor. ```dart factory GnssStatusModel.fromJson(Map json) => GnssStatusModel( satelliteCount: json["satelliteCount"] == null ? null : json["satelliteCount"], hashCodec: json["hashCode"] == null ? null : json["hashCode"], status: json["status"] == null ? null : List.from(json["status"] .map((x) => Status.fromJson(Map.from(x)))), ); ``` -------------------------------- ### SVID Property Implementation Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/Status/svid.html This snippet shows the basic declaration of the nullable integer svid property. ```dart int? svid; ``` -------------------------------- ### Measurement.fromJson Factory Constructor Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/Measurement/Measurement.fromJson.html Use this factory constructor to parse a JSON map into a Measurement object. It handles null checks and type conversions for each field. ```dart factory Measurement.fromJson(Map json) => Measurement( contents: json["contents"] == null ? null : json["contents"], accumulatedDeltaRangeMeters: json["accumulatedDeltaRangeMeters"] == null ? null : json["accumulatedDeltaRangeMeters"].toDouble(), accumulatedDeltaRangeState: json["accumulatedDeltaRangeState"] == null ? null : json["accumulatedDeltaRangeState"], accumulatedDeltaRangeUncertaintyMeters: json["accumulatedDeltaRangeUncertaintyMeters"] == null ? null : json["accumulatedDeltaRangeUncertaintyMeters"].toDouble(), automaticGainControlLevelDb: json["automaticGainControlLevelDb"] == null ? null : json["automaticGainControlLevelDb"].toDouble(), carrierFrequencyHz: json["carrierFrequencyHz"] == null ? null : json["carrierFrequencyHz"].toDouble(), cn0DbHz: json["cn0DbHz"] == null ? null : json["cn0DbHz"].toDouble(), constellationType: json["constellationType"] == null ? null : json["constellationType"], multipathIndicator: json["multipathIndicator"] == null ? null : json["multipathIndicator"], pseudorangeRateMetersPerSecond: json["pseudorangeRateMetersPerSecond"] == null ? null : json["pseudorangeRateMetersPerSecond"].toDouble(), pseudorangeRateUncertaintyMetersPerSecond: json["pseudorangeRateUncertaintyMetersPerSecond"] == null ? null : json["pseudorangeRateUncertaintyMetersPerSecond"].toDouble(), receivedSvTimeNanos: json["receivedSvTimeNanos"] == null ? null : json["receivedSvTimeNanos"], receivedSvTimeUncertaintyNanos: json["receivedSvTimeUncertaintyNanos"] == null ? null : json["receivedSvTimeUncertaintyNanos"], snrInDb: json["snrInDb"] == null ? null : json["snrInDb"].toDouble(), state: json["state"] == null ? null : json["state"], svid: json["svid"] == null ? null : json["svid"], timeOffsetNanos: json["timeOffsetNanos"] == null ? null : json["timeOffsetNanos"].toDouble(), string: json["string"] == null ? null : json["string"], ); ``` -------------------------------- ### GnssMeasurementModel Properties Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/GnssMeasurementModel-class.html Properties available on the GnssMeasurementModel class. ```APIDOC ## Properties clock → Clock? contents → int? hashCode → int measurements → List? runtimeType → Type string → String? ``` -------------------------------- ### Measurement.fromJson Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/Measurement/Measurement.fromJson.html Creates a Measurement object by parsing a Map JSON input. It maps various GNSS measurement properties from the JSON, handling null values and type conversions. ```APIDOC ## Measurement.fromJson(Map json) ### Description This factory constructor takes a JSON map and constructs a `Measurement` object. It populates the object's properties by extracting values from the provided map, with checks for nulls and appropriate type casting (e.g., to double for numerical values). ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **json** (Map) - Required - A map representing the GNSS measurement data in JSON format. - **contents** (dynamic) - Optional - The contents of the measurement. - **accumulatedDeltaRangeMeters** (double) - Optional - The accumulated delta range in meters. - **accumulatedDeltaRangeState** (dynamic) - Optional - The state of the accumulated delta range. - **accumulatedDeltaRangeUncertaintyMeters** (double) - Optional - The uncertainty of the accumulated delta range in meters. - **automaticGainControlLevelDb** (double) - Optional - The automatic gain control level in dB. - **carrierFrequencyHz** (double) - Optional - The carrier frequency in Hz. - **cn0DbHz** (double) - Optional - The carrier-to-noise density ratio in dB-Hz. - **constellationType** (dynamic) - Optional - The type of satellite constellation. - **multipathIndicator** (dynamic) - Optional - The multipath indicator. - **pseudorangeRateMetersPerSecond** (double) - Optional - The pseudorange rate in meters per second. - **pseudorangeRateUncertaintyMetersPerSecond** (double) - Optional - The uncertainty of the pseudorange rate in meters per second. - **receivedSvTimeNanos** (dynamic) - Optional - The time of the received satellite signal in nanoseconds. - **receivedSvTimeUncertaintyNanos** (dynamic) - Optional - The uncertainty of the received satellite signal time in nanoseconds. - **snrInDb** (double) - Optional - The signal-to-noise ratio in dB. - **state** (dynamic) - Optional - The state of the measurement. - **svid** (dynamic) - Optional - The satellite vehicle ID. - **timeOffsetNanos** (double) - Optional - The time offset in nanoseconds. - **string** (dynamic) - Optional - A string representation (purpose not fully specified). ### Request Example ```json { "contents": null, "accumulatedDeltaRangeMeters": 12345.67, "accumulatedDeltaRangeState": 1, "accumulatedDeltaRangeUncertaintyMeters": 0.5, "automaticGainControlLevelDb": 30.5, "carrierFrequencyHz": 1575.42, "cn0DbHz": 40.2, "constellationType": 1, "multipathIndicator": 0, "pseudorangeRateMetersPerSecond": 100.1, "pseudorangeRateUncertaintyMetersPerSecond": 0.05, "receivedSvTimeNanos": 1678886400000000000, "receivedSvTimeUncertaintyNanos": 1000, "snrInDb": 25.5, "state": 0, "svid": 1, "timeOffsetNanos": 0.000001, "string": "Example String" } ``` ### Response #### Success Response (200) Returns a `Measurement` object populated with data from the JSON input. #### Response Example (This would be an instance of the `Measurement` class, not directly representable as JSON in this context, but conceptually it holds the parsed data.) ``` -------------------------------- ### Status.fromJson Factory Constructor Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/Status/Status.fromJson.html Use this factory constructor to parse a JSON map and create a Status object. It handles null checks for each field, converting numeric values to doubles where appropriate. ```dart factory Status.fromJson(Map json) => Status( azimuthDegrees: json["azimuthDegrees"] == null ? null : json["azimuthDegrees"].toDouble(), carrierFrequencyHz: json["carrierFrequencyHz"] == null ? null : json["carrierFrequencyHz"].toDouble(), cn0DbHz: json["cn0DbHz"] == null ? null : json["cn0DbHz"].toDouble(), constellationType: json["constellationType"] == null ? null : json["constellationType"], elevationDegrees: json["elevationDegrees"] == null ? null : json["elevationDegrees"].toDouble(), svid: json["svid"] == null ? null : json["svid"], hasAlmanacData: json["hasAlmanacData"] == null ? null : json["hasAlmanacData"], hasCarrierFrequencyHz: json["hasCarrierFrequencyHz"] == null ? null : json["hasCarrierFrequencyHz"], hasEphemerisData: json["hasEphemerisData"] == null ? null : json["hasEphemerisData"], usedInFix: json["usedInFix"] == null ? null : json["usedInFix"], ); ``` -------------------------------- ### gnssNavigationMessageEvents Property Source: https://pub.dev/documentation/raw_gnss/latest/raw_gnss/RawGnss-class.html A stream representing GNSS navigation message events. ```APIDOC ## gnssNavigationMessageEvents ### Description Getter for GnssNavigationMessage events. Provides a stream of navigation message data. ### Type Stream ### Access Read-only ``` -------------------------------- ### Measurement Class Operators Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/Measurement-class.html Describes the operators available for the Measurement class, specifically the equality operator (`==`). ```APIDOC ## Operators operator ==(Object other) → bool The equality operator. inherited ``` -------------------------------- ### Listen to GNSS Navigation Messages Source: https://pub.dev/packages/raw_gnss Subscribe to a stream for GNSS navigation messages. This is useful for analyzing satellite communication data. Requires the raw_gnss package. ```dart RawGnss().gnssNavigationMessageEvents.listen((e) {}); ``` -------------------------------- ### String Property Implementation Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/GnssMeasurementModel/string.html This snippet shows the declaration of a nullable string property named 'string' within the GnssMeasurementModel. ```dart final String? string; ``` -------------------------------- ### hashCodec Property Implementation Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/GnssStatusModel/hashCodec.html This snippet shows the declaration of the hashCodec property as a nullable integer. ```dart int? hashCodec; ``` -------------------------------- ### Declare fullBiasNanos Property Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/Clock/fullBiasNanos.html This snippet shows the declaration of the fullBiasNanos property as an optional integer. ```java final int? fullBiasNanos; ``` -------------------------------- ### Listen to GNSS Status Events Source: https://pub.dev/packages/raw_gnss This code snippet allows you to listen for GNSS status events, such as changes in satellite connectivity or accuracy. Initialize the raw_gnss package before use. ```dart RawGnss().gnssStatusEvents.listen((e) {}); ``` -------------------------------- ### toJson method Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/GnssMeasurementModel/toJson.html Converts the GnssMeasurementModel object into a Map representation, suitable for JSON serialization. It includes the model's contents, string representation, measurements, and clock information. ```APIDOC ## toJson method ### Description Converts the GnssMeasurementModel object into a JSON-compatible Map. ### Method Signature `Map toJson()` ### Implementation Details The method constructs a map containing the following fields: - `contents`: The contents of the model, if available. - `string`: The string representation of the model, if available. - `measurements`: A list of measurements, each converted to its JSON representation, if available. - `clock`: The clock information, converted to its JSON representation, if available. ### Code Example ```dart Map toJson() => { "contents": contents == null ? null : contents, "string": string == null ? null : string, "measurements": measurements == null ? null : List.from(measurements!.map((x) => x.toJson())), "clock": clock == null ? null : clock!.toJson(), }; ``` ``` -------------------------------- ### gnssStatusEvents Source: https://pub.dev/documentation/raw_gnss/latest/raw_gnss/RawGnss/gnssStatusEvents.html Provides a stream of GnssStatusModel events. This getter allows you to subscribe to real-time updates on GNSS status. ```APIDOC ## gnssStatusEvents property ### Description Getter for GnssMeasurement events. This provides a stream of `GnssStatusModel` objects, allowing for real-time monitoring of GNSS status. ### Method Signature `Stream get gnssStatusEvents` ### Usage Subscribe to the stream to receive updates: ```dart // Assuming you have an instance of the class that exposes gnssStatusEvents // For example: myGnssManager.gnssStatusEvents.listen((status) { ... }); ``` ### Implementation Details This getter initializes and returns a broadcast stream that processes raw measurement events into `GnssStatusModel` objects. ``` -------------------------------- ### gnssStatusModelFromJson Function Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/gnssStatusModelFromJson.html This function takes a JSON string as input and returns a GnssStatusModel object by decoding the JSON and calling the fromJson factory constructor. ```APIDOC ## gnssStatusModelFromJson Function ### Description Parses a JSON string into a GnssStatusModel object. ### Parameters #### Path Parameters - **str** (String) - Required - The JSON string to parse. ### Implementation ```dart GnssStatusModel gnssStatusModelFromJson(String str) => GnssStatusModel.fromJson(json.decode(str)); ``` ### Request Example ```json { "example": "{\"key\": \"value\"}" } ``` ### Response #### Success Response (GnssStatusModel) - **GnssStatusModel** - The parsed GnssStatusModel object. ### Response Example ```json { "example": "GnssStatusModel object representation" } ``` ``` -------------------------------- ### gnssMeasurementEvents Property Source: https://pub.dev/documentation/raw_gnss/latest/raw_gnss/RawGnss-class.html A stream of GnssMeasurementModel objects representing GNSS measurement events. ```APIDOC ## gnssMeasurementEvents ### Description Getter for GnssMeasurement events. Provides a stream of GnssMeasurementModel objects. ### Type Stream ### Access Read-only ``` -------------------------------- ### gnssMeasurementEvents Property Source: https://pub.dev/documentation/raw_gnss/latest/raw_gnss/RawGnss/gnssMeasurementEvents.html Provides a stream of GnssMeasurementModel objects, representing real-time GNSS measurement events. ```APIDOC ## gnssMeasurementEvents Property ### Description Getter for GnssMeasurement events. This property returns a `Stream` that emits GNSS measurement data as it becomes available. ### Method Getter ### Return Type `Stream` ### Usage Example ```dart // Assuming you have an instance of the GNSS service Stream gnssEvents = gnssService.gnssMeasurementEvents; gnssEvents.listen((measurement) { // Process each GNSS measurement event print('Received GNSS measurement: $measurement'); }); ``` ``` -------------------------------- ### Convert JSON String to GnssMeasurementModel Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/gnssMeasurementModelFromJson.html Use this function to parse a JSON string and create a GnssMeasurementModel object. Ensure the input string is valid JSON. ```dart GnssMeasurementModel gnssMeasurementModelFromJson(String str) => GnssMeasurementModel.fromJson(json.decode(str)); ``` -------------------------------- ### toJson Method Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/Status-class.html Converts the Status object to a JSON-serializable map. ```APIDOC ## toJson() → Map ### Description Serializes the Status object into a Map suitable for JSON encoding. ### Returns A Map representing the Status object. ``` -------------------------------- ### Declare measurements property Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/GnssMeasurementModel/measurements.html This snippet shows the declaration of the 'measurements' property, which is a nullable list of Measurement objects. ```dart final List? measurements; ``` -------------------------------- ### Implement gnssStatusModelFromJson Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/gnssStatusModelFromJson.html Use this function to convert a JSON string into a GnssStatusModel object. Ensure the input string is valid JSON. ```dart GnssStatusModel gnssStatusModelFromJson(String str) => GnssStatusModel.fromJson(json.decode(str)); ``` -------------------------------- ### gnssStatusEvents Property Source: https://pub.dev/documentation/raw_gnss/latest/raw_gnss/RawGnss-class.html A stream of GnssStatusModel objects representing GNSS status events. ```APIDOC ## gnssStatusEvents ### Description Getter for GnssStatus events. Provides a stream of GnssStatusModel objects. ### Type Stream ### Access Read-only ``` -------------------------------- ### hasAlmanacData Property Implementation Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/Status/hasAlmanacData.html This snippet shows the declaration of the nullable boolean hasAlmanacData property. ```dart bool? hasAlmanacData; ``` -------------------------------- ### azimuthDegrees Property Implementation Source: https://pub.dev/documentation/raw_gnss/latest/gnss_status_model/Status/azimuthDegrees.html This snippet shows the declaration of the nullable double azimuthDegrees property. ```dart double? azimuthDegrees; ``` -------------------------------- ### Declare Multipath Indicator Property Source: https://pub.dev/documentation/raw_gnss/latest/gnss_measurement_model/Measurement/multipathIndicator.html This snippet shows the declaration of the nullable integer `multipathIndicator` property. ```dart final int? multipathIndicator; ```