diff --git a/app/build.gradle b/app/build.gradle index 3e29b13f..dd670da7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,6 +3,8 @@ plugins { id 'com.google.gms.google-services' id 'androidx.navigation.safeargs' id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' + // ADDED: The Protobuf Plugin + id 'com.google.protobuf' version '0.9.4' } // (Optional) load local secrets file: @@ -57,6 +59,22 @@ android { } } +// ADDED: The Protobuf Compiler Configuration +protobuf { + protoc { + artifact = 'com.google.protobuf:protoc:3.21.7' + } + generateProtoTasks { + all().each { task -> + task.builtins { + java { + option 'lite' + } + } + } + } +} + dependencies { // Core AndroidX implementation 'androidx.appcompat:appcompat:1.7.0-alpha03' // or stable: 1.6.1 @@ -83,6 +101,9 @@ dependencies { def nav_version = "2.8.6" implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version" + implementation 'com.google.code.gson:gson:2.10.1' + //implementation 'com.google.protobuf:protobuf-java-util:3.21.7' + implementation 'com.google.guava:guava:31.1-android' // Optional: Jetpack Compose (Material 3) // implementation "androidx.compose.material3:material3:1.3.1" @@ -92,4 +113,8 @@ dependencies { testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.2.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' -} + + implementation 'com.google.protobuf:protobuf-java:3.25.3' + implementation 'com.google.protobuf:protobuf-java-util:3.25.3' + +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 678711fd..de4c6f94 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -84,7 +84,7 @@ + android:value="AIzaSyCYcyjihkTeu6hyuQ9W2svhtf9eczFiImM"/> optional string android_version = 1; - */ - String getAndroidVersion(); - /** - * optional string android_version = 1; - */ - com.google.protobuf.ByteString - getAndroidVersionBytes(); - - /** - * repeated .Motion_Sample imu_data = 2; - */ - java.util.List - getImuDataList(); - /** - * repeated .Motion_Sample imu_data = 2; - */ - Motion_Sample getImuData(int index); - /** - * repeated .Motion_Sample imu_data = 2; - */ - int getImuDataCount(); - /** - * repeated .Motion_Sample imu_data = 2; - */ - java.util.List - getImuDataOrBuilderList(); - /** - * repeated .Motion_Sample imu_data = 2; - */ - Motion_SampleOrBuilder getImuDataOrBuilder( - int index); - - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - java.util.List - getPdrDataList(); - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - Pdr_Sample getPdrData(int index); - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - int getPdrDataCount(); - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - java.util.List - getPdrDataOrBuilderList(); - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - Pdr_SampleOrBuilder getPdrDataOrBuilder( - int index); - - /** - * repeated .Position_Sample position_data = 4; - */ - java.util.List - getPositionDataList(); - /** - * repeated .Position_Sample position_data = 4; - */ - Position_Sample getPositionData(int index); - /** - * repeated .Position_Sample position_data = 4; - */ - int getPositionDataCount(); - /** - * repeated .Position_Sample position_data = 4; - */ - java.util.List - getPositionDataOrBuilderList(); - /** - * repeated .Position_Sample position_data = 4; - */ - Position_SampleOrBuilder getPositionDataOrBuilder( - int index); - - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - java.util.List - getPressureDataList(); - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - Pressure_Sample getPressureData(int index); - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - int getPressureDataCount(); - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - java.util.List - getPressureDataOrBuilderList(); - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - Pressure_SampleOrBuilder getPressureDataOrBuilder( - int index); - - /** - * repeated .Light_Sample light_data = 6; - */ - java.util.List - getLightDataList(); - /** - * repeated .Light_Sample light_data = 6; - */ - Light_Sample getLightData(int index); - /** - * repeated .Light_Sample light_data = 6; - */ - int getLightDataCount(); - /** - * repeated .Light_Sample light_data = 6; - */ - java.util.List - getLightDataOrBuilderList(); - /** - * repeated .Light_Sample light_data = 6; - */ - Light_SampleOrBuilder getLightDataOrBuilder( - int index); - - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - java.util.List - getGnssDataList(); - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - GNSS_Sample getGnssData(int index); - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - int getGnssDataCount(); - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - java.util.List - getGnssDataOrBuilderList(); - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - GNSS_SampleOrBuilder getGnssDataOrBuilder( - int index); - - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - java.util.List - getWifiDataList(); - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - WiFi_Sample getWifiData(int index); - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - int getWifiDataCount(); - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - java.util.List - getWifiDataOrBuilderList(); - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - WiFi_SampleOrBuilder getWifiDataOrBuilder( - int index); - - /** - * repeated .AP_Data aps_data = 9; - */ - java.util.List - getApsDataList(); - /** - * repeated .AP_Data aps_data = 9; - */ - AP_Data getApsData(int index); - /** - * repeated .AP_Data aps_data = 9; - */ - int getApsDataCount(); - /** - * repeated .AP_Data aps_data = 9; - */ - java.util.List - getApsDataOrBuilderList(); - /** - * repeated .AP_Data aps_data = 9; - */ - AP_DataOrBuilder getApsDataOrBuilder( - int index); - - /** - *
-     * UNIX timestamp (in milliseconds) recorded from the start of this
-     * trajectory data collection event. All future
-     * timestamps in sub classes are to be RELATIVE timestamps
-     * (in milliseconds) to this start time.
-     * E.g.
-     * start_timestamp = 1674819807315 (UTC 27 Jan 2023 in the morning)
-     * relative_timestamp = 3000 (3s)
-     * 
- * - * optional int64 start_timestamp = 10; - */ - long getStartTimestamp(); - - /** - * optional string data_identifier = 11; - */ - String getDataIdentifier(); - /** - * optional string data_identifier = 11; - */ - com.google.protobuf.ByteString - getDataIdentifierBytes(); - - /** - * optional .Sensor_Info accelerometer_info = 12; - */ - boolean hasAccelerometerInfo(); - /** - * optional .Sensor_Info accelerometer_info = 12; - */ - Sensor_Info getAccelerometerInfo(); - /** - * optional .Sensor_Info accelerometer_info = 12; - */ - Sensor_InfoOrBuilder getAccelerometerInfoOrBuilder(); - - /** - * optional .Sensor_Info gyroscope_info = 13; - */ - boolean hasGyroscopeInfo(); - /** - * optional .Sensor_Info gyroscope_info = 13; - */ - Sensor_Info getGyroscopeInfo(); - /** - * optional .Sensor_Info gyroscope_info = 13; - */ - Sensor_InfoOrBuilder getGyroscopeInfoOrBuilder(); - - /** - * optional .Sensor_Info rotation_vector_info = 14; - */ - boolean hasRotationVectorInfo(); - /** - * optional .Sensor_Info rotation_vector_info = 14; - */ - Sensor_Info getRotationVectorInfo(); - /** - * optional .Sensor_Info rotation_vector_info = 14; - */ - Sensor_InfoOrBuilder getRotationVectorInfoOrBuilder(); - - /** - * optional .Sensor_Info magnetometer_info = 15; - */ - boolean hasMagnetometerInfo(); - /** - * optional .Sensor_Info magnetometer_info = 15; - */ - Sensor_Info getMagnetometerInfo(); - /** - * optional .Sensor_Info magnetometer_info = 15; - */ - Sensor_InfoOrBuilder getMagnetometerInfoOrBuilder(); - - /** - * optional .Sensor_Info barometer_info = 16; - */ - boolean hasBarometerInfo(); - /** - * optional .Sensor_Info barometer_info = 16; - */ - Sensor_Info getBarometerInfo(); - /** - * optional .Sensor_Info barometer_info = 16; - */ - Sensor_InfoOrBuilder getBarometerInfoOrBuilder(); - - /** - * optional .Sensor_Info light_sensor_info = 17; - */ - boolean hasLightSensorInfo(); - /** - * optional .Sensor_Info light_sensor_info = 17; - */ - Sensor_Info getLightSensorInfo(); - /** - * optional .Sensor_Info light_sensor_info = 17; - */ - Sensor_InfoOrBuilder getLightSensorInfoOrBuilder(); - } - /** - * Protobuf type {@code Trajectory} - */ - public static final class Trajectory extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:Trajectory) - TrajectoryOrBuilder { - // Use Trajectory.newBuilder() to construct. - private Trajectory(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Trajectory() { - androidVersion_ = ""; - imuData_ = java.util.Collections.emptyList(); - pdrData_ = java.util.Collections.emptyList(); - positionData_ = java.util.Collections.emptyList(); - pressureData_ = java.util.Collections.emptyList(); - lightData_ = java.util.Collections.emptyList(); - gnssData_ = java.util.Collections.emptyList(); - wifiData_ = java.util.Collections.emptyList(); - apsData_ = java.util.Collections.emptyList(); - startTimestamp_ = 0L; - dataIdentifier_ = ""; - } - - @Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - private Trajectory( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!input.skipField(tag)) { - done = true; - } - break; - } - case 10: { - String s = input.readStringRequireUtf8(); - - androidVersion_ = s; - break; - } - case 18: { - if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - imuData_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000002; - } - imuData_.add( - input.readMessage(Motion_Sample.parser(), extensionRegistry)); - break; - } - case 26: { - if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - pdrData_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000004; - } - pdrData_.add( - input.readMessage(Pdr_Sample.parser(), extensionRegistry)); - break; - } - case 34: { - if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - positionData_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000008; - } - positionData_.add( - input.readMessage(Position_Sample.parser(), extensionRegistry)); - break; - } - case 42: { - if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) { - pressureData_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000010; - } - pressureData_.add( - input.readMessage(Pressure_Sample.parser(), extensionRegistry)); - break; - } - case 50: { - if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { - lightData_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000020; - } - lightData_.add( - input.readMessage(Light_Sample.parser(), extensionRegistry)); - break; - } - case 58: { - if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) { - gnssData_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000040; - } - gnssData_.add( - input.readMessage(GNSS_Sample.parser(), extensionRegistry)); - break; - } - case 66: { - if (!((mutable_bitField0_ & 0x00000080) == 0x00000080)) { - wifiData_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000080; - } - wifiData_.add( - input.readMessage(WiFi_Sample.parser(), extensionRegistry)); - break; - } - case 74: { - if (!((mutable_bitField0_ & 0x00000100) == 0x00000100)) { - apsData_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000100; - } - apsData_.add( - input.readMessage(AP_Data.parser(), extensionRegistry)); - break; - } - case 80: { - - startTimestamp_ = input.readInt64(); - break; - } - case 90: { - String s = input.readStringRequireUtf8(); - - dataIdentifier_ = s; - break; - } - case 98: { - Sensor_Info.Builder subBuilder = null; - if (accelerometerInfo_ != null) { - subBuilder = accelerometerInfo_.toBuilder(); - } - accelerometerInfo_ = input.readMessage(Sensor_Info.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(accelerometerInfo_); - accelerometerInfo_ = subBuilder.buildPartial(); - } - - break; - } - case 106: { - Sensor_Info.Builder subBuilder = null; - if (gyroscopeInfo_ != null) { - subBuilder = gyroscopeInfo_.toBuilder(); - } - gyroscopeInfo_ = input.readMessage(Sensor_Info.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(gyroscopeInfo_); - gyroscopeInfo_ = subBuilder.buildPartial(); - } - - break; - } - case 114: { - Sensor_Info.Builder subBuilder = null; - if (rotationVectorInfo_ != null) { - subBuilder = rotationVectorInfo_.toBuilder(); - } - rotationVectorInfo_ = input.readMessage(Sensor_Info.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(rotationVectorInfo_); - rotationVectorInfo_ = subBuilder.buildPartial(); - } - - break; - } - case 122: { - Sensor_Info.Builder subBuilder = null; - if (magnetometerInfo_ != null) { - subBuilder = magnetometerInfo_.toBuilder(); - } - magnetometerInfo_ = input.readMessage(Sensor_Info.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(magnetometerInfo_); - magnetometerInfo_ = subBuilder.buildPartial(); - } - - break; - } - case 130: { - Sensor_Info.Builder subBuilder = null; - if (barometerInfo_ != null) { - subBuilder = barometerInfo_.toBuilder(); - } - barometerInfo_ = input.readMessage(Sensor_Info.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(barometerInfo_); - barometerInfo_ = subBuilder.buildPartial(); - } - - break; - } - case 138: { - Sensor_Info.Builder subBuilder = null; - if (lightSensorInfo_ != null) { - subBuilder = lightSensorInfo_.toBuilder(); - } - lightSensorInfo_ = input.readMessage(Sensor_Info.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(lightSensorInfo_); - lightSensorInfo_ = subBuilder.buildPartial(); - } - - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - imuData_ = java.util.Collections.unmodifiableList(imuData_); - } - if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - pdrData_ = java.util.Collections.unmodifiableList(pdrData_); - } - if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - positionData_ = java.util.Collections.unmodifiableList(positionData_); - } - if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) { - pressureData_ = java.util.Collections.unmodifiableList(pressureData_); - } - if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { - lightData_ = java.util.Collections.unmodifiableList(lightData_); - } - if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) { - gnssData_ = java.util.Collections.unmodifiableList(gnssData_); - } - if (((mutable_bitField0_ & 0x00000080) == 0x00000080)) { - wifiData_ = java.util.Collections.unmodifiableList(wifiData_); - } - if (((mutable_bitField0_ & 0x00000100) == 0x00000100)) { - apsData_ = java.util.Collections.unmodifiableList(apsData_); - } - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_Trajectory_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_Trajectory_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Trajectory.class, Builder.class); - } - - private int bitField0_; - public static final int ANDROID_VERSION_FIELD_NUMBER = 1; - private volatile Object androidVersion_; - /** - * optional string android_version = 1; - */ - public String getAndroidVersion() { - Object ref = androidVersion_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - androidVersion_ = s; - return s; - } - } - /** - * optional string android_version = 1; - */ - public com.google.protobuf.ByteString - getAndroidVersionBytes() { - Object ref = androidVersion_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (String) ref); - androidVersion_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int IMU_DATA_FIELD_NUMBER = 2; - private java.util.List imuData_; - /** - * repeated .Motion_Sample imu_data = 2; - */ - public java.util.List getImuDataList() { - return imuData_; - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public java.util.List - getImuDataOrBuilderList() { - return imuData_; - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public int getImuDataCount() { - return imuData_.size(); - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public Motion_Sample getImuData(int index) { - return imuData_.get(index); - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public Motion_SampleOrBuilder getImuDataOrBuilder( - int index) { - return imuData_.get(index); - } - - public static final int PDR_DATA_FIELD_NUMBER = 3; - private java.util.List pdrData_; - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public java.util.List getPdrDataList() { - return pdrData_; - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public java.util.List - getPdrDataOrBuilderList() { - return pdrData_; - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public int getPdrDataCount() { - return pdrData_.size(); - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public Pdr_Sample getPdrData(int index) { - return pdrData_.get(index); - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public Pdr_SampleOrBuilder getPdrDataOrBuilder( - int index) { - return pdrData_.get(index); - } - - public static final int POSITION_DATA_FIELD_NUMBER = 4; - private java.util.List positionData_; - /** - * repeated .Position_Sample position_data = 4; - */ - public java.util.List getPositionDataList() { - return positionData_; - } - /** - * repeated .Position_Sample position_data = 4; - */ - public java.util.List - getPositionDataOrBuilderList() { - return positionData_; - } - /** - * repeated .Position_Sample position_data = 4; - */ - public int getPositionDataCount() { - return positionData_.size(); - } - /** - * repeated .Position_Sample position_data = 4; - */ - public Position_Sample getPositionData(int index) { - return positionData_.get(index); - } - /** - * repeated .Position_Sample position_data = 4; - */ - public Position_SampleOrBuilder getPositionDataOrBuilder( - int index) { - return positionData_.get(index); - } - - public static final int PRESSURE_DATA_FIELD_NUMBER = 5; - private java.util.List pressureData_; - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public java.util.List getPressureDataList() { - return pressureData_; - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public java.util.List - getPressureDataOrBuilderList() { - return pressureData_; - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public int getPressureDataCount() { - return pressureData_.size(); - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public Pressure_Sample getPressureData(int index) { - return pressureData_.get(index); - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public Pressure_SampleOrBuilder getPressureDataOrBuilder( - int index) { - return pressureData_.get(index); - } - - public static final int LIGHT_DATA_FIELD_NUMBER = 6; - private java.util.List lightData_; - /** - * repeated .Light_Sample light_data = 6; - */ - public java.util.List getLightDataList() { - return lightData_; - } - /** - * repeated .Light_Sample light_data = 6; - */ - public java.util.List - getLightDataOrBuilderList() { - return lightData_; - } - /** - * repeated .Light_Sample light_data = 6; - */ - public int getLightDataCount() { - return lightData_.size(); - } - /** - * repeated .Light_Sample light_data = 6; - */ - public Light_Sample getLightData(int index) { - return lightData_.get(index); - } - /** - * repeated .Light_Sample light_data = 6; - */ - public Light_SampleOrBuilder getLightDataOrBuilder( - int index) { - return lightData_.get(index); - } - - public static final int GNSS_DATA_FIELD_NUMBER = 7; - private java.util.List gnssData_; - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public java.util.List getGnssDataList() { - return gnssData_; - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public java.util.List - getGnssDataOrBuilderList() { - return gnssData_; - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public int getGnssDataCount() { - return gnssData_.size(); - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public GNSS_Sample getGnssData(int index) { - return gnssData_.get(index); - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public GNSS_SampleOrBuilder getGnssDataOrBuilder( - int index) { - return gnssData_.get(index); - } - - public static final int WIFI_DATA_FIELD_NUMBER = 8; - private java.util.List wifiData_; - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public java.util.List getWifiDataList() { - return wifiData_; - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public java.util.List - getWifiDataOrBuilderList() { - return wifiData_; - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public int getWifiDataCount() { - return wifiData_.size(); - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public WiFi_Sample getWifiData(int index) { - return wifiData_.get(index); - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public WiFi_SampleOrBuilder getWifiDataOrBuilder( - int index) { - return wifiData_.get(index); - } - - public static final int APS_DATA_FIELD_NUMBER = 9; - private java.util.List apsData_; - /** - * repeated .AP_Data aps_data = 9; - */ - public java.util.List getApsDataList() { - return apsData_; - } - /** - * repeated .AP_Data aps_data = 9; - */ - public java.util.List - getApsDataOrBuilderList() { - return apsData_; - } - /** - * repeated .AP_Data aps_data = 9; - */ - public int getApsDataCount() { - return apsData_.size(); - } - /** - * repeated .AP_Data aps_data = 9; - */ - public AP_Data getApsData(int index) { - return apsData_.get(index); - } - /** - * repeated .AP_Data aps_data = 9; - */ - public AP_DataOrBuilder getApsDataOrBuilder( - int index) { - return apsData_.get(index); - } - - public static final int START_TIMESTAMP_FIELD_NUMBER = 10; - private long startTimestamp_; - /** - *
-     * UNIX timestamp (in milliseconds) recorded from the start of this
-     * trajectory data collection event. All future
-     * timestamps in sub classes are to be RELATIVE timestamps
-     * (in milliseconds) to this start time.
-     * E.g.
-     * start_timestamp = 1674819807315 (UTC 27 Jan 2023 in the morning)
-     * relative_timestamp = 3000 (3s)
-     * 
- * - * optional int64 start_timestamp = 10; - */ - public long getStartTimestamp() { - return startTimestamp_; - } - - public static final int DATA_IDENTIFIER_FIELD_NUMBER = 11; - private volatile Object dataIdentifier_; - /** - * optional string data_identifier = 11; - */ - public String getDataIdentifier() { - Object ref = dataIdentifier_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - dataIdentifier_ = s; - return s; - } - } - /** - * optional string data_identifier = 11; - */ - public com.google.protobuf.ByteString - getDataIdentifierBytes() { - Object ref = dataIdentifier_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (String) ref); - dataIdentifier_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int ACCELEROMETER_INFO_FIELD_NUMBER = 12; - private Sensor_Info accelerometerInfo_; - /** - * optional .Sensor_Info accelerometer_info = 12; - */ - public boolean hasAccelerometerInfo() { - return accelerometerInfo_ != null; - } - /** - * optional .Sensor_Info accelerometer_info = 12; - */ - public Sensor_Info getAccelerometerInfo() { - return accelerometerInfo_ == null ? Sensor_Info.getDefaultInstance() : accelerometerInfo_; - } - /** - * optional .Sensor_Info accelerometer_info = 12; - */ - public Sensor_InfoOrBuilder getAccelerometerInfoOrBuilder() { - return getAccelerometerInfo(); - } - - public static final int GYROSCOPE_INFO_FIELD_NUMBER = 13; - private Sensor_Info gyroscopeInfo_; - /** - * optional .Sensor_Info gyroscope_info = 13; - */ - public boolean hasGyroscopeInfo() { - return gyroscopeInfo_ != null; - } - /** - * optional .Sensor_Info gyroscope_info = 13; - */ - public Sensor_Info getGyroscopeInfo() { - return gyroscopeInfo_ == null ? Sensor_Info.getDefaultInstance() : gyroscopeInfo_; - } - /** - * optional .Sensor_Info gyroscope_info = 13; - */ - public Sensor_InfoOrBuilder getGyroscopeInfoOrBuilder() { - return getGyroscopeInfo(); - } - - public static final int ROTATION_VECTOR_INFO_FIELD_NUMBER = 14; - private Sensor_Info rotationVectorInfo_; - /** - * optional .Sensor_Info rotation_vector_info = 14; - */ - public boolean hasRotationVectorInfo() { - return rotationVectorInfo_ != null; - } - /** - * optional .Sensor_Info rotation_vector_info = 14; - */ - public Sensor_Info getRotationVectorInfo() { - return rotationVectorInfo_ == null ? Sensor_Info.getDefaultInstance() : rotationVectorInfo_; - } - /** - * optional .Sensor_Info rotation_vector_info = 14; - */ - public Sensor_InfoOrBuilder getRotationVectorInfoOrBuilder() { - return getRotationVectorInfo(); - } - - public static final int MAGNETOMETER_INFO_FIELD_NUMBER = 15; - private Sensor_Info magnetometerInfo_; - /** - * optional .Sensor_Info magnetometer_info = 15; - */ - public boolean hasMagnetometerInfo() { - return magnetometerInfo_ != null; - } - /** - * optional .Sensor_Info magnetometer_info = 15; - */ - public Sensor_Info getMagnetometerInfo() { - return magnetometerInfo_ == null ? Sensor_Info.getDefaultInstance() : magnetometerInfo_; - } - /** - * optional .Sensor_Info magnetometer_info = 15; - */ - public Sensor_InfoOrBuilder getMagnetometerInfoOrBuilder() { - return getMagnetometerInfo(); - } - - public static final int BAROMETER_INFO_FIELD_NUMBER = 16; - private Sensor_Info barometerInfo_; - /** - * optional .Sensor_Info barometer_info = 16; - */ - public boolean hasBarometerInfo() { - return barometerInfo_ != null; - } - /** - * optional .Sensor_Info barometer_info = 16; - */ - public Sensor_Info getBarometerInfo() { - return barometerInfo_ == null ? Sensor_Info.getDefaultInstance() : barometerInfo_; - } - /** - * optional .Sensor_Info barometer_info = 16; - */ - public Sensor_InfoOrBuilder getBarometerInfoOrBuilder() { - return getBarometerInfo(); - } - - public static final int LIGHT_SENSOR_INFO_FIELD_NUMBER = 17; - private Sensor_Info lightSensorInfo_; - /** - * optional .Sensor_Info light_sensor_info = 17; - */ - public boolean hasLightSensorInfo() { - return lightSensorInfo_ != null; - } - /** - * optional .Sensor_Info light_sensor_info = 17; - */ - public Sensor_Info getLightSensorInfo() { - return lightSensorInfo_ == null ? Sensor_Info.getDefaultInstance() : lightSensorInfo_; - } - /** - * optional .Sensor_Info light_sensor_info = 17; - */ - public Sensor_InfoOrBuilder getLightSensorInfoOrBuilder() { - return getLightSensorInfo(); - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (!getAndroidVersionBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, androidVersion_); - } - for (int i = 0; i < imuData_.size(); i++) { - output.writeMessage(2, imuData_.get(i)); - } - for (int i = 0; i < pdrData_.size(); i++) { - output.writeMessage(3, pdrData_.get(i)); - } - for (int i = 0; i < positionData_.size(); i++) { - output.writeMessage(4, positionData_.get(i)); - } - for (int i = 0; i < pressureData_.size(); i++) { - output.writeMessage(5, pressureData_.get(i)); - } - for (int i = 0; i < lightData_.size(); i++) { - output.writeMessage(6, lightData_.get(i)); - } - for (int i = 0; i < gnssData_.size(); i++) { - output.writeMessage(7, gnssData_.get(i)); - } - for (int i = 0; i < wifiData_.size(); i++) { - output.writeMessage(8, wifiData_.get(i)); - } - for (int i = 0; i < apsData_.size(); i++) { - output.writeMessage(9, apsData_.get(i)); - } - if (startTimestamp_ != 0L) { - output.writeInt64(10, startTimestamp_); - } - if (!getDataIdentifierBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 11, dataIdentifier_); - } - if (accelerometerInfo_ != null) { - output.writeMessage(12, getAccelerometerInfo()); - } - if (gyroscopeInfo_ != null) { - output.writeMessage(13, getGyroscopeInfo()); - } - if (rotationVectorInfo_ != null) { - output.writeMessage(14, getRotationVectorInfo()); - } - if (magnetometerInfo_ != null) { - output.writeMessage(15, getMagnetometerInfo()); - } - if (barometerInfo_ != null) { - output.writeMessage(16, getBarometerInfo()); - } - if (lightSensorInfo_ != null) { - output.writeMessage(17, getLightSensorInfo()); - } - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!getAndroidVersionBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, androidVersion_); - } - for (int i = 0; i < imuData_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, imuData_.get(i)); - } - for (int i = 0; i < pdrData_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, pdrData_.get(i)); - } - for (int i = 0; i < positionData_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(4, positionData_.get(i)); - } - for (int i = 0; i < pressureData_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(5, pressureData_.get(i)); - } - for (int i = 0; i < lightData_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(6, lightData_.get(i)); - } - for (int i = 0; i < gnssData_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(7, gnssData_.get(i)); - } - for (int i = 0; i < wifiData_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(8, wifiData_.get(i)); - } - for (int i = 0; i < apsData_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(9, apsData_.get(i)); - } - if (startTimestamp_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(10, startTimestamp_); - } - if (!getDataIdentifierBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(11, dataIdentifier_); - } - if (accelerometerInfo_ != null) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(12, getAccelerometerInfo()); - } - if (gyroscopeInfo_ != null) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(13, getGyroscopeInfo()); - } - if (rotationVectorInfo_ != null) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(14, getRotationVectorInfo()); - } - if (magnetometerInfo_ != null) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(15, getMagnetometerInfo()); - } - if (barometerInfo_ != null) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(16, getBarometerInfo()); - } - if (lightSensorInfo_ != null) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(17, getLightSensorInfo()); - } - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @Override - public boolean equals(final Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof Trajectory)) { - return super.equals(obj); - } - Trajectory other = (Trajectory) obj; - - boolean result = true; - result = result && getAndroidVersion() - .equals(other.getAndroidVersion()); - result = result && getImuDataList() - .equals(other.getImuDataList()); - result = result && getPdrDataList() - .equals(other.getPdrDataList()); - result = result && getPositionDataList() - .equals(other.getPositionDataList()); - result = result && getPressureDataList() - .equals(other.getPressureDataList()); - result = result && getLightDataList() - .equals(other.getLightDataList()); - result = result && getGnssDataList() - .equals(other.getGnssDataList()); - result = result && getWifiDataList() - .equals(other.getWifiDataList()); - result = result && getApsDataList() - .equals(other.getApsDataList()); - result = result && (getStartTimestamp() - == other.getStartTimestamp()); - result = result && getDataIdentifier() - .equals(other.getDataIdentifier()); - result = result && (hasAccelerometerInfo() == other.hasAccelerometerInfo()); - if (hasAccelerometerInfo()) { - result = result && getAccelerometerInfo() - .equals(other.getAccelerometerInfo()); - } - result = result && (hasGyroscopeInfo() == other.hasGyroscopeInfo()); - if (hasGyroscopeInfo()) { - result = result && getGyroscopeInfo() - .equals(other.getGyroscopeInfo()); - } - result = result && (hasRotationVectorInfo() == other.hasRotationVectorInfo()); - if (hasRotationVectorInfo()) { - result = result && getRotationVectorInfo() - .equals(other.getRotationVectorInfo()); - } - result = result && (hasMagnetometerInfo() == other.hasMagnetometerInfo()); - if (hasMagnetometerInfo()) { - result = result && getMagnetometerInfo() - .equals(other.getMagnetometerInfo()); - } - result = result && (hasBarometerInfo() == other.hasBarometerInfo()); - if (hasBarometerInfo()) { - result = result && getBarometerInfo() - .equals(other.getBarometerInfo()); - } - result = result && (hasLightSensorInfo() == other.hasLightSensorInfo()); - if (hasLightSensorInfo()) { - result = result && getLightSensorInfo() - .equals(other.getLightSensorInfo()); - } - return result; - } - - @Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - hash = (37 * hash) + ANDROID_VERSION_FIELD_NUMBER; - hash = (53 * hash) + getAndroidVersion().hashCode(); - if (getImuDataCount() > 0) { - hash = (37 * hash) + IMU_DATA_FIELD_NUMBER; - hash = (53 * hash) + getImuDataList().hashCode(); - } - if (getPdrDataCount() > 0) { - hash = (37 * hash) + PDR_DATA_FIELD_NUMBER; - hash = (53 * hash) + getPdrDataList().hashCode(); - } - if (getPositionDataCount() > 0) { - hash = (37 * hash) + POSITION_DATA_FIELD_NUMBER; - hash = (53 * hash) + getPositionDataList().hashCode(); - } - if (getPressureDataCount() > 0) { - hash = (37 * hash) + PRESSURE_DATA_FIELD_NUMBER; - hash = (53 * hash) + getPressureDataList().hashCode(); - } - if (getLightDataCount() > 0) { - hash = (37 * hash) + LIGHT_DATA_FIELD_NUMBER; - hash = (53 * hash) + getLightDataList().hashCode(); - } - if (getGnssDataCount() > 0) { - hash = (37 * hash) + GNSS_DATA_FIELD_NUMBER; - hash = (53 * hash) + getGnssDataList().hashCode(); - } - if (getWifiDataCount() > 0) { - hash = (37 * hash) + WIFI_DATA_FIELD_NUMBER; - hash = (53 * hash) + getWifiDataList().hashCode(); - } - if (getApsDataCount() > 0) { - hash = (37 * hash) + APS_DATA_FIELD_NUMBER; - hash = (53 * hash) + getApsDataList().hashCode(); - } - hash = (37 * hash) + START_TIMESTAMP_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getStartTimestamp()); - hash = (37 * hash) + DATA_IDENTIFIER_FIELD_NUMBER; - hash = (53 * hash) + getDataIdentifier().hashCode(); - if (hasAccelerometerInfo()) { - hash = (37 * hash) + ACCELEROMETER_INFO_FIELD_NUMBER; - hash = (53 * hash) + getAccelerometerInfo().hashCode(); - } - if (hasGyroscopeInfo()) { - hash = (37 * hash) + GYROSCOPE_INFO_FIELD_NUMBER; - hash = (53 * hash) + getGyroscopeInfo().hashCode(); - } - if (hasRotationVectorInfo()) { - hash = (37 * hash) + ROTATION_VECTOR_INFO_FIELD_NUMBER; - hash = (53 * hash) + getRotationVectorInfo().hashCode(); - } - if (hasMagnetometerInfo()) { - hash = (37 * hash) + MAGNETOMETER_INFO_FIELD_NUMBER; - hash = (53 * hash) + getMagnetometerInfo().hashCode(); - } - if (hasBarometerInfo()) { - hash = (37 * hash) + BAROMETER_INFO_FIELD_NUMBER; - hash = (53 * hash) + getBarometerInfo().hashCode(); - } - if (hasLightSensorInfo()) { - hash = (37 * hash) + LIGHT_SENSOR_INFO_FIELD_NUMBER; - hash = (53 * hash) + getLightSensorInfo().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static Trajectory parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Trajectory parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Trajectory parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Trajectory parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Trajectory parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Trajectory parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static Trajectory parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static Trajectory parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static Trajectory parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Trajectory parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(Trajectory prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code Trajectory} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:Trajectory) - TrajectoryOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_Trajectory_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_Trajectory_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Trajectory.class, Builder.class); - } - - // Construct using Traj.Trajectory.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getImuDataFieldBuilder(); - getPdrDataFieldBuilder(); - getPositionDataFieldBuilder(); - getPressureDataFieldBuilder(); - getLightDataFieldBuilder(); - getGnssDataFieldBuilder(); - getWifiDataFieldBuilder(); - getApsDataFieldBuilder(); - } - } - public Builder clear() { - super.clear(); - androidVersion_ = ""; - - if (imuDataBuilder_ == null) { - imuData_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - imuDataBuilder_.clear(); - } - if (pdrDataBuilder_ == null) { - pdrData_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - } else { - pdrDataBuilder_.clear(); - } - if (positionDataBuilder_ == null) { - positionData_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - } else { - positionDataBuilder_.clear(); - } - if (pressureDataBuilder_ == null) { - pressureData_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000010); - } else { - pressureDataBuilder_.clear(); - } - if (lightDataBuilder_ == null) { - lightData_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); - } else { - lightDataBuilder_.clear(); - } - if (gnssDataBuilder_ == null) { - gnssData_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000040); - } else { - gnssDataBuilder_.clear(); - } - if (wifiDataBuilder_ == null) { - wifiData_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000080); - } else { - wifiDataBuilder_.clear(); - } - if (apsDataBuilder_ == null) { - apsData_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000100); - } else { - apsDataBuilder_.clear(); - } - startTimestamp_ = 0L; - - dataIdentifier_ = ""; - - if (accelerometerInfoBuilder_ == null) { - accelerometerInfo_ = null; - } else { - accelerometerInfo_ = null; - accelerometerInfoBuilder_ = null; - } - if (gyroscopeInfoBuilder_ == null) { - gyroscopeInfo_ = null; - } else { - gyroscopeInfo_ = null; - gyroscopeInfoBuilder_ = null; - } - if (rotationVectorInfoBuilder_ == null) { - rotationVectorInfo_ = null; - } else { - rotationVectorInfo_ = null; - rotationVectorInfoBuilder_ = null; - } - if (magnetometerInfoBuilder_ == null) { - magnetometerInfo_ = null; - } else { - magnetometerInfo_ = null; - magnetometerInfoBuilder_ = null; - } - if (barometerInfoBuilder_ == null) { - barometerInfo_ = null; - } else { - barometerInfo_ = null; - barometerInfoBuilder_ = null; - } - if (lightSensorInfoBuilder_ == null) { - lightSensorInfo_ = null; - } else { - lightSensorInfo_ = null; - lightSensorInfoBuilder_ = null; - } - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return Traj.internal_static_Trajectory_descriptor; - } - - public Trajectory getDefaultInstanceForType() { - return Trajectory.getDefaultInstance(); - } - - public Trajectory build() { - Trajectory result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public Trajectory buildPartial() { - Trajectory result = new Trajectory(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - result.androidVersion_ = androidVersion_; - if (imuDataBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - imuData_ = java.util.Collections.unmodifiableList(imuData_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.imuData_ = imuData_; - } else { - result.imuData_ = imuDataBuilder_.build(); - } - if (pdrDataBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004)) { - pdrData_ = java.util.Collections.unmodifiableList(pdrData_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.pdrData_ = pdrData_; - } else { - result.pdrData_ = pdrDataBuilder_.build(); - } - if (positionDataBuilder_ == null) { - if (((bitField0_ & 0x00000008) == 0x00000008)) { - positionData_ = java.util.Collections.unmodifiableList(positionData_); - bitField0_ = (bitField0_ & ~0x00000008); - } - result.positionData_ = positionData_; - } else { - result.positionData_ = positionDataBuilder_.build(); - } - if (pressureDataBuilder_ == null) { - if (((bitField0_ & 0x00000010) == 0x00000010)) { - pressureData_ = java.util.Collections.unmodifiableList(pressureData_); - bitField0_ = (bitField0_ & ~0x00000010); - } - result.pressureData_ = pressureData_; - } else { - result.pressureData_ = pressureDataBuilder_.build(); - } - if (lightDataBuilder_ == null) { - if (((bitField0_ & 0x00000020) == 0x00000020)) { - lightData_ = java.util.Collections.unmodifiableList(lightData_); - bitField0_ = (bitField0_ & ~0x00000020); - } - result.lightData_ = lightData_; - } else { - result.lightData_ = lightDataBuilder_.build(); - } - if (gnssDataBuilder_ == null) { - if (((bitField0_ & 0x00000040) == 0x00000040)) { - gnssData_ = java.util.Collections.unmodifiableList(gnssData_); - bitField0_ = (bitField0_ & ~0x00000040); - } - result.gnssData_ = gnssData_; - } else { - result.gnssData_ = gnssDataBuilder_.build(); - } - if (wifiDataBuilder_ == null) { - if (((bitField0_ & 0x00000080) == 0x00000080)) { - wifiData_ = java.util.Collections.unmodifiableList(wifiData_); - bitField0_ = (bitField0_ & ~0x00000080); - } - result.wifiData_ = wifiData_; - } else { - result.wifiData_ = wifiDataBuilder_.build(); - } - if (apsDataBuilder_ == null) { - if (((bitField0_ & 0x00000100) == 0x00000100)) { - apsData_ = java.util.Collections.unmodifiableList(apsData_); - bitField0_ = (bitField0_ & ~0x00000100); - } - result.apsData_ = apsData_; - } else { - result.apsData_ = apsDataBuilder_.build(); - } - result.startTimestamp_ = startTimestamp_; - result.dataIdentifier_ = dataIdentifier_; - if (accelerometerInfoBuilder_ == null) { - result.accelerometerInfo_ = accelerometerInfo_; - } else { - result.accelerometerInfo_ = accelerometerInfoBuilder_.build(); - } - if (gyroscopeInfoBuilder_ == null) { - result.gyroscopeInfo_ = gyroscopeInfo_; - } else { - result.gyroscopeInfo_ = gyroscopeInfoBuilder_.build(); - } - if (rotationVectorInfoBuilder_ == null) { - result.rotationVectorInfo_ = rotationVectorInfo_; - } else { - result.rotationVectorInfo_ = rotationVectorInfoBuilder_.build(); - } - if (magnetometerInfoBuilder_ == null) { - result.magnetometerInfo_ = magnetometerInfo_; - } else { - result.magnetometerInfo_ = magnetometerInfoBuilder_.build(); - } - if (barometerInfoBuilder_ == null) { - result.barometerInfo_ = barometerInfo_; - } else { - result.barometerInfo_ = barometerInfoBuilder_.build(); - } - if (lightSensorInfoBuilder_ == null) { - result.lightSensorInfo_ = lightSensorInfo_; - } else { - result.lightSensorInfo_ = lightSensorInfoBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof Trajectory) { - return mergeFrom((Trajectory)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(Trajectory other) { - if (other == Trajectory.getDefaultInstance()) return this; - if (!other.getAndroidVersion().isEmpty()) { - androidVersion_ = other.androidVersion_; - onChanged(); - } - if (imuDataBuilder_ == null) { - if (!other.imuData_.isEmpty()) { - if (imuData_.isEmpty()) { - imuData_ = other.imuData_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureImuDataIsMutable(); - imuData_.addAll(other.imuData_); - } - onChanged(); - } - } else { - if (!other.imuData_.isEmpty()) { - if (imuDataBuilder_.isEmpty()) { - imuDataBuilder_.dispose(); - imuDataBuilder_ = null; - imuData_ = other.imuData_; - bitField0_ = (bitField0_ & ~0x00000002); - imuDataBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getImuDataFieldBuilder() : null; - } else { - imuDataBuilder_.addAllMessages(other.imuData_); - } - } - } - if (pdrDataBuilder_ == null) { - if (!other.pdrData_.isEmpty()) { - if (pdrData_.isEmpty()) { - pdrData_ = other.pdrData_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensurePdrDataIsMutable(); - pdrData_.addAll(other.pdrData_); - } - onChanged(); - } - } else { - if (!other.pdrData_.isEmpty()) { - if (pdrDataBuilder_.isEmpty()) { - pdrDataBuilder_.dispose(); - pdrDataBuilder_ = null; - pdrData_ = other.pdrData_; - bitField0_ = (bitField0_ & ~0x00000004); - pdrDataBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getPdrDataFieldBuilder() : null; - } else { - pdrDataBuilder_.addAllMessages(other.pdrData_); - } - } - } - if (positionDataBuilder_ == null) { - if (!other.positionData_.isEmpty()) { - if (positionData_.isEmpty()) { - positionData_ = other.positionData_; - bitField0_ = (bitField0_ & ~0x00000008); - } else { - ensurePositionDataIsMutable(); - positionData_.addAll(other.positionData_); - } - onChanged(); - } - } else { - if (!other.positionData_.isEmpty()) { - if (positionDataBuilder_.isEmpty()) { - positionDataBuilder_.dispose(); - positionDataBuilder_ = null; - positionData_ = other.positionData_; - bitField0_ = (bitField0_ & ~0x00000008); - positionDataBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getPositionDataFieldBuilder() : null; - } else { - positionDataBuilder_.addAllMessages(other.positionData_); - } - } - } - if (pressureDataBuilder_ == null) { - if (!other.pressureData_.isEmpty()) { - if (pressureData_.isEmpty()) { - pressureData_ = other.pressureData_; - bitField0_ = (bitField0_ & ~0x00000010); - } else { - ensurePressureDataIsMutable(); - pressureData_.addAll(other.pressureData_); - } - onChanged(); - } - } else { - if (!other.pressureData_.isEmpty()) { - if (pressureDataBuilder_.isEmpty()) { - pressureDataBuilder_.dispose(); - pressureDataBuilder_ = null; - pressureData_ = other.pressureData_; - bitField0_ = (bitField0_ & ~0x00000010); - pressureDataBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getPressureDataFieldBuilder() : null; - } else { - pressureDataBuilder_.addAllMessages(other.pressureData_); - } - } - } - if (lightDataBuilder_ == null) { - if (!other.lightData_.isEmpty()) { - if (lightData_.isEmpty()) { - lightData_ = other.lightData_; - bitField0_ = (bitField0_ & ~0x00000020); - } else { - ensureLightDataIsMutable(); - lightData_.addAll(other.lightData_); - } - onChanged(); - } - } else { - if (!other.lightData_.isEmpty()) { - if (lightDataBuilder_.isEmpty()) { - lightDataBuilder_.dispose(); - lightDataBuilder_ = null; - lightData_ = other.lightData_; - bitField0_ = (bitField0_ & ~0x00000020); - lightDataBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getLightDataFieldBuilder() : null; - } else { - lightDataBuilder_.addAllMessages(other.lightData_); - } - } - } - if (gnssDataBuilder_ == null) { - if (!other.gnssData_.isEmpty()) { - if (gnssData_.isEmpty()) { - gnssData_ = other.gnssData_; - bitField0_ = (bitField0_ & ~0x00000040); - } else { - ensureGnssDataIsMutable(); - gnssData_.addAll(other.gnssData_); - } - onChanged(); - } - } else { - if (!other.gnssData_.isEmpty()) { - if (gnssDataBuilder_.isEmpty()) { - gnssDataBuilder_.dispose(); - gnssDataBuilder_ = null; - gnssData_ = other.gnssData_; - bitField0_ = (bitField0_ & ~0x00000040); - gnssDataBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getGnssDataFieldBuilder() : null; - } else { - gnssDataBuilder_.addAllMessages(other.gnssData_); - } - } - } - if (wifiDataBuilder_ == null) { - if (!other.wifiData_.isEmpty()) { - if (wifiData_.isEmpty()) { - wifiData_ = other.wifiData_; - bitField0_ = (bitField0_ & ~0x00000080); - } else { - ensureWifiDataIsMutable(); - wifiData_.addAll(other.wifiData_); - } - onChanged(); - } - } else { - if (!other.wifiData_.isEmpty()) { - if (wifiDataBuilder_.isEmpty()) { - wifiDataBuilder_.dispose(); - wifiDataBuilder_ = null; - wifiData_ = other.wifiData_; - bitField0_ = (bitField0_ & ~0x00000080); - wifiDataBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getWifiDataFieldBuilder() : null; - } else { - wifiDataBuilder_.addAllMessages(other.wifiData_); - } - } - } - if (apsDataBuilder_ == null) { - if (!other.apsData_.isEmpty()) { - if (apsData_.isEmpty()) { - apsData_ = other.apsData_; - bitField0_ = (bitField0_ & ~0x00000100); - } else { - ensureApsDataIsMutable(); - apsData_.addAll(other.apsData_); - } - onChanged(); - } - } else { - if (!other.apsData_.isEmpty()) { - if (apsDataBuilder_.isEmpty()) { - apsDataBuilder_.dispose(); - apsDataBuilder_ = null; - apsData_ = other.apsData_; - bitField0_ = (bitField0_ & ~0x00000100); - apsDataBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getApsDataFieldBuilder() : null; - } else { - apsDataBuilder_.addAllMessages(other.apsData_); - } - } - } - if (other.getStartTimestamp() != 0L) { - setStartTimestamp(other.getStartTimestamp()); - } - if (!other.getDataIdentifier().isEmpty()) { - dataIdentifier_ = other.dataIdentifier_; - onChanged(); - } - if (other.hasAccelerometerInfo()) { - mergeAccelerometerInfo(other.getAccelerometerInfo()); - } - if (other.hasGyroscopeInfo()) { - mergeGyroscopeInfo(other.getGyroscopeInfo()); - } - if (other.hasRotationVectorInfo()) { - mergeRotationVectorInfo(other.getRotationVectorInfo()); - } - if (other.hasMagnetometerInfo()) { - mergeMagnetometerInfo(other.getMagnetometerInfo()); - } - if (other.hasBarometerInfo()) { - mergeBarometerInfo(other.getBarometerInfo()); - } - if (other.hasLightSensorInfo()) { - mergeLightSensorInfo(other.getLightSensorInfo()); - } - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Trajectory parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (Trajectory) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private Object androidVersion_ = ""; - /** - * optional string android_version = 1; - */ - public String getAndroidVersion() { - Object ref = androidVersion_; - if (!(ref instanceof String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - androidVersion_ = s; - return s; - } else { - return (String) ref; - } - } - /** - * optional string android_version = 1; - */ - public com.google.protobuf.ByteString - getAndroidVersionBytes() { - Object ref = androidVersion_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (String) ref); - androidVersion_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * optional string android_version = 1; - */ - public Builder setAndroidVersion( - String value) { - if (value == null) { - throw new NullPointerException(); - } - - androidVersion_ = value; - onChanged(); - return this; - } - /** - * optional string android_version = 1; - */ - public Builder clearAndroidVersion() { - - androidVersion_ = getDefaultInstance().getAndroidVersion(); - onChanged(); - return this; - } - /** - * optional string android_version = 1; - */ - public Builder setAndroidVersionBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - androidVersion_ = value; - onChanged(); - return this; - } - - private java.util.List imuData_ = - java.util.Collections.emptyList(); - private void ensureImuDataIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - imuData_ = new java.util.ArrayList(imuData_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - Motion_Sample, Motion_Sample.Builder, Motion_SampleOrBuilder> imuDataBuilder_; - - /** - * repeated .Motion_Sample imu_data = 2; - */ - public java.util.List getImuDataList() { - if (imuDataBuilder_ == null) { - return java.util.Collections.unmodifiableList(imuData_); - } else { - return imuDataBuilder_.getMessageList(); - } - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public int getImuDataCount() { - if (imuDataBuilder_ == null) { - return imuData_.size(); - } else { - return imuDataBuilder_.getCount(); - } - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public Motion_Sample getImuData(int index) { - if (imuDataBuilder_ == null) { - return imuData_.get(index); - } else { - return imuDataBuilder_.getMessage(index); - } - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public Builder setImuData( - int index, Motion_Sample value) { - if (imuDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureImuDataIsMutable(); - imuData_.set(index, value); - onChanged(); - } else { - imuDataBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public Builder setImuData( - int index, Motion_Sample.Builder builderForValue) { - if (imuDataBuilder_ == null) { - ensureImuDataIsMutable(); - imuData_.set(index, builderForValue.build()); - onChanged(); - } else { - imuDataBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public Builder addImuData(Motion_Sample value) { - if (imuDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureImuDataIsMutable(); - imuData_.add(value); - onChanged(); - } else { - imuDataBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public Builder addImuData( - int index, Motion_Sample value) { - if (imuDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureImuDataIsMutable(); - imuData_.add(index, value); - onChanged(); - } else { - imuDataBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public Builder addImuData( - Motion_Sample.Builder builderForValue) { - if (imuDataBuilder_ == null) { - ensureImuDataIsMutable(); - imuData_.add(builderForValue.build()); - onChanged(); - } else { - imuDataBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public Builder addImuData( - int index, Motion_Sample.Builder builderForValue) { - if (imuDataBuilder_ == null) { - ensureImuDataIsMutable(); - imuData_.add(index, builderForValue.build()); - onChanged(); - } else { - imuDataBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public Builder addAllImuData( - Iterable values) { - if (imuDataBuilder_ == null) { - ensureImuDataIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, imuData_); - onChanged(); - } else { - imuDataBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public Builder clearImuData() { - if (imuDataBuilder_ == null) { - imuData_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - imuDataBuilder_.clear(); - } - return this; - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public Builder removeImuData(int index) { - if (imuDataBuilder_ == null) { - ensureImuDataIsMutable(); - imuData_.remove(index); - onChanged(); - } else { - imuDataBuilder_.remove(index); - } - return this; - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public Motion_Sample.Builder getImuDataBuilder( - int index) { - return getImuDataFieldBuilder().getBuilder(index); - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public Motion_SampleOrBuilder getImuDataOrBuilder( - int index) { - if (imuDataBuilder_ == null) { - return imuData_.get(index); } else { - return imuDataBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public java.util.List - getImuDataOrBuilderList() { - if (imuDataBuilder_ != null) { - return imuDataBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(imuData_); - } - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public Motion_Sample.Builder addImuDataBuilder() { - return getImuDataFieldBuilder().addBuilder( - Motion_Sample.getDefaultInstance()); - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public Motion_Sample.Builder addImuDataBuilder( - int index) { - return getImuDataFieldBuilder().addBuilder( - index, Motion_Sample.getDefaultInstance()); - } - /** - * repeated .Motion_Sample imu_data = 2; - */ - public java.util.List - getImuDataBuilderList() { - return getImuDataFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - Motion_Sample, Motion_Sample.Builder, Motion_SampleOrBuilder> - getImuDataFieldBuilder() { - if (imuDataBuilder_ == null) { - imuDataBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - Motion_Sample, Motion_Sample.Builder, Motion_SampleOrBuilder>( - imuData_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - imuData_ = null; - } - return imuDataBuilder_; - } - - private java.util.List pdrData_ = - java.util.Collections.emptyList(); - private void ensurePdrDataIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - pdrData_ = new java.util.ArrayList(pdrData_); - bitField0_ |= 0x00000004; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - Pdr_Sample, Pdr_Sample.Builder, Pdr_SampleOrBuilder> pdrDataBuilder_; - - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public java.util.List getPdrDataList() { - if (pdrDataBuilder_ == null) { - return java.util.Collections.unmodifiableList(pdrData_); - } else { - return pdrDataBuilder_.getMessageList(); - } - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public int getPdrDataCount() { - if (pdrDataBuilder_ == null) { - return pdrData_.size(); - } else { - return pdrDataBuilder_.getCount(); - } - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public Pdr_Sample getPdrData(int index) { - if (pdrDataBuilder_ == null) { - return pdrData_.get(index); - } else { - return pdrDataBuilder_.getMessage(index); - } - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public Builder setPdrData( - int index, Pdr_Sample value) { - if (pdrDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePdrDataIsMutable(); - pdrData_.set(index, value); - onChanged(); - } else { - pdrDataBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public Builder setPdrData( - int index, Pdr_Sample.Builder builderForValue) { - if (pdrDataBuilder_ == null) { - ensurePdrDataIsMutable(); - pdrData_.set(index, builderForValue.build()); - onChanged(); - } else { - pdrDataBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public Builder addPdrData(Pdr_Sample value) { - if (pdrDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePdrDataIsMutable(); - pdrData_.add(value); - onChanged(); - } else { - pdrDataBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public Builder addPdrData( - int index, Pdr_Sample value) { - if (pdrDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePdrDataIsMutable(); - pdrData_.add(index, value); - onChanged(); - } else { - pdrDataBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public Builder addPdrData( - Pdr_Sample.Builder builderForValue) { - if (pdrDataBuilder_ == null) { - ensurePdrDataIsMutable(); - pdrData_.add(builderForValue.build()); - onChanged(); - } else { - pdrDataBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public Builder addPdrData( - int index, Pdr_Sample.Builder builderForValue) { - if (pdrDataBuilder_ == null) { - ensurePdrDataIsMutable(); - pdrData_.add(index, builderForValue.build()); - onChanged(); - } else { - pdrDataBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public Builder addAllPdrData( - Iterable values) { - if (pdrDataBuilder_ == null) { - ensurePdrDataIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, pdrData_); - onChanged(); - } else { - pdrDataBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public Builder clearPdrData() { - if (pdrDataBuilder_ == null) { - pdrData_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - } else { - pdrDataBuilder_.clear(); - } - return this; - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public Builder removePdrData(int index) { - if (pdrDataBuilder_ == null) { - ensurePdrDataIsMutable(); - pdrData_.remove(index); - onChanged(); - } else { - pdrDataBuilder_.remove(index); - } - return this; - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public Pdr_Sample.Builder getPdrDataBuilder( - int index) { - return getPdrDataFieldBuilder().getBuilder(index); - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public Pdr_SampleOrBuilder getPdrDataOrBuilder( - int index) { - if (pdrDataBuilder_ == null) { - return pdrData_.get(index); } else { - return pdrDataBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public java.util.List - getPdrDataOrBuilderList() { - if (pdrDataBuilder_ != null) { - return pdrDataBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(pdrData_); - } - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public Pdr_Sample.Builder addPdrDataBuilder() { - return getPdrDataFieldBuilder().addBuilder( - Pdr_Sample.getDefaultInstance()); - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public Pdr_Sample.Builder addPdrDataBuilder( - int index) { - return getPdrDataFieldBuilder().addBuilder( - index, Pdr_Sample.getDefaultInstance()); - } - /** - * repeated .Pdr_Sample pdr_data = 3; - */ - public java.util.List - getPdrDataBuilderList() { - return getPdrDataFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - Pdr_Sample, Pdr_Sample.Builder, Pdr_SampleOrBuilder> - getPdrDataFieldBuilder() { - if (pdrDataBuilder_ == null) { - pdrDataBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - Pdr_Sample, Pdr_Sample.Builder, Pdr_SampleOrBuilder>( - pdrData_, - ((bitField0_ & 0x00000004) == 0x00000004), - getParentForChildren(), - isClean()); - pdrData_ = null; - } - return pdrDataBuilder_; - } - - private java.util.List positionData_ = - java.util.Collections.emptyList(); - private void ensurePositionDataIsMutable() { - if (!((bitField0_ & 0x00000008) == 0x00000008)) { - positionData_ = new java.util.ArrayList(positionData_); - bitField0_ |= 0x00000008; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - Position_Sample, Position_Sample.Builder, Position_SampleOrBuilder> positionDataBuilder_; - - /** - * repeated .Position_Sample position_data = 4; - */ - public java.util.List getPositionDataList() { - if (positionDataBuilder_ == null) { - return java.util.Collections.unmodifiableList(positionData_); - } else { - return positionDataBuilder_.getMessageList(); - } - } - /** - * repeated .Position_Sample position_data = 4; - */ - public int getPositionDataCount() { - if (positionDataBuilder_ == null) { - return positionData_.size(); - } else { - return positionDataBuilder_.getCount(); - } - } - /** - * repeated .Position_Sample position_data = 4; - */ - public Position_Sample getPositionData(int index) { - if (positionDataBuilder_ == null) { - return positionData_.get(index); - } else { - return positionDataBuilder_.getMessage(index); - } - } - /** - * repeated .Position_Sample position_data = 4; - */ - public Builder setPositionData( - int index, Position_Sample value) { - if (positionDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePositionDataIsMutable(); - positionData_.set(index, value); - onChanged(); - } else { - positionDataBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .Position_Sample position_data = 4; - */ - public Builder setPositionData( - int index, Position_Sample.Builder builderForValue) { - if (positionDataBuilder_ == null) { - ensurePositionDataIsMutable(); - positionData_.set(index, builderForValue.build()); - onChanged(); - } else { - positionDataBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .Position_Sample position_data = 4; - */ - public Builder addPositionData(Position_Sample value) { - if (positionDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePositionDataIsMutable(); - positionData_.add(value); - onChanged(); - } else { - positionDataBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .Position_Sample position_data = 4; - */ - public Builder addPositionData( - int index, Position_Sample value) { - if (positionDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePositionDataIsMutable(); - positionData_.add(index, value); - onChanged(); - } else { - positionDataBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .Position_Sample position_data = 4; - */ - public Builder addPositionData( - Position_Sample.Builder builderForValue) { - if (positionDataBuilder_ == null) { - ensurePositionDataIsMutable(); - positionData_.add(builderForValue.build()); - onChanged(); - } else { - positionDataBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .Position_Sample position_data = 4; - */ - public Builder addPositionData( - int index, Position_Sample.Builder builderForValue) { - if (positionDataBuilder_ == null) { - ensurePositionDataIsMutable(); - positionData_.add(index, builderForValue.build()); - onChanged(); - } else { - positionDataBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .Position_Sample position_data = 4; - */ - public Builder addAllPositionData( - Iterable values) { - if (positionDataBuilder_ == null) { - ensurePositionDataIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, positionData_); - onChanged(); - } else { - positionDataBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .Position_Sample position_data = 4; - */ - public Builder clearPositionData() { - if (positionDataBuilder_ == null) { - positionData_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - onChanged(); - } else { - positionDataBuilder_.clear(); - } - return this; - } - /** - * repeated .Position_Sample position_data = 4; - */ - public Builder removePositionData(int index) { - if (positionDataBuilder_ == null) { - ensurePositionDataIsMutable(); - positionData_.remove(index); - onChanged(); - } else { - positionDataBuilder_.remove(index); - } - return this; - } - /** - * repeated .Position_Sample position_data = 4; - */ - public Position_Sample.Builder getPositionDataBuilder( - int index) { - return getPositionDataFieldBuilder().getBuilder(index); - } - /** - * repeated .Position_Sample position_data = 4; - */ - public Position_SampleOrBuilder getPositionDataOrBuilder( - int index) { - if (positionDataBuilder_ == null) { - return positionData_.get(index); } else { - return positionDataBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .Position_Sample position_data = 4; - */ - public java.util.List - getPositionDataOrBuilderList() { - if (positionDataBuilder_ != null) { - return positionDataBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(positionData_); - } - } - /** - * repeated .Position_Sample position_data = 4; - */ - public Position_Sample.Builder addPositionDataBuilder() { - return getPositionDataFieldBuilder().addBuilder( - Position_Sample.getDefaultInstance()); - } - /** - * repeated .Position_Sample position_data = 4; - */ - public Position_Sample.Builder addPositionDataBuilder( - int index) { - return getPositionDataFieldBuilder().addBuilder( - index, Position_Sample.getDefaultInstance()); - } - /** - * repeated .Position_Sample position_data = 4; - */ - public java.util.List - getPositionDataBuilderList() { - return getPositionDataFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - Position_Sample, Position_Sample.Builder, Position_SampleOrBuilder> - getPositionDataFieldBuilder() { - if (positionDataBuilder_ == null) { - positionDataBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - Position_Sample, Position_Sample.Builder, Position_SampleOrBuilder>( - positionData_, - ((bitField0_ & 0x00000008) == 0x00000008), - getParentForChildren(), - isClean()); - positionData_ = null; - } - return positionDataBuilder_; - } - - private java.util.List pressureData_ = - java.util.Collections.emptyList(); - private void ensurePressureDataIsMutable() { - if (!((bitField0_ & 0x00000010) == 0x00000010)) { - pressureData_ = new java.util.ArrayList(pressureData_); - bitField0_ |= 0x00000010; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - Pressure_Sample, Pressure_Sample.Builder, Pressure_SampleOrBuilder> pressureDataBuilder_; - - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public java.util.List getPressureDataList() { - if (pressureDataBuilder_ == null) { - return java.util.Collections.unmodifiableList(pressureData_); - } else { - return pressureDataBuilder_.getMessageList(); - } - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public int getPressureDataCount() { - if (pressureDataBuilder_ == null) { - return pressureData_.size(); - } else { - return pressureDataBuilder_.getCount(); - } - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public Pressure_Sample getPressureData(int index) { - if (pressureDataBuilder_ == null) { - return pressureData_.get(index); - } else { - return pressureDataBuilder_.getMessage(index); - } - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public Builder setPressureData( - int index, Pressure_Sample value) { - if (pressureDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePressureDataIsMutable(); - pressureData_.set(index, value); - onChanged(); - } else { - pressureDataBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public Builder setPressureData( - int index, Pressure_Sample.Builder builderForValue) { - if (pressureDataBuilder_ == null) { - ensurePressureDataIsMutable(); - pressureData_.set(index, builderForValue.build()); - onChanged(); - } else { - pressureDataBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public Builder addPressureData(Pressure_Sample value) { - if (pressureDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePressureDataIsMutable(); - pressureData_.add(value); - onChanged(); - } else { - pressureDataBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public Builder addPressureData( - int index, Pressure_Sample value) { - if (pressureDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePressureDataIsMutable(); - pressureData_.add(index, value); - onChanged(); - } else { - pressureDataBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public Builder addPressureData( - Pressure_Sample.Builder builderForValue) { - if (pressureDataBuilder_ == null) { - ensurePressureDataIsMutable(); - pressureData_.add(builderForValue.build()); - onChanged(); - } else { - pressureDataBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public Builder addPressureData( - int index, Pressure_Sample.Builder builderForValue) { - if (pressureDataBuilder_ == null) { - ensurePressureDataIsMutable(); - pressureData_.add(index, builderForValue.build()); - onChanged(); - } else { - pressureDataBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public Builder addAllPressureData( - Iterable values) { - if (pressureDataBuilder_ == null) { - ensurePressureDataIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, pressureData_); - onChanged(); - } else { - pressureDataBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public Builder clearPressureData() { - if (pressureDataBuilder_ == null) { - pressureData_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000010); - onChanged(); - } else { - pressureDataBuilder_.clear(); - } - return this; - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public Builder removePressureData(int index) { - if (pressureDataBuilder_ == null) { - ensurePressureDataIsMutable(); - pressureData_.remove(index); - onChanged(); - } else { - pressureDataBuilder_.remove(index); - } - return this; - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public Pressure_Sample.Builder getPressureDataBuilder( - int index) { - return getPressureDataFieldBuilder().getBuilder(index); - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public Pressure_SampleOrBuilder getPressureDataOrBuilder( - int index) { - if (pressureDataBuilder_ == null) { - return pressureData_.get(index); } else { - return pressureDataBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public java.util.List - getPressureDataOrBuilderList() { - if (pressureDataBuilder_ != null) { - return pressureDataBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(pressureData_); - } - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public Pressure_Sample.Builder addPressureDataBuilder() { - return getPressureDataFieldBuilder().addBuilder( - Pressure_Sample.getDefaultInstance()); - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public Pressure_Sample.Builder addPressureDataBuilder( - int index) { - return getPressureDataFieldBuilder().addBuilder( - index, Pressure_Sample.getDefaultInstance()); - } - /** - * repeated .Pressure_Sample pressure_data = 5; - */ - public java.util.List - getPressureDataBuilderList() { - return getPressureDataFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - Pressure_Sample, Pressure_Sample.Builder, Pressure_SampleOrBuilder> - getPressureDataFieldBuilder() { - if (pressureDataBuilder_ == null) { - pressureDataBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - Pressure_Sample, Pressure_Sample.Builder, Pressure_SampleOrBuilder>( - pressureData_, - ((bitField0_ & 0x00000010) == 0x00000010), - getParentForChildren(), - isClean()); - pressureData_ = null; - } - return pressureDataBuilder_; - } - - private java.util.List lightData_ = - java.util.Collections.emptyList(); - private void ensureLightDataIsMutable() { - if (!((bitField0_ & 0x00000020) == 0x00000020)) { - lightData_ = new java.util.ArrayList(lightData_); - bitField0_ |= 0x00000020; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - Light_Sample, Light_Sample.Builder, Light_SampleOrBuilder> lightDataBuilder_; - - /** - * repeated .Light_Sample light_data = 6; - */ - public java.util.List getLightDataList() { - if (lightDataBuilder_ == null) { - return java.util.Collections.unmodifiableList(lightData_); - } else { - return lightDataBuilder_.getMessageList(); - } - } - /** - * repeated .Light_Sample light_data = 6; - */ - public int getLightDataCount() { - if (lightDataBuilder_ == null) { - return lightData_.size(); - } else { - return lightDataBuilder_.getCount(); - } - } - /** - * repeated .Light_Sample light_data = 6; - */ - public Light_Sample getLightData(int index) { - if (lightDataBuilder_ == null) { - return lightData_.get(index); - } else { - return lightDataBuilder_.getMessage(index); - } - } - /** - * repeated .Light_Sample light_data = 6; - */ - public Builder setLightData( - int index, Light_Sample value) { - if (lightDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureLightDataIsMutable(); - lightData_.set(index, value); - onChanged(); - } else { - lightDataBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .Light_Sample light_data = 6; - */ - public Builder setLightData( - int index, Light_Sample.Builder builderForValue) { - if (lightDataBuilder_ == null) { - ensureLightDataIsMutable(); - lightData_.set(index, builderForValue.build()); - onChanged(); - } else { - lightDataBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .Light_Sample light_data = 6; - */ - public Builder addLightData(Light_Sample value) { - if (lightDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureLightDataIsMutable(); - lightData_.add(value); - onChanged(); - } else { - lightDataBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .Light_Sample light_data = 6; - */ - public Builder addLightData( - int index, Light_Sample value) { - if (lightDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureLightDataIsMutable(); - lightData_.add(index, value); - onChanged(); - } else { - lightDataBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .Light_Sample light_data = 6; - */ - public Builder addLightData( - Light_Sample.Builder builderForValue) { - if (lightDataBuilder_ == null) { - ensureLightDataIsMutable(); - lightData_.add(builderForValue.build()); - onChanged(); - } else { - lightDataBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .Light_Sample light_data = 6; - */ - public Builder addLightData( - int index, Light_Sample.Builder builderForValue) { - if (lightDataBuilder_ == null) { - ensureLightDataIsMutable(); - lightData_.add(index, builderForValue.build()); - onChanged(); - } else { - lightDataBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .Light_Sample light_data = 6; - */ - public Builder addAllLightData( - Iterable values) { - if (lightDataBuilder_ == null) { - ensureLightDataIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, lightData_); - onChanged(); - } else { - lightDataBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .Light_Sample light_data = 6; - */ - public Builder clearLightData() { - if (lightDataBuilder_ == null) { - lightData_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); - onChanged(); - } else { - lightDataBuilder_.clear(); - } - return this; - } - /** - * repeated .Light_Sample light_data = 6; - */ - public Builder removeLightData(int index) { - if (lightDataBuilder_ == null) { - ensureLightDataIsMutable(); - lightData_.remove(index); - onChanged(); - } else { - lightDataBuilder_.remove(index); - } - return this; - } - /** - * repeated .Light_Sample light_data = 6; - */ - public Light_Sample.Builder getLightDataBuilder( - int index) { - return getLightDataFieldBuilder().getBuilder(index); - } - /** - * repeated .Light_Sample light_data = 6; - */ - public Light_SampleOrBuilder getLightDataOrBuilder( - int index) { - if (lightDataBuilder_ == null) { - return lightData_.get(index); } else { - return lightDataBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .Light_Sample light_data = 6; - */ - public java.util.List - getLightDataOrBuilderList() { - if (lightDataBuilder_ != null) { - return lightDataBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(lightData_); - } - } - /** - * repeated .Light_Sample light_data = 6; - */ - public Light_Sample.Builder addLightDataBuilder() { - return getLightDataFieldBuilder().addBuilder( - Light_Sample.getDefaultInstance()); - } - /** - * repeated .Light_Sample light_data = 6; - */ - public Light_Sample.Builder addLightDataBuilder( - int index) { - return getLightDataFieldBuilder().addBuilder( - index, Light_Sample.getDefaultInstance()); - } - /** - * repeated .Light_Sample light_data = 6; - */ - public java.util.List - getLightDataBuilderList() { - return getLightDataFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - Light_Sample, Light_Sample.Builder, Light_SampleOrBuilder> - getLightDataFieldBuilder() { - if (lightDataBuilder_ == null) { - lightDataBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - Light_Sample, Light_Sample.Builder, Light_SampleOrBuilder>( - lightData_, - ((bitField0_ & 0x00000020) == 0x00000020), - getParentForChildren(), - isClean()); - lightData_ = null; - } - return lightDataBuilder_; - } - - private java.util.List gnssData_ = - java.util.Collections.emptyList(); - private void ensureGnssDataIsMutable() { - if (!((bitField0_ & 0x00000040) == 0x00000040)) { - gnssData_ = new java.util.ArrayList(gnssData_); - bitField0_ |= 0x00000040; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - GNSS_Sample, GNSS_Sample.Builder, GNSS_SampleOrBuilder> gnssDataBuilder_; - - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public java.util.List getGnssDataList() { - if (gnssDataBuilder_ == null) { - return java.util.Collections.unmodifiableList(gnssData_); - } else { - return gnssDataBuilder_.getMessageList(); - } - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public int getGnssDataCount() { - if (gnssDataBuilder_ == null) { - return gnssData_.size(); - } else { - return gnssDataBuilder_.getCount(); - } - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public GNSS_Sample getGnssData(int index) { - if (gnssDataBuilder_ == null) { - return gnssData_.get(index); - } else { - return gnssDataBuilder_.getMessage(index); - } - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public Builder setGnssData( - int index, GNSS_Sample value) { - if (gnssDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureGnssDataIsMutable(); - gnssData_.set(index, value); - onChanged(); - } else { - gnssDataBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public Builder setGnssData( - int index, GNSS_Sample.Builder builderForValue) { - if (gnssDataBuilder_ == null) { - ensureGnssDataIsMutable(); - gnssData_.set(index, builderForValue.build()); - onChanged(); - } else { - gnssDataBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public Builder addGnssData(GNSS_Sample value) { - if (gnssDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureGnssDataIsMutable(); - gnssData_.add(value); - onChanged(); - } else { - gnssDataBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public Builder addGnssData( - int index, GNSS_Sample value) { - if (gnssDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureGnssDataIsMutable(); - gnssData_.add(index, value); - onChanged(); - } else { - gnssDataBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public Builder addGnssData( - GNSS_Sample.Builder builderForValue) { - if (gnssDataBuilder_ == null) { - ensureGnssDataIsMutable(); - gnssData_.add(builderForValue.build()); - onChanged(); - } else { - gnssDataBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public Builder addGnssData( - int index, GNSS_Sample.Builder builderForValue) { - if (gnssDataBuilder_ == null) { - ensureGnssDataIsMutable(); - gnssData_.add(index, builderForValue.build()); - onChanged(); - } else { - gnssDataBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public Builder addAllGnssData( - Iterable values) { - if (gnssDataBuilder_ == null) { - ensureGnssDataIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, gnssData_); - onChanged(); - } else { - gnssDataBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public Builder clearGnssData() { - if (gnssDataBuilder_ == null) { - gnssData_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000040); - onChanged(); - } else { - gnssDataBuilder_.clear(); - } - return this; - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public Builder removeGnssData(int index) { - if (gnssDataBuilder_ == null) { - ensureGnssDataIsMutable(); - gnssData_.remove(index); - onChanged(); - } else { - gnssDataBuilder_.remove(index); - } - return this; - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public GNSS_Sample.Builder getGnssDataBuilder( - int index) { - return getGnssDataFieldBuilder().getBuilder(index); - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public GNSS_SampleOrBuilder getGnssDataOrBuilder( - int index) { - if (gnssDataBuilder_ == null) { - return gnssData_.get(index); } else { - return gnssDataBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public java.util.List - getGnssDataOrBuilderList() { - if (gnssDataBuilder_ != null) { - return gnssDataBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(gnssData_); - } - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public GNSS_Sample.Builder addGnssDataBuilder() { - return getGnssDataFieldBuilder().addBuilder( - GNSS_Sample.getDefaultInstance()); - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public GNSS_Sample.Builder addGnssDataBuilder( - int index) { - return getGnssDataFieldBuilder().addBuilder( - index, GNSS_Sample.getDefaultInstance()); - } - /** - * repeated .GNSS_Sample gnss_data = 7; - */ - public java.util.List - getGnssDataBuilderList() { - return getGnssDataFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - GNSS_Sample, GNSS_Sample.Builder, GNSS_SampleOrBuilder> - getGnssDataFieldBuilder() { - if (gnssDataBuilder_ == null) { - gnssDataBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - GNSS_Sample, GNSS_Sample.Builder, GNSS_SampleOrBuilder>( - gnssData_, - ((bitField0_ & 0x00000040) == 0x00000040), - getParentForChildren(), - isClean()); - gnssData_ = null; - } - return gnssDataBuilder_; - } - - private java.util.List wifiData_ = - java.util.Collections.emptyList(); - private void ensureWifiDataIsMutable() { - if (!((bitField0_ & 0x00000080) == 0x00000080)) { - wifiData_ = new java.util.ArrayList(wifiData_); - bitField0_ |= 0x00000080; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - WiFi_Sample, WiFi_Sample.Builder, WiFi_SampleOrBuilder> wifiDataBuilder_; - - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public java.util.List getWifiDataList() { - if (wifiDataBuilder_ == null) { - return java.util.Collections.unmodifiableList(wifiData_); - } else { - return wifiDataBuilder_.getMessageList(); - } - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public int getWifiDataCount() { - if (wifiDataBuilder_ == null) { - return wifiData_.size(); - } else { - return wifiDataBuilder_.getCount(); - } - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public WiFi_Sample getWifiData(int index) { - if (wifiDataBuilder_ == null) { - return wifiData_.get(index); - } else { - return wifiDataBuilder_.getMessage(index); - } - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public Builder setWifiData( - int index, WiFi_Sample value) { - if (wifiDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureWifiDataIsMutable(); - wifiData_.set(index, value); - onChanged(); - } else { - wifiDataBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public Builder setWifiData( - int index, WiFi_Sample.Builder builderForValue) { - if (wifiDataBuilder_ == null) { - ensureWifiDataIsMutable(); - wifiData_.set(index, builderForValue.build()); - onChanged(); - } else { - wifiDataBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public Builder addWifiData(WiFi_Sample value) { - if (wifiDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureWifiDataIsMutable(); - wifiData_.add(value); - onChanged(); - } else { - wifiDataBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public Builder addWifiData( - int index, WiFi_Sample value) { - if (wifiDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureWifiDataIsMutable(); - wifiData_.add(index, value); - onChanged(); - } else { - wifiDataBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public Builder addWifiData( - WiFi_Sample.Builder builderForValue) { - if (wifiDataBuilder_ == null) { - ensureWifiDataIsMutable(); - wifiData_.add(builderForValue.build()); - onChanged(); - } else { - wifiDataBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public Builder addWifiData( - int index, WiFi_Sample.Builder builderForValue) { - if (wifiDataBuilder_ == null) { - ensureWifiDataIsMutable(); - wifiData_.add(index, builderForValue.build()); - onChanged(); - } else { - wifiDataBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public Builder addAllWifiData( - Iterable values) { - if (wifiDataBuilder_ == null) { - ensureWifiDataIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, wifiData_); - onChanged(); - } else { - wifiDataBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public Builder clearWifiData() { - if (wifiDataBuilder_ == null) { - wifiData_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000080); - onChanged(); - } else { - wifiDataBuilder_.clear(); - } - return this; - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public Builder removeWifiData(int index) { - if (wifiDataBuilder_ == null) { - ensureWifiDataIsMutable(); - wifiData_.remove(index); - onChanged(); - } else { - wifiDataBuilder_.remove(index); - } - return this; - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public WiFi_Sample.Builder getWifiDataBuilder( - int index) { - return getWifiDataFieldBuilder().getBuilder(index); - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public WiFi_SampleOrBuilder getWifiDataOrBuilder( - int index) { - if (wifiDataBuilder_ == null) { - return wifiData_.get(index); } else { - return wifiDataBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public java.util.List - getWifiDataOrBuilderList() { - if (wifiDataBuilder_ != null) { - return wifiDataBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(wifiData_); - } - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public WiFi_Sample.Builder addWifiDataBuilder() { - return getWifiDataFieldBuilder().addBuilder( - WiFi_Sample.getDefaultInstance()); - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public WiFi_Sample.Builder addWifiDataBuilder( - int index) { - return getWifiDataFieldBuilder().addBuilder( - index, WiFi_Sample.getDefaultInstance()); - } - /** - * repeated .WiFi_Sample wifi_data = 8; - */ - public java.util.List - getWifiDataBuilderList() { - return getWifiDataFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - WiFi_Sample, WiFi_Sample.Builder, WiFi_SampleOrBuilder> - getWifiDataFieldBuilder() { - if (wifiDataBuilder_ == null) { - wifiDataBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - WiFi_Sample, WiFi_Sample.Builder, WiFi_SampleOrBuilder>( - wifiData_, - ((bitField0_ & 0x00000080) == 0x00000080), - getParentForChildren(), - isClean()); - wifiData_ = null; - } - return wifiDataBuilder_; - } - - private java.util.List apsData_ = - java.util.Collections.emptyList(); - private void ensureApsDataIsMutable() { - if (!((bitField0_ & 0x00000100) == 0x00000100)) { - apsData_ = new java.util.ArrayList(apsData_); - bitField0_ |= 0x00000100; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - AP_Data, AP_Data.Builder, AP_DataOrBuilder> apsDataBuilder_; - - /** - * repeated .AP_Data aps_data = 9; - */ - public java.util.List getApsDataList() { - if (apsDataBuilder_ == null) { - return java.util.Collections.unmodifiableList(apsData_); - } else { - return apsDataBuilder_.getMessageList(); - } - } - /** - * repeated .AP_Data aps_data = 9; - */ - public int getApsDataCount() { - if (apsDataBuilder_ == null) { - return apsData_.size(); - } else { - return apsDataBuilder_.getCount(); - } - } - /** - * repeated .AP_Data aps_data = 9; - */ - public AP_Data getApsData(int index) { - if (apsDataBuilder_ == null) { - return apsData_.get(index); - } else { - return apsDataBuilder_.getMessage(index); - } - } - /** - * repeated .AP_Data aps_data = 9; - */ - public Builder setApsData( - int index, AP_Data value) { - if (apsDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureApsDataIsMutable(); - apsData_.set(index, value); - onChanged(); - } else { - apsDataBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .AP_Data aps_data = 9; - */ - public Builder setApsData( - int index, AP_Data.Builder builderForValue) { - if (apsDataBuilder_ == null) { - ensureApsDataIsMutable(); - apsData_.set(index, builderForValue.build()); - onChanged(); - } else { - apsDataBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .AP_Data aps_data = 9; - */ - public Builder addApsData(AP_Data value) { - if (apsDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureApsDataIsMutable(); - apsData_.add(value); - onChanged(); - } else { - apsDataBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .AP_Data aps_data = 9; - */ - public Builder addApsData( - int index, AP_Data value) { - if (apsDataBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureApsDataIsMutable(); - apsData_.add(index, value); - onChanged(); - } else { - apsDataBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .AP_Data aps_data = 9; - */ - public Builder addApsData( - AP_Data.Builder builderForValue) { - if (apsDataBuilder_ == null) { - ensureApsDataIsMutable(); - apsData_.add(builderForValue.build()); - onChanged(); - } else { - apsDataBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .AP_Data aps_data = 9; - */ - public Builder addApsData( - int index, AP_Data.Builder builderForValue) { - if (apsDataBuilder_ == null) { - ensureApsDataIsMutable(); - apsData_.add(index, builderForValue.build()); - onChanged(); - } else { - apsDataBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .AP_Data aps_data = 9; - */ - public Builder addAllApsData( - Iterable values) { - if (apsDataBuilder_ == null) { - ensureApsDataIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, apsData_); - onChanged(); - } else { - apsDataBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .AP_Data aps_data = 9; - */ - public Builder clearApsData() { - if (apsDataBuilder_ == null) { - apsData_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000100); - onChanged(); - } else { - apsDataBuilder_.clear(); - } - return this; - } - /** - * repeated .AP_Data aps_data = 9; - */ - public Builder removeApsData(int index) { - if (apsDataBuilder_ == null) { - ensureApsDataIsMutable(); - apsData_.remove(index); - onChanged(); - } else { - apsDataBuilder_.remove(index); - } - return this; - } - /** - * repeated .AP_Data aps_data = 9; - */ - public AP_Data.Builder getApsDataBuilder( - int index) { - return getApsDataFieldBuilder().getBuilder(index); - } - /** - * repeated .AP_Data aps_data = 9; - */ - public AP_DataOrBuilder getApsDataOrBuilder( - int index) { - if (apsDataBuilder_ == null) { - return apsData_.get(index); } else { - return apsDataBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .AP_Data aps_data = 9; - */ - public java.util.List - getApsDataOrBuilderList() { - if (apsDataBuilder_ != null) { - return apsDataBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(apsData_); - } - } - /** - * repeated .AP_Data aps_data = 9; - */ - public AP_Data.Builder addApsDataBuilder() { - return getApsDataFieldBuilder().addBuilder( - AP_Data.getDefaultInstance()); - } - /** - * repeated .AP_Data aps_data = 9; - */ - public AP_Data.Builder addApsDataBuilder( - int index) { - return getApsDataFieldBuilder().addBuilder( - index, AP_Data.getDefaultInstance()); - } - /** - * repeated .AP_Data aps_data = 9; - */ - public java.util.List - getApsDataBuilderList() { - return getApsDataFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - AP_Data, AP_Data.Builder, AP_DataOrBuilder> - getApsDataFieldBuilder() { - if (apsDataBuilder_ == null) { - apsDataBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - AP_Data, AP_Data.Builder, AP_DataOrBuilder>( - apsData_, - ((bitField0_ & 0x00000100) == 0x00000100), - getParentForChildren(), - isClean()); - apsData_ = null; - } - return apsDataBuilder_; - } - - private long startTimestamp_ ; - /** - *
-       * UNIX timestamp (in milliseconds) recorded from the start of this
-       * trajectory data collection event. All future
-       * timestamps in sub classes are to be RELATIVE timestamps
-       * (in milliseconds) to this start time.
-       * E.g.
-       * start_timestamp = 1674819807315 (UTC 27 Jan 2023 in the morning)
-       * relative_timestamp = 3000 (3s)
-       * 
- * - * optional int64 start_timestamp = 10; - */ - public long getStartTimestamp() { - return startTimestamp_; - } - /** - *
-       * UNIX timestamp (in milliseconds) recorded from the start of this
-       * trajectory data collection event. All future
-       * timestamps in sub classes are to be RELATIVE timestamps
-       * (in milliseconds) to this start time.
-       * E.g.
-       * start_timestamp = 1674819807315 (UTC 27 Jan 2023 in the morning)
-       * relative_timestamp = 3000 (3s)
-       * 
- * - * optional int64 start_timestamp = 10; - */ - public Builder setStartTimestamp(long value) { - - startTimestamp_ = value; - onChanged(); - return this; - } - /** - *
-       * UNIX timestamp (in milliseconds) recorded from the start of this
-       * trajectory data collection event. All future
-       * timestamps in sub classes are to be RELATIVE timestamps
-       * (in milliseconds) to this start time.
-       * E.g.
-       * start_timestamp = 1674819807315 (UTC 27 Jan 2023 in the morning)
-       * relative_timestamp = 3000 (3s)
-       * 
- * - * optional int64 start_timestamp = 10; - */ - public Builder clearStartTimestamp() { - - startTimestamp_ = 0L; - onChanged(); - return this; - } - - private Object dataIdentifier_ = ""; - /** - * optional string data_identifier = 11; - */ - public String getDataIdentifier() { - Object ref = dataIdentifier_; - if (!(ref instanceof String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - dataIdentifier_ = s; - return s; - } else { - return (String) ref; - } - } - /** - * optional string data_identifier = 11; - */ - public com.google.protobuf.ByteString - getDataIdentifierBytes() { - Object ref = dataIdentifier_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (String) ref); - dataIdentifier_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * optional string data_identifier = 11; - */ - public Builder setDataIdentifier( - String value) { - if (value == null) { - throw new NullPointerException(); - } - - dataIdentifier_ = value; - onChanged(); - return this; - } - /** - * optional string data_identifier = 11; - */ - public Builder clearDataIdentifier() { - - dataIdentifier_ = getDefaultInstance().getDataIdentifier(); - onChanged(); - return this; - } - /** - * optional string data_identifier = 11; - */ - public Builder setDataIdentifierBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - dataIdentifier_ = value; - onChanged(); - return this; - } - - private Sensor_Info accelerometerInfo_ = null; - private com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder> accelerometerInfoBuilder_; - /** - * optional .Sensor_Info accelerometer_info = 12; - */ - public boolean hasAccelerometerInfo() { - return accelerometerInfoBuilder_ != null || accelerometerInfo_ != null; - } - /** - * optional .Sensor_Info accelerometer_info = 12; - */ - public Sensor_Info getAccelerometerInfo() { - if (accelerometerInfoBuilder_ == null) { - return accelerometerInfo_ == null ? Sensor_Info.getDefaultInstance() : accelerometerInfo_; - } else { - return accelerometerInfoBuilder_.getMessage(); - } - } - /** - * optional .Sensor_Info accelerometer_info = 12; - */ - public Builder setAccelerometerInfo(Sensor_Info value) { - if (accelerometerInfoBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - accelerometerInfo_ = value; - onChanged(); - } else { - accelerometerInfoBuilder_.setMessage(value); - } - - return this; - } - /** - * optional .Sensor_Info accelerometer_info = 12; - */ - public Builder setAccelerometerInfo( - Sensor_Info.Builder builderForValue) { - if (accelerometerInfoBuilder_ == null) { - accelerometerInfo_ = builderForValue.build(); - onChanged(); - } else { - accelerometerInfoBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * optional .Sensor_Info accelerometer_info = 12; - */ - public Builder mergeAccelerometerInfo(Sensor_Info value) { - if (accelerometerInfoBuilder_ == null) { - if (accelerometerInfo_ != null) { - accelerometerInfo_ = - Sensor_Info.newBuilder(accelerometerInfo_).mergeFrom(value).buildPartial(); - } else { - accelerometerInfo_ = value; - } - onChanged(); - } else { - accelerometerInfoBuilder_.mergeFrom(value); - } - - return this; - } - /** - * optional .Sensor_Info accelerometer_info = 12; - */ - public Builder clearAccelerometerInfo() { - if (accelerometerInfoBuilder_ == null) { - accelerometerInfo_ = null; - onChanged(); - } else { - accelerometerInfo_ = null; - accelerometerInfoBuilder_ = null; - } - - return this; - } - /** - * optional .Sensor_Info accelerometer_info = 12; - */ - public Sensor_Info.Builder getAccelerometerInfoBuilder() { - - onChanged(); - return getAccelerometerInfoFieldBuilder().getBuilder(); - } - /** - * optional .Sensor_Info accelerometer_info = 12; - */ - public Sensor_InfoOrBuilder getAccelerometerInfoOrBuilder() { - if (accelerometerInfoBuilder_ != null) { - return accelerometerInfoBuilder_.getMessageOrBuilder(); - } else { - return accelerometerInfo_ == null ? - Sensor_Info.getDefaultInstance() : accelerometerInfo_; - } - } - /** - * optional .Sensor_Info accelerometer_info = 12; - */ - private com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder> - getAccelerometerInfoFieldBuilder() { - if (accelerometerInfoBuilder_ == null) { - accelerometerInfoBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder>( - getAccelerometerInfo(), - getParentForChildren(), - isClean()); - accelerometerInfo_ = null; - } - return accelerometerInfoBuilder_; - } - - private Sensor_Info gyroscopeInfo_ = null; - private com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder> gyroscopeInfoBuilder_; - /** - * optional .Sensor_Info gyroscope_info = 13; - */ - public boolean hasGyroscopeInfo() { - return gyroscopeInfoBuilder_ != null || gyroscopeInfo_ != null; - } - /** - * optional .Sensor_Info gyroscope_info = 13; - */ - public Sensor_Info getGyroscopeInfo() { - if (gyroscopeInfoBuilder_ == null) { - return gyroscopeInfo_ == null ? Sensor_Info.getDefaultInstance() : gyroscopeInfo_; - } else { - return gyroscopeInfoBuilder_.getMessage(); - } - } - /** - * optional .Sensor_Info gyroscope_info = 13; - */ - public Builder setGyroscopeInfo(Sensor_Info value) { - if (gyroscopeInfoBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - gyroscopeInfo_ = value; - onChanged(); - } else { - gyroscopeInfoBuilder_.setMessage(value); - } - - return this; - } - /** - * optional .Sensor_Info gyroscope_info = 13; - */ - public Builder setGyroscopeInfo( - Sensor_Info.Builder builderForValue) { - if (gyroscopeInfoBuilder_ == null) { - gyroscopeInfo_ = builderForValue.build(); - onChanged(); - } else { - gyroscopeInfoBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * optional .Sensor_Info gyroscope_info = 13; - */ - public Builder mergeGyroscopeInfo(Sensor_Info value) { - if (gyroscopeInfoBuilder_ == null) { - if (gyroscopeInfo_ != null) { - gyroscopeInfo_ = - Sensor_Info.newBuilder(gyroscopeInfo_).mergeFrom(value).buildPartial(); - } else { - gyroscopeInfo_ = value; - } - onChanged(); - } else { - gyroscopeInfoBuilder_.mergeFrom(value); - } - - return this; - } - /** - * optional .Sensor_Info gyroscope_info = 13; - */ - public Builder clearGyroscopeInfo() { - if (gyroscopeInfoBuilder_ == null) { - gyroscopeInfo_ = null; - onChanged(); - } else { - gyroscopeInfo_ = null; - gyroscopeInfoBuilder_ = null; - } - - return this; - } - /** - * optional .Sensor_Info gyroscope_info = 13; - */ - public Sensor_Info.Builder getGyroscopeInfoBuilder() { - - onChanged(); - return getGyroscopeInfoFieldBuilder().getBuilder(); - } - /** - * optional .Sensor_Info gyroscope_info = 13; - */ - public Sensor_InfoOrBuilder getGyroscopeInfoOrBuilder() { - if (gyroscopeInfoBuilder_ != null) { - return gyroscopeInfoBuilder_.getMessageOrBuilder(); - } else { - return gyroscopeInfo_ == null ? - Sensor_Info.getDefaultInstance() : gyroscopeInfo_; - } - } - /** - * optional .Sensor_Info gyroscope_info = 13; - */ - private com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder> - getGyroscopeInfoFieldBuilder() { - if (gyroscopeInfoBuilder_ == null) { - gyroscopeInfoBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder>( - getGyroscopeInfo(), - getParentForChildren(), - isClean()); - gyroscopeInfo_ = null; - } - return gyroscopeInfoBuilder_; - } - - private Sensor_Info rotationVectorInfo_ = null; - private com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder> rotationVectorInfoBuilder_; - /** - * optional .Sensor_Info rotation_vector_info = 14; - */ - public boolean hasRotationVectorInfo() { - return rotationVectorInfoBuilder_ != null || rotationVectorInfo_ != null; - } - /** - * optional .Sensor_Info rotation_vector_info = 14; - */ - public Sensor_Info getRotationVectorInfo() { - if (rotationVectorInfoBuilder_ == null) { - return rotationVectorInfo_ == null ? Sensor_Info.getDefaultInstance() : rotationVectorInfo_; - } else { - return rotationVectorInfoBuilder_.getMessage(); - } - } - /** - * optional .Sensor_Info rotation_vector_info = 14; - */ - public Builder setRotationVectorInfo(Sensor_Info value) { - if (rotationVectorInfoBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - rotationVectorInfo_ = value; - onChanged(); - } else { - rotationVectorInfoBuilder_.setMessage(value); - } - - return this; - } - /** - * optional .Sensor_Info rotation_vector_info = 14; - */ - public Builder setRotationVectorInfo( - Sensor_Info.Builder builderForValue) { - if (rotationVectorInfoBuilder_ == null) { - rotationVectorInfo_ = builderForValue.build(); - onChanged(); - } else { - rotationVectorInfoBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * optional .Sensor_Info rotation_vector_info = 14; - */ - public Builder mergeRotationVectorInfo(Sensor_Info value) { - if (rotationVectorInfoBuilder_ == null) { - if (rotationVectorInfo_ != null) { - rotationVectorInfo_ = - Sensor_Info.newBuilder(rotationVectorInfo_).mergeFrom(value).buildPartial(); - } else { - rotationVectorInfo_ = value; - } - onChanged(); - } else { - rotationVectorInfoBuilder_.mergeFrom(value); - } - - return this; - } - /** - * optional .Sensor_Info rotation_vector_info = 14; - */ - public Builder clearRotationVectorInfo() { - if (rotationVectorInfoBuilder_ == null) { - rotationVectorInfo_ = null; - onChanged(); - } else { - rotationVectorInfo_ = null; - rotationVectorInfoBuilder_ = null; - } - - return this; - } - /** - * optional .Sensor_Info rotation_vector_info = 14; - */ - public Sensor_Info.Builder getRotationVectorInfoBuilder() { - - onChanged(); - return getRotationVectorInfoFieldBuilder().getBuilder(); - } - /** - * optional .Sensor_Info rotation_vector_info = 14; - */ - public Sensor_InfoOrBuilder getRotationVectorInfoOrBuilder() { - if (rotationVectorInfoBuilder_ != null) { - return rotationVectorInfoBuilder_.getMessageOrBuilder(); - } else { - return rotationVectorInfo_ == null ? - Sensor_Info.getDefaultInstance() : rotationVectorInfo_; - } - } - /** - * optional .Sensor_Info rotation_vector_info = 14; - */ - private com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder> - getRotationVectorInfoFieldBuilder() { - if (rotationVectorInfoBuilder_ == null) { - rotationVectorInfoBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder>( - getRotationVectorInfo(), - getParentForChildren(), - isClean()); - rotationVectorInfo_ = null; - } - return rotationVectorInfoBuilder_; - } - - private Sensor_Info magnetometerInfo_ = null; - private com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder> magnetometerInfoBuilder_; - /** - * optional .Sensor_Info magnetometer_info = 15; - */ - public boolean hasMagnetometerInfo() { - return magnetometerInfoBuilder_ != null || magnetometerInfo_ != null; - } - /** - * optional .Sensor_Info magnetometer_info = 15; - */ - public Sensor_Info getMagnetometerInfo() { - if (magnetometerInfoBuilder_ == null) { - return magnetometerInfo_ == null ? Sensor_Info.getDefaultInstance() : magnetometerInfo_; - } else { - return magnetometerInfoBuilder_.getMessage(); - } - } - /** - * optional .Sensor_Info magnetometer_info = 15; - */ - public Builder setMagnetometerInfo(Sensor_Info value) { - if (magnetometerInfoBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - magnetometerInfo_ = value; - onChanged(); - } else { - magnetometerInfoBuilder_.setMessage(value); - } - - return this; - } - /** - * optional .Sensor_Info magnetometer_info = 15; - */ - public Builder setMagnetometerInfo( - Sensor_Info.Builder builderForValue) { - if (magnetometerInfoBuilder_ == null) { - magnetometerInfo_ = builderForValue.build(); - onChanged(); - } else { - magnetometerInfoBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * optional .Sensor_Info magnetometer_info = 15; - */ - public Builder mergeMagnetometerInfo(Sensor_Info value) { - if (magnetometerInfoBuilder_ == null) { - if (magnetometerInfo_ != null) { - magnetometerInfo_ = - Sensor_Info.newBuilder(magnetometerInfo_).mergeFrom(value).buildPartial(); - } else { - magnetometerInfo_ = value; - } - onChanged(); - } else { - magnetometerInfoBuilder_.mergeFrom(value); - } - - return this; - } - /** - * optional .Sensor_Info magnetometer_info = 15; - */ - public Builder clearMagnetometerInfo() { - if (magnetometerInfoBuilder_ == null) { - magnetometerInfo_ = null; - onChanged(); - } else { - magnetometerInfo_ = null; - magnetometerInfoBuilder_ = null; - } - - return this; - } - /** - * optional .Sensor_Info magnetometer_info = 15; - */ - public Sensor_Info.Builder getMagnetometerInfoBuilder() { - - onChanged(); - return getMagnetometerInfoFieldBuilder().getBuilder(); - } - /** - * optional .Sensor_Info magnetometer_info = 15; - */ - public Sensor_InfoOrBuilder getMagnetometerInfoOrBuilder() { - if (magnetometerInfoBuilder_ != null) { - return magnetometerInfoBuilder_.getMessageOrBuilder(); - } else { - return magnetometerInfo_ == null ? - Sensor_Info.getDefaultInstance() : magnetometerInfo_; - } - } - /** - * optional .Sensor_Info magnetometer_info = 15; - */ - private com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder> - getMagnetometerInfoFieldBuilder() { - if (magnetometerInfoBuilder_ == null) { - magnetometerInfoBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder>( - getMagnetometerInfo(), - getParentForChildren(), - isClean()); - magnetometerInfo_ = null; - } - return magnetometerInfoBuilder_; - } - - private Sensor_Info barometerInfo_ = null; - private com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder> barometerInfoBuilder_; - /** - * optional .Sensor_Info barometer_info = 16; - */ - public boolean hasBarometerInfo() { - return barometerInfoBuilder_ != null || barometerInfo_ != null; - } - /** - * optional .Sensor_Info barometer_info = 16; - */ - public Sensor_Info getBarometerInfo() { - if (barometerInfoBuilder_ == null) { - return barometerInfo_ == null ? Sensor_Info.getDefaultInstance() : barometerInfo_; - } else { - return barometerInfoBuilder_.getMessage(); - } - } - /** - * optional .Sensor_Info barometer_info = 16; - */ - public Builder setBarometerInfo(Sensor_Info value) { - if (barometerInfoBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - barometerInfo_ = value; - onChanged(); - } else { - barometerInfoBuilder_.setMessage(value); - } - - return this; - } - /** - * optional .Sensor_Info barometer_info = 16; - */ - public Builder setBarometerInfo( - Sensor_Info.Builder builderForValue) { - if (barometerInfoBuilder_ == null) { - barometerInfo_ = builderForValue.build(); - onChanged(); - } else { - barometerInfoBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * optional .Sensor_Info barometer_info = 16; - */ - public Builder mergeBarometerInfo(Sensor_Info value) { - if (barometerInfoBuilder_ == null) { - if (barometerInfo_ != null) { - barometerInfo_ = - Sensor_Info.newBuilder(barometerInfo_).mergeFrom(value).buildPartial(); - } else { - barometerInfo_ = value; - } - onChanged(); - } else { - barometerInfoBuilder_.mergeFrom(value); - } - - return this; - } - /** - * optional .Sensor_Info barometer_info = 16; - */ - public Builder clearBarometerInfo() { - if (barometerInfoBuilder_ == null) { - barometerInfo_ = null; - onChanged(); - } else { - barometerInfo_ = null; - barometerInfoBuilder_ = null; - } - - return this; - } - /** - * optional .Sensor_Info barometer_info = 16; - */ - public Sensor_Info.Builder getBarometerInfoBuilder() { - - onChanged(); - return getBarometerInfoFieldBuilder().getBuilder(); - } - /** - * optional .Sensor_Info barometer_info = 16; - */ - public Sensor_InfoOrBuilder getBarometerInfoOrBuilder() { - if (barometerInfoBuilder_ != null) { - return barometerInfoBuilder_.getMessageOrBuilder(); - } else { - return barometerInfo_ == null ? - Sensor_Info.getDefaultInstance() : barometerInfo_; - } - } - /** - * optional .Sensor_Info barometer_info = 16; - */ - private com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder> - getBarometerInfoFieldBuilder() { - if (barometerInfoBuilder_ == null) { - barometerInfoBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder>( - getBarometerInfo(), - getParentForChildren(), - isClean()); - barometerInfo_ = null; - } - return barometerInfoBuilder_; - } - - private Sensor_Info lightSensorInfo_ = null; - private com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder> lightSensorInfoBuilder_; - /** - * optional .Sensor_Info light_sensor_info = 17; - */ - public boolean hasLightSensorInfo() { - return lightSensorInfoBuilder_ != null || lightSensorInfo_ != null; - } - /** - * optional .Sensor_Info light_sensor_info = 17; - */ - public Sensor_Info getLightSensorInfo() { - if (lightSensorInfoBuilder_ == null) { - return lightSensorInfo_ == null ? Sensor_Info.getDefaultInstance() : lightSensorInfo_; - } else { - return lightSensorInfoBuilder_.getMessage(); - } - } - /** - * optional .Sensor_Info light_sensor_info = 17; - */ - public Builder setLightSensorInfo(Sensor_Info value) { - if (lightSensorInfoBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - lightSensorInfo_ = value; - onChanged(); - } else { - lightSensorInfoBuilder_.setMessage(value); - } - - return this; - } - /** - * optional .Sensor_Info light_sensor_info = 17; - */ - public Builder setLightSensorInfo( - Sensor_Info.Builder builderForValue) { - if (lightSensorInfoBuilder_ == null) { - lightSensorInfo_ = builderForValue.build(); - onChanged(); - } else { - lightSensorInfoBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * optional .Sensor_Info light_sensor_info = 17; - */ - public Builder mergeLightSensorInfo(Sensor_Info value) { - if (lightSensorInfoBuilder_ == null) { - if (lightSensorInfo_ != null) { - lightSensorInfo_ = - Sensor_Info.newBuilder(lightSensorInfo_).mergeFrom(value).buildPartial(); - } else { - lightSensorInfo_ = value; - } - onChanged(); - } else { - lightSensorInfoBuilder_.mergeFrom(value); - } - - return this; - } - /** - * optional .Sensor_Info light_sensor_info = 17; - */ - public Builder clearLightSensorInfo() { - if (lightSensorInfoBuilder_ == null) { - lightSensorInfo_ = null; - onChanged(); - } else { - lightSensorInfo_ = null; - lightSensorInfoBuilder_ = null; - } - - return this; - } - /** - * optional .Sensor_Info light_sensor_info = 17; - */ - public Sensor_Info.Builder getLightSensorInfoBuilder() { - - onChanged(); - return getLightSensorInfoFieldBuilder().getBuilder(); - } - /** - * optional .Sensor_Info light_sensor_info = 17; - */ - public Sensor_InfoOrBuilder getLightSensorInfoOrBuilder() { - if (lightSensorInfoBuilder_ != null) { - return lightSensorInfoBuilder_.getMessageOrBuilder(); - } else { - return lightSensorInfo_ == null ? - Sensor_Info.getDefaultInstance() : lightSensorInfo_; - } - } - /** - * optional .Sensor_Info light_sensor_info = 17; - */ - private com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder> - getLightSensorInfoFieldBuilder() { - if (lightSensorInfoBuilder_ == null) { - lightSensorInfoBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - Sensor_Info, Sensor_Info.Builder, Sensor_InfoOrBuilder>( - getLightSensorInfo(), - getParentForChildren(), - isClean()); - lightSensorInfo_ = null; - } - return lightSensorInfoBuilder_; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - - // @@protoc_insertion_point(builder_scope:Trajectory) - } - - // @@protoc_insertion_point(class_scope:Trajectory) - private static final Trajectory DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new Trajectory(); - } - - public static Trajectory getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - public Trajectory parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Trajectory(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - public Trajectory getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface Pdr_SampleOrBuilder extends - // @@protoc_insertion_point(interface_extends:Pdr_Sample) - com.google.protobuf.MessageOrBuilder { - - /** - *
-     * milliseconds from the start_timestamp
-     * 
- * - * optional int64 relative_timestamp = 1; - */ - long getRelativeTimestamp(); - - /** - *
-     * Both in metres. You should implement an algorithm to estimate
-     * these values. The values are always relative to your start point
-     * so the first entry should always be x = 0.0, y = 0.0
-     * 
- * - * optional float x = 2; - */ - float getX(); - - /** - * optional float y = 3; - */ - float getY(); - } - /** - * Protobuf type {@code Pdr_Sample} - */ - public static final class Pdr_Sample extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:Pdr_Sample) - Pdr_SampleOrBuilder { - // Use Pdr_Sample.newBuilder() to construct. - private Pdr_Sample(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Pdr_Sample() { - relativeTimestamp_ = 0L; - x_ = 0F; - y_ = 0F; - } - - @Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - private Pdr_Sample( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!input.skipField(tag)) { - done = true; - } - break; - } - case 8: { - - relativeTimestamp_ = input.readInt64(); - break; - } - case 21: { - - x_ = input.readFloat(); - break; - } - case 29: { - - y_ = input.readFloat(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_Pdr_Sample_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_Pdr_Sample_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Pdr_Sample.class, Builder.class); - } - - public static final int RELATIVE_TIMESTAMP_FIELD_NUMBER = 1; - private long relativeTimestamp_; - /** - *
-     * milliseconds from the start_timestamp
-     * 
- * - * optional int64 relative_timestamp = 1; - */ - public long getRelativeTimestamp() { - return relativeTimestamp_; - } - - public static final int X_FIELD_NUMBER = 2; - private float x_; - /** - *
-     * Both in metres. You should implement an algorithm to estimate
-     * these values. The values are always relative to your start point
-     * so the first entry should always be x = 0.0, y = 0.0
-     * 
- * - * optional float x = 2; - */ - public float getX() { - return x_; - } - - public static final int Y_FIELD_NUMBER = 3; - private float y_; - /** - * optional float y = 3; - */ - public float getY() { - return y_; - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (relativeTimestamp_ != 0L) { - output.writeInt64(1, relativeTimestamp_); - } - if (x_ != 0F) { - output.writeFloat(2, x_); - } - if (y_ != 0F) { - output.writeFloat(3, y_); - } - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (relativeTimestamp_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, relativeTimestamp_); - } - if (x_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(2, x_); - } - if (y_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(3, y_); - } - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @Override - public boolean equals(final Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof Pdr_Sample)) { - return super.equals(obj); - } - Pdr_Sample other = (Pdr_Sample) obj; - - boolean result = true; - result = result && (getRelativeTimestamp() - == other.getRelativeTimestamp()); - result = result && ( - Float.floatToIntBits(getX()) - == Float.floatToIntBits( - other.getX())); - result = result && ( - Float.floatToIntBits(getY()) - == Float.floatToIntBits( - other.getY())); - return result; - } - - @Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - hash = (37 * hash) + RELATIVE_TIMESTAMP_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getRelativeTimestamp()); - hash = (37 * hash) + X_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getX()); - hash = (37 * hash) + Y_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getY()); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static Pdr_Sample parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Pdr_Sample parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Pdr_Sample parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Pdr_Sample parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Pdr_Sample parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Pdr_Sample parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static Pdr_Sample parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static Pdr_Sample parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static Pdr_Sample parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Pdr_Sample parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(Pdr_Sample prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code Pdr_Sample} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:Pdr_Sample) - Pdr_SampleOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_Pdr_Sample_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_Pdr_Sample_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Pdr_Sample.class, Builder.class); - } - - // Construct using Traj.Pdr_Sample.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - relativeTimestamp_ = 0L; - - x_ = 0F; - - y_ = 0F; - - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return Traj.internal_static_Pdr_Sample_descriptor; - } - - public Pdr_Sample getDefaultInstanceForType() { - return Pdr_Sample.getDefaultInstance(); - } - - public Pdr_Sample build() { - Pdr_Sample result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public Pdr_Sample buildPartial() { - Pdr_Sample result = new Pdr_Sample(this); - result.relativeTimestamp_ = relativeTimestamp_; - result.x_ = x_; - result.y_ = y_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof Pdr_Sample) { - return mergeFrom((Pdr_Sample)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(Pdr_Sample other) { - if (other == Pdr_Sample.getDefaultInstance()) return this; - if (other.getRelativeTimestamp() != 0L) { - setRelativeTimestamp(other.getRelativeTimestamp()); - } - if (other.getX() != 0F) { - setX(other.getX()); - } - if (other.getY() != 0F) { - setY(other.getY()); - } - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Pdr_Sample parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (Pdr_Sample) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private long relativeTimestamp_ ; - /** - *
-       * milliseconds from the start_timestamp
-       * 
- * - * optional int64 relative_timestamp = 1; - */ - public long getRelativeTimestamp() { - return relativeTimestamp_; - } - /** - *
-       * milliseconds from the start_timestamp
-       * 
- * - * optional int64 relative_timestamp = 1; - */ - public Builder setRelativeTimestamp(long value) { - - relativeTimestamp_ = value; - onChanged(); - return this; - } - /** - *
-       * milliseconds from the start_timestamp
-       * 
- * - * optional int64 relative_timestamp = 1; - */ - public Builder clearRelativeTimestamp() { - - relativeTimestamp_ = 0L; - onChanged(); - return this; - } - - private float x_ ; - /** - *
-       * Both in metres. You should implement an algorithm to estimate
-       * these values. The values are always relative to your start point
-       * so the first entry should always be x = 0.0, y = 0.0
-       * 
- * - * optional float x = 2; - */ - public float getX() { - return x_; - } - /** - *
-       * Both in metres. You should implement an algorithm to estimate
-       * these values. The values are always relative to your start point
-       * so the first entry should always be x = 0.0, y = 0.0
-       * 
- * - * optional float x = 2; - */ - public Builder setX(float value) { - - x_ = value; - onChanged(); - return this; - } - /** - *
-       * Both in metres. You should implement an algorithm to estimate
-       * these values. The values are always relative to your start point
-       * so the first entry should always be x = 0.0, y = 0.0
-       * 
- * - * optional float x = 2; - */ - public Builder clearX() { - - x_ = 0F; - onChanged(); - return this; - } - - private float y_ ; - /** - * optional float y = 3; - */ - public float getY() { - return y_; - } - /** - * optional float y = 3; - */ - public Builder setY(float value) { - - y_ = value; - onChanged(); - return this; - } - /** - * optional float y = 3; - */ - public Builder clearY() { - - y_ = 0F; - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - - // @@protoc_insertion_point(builder_scope:Pdr_Sample) - } - - // @@protoc_insertion_point(class_scope:Pdr_Sample) - private static final Pdr_Sample DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new Pdr_Sample(); - } - - public static Pdr_Sample getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - public Pdr_Sample parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Pdr_Sample(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - public Pdr_Sample getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface Motion_SampleOrBuilder extends - // @@protoc_insertion_point(interface_extends:Motion_Sample) - com.google.protobuf.MessageOrBuilder { - - /** - *
-     * milliseconds
-     * 
- * - * optional int64 relative_timestamp = 1; - */ - long getRelativeTimestamp(); - - /** - *
-     * m/s^2
-     * 
- * - * optional float acc_x = 2; - */ - float getAccX(); - - /** - * optional float acc_y = 3; - */ - float getAccY(); - - /** - * optional float acc_z = 4; - */ - float getAccZ(); - - /** - *
-     * radians/s
-     * 
- * - * optional float gyr_x = 5; - */ - float getGyrX(); - - /** - * optional float gyr_y = 6; - */ - float getGyrY(); - - /** - * optional float gyr_z = 7; - */ - float getGyrZ(); - - /** - *
-     * unitless, 4 components should sum to ~1
-     * 
- * - * optional float rotation_vector_x = 8; - */ - float getRotationVectorX(); - - /** - * optional float rotation_vector_y = 9; - */ - float getRotationVectorY(); - - /** - * optional float rotation_vector_z = 10; - */ - float getRotationVectorZ(); - - /** - * optional float rotation_vector_w = 11; - */ - float getRotationVectorW(); - - /** - *
-     * Integer
-     * 
- * - * optional int32 step_count = 12; - */ - int getStepCount(); - } - /** - * Protobuf type {@code Motion_Sample} - */ - public static final class Motion_Sample extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:Motion_Sample) - Motion_SampleOrBuilder { - // Use Motion_Sample.newBuilder() to construct. - private Motion_Sample(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Motion_Sample() { - relativeTimestamp_ = 0L; - accX_ = 0F; - accY_ = 0F; - accZ_ = 0F; - gyrX_ = 0F; - gyrY_ = 0F; - gyrZ_ = 0F; - rotationVectorX_ = 0F; - rotationVectorY_ = 0F; - rotationVectorZ_ = 0F; - rotationVectorW_ = 0F; - stepCount_ = 0; - } - - @Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - private Motion_Sample( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!input.skipField(tag)) { - done = true; - } - break; - } - case 8: { - - relativeTimestamp_ = input.readInt64(); - break; - } - case 21: { - - accX_ = input.readFloat(); - break; - } - case 29: { - - accY_ = input.readFloat(); - break; - } - case 37: { - - accZ_ = input.readFloat(); - break; - } - case 45: { - - gyrX_ = input.readFloat(); - break; - } - case 53: { - - gyrY_ = input.readFloat(); - break; - } - case 61: { - - gyrZ_ = input.readFloat(); - break; - } - case 69: { - - rotationVectorX_ = input.readFloat(); - break; - } - case 77: { - - rotationVectorY_ = input.readFloat(); - break; - } - case 85: { - - rotationVectorZ_ = input.readFloat(); - break; - } - case 93: { - - rotationVectorW_ = input.readFloat(); - break; - } - case 96: { - - stepCount_ = input.readInt32(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_Motion_Sample_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_Motion_Sample_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Motion_Sample.class, Builder.class); - } - - public static final int RELATIVE_TIMESTAMP_FIELD_NUMBER = 1; - private long relativeTimestamp_; - /** - *
-     * milliseconds
-     * 
- * - * optional int64 relative_timestamp = 1; - */ - public long getRelativeTimestamp() { - return relativeTimestamp_; - } - - public static final int ACC_X_FIELD_NUMBER = 2; - private float accX_; - /** - *
-     * m/s^2
-     * 
- * - * optional float acc_x = 2; - */ - public float getAccX() { - return accX_; - } - - public static final int ACC_Y_FIELD_NUMBER = 3; - private float accY_; - /** - * optional float acc_y = 3; - */ - public float getAccY() { - return accY_; - } - - public static final int ACC_Z_FIELD_NUMBER = 4; - private float accZ_; - /** - * optional float acc_z = 4; - */ - public float getAccZ() { - return accZ_; - } - - public static final int GYR_X_FIELD_NUMBER = 5; - private float gyrX_; - /** - *
-     * radians/s
-     * 
- * - * optional float gyr_x = 5; - */ - public float getGyrX() { - return gyrX_; - } - - public static final int GYR_Y_FIELD_NUMBER = 6; - private float gyrY_; - /** - * optional float gyr_y = 6; - */ - public float getGyrY() { - return gyrY_; - } - - public static final int GYR_Z_FIELD_NUMBER = 7; - private float gyrZ_; - /** - * optional float gyr_z = 7; - */ - public float getGyrZ() { - return gyrZ_; - } - - public static final int ROTATION_VECTOR_X_FIELD_NUMBER = 8; - private float rotationVectorX_; - /** - *
-     * unitless, 4 components should sum to ~1
-     * 
- * - * optional float rotation_vector_x = 8; - */ - public float getRotationVectorX() { - return rotationVectorX_; - } - - public static final int ROTATION_VECTOR_Y_FIELD_NUMBER = 9; - private float rotationVectorY_; - /** - * optional float rotation_vector_y = 9; - */ - public float getRotationVectorY() { - return rotationVectorY_; - } - - public static final int ROTATION_VECTOR_Z_FIELD_NUMBER = 10; - private float rotationVectorZ_; - /** - * optional float rotation_vector_z = 10; - */ - public float getRotationVectorZ() { - return rotationVectorZ_; - } - - public static final int ROTATION_VECTOR_W_FIELD_NUMBER = 11; - private float rotationVectorW_; - /** - * optional float rotation_vector_w = 11; - */ - public float getRotationVectorW() { - return rotationVectorW_; - } - - public static final int STEP_COUNT_FIELD_NUMBER = 12; - private int stepCount_; - /** - *
-     * Integer
-     * 
- * - * optional int32 step_count = 12; - */ - public int getStepCount() { - return stepCount_; - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (relativeTimestamp_ != 0L) { - output.writeInt64(1, relativeTimestamp_); - } - if (accX_ != 0F) { - output.writeFloat(2, accX_); - } - if (accY_ != 0F) { - output.writeFloat(3, accY_); - } - if (accZ_ != 0F) { - output.writeFloat(4, accZ_); - } - if (gyrX_ != 0F) { - output.writeFloat(5, gyrX_); - } - if (gyrY_ != 0F) { - output.writeFloat(6, gyrY_); - } - if (gyrZ_ != 0F) { - output.writeFloat(7, gyrZ_); - } - if (rotationVectorX_ != 0F) { - output.writeFloat(8, rotationVectorX_); - } - if (rotationVectorY_ != 0F) { - output.writeFloat(9, rotationVectorY_); - } - if (rotationVectorZ_ != 0F) { - output.writeFloat(10, rotationVectorZ_); - } - if (rotationVectorW_ != 0F) { - output.writeFloat(11, rotationVectorW_); - } - if (stepCount_ != 0) { - output.writeInt32(12, stepCount_); - } - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (relativeTimestamp_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, relativeTimestamp_); - } - if (accX_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(2, accX_); - } - if (accY_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(3, accY_); - } - if (accZ_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(4, accZ_); - } - if (gyrX_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(5, gyrX_); - } - if (gyrY_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(6, gyrY_); - } - if (gyrZ_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(7, gyrZ_); - } - if (rotationVectorX_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(8, rotationVectorX_); - } - if (rotationVectorY_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(9, rotationVectorY_); - } - if (rotationVectorZ_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(10, rotationVectorZ_); - } - if (rotationVectorW_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(11, rotationVectorW_); - } - if (stepCount_ != 0) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(12, stepCount_); - } - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @Override - public boolean equals(final Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof Motion_Sample)) { - return super.equals(obj); - } - Motion_Sample other = (Motion_Sample) obj; - - boolean result = true; - result = result && (getRelativeTimestamp() - == other.getRelativeTimestamp()); - result = result && ( - Float.floatToIntBits(getAccX()) - == Float.floatToIntBits( - other.getAccX())); - result = result && ( - Float.floatToIntBits(getAccY()) - == Float.floatToIntBits( - other.getAccY())); - result = result && ( - Float.floatToIntBits(getAccZ()) - == Float.floatToIntBits( - other.getAccZ())); - result = result && ( - Float.floatToIntBits(getGyrX()) - == Float.floatToIntBits( - other.getGyrX())); - result = result && ( - Float.floatToIntBits(getGyrY()) - == Float.floatToIntBits( - other.getGyrY())); - result = result && ( - Float.floatToIntBits(getGyrZ()) - == Float.floatToIntBits( - other.getGyrZ())); - result = result && ( - Float.floatToIntBits(getRotationVectorX()) - == Float.floatToIntBits( - other.getRotationVectorX())); - result = result && ( - Float.floatToIntBits(getRotationVectorY()) - == Float.floatToIntBits( - other.getRotationVectorY())); - result = result && ( - Float.floatToIntBits(getRotationVectorZ()) - == Float.floatToIntBits( - other.getRotationVectorZ())); - result = result && ( - Float.floatToIntBits(getRotationVectorW()) - == Float.floatToIntBits( - other.getRotationVectorW())); - result = result && (getStepCount() - == other.getStepCount()); - return result; - } - - @Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - hash = (37 * hash) + RELATIVE_TIMESTAMP_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getRelativeTimestamp()); - hash = (37 * hash) + ACC_X_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getAccX()); - hash = (37 * hash) + ACC_Y_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getAccY()); - hash = (37 * hash) + ACC_Z_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getAccZ()); - hash = (37 * hash) + GYR_X_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getGyrX()); - hash = (37 * hash) + GYR_Y_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getGyrY()); - hash = (37 * hash) + GYR_Z_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getGyrZ()); - hash = (37 * hash) + ROTATION_VECTOR_X_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getRotationVectorX()); - hash = (37 * hash) + ROTATION_VECTOR_Y_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getRotationVectorY()); - hash = (37 * hash) + ROTATION_VECTOR_Z_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getRotationVectorZ()); - hash = (37 * hash) + ROTATION_VECTOR_W_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getRotationVectorW()); - hash = (37 * hash) + STEP_COUNT_FIELD_NUMBER; - hash = (53 * hash) + getStepCount(); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static Motion_Sample parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Motion_Sample parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Motion_Sample parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Motion_Sample parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Motion_Sample parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Motion_Sample parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static Motion_Sample parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static Motion_Sample parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static Motion_Sample parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Motion_Sample parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(Motion_Sample prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code Motion_Sample} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:Motion_Sample) - Motion_SampleOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_Motion_Sample_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_Motion_Sample_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Motion_Sample.class, Builder.class); - } - - // Construct using Traj.Motion_Sample.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - relativeTimestamp_ = 0L; - - accX_ = 0F; - - accY_ = 0F; - - accZ_ = 0F; - - gyrX_ = 0F; - - gyrY_ = 0F; - - gyrZ_ = 0F; - - rotationVectorX_ = 0F; - - rotationVectorY_ = 0F; - - rotationVectorZ_ = 0F; - - rotationVectorW_ = 0F; - - stepCount_ = 0; - - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return Traj.internal_static_Motion_Sample_descriptor; - } - - public Motion_Sample getDefaultInstanceForType() { - return Motion_Sample.getDefaultInstance(); - } - - public Motion_Sample build() { - Motion_Sample result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public Motion_Sample buildPartial() { - Motion_Sample result = new Motion_Sample(this); - result.relativeTimestamp_ = relativeTimestamp_; - result.accX_ = accX_; - result.accY_ = accY_; - result.accZ_ = accZ_; - result.gyrX_ = gyrX_; - result.gyrY_ = gyrY_; - result.gyrZ_ = gyrZ_; - result.rotationVectorX_ = rotationVectorX_; - result.rotationVectorY_ = rotationVectorY_; - result.rotationVectorZ_ = rotationVectorZ_; - result.rotationVectorW_ = rotationVectorW_; - result.stepCount_ = stepCount_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof Motion_Sample) { - return mergeFrom((Motion_Sample)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(Motion_Sample other) { - if (other == Motion_Sample.getDefaultInstance()) return this; - if (other.getRelativeTimestamp() != 0L) { - setRelativeTimestamp(other.getRelativeTimestamp()); - } - if (other.getAccX() != 0F) { - setAccX(other.getAccX()); - } - if (other.getAccY() != 0F) { - setAccY(other.getAccY()); - } - if (other.getAccZ() != 0F) { - setAccZ(other.getAccZ()); - } - if (other.getGyrX() != 0F) { - setGyrX(other.getGyrX()); - } - if (other.getGyrY() != 0F) { - setGyrY(other.getGyrY()); - } - if (other.getGyrZ() != 0F) { - setGyrZ(other.getGyrZ()); - } - if (other.getRotationVectorX() != 0F) { - setRotationVectorX(other.getRotationVectorX()); - } - if (other.getRotationVectorY() != 0F) { - setRotationVectorY(other.getRotationVectorY()); - } - if (other.getRotationVectorZ() != 0F) { - setRotationVectorZ(other.getRotationVectorZ()); - } - if (other.getRotationVectorW() != 0F) { - setRotationVectorW(other.getRotationVectorW()); - } - if (other.getStepCount() != 0) { - setStepCount(other.getStepCount()); - } - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Motion_Sample parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (Motion_Sample) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private long relativeTimestamp_ ; - /** - *
-       * milliseconds
-       * 
- * - * optional int64 relative_timestamp = 1; - */ - public long getRelativeTimestamp() { - return relativeTimestamp_; - } - /** - *
-       * milliseconds
-       * 
- * - * optional int64 relative_timestamp = 1; - */ - public Builder setRelativeTimestamp(long value) { - - relativeTimestamp_ = value; - onChanged(); - return this; - } - /** - *
-       * milliseconds
-       * 
- * - * optional int64 relative_timestamp = 1; - */ - public Builder clearRelativeTimestamp() { - - relativeTimestamp_ = 0L; - onChanged(); - return this; - } - - private float accX_ ; - /** - *
-       * m/s^2
-       * 
- * - * optional float acc_x = 2; - */ - public float getAccX() { - return accX_; - } - /** - *
-       * m/s^2
-       * 
- * - * optional float acc_x = 2; - */ - public Builder setAccX(float value) { - - accX_ = value; - onChanged(); - return this; - } - /** - *
-       * m/s^2
-       * 
- * - * optional float acc_x = 2; - */ - public Builder clearAccX() { - - accX_ = 0F; - onChanged(); - return this; - } - - private float accY_ ; - /** - * optional float acc_y = 3; - */ - public float getAccY() { - return accY_; - } - /** - * optional float acc_y = 3; - */ - public Builder setAccY(float value) { - - accY_ = value; - onChanged(); - return this; - } - /** - * optional float acc_y = 3; - */ - public Builder clearAccY() { - - accY_ = 0F; - onChanged(); - return this; - } - - private float accZ_ ; - /** - * optional float acc_z = 4; - */ - public float getAccZ() { - return accZ_; - } - /** - * optional float acc_z = 4; - */ - public Builder setAccZ(float value) { - - accZ_ = value; - onChanged(); - return this; - } - /** - * optional float acc_z = 4; - */ - public Builder clearAccZ() { - - accZ_ = 0F; - onChanged(); - return this; - } - - private float gyrX_ ; - /** - *
-       * radians/s
-       * 
- * - * optional float gyr_x = 5; - */ - public float getGyrX() { - return gyrX_; - } - /** - *
-       * radians/s
-       * 
- * - * optional float gyr_x = 5; - */ - public Builder setGyrX(float value) { - - gyrX_ = value; - onChanged(); - return this; - } - /** - *
-       * radians/s
-       * 
- * - * optional float gyr_x = 5; - */ - public Builder clearGyrX() { - - gyrX_ = 0F; - onChanged(); - return this; - } - - private float gyrY_ ; - /** - * optional float gyr_y = 6; - */ - public float getGyrY() { - return gyrY_; - } - /** - * optional float gyr_y = 6; - */ - public Builder setGyrY(float value) { - - gyrY_ = value; - onChanged(); - return this; - } - /** - * optional float gyr_y = 6; - */ - public Builder clearGyrY() { - - gyrY_ = 0F; - onChanged(); - return this; - } - - private float gyrZ_ ; - /** - * optional float gyr_z = 7; - */ - public float getGyrZ() { - return gyrZ_; - } - /** - * optional float gyr_z = 7; - */ - public Builder setGyrZ(float value) { - - gyrZ_ = value; - onChanged(); - return this; - } - /** - * optional float gyr_z = 7; - */ - public Builder clearGyrZ() { - - gyrZ_ = 0F; - onChanged(); - return this; - } - - private float rotationVectorX_ ; - /** - *
-       * unitless, 4 components should sum to ~1
-       * 
- * - * optional float rotation_vector_x = 8; - */ - public float getRotationVectorX() { - return rotationVectorX_; - } - /** - *
-       * unitless, 4 components should sum to ~1
-       * 
- * - * optional float rotation_vector_x = 8; - */ - public Builder setRotationVectorX(float value) { - - rotationVectorX_ = value; - onChanged(); - return this; - } - /** - *
-       * unitless, 4 components should sum to ~1
-       * 
- * - * optional float rotation_vector_x = 8; - */ - public Builder clearRotationVectorX() { - - rotationVectorX_ = 0F; - onChanged(); - return this; - } - - private float rotationVectorY_ ; - /** - * optional float rotation_vector_y = 9; - */ - public float getRotationVectorY() { - return rotationVectorY_; - } - /** - * optional float rotation_vector_y = 9; - */ - public Builder setRotationVectorY(float value) { - - rotationVectorY_ = value; - onChanged(); - return this; - } - /** - * optional float rotation_vector_y = 9; - */ - public Builder clearRotationVectorY() { - - rotationVectorY_ = 0F; - onChanged(); - return this; - } - - private float rotationVectorZ_ ; - /** - * optional float rotation_vector_z = 10; - */ - public float getRotationVectorZ() { - return rotationVectorZ_; - } - /** - * optional float rotation_vector_z = 10; - */ - public Builder setRotationVectorZ(float value) { - - rotationVectorZ_ = value; - onChanged(); - return this; - } - /** - * optional float rotation_vector_z = 10; - */ - public Builder clearRotationVectorZ() { - - rotationVectorZ_ = 0F; - onChanged(); - return this; - } - - private float rotationVectorW_ ; - /** - * optional float rotation_vector_w = 11; - */ - public float getRotationVectorW() { - return rotationVectorW_; - } - /** - * optional float rotation_vector_w = 11; - */ - public Builder setRotationVectorW(float value) { - - rotationVectorW_ = value; - onChanged(); - return this; - } - /** - * optional float rotation_vector_w = 11; - */ - public Builder clearRotationVectorW() { - - rotationVectorW_ = 0F; - onChanged(); - return this; - } - - private int stepCount_ ; - /** - *
-       * Integer
-       * 
- * - * optional int32 step_count = 12; - */ - public int getStepCount() { - return stepCount_; - } - /** - *
-       * Integer
-       * 
- * - * optional int32 step_count = 12; - */ - public Builder setStepCount(int value) { - - stepCount_ = value; - onChanged(); - return this; - } - /** - *
-       * Integer
-       * 
- * - * optional int32 step_count = 12; - */ - public Builder clearStepCount() { - - stepCount_ = 0; - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - - // @@protoc_insertion_point(builder_scope:Motion_Sample) - } - - // @@protoc_insertion_point(class_scope:Motion_Sample) - private static final Motion_Sample DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new Motion_Sample(); - } - - public static Motion_Sample getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - public Motion_Sample parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Motion_Sample(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - public Motion_Sample getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface Position_SampleOrBuilder extends - // @@protoc_insertion_point(interface_extends:Position_Sample) - com.google.protobuf.MessageOrBuilder { - - /** - * optional int64 relative_timestamp = 1; - */ - long getRelativeTimestamp(); - - /** - *
-     * uT
-     * 
- * - * optional float mag_x = 2; - */ - float getMagX(); - - /** - * optional float mag_y = 3; - */ - float getMagY(); - - /** - * optional float mag_z = 4; - */ - float getMagZ(); - } - /** - * Protobuf type {@code Position_Sample} - */ - public static final class Position_Sample extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:Position_Sample) - Position_SampleOrBuilder { - // Use Position_Sample.newBuilder() to construct. - private Position_Sample(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Position_Sample() { - relativeTimestamp_ = 0L; - magX_ = 0F; - magY_ = 0F; - magZ_ = 0F; - } - - @Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - private Position_Sample( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!input.skipField(tag)) { - done = true; - } - break; - } - case 8: { - - relativeTimestamp_ = input.readInt64(); - break; - } - case 21: { - - magX_ = input.readFloat(); - break; - } - case 29: { - - magY_ = input.readFloat(); - break; - } - case 37: { - - magZ_ = input.readFloat(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_Position_Sample_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_Position_Sample_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Position_Sample.class, Builder.class); - } - - public static final int RELATIVE_TIMESTAMP_FIELD_NUMBER = 1; - private long relativeTimestamp_; - /** - * optional int64 relative_timestamp = 1; - */ - public long getRelativeTimestamp() { - return relativeTimestamp_; - } - - public static final int MAG_X_FIELD_NUMBER = 2; - private float magX_; - /** - *
-     * uT
-     * 
- * - * optional float mag_x = 2; - */ - public float getMagX() { - return magX_; - } - - public static final int MAG_Y_FIELD_NUMBER = 3; - private float magY_; - /** - * optional float mag_y = 3; - */ - public float getMagY() { - return magY_; - } - - public static final int MAG_Z_FIELD_NUMBER = 4; - private float magZ_; - /** - * optional float mag_z = 4; - */ - public float getMagZ() { - return magZ_; - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (relativeTimestamp_ != 0L) { - output.writeInt64(1, relativeTimestamp_); - } - if (magX_ != 0F) { - output.writeFloat(2, magX_); - } - if (magY_ != 0F) { - output.writeFloat(3, magY_); - } - if (magZ_ != 0F) { - output.writeFloat(4, magZ_); - } - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (relativeTimestamp_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, relativeTimestamp_); - } - if (magX_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(2, magX_); - } - if (magY_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(3, magY_); - } - if (magZ_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(4, magZ_); - } - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @Override - public boolean equals(final Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof Position_Sample)) { - return super.equals(obj); - } - Position_Sample other = (Position_Sample) obj; - - boolean result = true; - result = result && (getRelativeTimestamp() - == other.getRelativeTimestamp()); - result = result && ( - Float.floatToIntBits(getMagX()) - == Float.floatToIntBits( - other.getMagX())); - result = result && ( - Float.floatToIntBits(getMagY()) - == Float.floatToIntBits( - other.getMagY())); - result = result && ( - Float.floatToIntBits(getMagZ()) - == Float.floatToIntBits( - other.getMagZ())); - return result; - } - - @Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - hash = (37 * hash) + RELATIVE_TIMESTAMP_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getRelativeTimestamp()); - hash = (37 * hash) + MAG_X_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getMagX()); - hash = (37 * hash) + MAG_Y_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getMagY()); - hash = (37 * hash) + MAG_Z_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getMagZ()); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static Position_Sample parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Position_Sample parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Position_Sample parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Position_Sample parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Position_Sample parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Position_Sample parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static Position_Sample parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static Position_Sample parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static Position_Sample parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Position_Sample parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(Position_Sample prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code Position_Sample} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:Position_Sample) - Position_SampleOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_Position_Sample_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_Position_Sample_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Position_Sample.class, Builder.class); - } - - // Construct using Traj.Position_Sample.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - relativeTimestamp_ = 0L; - - magX_ = 0F; - - magY_ = 0F; - - magZ_ = 0F; - - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return Traj.internal_static_Position_Sample_descriptor; - } - - public Position_Sample getDefaultInstanceForType() { - return Position_Sample.getDefaultInstance(); - } - - public Position_Sample build() { - Position_Sample result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public Position_Sample buildPartial() { - Position_Sample result = new Position_Sample(this); - result.relativeTimestamp_ = relativeTimestamp_; - result.magX_ = magX_; - result.magY_ = magY_; - result.magZ_ = magZ_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof Position_Sample) { - return mergeFrom((Position_Sample)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(Position_Sample other) { - if (other == Position_Sample.getDefaultInstance()) return this; - if (other.getRelativeTimestamp() != 0L) { - setRelativeTimestamp(other.getRelativeTimestamp()); - } - if (other.getMagX() != 0F) { - setMagX(other.getMagX()); - } - if (other.getMagY() != 0F) { - setMagY(other.getMagY()); - } - if (other.getMagZ() != 0F) { - setMagZ(other.getMagZ()); - } - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Position_Sample parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (Position_Sample) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private long relativeTimestamp_ ; - /** - * optional int64 relative_timestamp = 1; - */ - public long getRelativeTimestamp() { - return relativeTimestamp_; - } - /** - * optional int64 relative_timestamp = 1; - */ - public Builder setRelativeTimestamp(long value) { - - relativeTimestamp_ = value; - onChanged(); - return this; - } - /** - * optional int64 relative_timestamp = 1; - */ - public Builder clearRelativeTimestamp() { - - relativeTimestamp_ = 0L; - onChanged(); - return this; - } - - private float magX_ ; - /** - *
-       * uT
-       * 
- * - * optional float mag_x = 2; - */ - public float getMagX() { - return magX_; - } - /** - *
-       * uT
-       * 
- * - * optional float mag_x = 2; - */ - public Builder setMagX(float value) { - - magX_ = value; - onChanged(); - return this; - } - /** - *
-       * uT
-       * 
- * - * optional float mag_x = 2; - */ - public Builder clearMagX() { - - magX_ = 0F; - onChanged(); - return this; - } - - private float magY_ ; - /** - * optional float mag_y = 3; - */ - public float getMagY() { - return magY_; - } - /** - * optional float mag_y = 3; - */ - public Builder setMagY(float value) { - - magY_ = value; - onChanged(); - return this; - } - /** - * optional float mag_y = 3; - */ - public Builder clearMagY() { - - magY_ = 0F; - onChanged(); - return this; - } - - private float magZ_ ; - /** - * optional float mag_z = 4; - */ - public float getMagZ() { - return magZ_; - } - /** - * optional float mag_z = 4; - */ - public Builder setMagZ(float value) { - - magZ_ = value; - onChanged(); - return this; - } - /** - * optional float mag_z = 4; - */ - public Builder clearMagZ() { - - magZ_ = 0F; - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - - // @@protoc_insertion_point(builder_scope:Position_Sample) - } - - // @@protoc_insertion_point(class_scope:Position_Sample) - private static final Position_Sample DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new Position_Sample(); - } - - public static Position_Sample getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - public Position_Sample parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Position_Sample(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - public Position_Sample getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface Pressure_SampleOrBuilder extends - // @@protoc_insertion_point(interface_extends:Pressure_Sample) - com.google.protobuf.MessageOrBuilder { - - /** - * optional int64 relative_timestamp = 1; - */ - long getRelativeTimestamp(); - - /** - *
-     * mbar
-     * 
- * - * optional float pressure = 2; - */ - float getPressure(); - } - /** - * Protobuf type {@code Pressure_Sample} - */ - public static final class Pressure_Sample extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:Pressure_Sample) - Pressure_SampleOrBuilder { - // Use Pressure_Sample.newBuilder() to construct. - private Pressure_Sample(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Pressure_Sample() { - relativeTimestamp_ = 0L; - pressure_ = 0F; - } - - @Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - private Pressure_Sample( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!input.skipField(tag)) { - done = true; - } - break; - } - case 8: { - - relativeTimestamp_ = input.readInt64(); - break; - } - case 21: { - - pressure_ = input.readFloat(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_Pressure_Sample_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_Pressure_Sample_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Pressure_Sample.class, Builder.class); - } - - public static final int RELATIVE_TIMESTAMP_FIELD_NUMBER = 1; - private long relativeTimestamp_; - /** - * optional int64 relative_timestamp = 1; - */ - public long getRelativeTimestamp() { - return relativeTimestamp_; - } - - public static final int PRESSURE_FIELD_NUMBER = 2; - private float pressure_; - /** - *
-     * mbar
-     * 
- * - * optional float pressure = 2; - */ - public float getPressure() { - return pressure_; - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (relativeTimestamp_ != 0L) { - output.writeInt64(1, relativeTimestamp_); - } - if (pressure_ != 0F) { - output.writeFloat(2, pressure_); - } - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (relativeTimestamp_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, relativeTimestamp_); - } - if (pressure_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(2, pressure_); - } - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @Override - public boolean equals(final Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof Pressure_Sample)) { - return super.equals(obj); - } - Pressure_Sample other = (Pressure_Sample) obj; - - boolean result = true; - result = result && (getRelativeTimestamp() - == other.getRelativeTimestamp()); - result = result && ( - Float.floatToIntBits(getPressure()) - == Float.floatToIntBits( - other.getPressure())); - return result; - } - - @Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - hash = (37 * hash) + RELATIVE_TIMESTAMP_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getRelativeTimestamp()); - hash = (37 * hash) + PRESSURE_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getPressure()); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static Pressure_Sample parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Pressure_Sample parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Pressure_Sample parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Pressure_Sample parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Pressure_Sample parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Pressure_Sample parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static Pressure_Sample parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static Pressure_Sample parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static Pressure_Sample parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Pressure_Sample parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(Pressure_Sample prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code Pressure_Sample} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:Pressure_Sample) - Pressure_SampleOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_Pressure_Sample_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_Pressure_Sample_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Pressure_Sample.class, Builder.class); - } - - // Construct using Traj.Pressure_Sample.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - relativeTimestamp_ = 0L; - - pressure_ = 0F; - - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return Traj.internal_static_Pressure_Sample_descriptor; - } - - public Pressure_Sample getDefaultInstanceForType() { - return Pressure_Sample.getDefaultInstance(); - } - - public Pressure_Sample build() { - Pressure_Sample result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public Pressure_Sample buildPartial() { - Pressure_Sample result = new Pressure_Sample(this); - result.relativeTimestamp_ = relativeTimestamp_; - result.pressure_ = pressure_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof Pressure_Sample) { - return mergeFrom((Pressure_Sample)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(Pressure_Sample other) { - if (other == Pressure_Sample.getDefaultInstance()) return this; - if (other.getRelativeTimestamp() != 0L) { - setRelativeTimestamp(other.getRelativeTimestamp()); - } - if (other.getPressure() != 0F) { - setPressure(other.getPressure()); - } - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Pressure_Sample parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (Pressure_Sample) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private long relativeTimestamp_ ; - /** - * optional int64 relative_timestamp = 1; - */ - public long getRelativeTimestamp() { - return relativeTimestamp_; - } - /** - * optional int64 relative_timestamp = 1; - */ - public Builder setRelativeTimestamp(long value) { - - relativeTimestamp_ = value; - onChanged(); - return this; - } - /** - * optional int64 relative_timestamp = 1; - */ - public Builder clearRelativeTimestamp() { - - relativeTimestamp_ = 0L; - onChanged(); - return this; - } - - private float pressure_ ; - /** - *
-       * mbar
-       * 
- * - * optional float pressure = 2; - */ - public float getPressure() { - return pressure_; - } - /** - *
-       * mbar
-       * 
- * - * optional float pressure = 2; - */ - public Builder setPressure(float value) { - - pressure_ = value; - onChanged(); - return this; - } - /** - *
-       * mbar
-       * 
- * - * optional float pressure = 2; - */ - public Builder clearPressure() { - - pressure_ = 0F; - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - - // @@protoc_insertion_point(builder_scope:Pressure_Sample) - } - - // @@protoc_insertion_point(class_scope:Pressure_Sample) - private static final Pressure_Sample DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new Pressure_Sample(); - } - - public static Pressure_Sample getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - public Pressure_Sample parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Pressure_Sample(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - public Pressure_Sample getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface Light_SampleOrBuilder extends - // @@protoc_insertion_point(interface_extends:Light_Sample) - com.google.protobuf.MessageOrBuilder { - - /** - * optional int64 relative_timestamp = 1; - */ - long getRelativeTimestamp(); - - /** - *
-     * lux
-     * 
- * - * optional float light = 2; - */ - float getLight(); - } - /** - * Protobuf type {@code Light_Sample} - */ - public static final class Light_Sample extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:Light_Sample) - Light_SampleOrBuilder { - // Use Light_Sample.newBuilder() to construct. - private Light_Sample(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Light_Sample() { - relativeTimestamp_ = 0L; - light_ = 0F; - } - - @Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - private Light_Sample( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!input.skipField(tag)) { - done = true; - } - break; - } - case 8: { - - relativeTimestamp_ = input.readInt64(); - break; - } - case 21: { - - light_ = input.readFloat(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_Light_Sample_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_Light_Sample_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Light_Sample.class, Builder.class); - } - - public static final int RELATIVE_TIMESTAMP_FIELD_NUMBER = 1; - private long relativeTimestamp_; - /** - * optional int64 relative_timestamp = 1; - */ - public long getRelativeTimestamp() { - return relativeTimestamp_; - } - - public static final int LIGHT_FIELD_NUMBER = 2; - private float light_; - /** - *
-     * lux
-     * 
- * - * optional float light = 2; - */ - public float getLight() { - return light_; - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (relativeTimestamp_ != 0L) { - output.writeInt64(1, relativeTimestamp_); - } - if (light_ != 0F) { - output.writeFloat(2, light_); - } - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (relativeTimestamp_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, relativeTimestamp_); - } - if (light_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(2, light_); - } - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @Override - public boolean equals(final Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof Light_Sample)) { - return super.equals(obj); - } - Light_Sample other = (Light_Sample) obj; - - boolean result = true; - result = result && (getRelativeTimestamp() - == other.getRelativeTimestamp()); - result = result && ( - Float.floatToIntBits(getLight()) - == Float.floatToIntBits( - other.getLight())); - return result; - } - - @Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - hash = (37 * hash) + RELATIVE_TIMESTAMP_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getRelativeTimestamp()); - hash = (37 * hash) + LIGHT_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getLight()); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static Light_Sample parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Light_Sample parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Light_Sample parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Light_Sample parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Light_Sample parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Light_Sample parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static Light_Sample parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static Light_Sample parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static Light_Sample parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Light_Sample parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(Light_Sample prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code Light_Sample} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:Light_Sample) - Light_SampleOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_Light_Sample_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_Light_Sample_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Light_Sample.class, Builder.class); - } - - // Construct using Traj.Light_Sample.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - relativeTimestamp_ = 0L; - - light_ = 0F; - - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return Traj.internal_static_Light_Sample_descriptor; - } - - public Light_Sample getDefaultInstanceForType() { - return Light_Sample.getDefaultInstance(); - } - - public Light_Sample build() { - Light_Sample result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public Light_Sample buildPartial() { - Light_Sample result = new Light_Sample(this); - result.relativeTimestamp_ = relativeTimestamp_; - result.light_ = light_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof Light_Sample) { - return mergeFrom((Light_Sample)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(Light_Sample other) { - if (other == Light_Sample.getDefaultInstance()) return this; - if (other.getRelativeTimestamp() != 0L) { - setRelativeTimestamp(other.getRelativeTimestamp()); - } - if (other.getLight() != 0F) { - setLight(other.getLight()); - } - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Light_Sample parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (Light_Sample) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private long relativeTimestamp_ ; - /** - * optional int64 relative_timestamp = 1; - */ - public long getRelativeTimestamp() { - return relativeTimestamp_; - } - /** - * optional int64 relative_timestamp = 1; - */ - public Builder setRelativeTimestamp(long value) { - - relativeTimestamp_ = value; - onChanged(); - return this; - } - /** - * optional int64 relative_timestamp = 1; - */ - public Builder clearRelativeTimestamp() { - - relativeTimestamp_ = 0L; - onChanged(); - return this; - } - - private float light_ ; - /** - *
-       * lux
-       * 
- * - * optional float light = 2; - */ - public float getLight() { - return light_; - } - /** - *
-       * lux
-       * 
- * - * optional float light = 2; - */ - public Builder setLight(float value) { - - light_ = value; - onChanged(); - return this; - } - /** - *
-       * lux
-       * 
- * - * optional float light = 2; - */ - public Builder clearLight() { - - light_ = 0F; - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - - // @@protoc_insertion_point(builder_scope:Light_Sample) - } - - // @@protoc_insertion_point(class_scope:Light_Sample) - private static final Light_Sample DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new Light_Sample(); - } - - public static Light_Sample getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - public Light_Sample parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Light_Sample(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - public Light_Sample getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface GNSS_SampleOrBuilder extends - // @@protoc_insertion_point(interface_extends:GNSS_Sample) - com.google.protobuf.MessageOrBuilder { - - /** - * optional int64 relative_timestamp = 1; - */ - long getRelativeTimestamp(); - - /** - *
-     * degrees (minimum 6 significant figures)
-     * latitude between -90 and 90
-     * 
- * - * optional float latitude = 2; - */ - float getLatitude(); - - /** - *
-     * longitude between -180 and 180
-     * 
- * - * optional float longitude = 3; - */ - float getLongitude(); - - /** - *
-     *metres
-     * 
- * - * optional float altitude = 4; - */ - float getAltitude(); - - /** - *
-     * metres
-     * 
- * - * optional float accuracy = 5; - */ - float getAccuracy(); - - /** - *
-     * m/s
-     * 
- * - * optional float speed = 6; - */ - float getSpeed(); - - /** - *
-     * e.g 'gps' or 'network'
-     * 
- * - * optional string provider = 7; - */ - String getProvider(); - /** - *
-     * e.g 'gps' or 'network'
-     * 
- * - * optional string provider = 7; - */ - com.google.protobuf.ByteString - getProviderBytes(); - } - /** - * Protobuf type {@code GNSS_Sample} - */ - public static final class GNSS_Sample extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:GNSS_Sample) - GNSS_SampleOrBuilder { - // Use GNSS_Sample.newBuilder() to construct. - private GNSS_Sample(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private GNSS_Sample() { - relativeTimestamp_ = 0L; - latitude_ = 0F; - longitude_ = 0F; - altitude_ = 0F; - accuracy_ = 0F; - speed_ = 0F; - provider_ = ""; - } - - @Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - private GNSS_Sample( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!input.skipField(tag)) { - done = true; - } - break; - } - case 8: { - - relativeTimestamp_ = input.readInt64(); - break; - } - case 21: { - - latitude_ = input.readFloat(); - break; - } - case 29: { - - longitude_ = input.readFloat(); - break; - } - case 37: { - - altitude_ = input.readFloat(); - break; - } - case 45: { - - accuracy_ = input.readFloat(); - break; - } - case 53: { - - speed_ = input.readFloat(); - break; - } - case 58: { - String s = input.readStringRequireUtf8(); - - provider_ = s; - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_GNSS_Sample_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_GNSS_Sample_fieldAccessorTable - .ensureFieldAccessorsInitialized( - GNSS_Sample.class, Builder.class); - } - - public static final int RELATIVE_TIMESTAMP_FIELD_NUMBER = 1; - private long relativeTimestamp_; - /** - * optional int64 relative_timestamp = 1; - */ - public long getRelativeTimestamp() { - return relativeTimestamp_; - } - - public static final int LATITUDE_FIELD_NUMBER = 2; - private float latitude_; - /** - *
-     * degrees (minimum 6 significant figures)
-     * latitude between -90 and 90
-     * 
- * - * optional float latitude = 2; - */ - public float getLatitude() { - return latitude_; - } - - public static final int LONGITUDE_FIELD_NUMBER = 3; - private float longitude_; - /** - *
-     * longitude between -180 and 180
-     * 
- * - * optional float longitude = 3; - */ - public float getLongitude() { - return longitude_; - } - - public static final int ALTITUDE_FIELD_NUMBER = 4; - private float altitude_; - /** - *
-     *metres
-     * 
- * - * optional float altitude = 4; - */ - public float getAltitude() { - return altitude_; - } - - public static final int ACCURACY_FIELD_NUMBER = 5; - private float accuracy_; - /** - *
-     * metres
-     * 
- * - * optional float accuracy = 5; - */ - public float getAccuracy() { - return accuracy_; - } - - public static final int SPEED_FIELD_NUMBER = 6; - private float speed_; - /** - *
-     * m/s
-     * 
- * - * optional float speed = 6; - */ - public float getSpeed() { - return speed_; - } - - public static final int PROVIDER_FIELD_NUMBER = 7; - private volatile Object provider_; - /** - *
-     * e.g 'gps' or 'network'
-     * 
- * - * optional string provider = 7; - */ - public String getProvider() { - Object ref = provider_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - provider_ = s; - return s; - } - } - /** - *
-     * e.g 'gps' or 'network'
-     * 
- * - * optional string provider = 7; - */ - public com.google.protobuf.ByteString - getProviderBytes() { - Object ref = provider_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (String) ref); - provider_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (relativeTimestamp_ != 0L) { - output.writeInt64(1, relativeTimestamp_); - } - if (latitude_ != 0F) { - output.writeFloat(2, latitude_); - } - if (longitude_ != 0F) { - output.writeFloat(3, longitude_); - } - if (altitude_ != 0F) { - output.writeFloat(4, altitude_); - } - if (accuracy_ != 0F) { - output.writeFloat(5, accuracy_); - } - if (speed_ != 0F) { - output.writeFloat(6, speed_); - } - if (!getProviderBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 7, provider_); - } - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (relativeTimestamp_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, relativeTimestamp_); - } - if (latitude_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(2, latitude_); - } - if (longitude_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(3, longitude_); - } - if (altitude_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(4, altitude_); - } - if (accuracy_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(5, accuracy_); - } - if (speed_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(6, speed_); - } - if (!getProviderBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, provider_); - } - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @Override - public boolean equals(final Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof GNSS_Sample)) { - return super.equals(obj); - } - GNSS_Sample other = (GNSS_Sample) obj; - - boolean result = true; - result = result && (getRelativeTimestamp() - == other.getRelativeTimestamp()); - result = result && ( - Float.floatToIntBits(getLatitude()) - == Float.floatToIntBits( - other.getLatitude())); - result = result && ( - Float.floatToIntBits(getLongitude()) - == Float.floatToIntBits( - other.getLongitude())); - result = result && ( - Float.floatToIntBits(getAltitude()) - == Float.floatToIntBits( - other.getAltitude())); - result = result && ( - Float.floatToIntBits(getAccuracy()) - == Float.floatToIntBits( - other.getAccuracy())); - result = result && ( - Float.floatToIntBits(getSpeed()) - == Float.floatToIntBits( - other.getSpeed())); - result = result && getProvider() - .equals(other.getProvider()); - return result; - } - - @Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - hash = (37 * hash) + RELATIVE_TIMESTAMP_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getRelativeTimestamp()); - hash = (37 * hash) + LATITUDE_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getLatitude()); - hash = (37 * hash) + LONGITUDE_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getLongitude()); - hash = (37 * hash) + ALTITUDE_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getAltitude()); - hash = (37 * hash) + ACCURACY_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getAccuracy()); - hash = (37 * hash) + SPEED_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getSpeed()); - hash = (37 * hash) + PROVIDER_FIELD_NUMBER; - hash = (53 * hash) + getProvider().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static GNSS_Sample parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static GNSS_Sample parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static GNSS_Sample parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static GNSS_Sample parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static GNSS_Sample parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static GNSS_Sample parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static GNSS_Sample parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static GNSS_Sample parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static GNSS_Sample parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static GNSS_Sample parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(GNSS_Sample prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code GNSS_Sample} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:GNSS_Sample) - GNSS_SampleOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_GNSS_Sample_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_GNSS_Sample_fieldAccessorTable - .ensureFieldAccessorsInitialized( - GNSS_Sample.class, Builder.class); - } - - // Construct using Traj.GNSS_Sample.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - relativeTimestamp_ = 0L; - - latitude_ = 0F; - - longitude_ = 0F; - - altitude_ = 0F; - - accuracy_ = 0F; - - speed_ = 0F; - - provider_ = ""; - - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return Traj.internal_static_GNSS_Sample_descriptor; - } - - public GNSS_Sample getDefaultInstanceForType() { - return GNSS_Sample.getDefaultInstance(); - } - - public GNSS_Sample build() { - GNSS_Sample result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public GNSS_Sample buildPartial() { - GNSS_Sample result = new GNSS_Sample(this); - result.relativeTimestamp_ = relativeTimestamp_; - result.latitude_ = latitude_; - result.longitude_ = longitude_; - result.altitude_ = altitude_; - result.accuracy_ = accuracy_; - result.speed_ = speed_; - result.provider_ = provider_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof GNSS_Sample) { - return mergeFrom((GNSS_Sample)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(GNSS_Sample other) { - if (other == GNSS_Sample.getDefaultInstance()) return this; - if (other.getRelativeTimestamp() != 0L) { - setRelativeTimestamp(other.getRelativeTimestamp()); - } - if (other.getLatitude() != 0F) { - setLatitude(other.getLatitude()); - } - if (other.getLongitude() != 0F) { - setLongitude(other.getLongitude()); - } - if (other.getAltitude() != 0F) { - setAltitude(other.getAltitude()); - } - if (other.getAccuracy() != 0F) { - setAccuracy(other.getAccuracy()); - } - if (other.getSpeed() != 0F) { - setSpeed(other.getSpeed()); - } - if (!other.getProvider().isEmpty()) { - provider_ = other.provider_; - onChanged(); - } - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - GNSS_Sample parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (GNSS_Sample) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private long relativeTimestamp_ ; - /** - * optional int64 relative_timestamp = 1; - */ - public long getRelativeTimestamp() { - return relativeTimestamp_; - } - /** - * optional int64 relative_timestamp = 1; - */ - public Builder setRelativeTimestamp(long value) { - - relativeTimestamp_ = value; - onChanged(); - return this; - } - /** - * optional int64 relative_timestamp = 1; - */ - public Builder clearRelativeTimestamp() { - - relativeTimestamp_ = 0L; - onChanged(); - return this; - } - - private float latitude_ ; - /** - *
-       * degrees (minimum 6 significant figures)
-       * latitude between -90 and 90
-       * 
- * - * optional float latitude = 2; - */ - public float getLatitude() { - return latitude_; - } - /** - *
-       * degrees (minimum 6 significant figures)
-       * latitude between -90 and 90
-       * 
- * - * optional float latitude = 2; - */ - public Builder setLatitude(float value) { - - latitude_ = value; - onChanged(); - return this; - } - /** - *
-       * degrees (minimum 6 significant figures)
-       * latitude between -90 and 90
-       * 
- * - * optional float latitude = 2; - */ - public Builder clearLatitude() { - - latitude_ = 0F; - onChanged(); - return this; - } - - private float longitude_ ; - /** - *
-       * longitude between -180 and 180
-       * 
- * - * optional float longitude = 3; - */ - public float getLongitude() { - return longitude_; - } - /** - *
-       * longitude between -180 and 180
-       * 
- * - * optional float longitude = 3; - */ - public Builder setLongitude(float value) { - - longitude_ = value; - onChanged(); - return this; - } - /** - *
-       * longitude between -180 and 180
-       * 
- * - * optional float longitude = 3; - */ - public Builder clearLongitude() { - - longitude_ = 0F; - onChanged(); - return this; - } - - private float altitude_ ; - /** - *
-       *metres
-       * 
- * - * optional float altitude = 4; - */ - public float getAltitude() { - return altitude_; - } - /** - *
-       *metres
-       * 
- * - * optional float altitude = 4; - */ - public Builder setAltitude(float value) { - - altitude_ = value; - onChanged(); - return this; - } - /** - *
-       *metres
-       * 
- * - * optional float altitude = 4; - */ - public Builder clearAltitude() { - - altitude_ = 0F; - onChanged(); - return this; - } - - private float accuracy_ ; - /** - *
-       * metres
-       * 
- * - * optional float accuracy = 5; - */ - public float getAccuracy() { - return accuracy_; - } - /** - *
-       * metres
-       * 
- * - * optional float accuracy = 5; - */ - public Builder setAccuracy(float value) { - - accuracy_ = value; - onChanged(); - return this; - } - /** - *
-       * metres
-       * 
- * - * optional float accuracy = 5; - */ - public Builder clearAccuracy() { - - accuracy_ = 0F; - onChanged(); - return this; - } - - private float speed_ ; - /** - *
-       * m/s
-       * 
- * - * optional float speed = 6; - */ - public float getSpeed() { - return speed_; - } - /** - *
-       * m/s
-       * 
- * - * optional float speed = 6; - */ - public Builder setSpeed(float value) { - - speed_ = value; - onChanged(); - return this; - } - /** - *
-       * m/s
-       * 
- * - * optional float speed = 6; - */ - public Builder clearSpeed() { - - speed_ = 0F; - onChanged(); - return this; - } - - private Object provider_ = ""; - /** - *
-       * e.g 'gps' or 'network'
-       * 
- * - * optional string provider = 7; - */ - public String getProvider() { - Object ref = provider_; - if (!(ref instanceof String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - provider_ = s; - return s; - } else { - return (String) ref; - } - } - /** - *
-       * e.g 'gps' or 'network'
-       * 
- * - * optional string provider = 7; - */ - public com.google.protobuf.ByteString - getProviderBytes() { - Object ref = provider_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (String) ref); - provider_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - *
-       * e.g 'gps' or 'network'
-       * 
- * - * optional string provider = 7; - */ - public Builder setProvider( - String value) { - if (value == null) { - throw new NullPointerException(); - } - - provider_ = value; - onChanged(); - return this; - } - /** - *
-       * e.g 'gps' or 'network'
-       * 
- * - * optional string provider = 7; - */ - public Builder clearProvider() { - - provider_ = getDefaultInstance().getProvider(); - onChanged(); - return this; - } - /** - *
-       * e.g 'gps' or 'network'
-       * 
- * - * optional string provider = 7; - */ - public Builder setProviderBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - provider_ = value; - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - - // @@protoc_insertion_point(builder_scope:GNSS_Sample) - } - - // @@protoc_insertion_point(class_scope:GNSS_Sample) - private static final GNSS_Sample DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new GNSS_Sample(); - } - - public static GNSS_Sample getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - public GNSS_Sample parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new GNSS_Sample(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - public GNSS_Sample getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface WiFi_SampleOrBuilder extends - // @@protoc_insertion_point(interface_extends:WiFi_Sample) - com.google.protobuf.MessageOrBuilder { - - /** - * optional int64 relative_timestamp = 1; - */ - long getRelativeTimestamp(); - - /** - * repeated .Mac_Scan mac_scans = 2; - */ - java.util.List - getMacScansList(); - /** - * repeated .Mac_Scan mac_scans = 2; - */ - Mac_Scan getMacScans(int index); - /** - * repeated .Mac_Scan mac_scans = 2; - */ - int getMacScansCount(); - /** - * repeated .Mac_Scan mac_scans = 2; - */ - java.util.List - getMacScansOrBuilderList(); - /** - * repeated .Mac_Scan mac_scans = 2; - */ - Mac_ScanOrBuilder getMacScansOrBuilder( - int index); - } - /** - * Protobuf type {@code WiFi_Sample} - */ - public static final class WiFi_Sample extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:WiFi_Sample) - WiFi_SampleOrBuilder { - // Use WiFi_Sample.newBuilder() to construct. - private WiFi_Sample(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private WiFi_Sample() { - relativeTimestamp_ = 0L; - macScans_ = java.util.Collections.emptyList(); - } - - @Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - private WiFi_Sample( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!input.skipField(tag)) { - done = true; - } - break; - } - case 8: { - - relativeTimestamp_ = input.readInt64(); - break; - } - case 18: { - if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - macScans_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000002; - } - macScans_.add( - input.readMessage(Mac_Scan.parser(), extensionRegistry)); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - macScans_ = java.util.Collections.unmodifiableList(macScans_); - } - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_WiFi_Sample_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_WiFi_Sample_fieldAccessorTable - .ensureFieldAccessorsInitialized( - WiFi_Sample.class, Builder.class); - } - - private int bitField0_; - public static final int RELATIVE_TIMESTAMP_FIELD_NUMBER = 1; - private long relativeTimestamp_; - /** - * optional int64 relative_timestamp = 1; - */ - public long getRelativeTimestamp() { - return relativeTimestamp_; - } - - public static final int MAC_SCANS_FIELD_NUMBER = 2; - private java.util.List macScans_; - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public java.util.List getMacScansList() { - return macScans_; - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public java.util.List - getMacScansOrBuilderList() { - return macScans_; - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public int getMacScansCount() { - return macScans_.size(); - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public Mac_Scan getMacScans(int index) { - return macScans_.get(index); - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public Mac_ScanOrBuilder getMacScansOrBuilder( - int index) { - return macScans_.get(index); - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (relativeTimestamp_ != 0L) { - output.writeInt64(1, relativeTimestamp_); - } - for (int i = 0; i < macScans_.size(); i++) { - output.writeMessage(2, macScans_.get(i)); - } - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (relativeTimestamp_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, relativeTimestamp_); - } - for (int i = 0; i < macScans_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, macScans_.get(i)); - } - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @Override - public boolean equals(final Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof WiFi_Sample)) { - return super.equals(obj); - } - WiFi_Sample other = (WiFi_Sample) obj; - - boolean result = true; - result = result && (getRelativeTimestamp() - == other.getRelativeTimestamp()); - result = result && getMacScansList() - .equals(other.getMacScansList()); - return result; - } - - @Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - hash = (37 * hash) + RELATIVE_TIMESTAMP_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getRelativeTimestamp()); - if (getMacScansCount() > 0) { - hash = (37 * hash) + MAC_SCANS_FIELD_NUMBER; - hash = (53 * hash) + getMacScansList().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static WiFi_Sample parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static WiFi_Sample parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static WiFi_Sample parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static WiFi_Sample parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static WiFi_Sample parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static WiFi_Sample parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static WiFi_Sample parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static WiFi_Sample parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static WiFi_Sample parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static WiFi_Sample parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(WiFi_Sample prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code WiFi_Sample} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:WiFi_Sample) - WiFi_SampleOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_WiFi_Sample_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_WiFi_Sample_fieldAccessorTable - .ensureFieldAccessorsInitialized( - WiFi_Sample.class, Builder.class); - } - - // Construct using Traj.WiFi_Sample.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getMacScansFieldBuilder(); - } - } - public Builder clear() { - super.clear(); - relativeTimestamp_ = 0L; - - if (macScansBuilder_ == null) { - macScans_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - macScansBuilder_.clear(); - } - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return Traj.internal_static_WiFi_Sample_descriptor; - } - - public WiFi_Sample getDefaultInstanceForType() { - return WiFi_Sample.getDefaultInstance(); - } - - public WiFi_Sample build() { - WiFi_Sample result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public WiFi_Sample buildPartial() { - WiFi_Sample result = new WiFi_Sample(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - result.relativeTimestamp_ = relativeTimestamp_; - if (macScansBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - macScans_ = java.util.Collections.unmodifiableList(macScans_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.macScans_ = macScans_; - } else { - result.macScans_ = macScansBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof WiFi_Sample) { - return mergeFrom((WiFi_Sample)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(WiFi_Sample other) { - if (other == WiFi_Sample.getDefaultInstance()) return this; - if (other.getRelativeTimestamp() != 0L) { - setRelativeTimestamp(other.getRelativeTimestamp()); - } - if (macScansBuilder_ == null) { - if (!other.macScans_.isEmpty()) { - if (macScans_.isEmpty()) { - macScans_ = other.macScans_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureMacScansIsMutable(); - macScans_.addAll(other.macScans_); - } - onChanged(); - } - } else { - if (!other.macScans_.isEmpty()) { - if (macScansBuilder_.isEmpty()) { - macScansBuilder_.dispose(); - macScansBuilder_ = null; - macScans_ = other.macScans_; - bitField0_ = (bitField0_ & ~0x00000002); - macScansBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getMacScansFieldBuilder() : null; - } else { - macScansBuilder_.addAllMessages(other.macScans_); - } - } - } - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - WiFi_Sample parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (WiFi_Sample) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private long relativeTimestamp_ ; - /** - * optional int64 relative_timestamp = 1; - */ - public long getRelativeTimestamp() { - return relativeTimestamp_; - } - /** - * optional int64 relative_timestamp = 1; - */ - public Builder setRelativeTimestamp(long value) { - - relativeTimestamp_ = value; - onChanged(); - return this; - } - /** - * optional int64 relative_timestamp = 1; - */ - public Builder clearRelativeTimestamp() { - - relativeTimestamp_ = 0L; - onChanged(); - return this; - } - - private java.util.List macScans_ = - java.util.Collections.emptyList(); - private void ensureMacScansIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - macScans_ = new java.util.ArrayList(macScans_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - Mac_Scan, Mac_Scan.Builder, Mac_ScanOrBuilder> macScansBuilder_; - - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public java.util.List getMacScansList() { - if (macScansBuilder_ == null) { - return java.util.Collections.unmodifiableList(macScans_); - } else { - return macScansBuilder_.getMessageList(); - } - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public int getMacScansCount() { - if (macScansBuilder_ == null) { - return macScans_.size(); - } else { - return macScansBuilder_.getCount(); - } - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public Mac_Scan getMacScans(int index) { - if (macScansBuilder_ == null) { - return macScans_.get(index); - } else { - return macScansBuilder_.getMessage(index); - } - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public Builder setMacScans( - int index, Mac_Scan value) { - if (macScansBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureMacScansIsMutable(); - macScans_.set(index, value); - onChanged(); - } else { - macScansBuilder_.setMessage(index, value); - } - return this; - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public Builder setMacScans( - int index, Mac_Scan.Builder builderForValue) { - if (macScansBuilder_ == null) { - ensureMacScansIsMutable(); - macScans_.set(index, builderForValue.build()); - onChanged(); - } else { - macScansBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public Builder addMacScans(Mac_Scan value) { - if (macScansBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureMacScansIsMutable(); - macScans_.add(value); - onChanged(); - } else { - macScansBuilder_.addMessage(value); - } - return this; - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public Builder addMacScans( - int index, Mac_Scan value) { - if (macScansBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureMacScansIsMutable(); - macScans_.add(index, value); - onChanged(); - } else { - macScansBuilder_.addMessage(index, value); - } - return this; - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public Builder addMacScans( - Mac_Scan.Builder builderForValue) { - if (macScansBuilder_ == null) { - ensureMacScansIsMutable(); - macScans_.add(builderForValue.build()); - onChanged(); - } else { - macScansBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public Builder addMacScans( - int index, Mac_Scan.Builder builderForValue) { - if (macScansBuilder_ == null) { - ensureMacScansIsMutable(); - macScans_.add(index, builderForValue.build()); - onChanged(); - } else { - macScansBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public Builder addAllMacScans( - Iterable values) { - if (macScansBuilder_ == null) { - ensureMacScansIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, macScans_); - onChanged(); - } else { - macScansBuilder_.addAllMessages(values); - } - return this; - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public Builder clearMacScans() { - if (macScansBuilder_ == null) { - macScans_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - macScansBuilder_.clear(); - } - return this; - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public Builder removeMacScans(int index) { - if (macScansBuilder_ == null) { - ensureMacScansIsMutable(); - macScans_.remove(index); - onChanged(); - } else { - macScansBuilder_.remove(index); - } - return this; - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public Mac_Scan.Builder getMacScansBuilder( - int index) { - return getMacScansFieldBuilder().getBuilder(index); - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public Mac_ScanOrBuilder getMacScansOrBuilder( - int index) { - if (macScansBuilder_ == null) { - return macScans_.get(index); } else { - return macScansBuilder_.getMessageOrBuilder(index); - } - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public java.util.List - getMacScansOrBuilderList() { - if (macScansBuilder_ != null) { - return macScansBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(macScans_); - } - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public Mac_Scan.Builder addMacScansBuilder() { - return getMacScansFieldBuilder().addBuilder( - Mac_Scan.getDefaultInstance()); - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public Mac_Scan.Builder addMacScansBuilder( - int index) { - return getMacScansFieldBuilder().addBuilder( - index, Mac_Scan.getDefaultInstance()); - } - /** - * repeated .Mac_Scan mac_scans = 2; - */ - public java.util.List - getMacScansBuilderList() { - return getMacScansFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - Mac_Scan, Mac_Scan.Builder, Mac_ScanOrBuilder> - getMacScansFieldBuilder() { - if (macScansBuilder_ == null) { - macScansBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - Mac_Scan, Mac_Scan.Builder, Mac_ScanOrBuilder>( - macScans_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - macScans_ = null; - } - return macScansBuilder_; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - - // @@protoc_insertion_point(builder_scope:WiFi_Sample) - } - - // @@protoc_insertion_point(class_scope:WiFi_Sample) - private static final WiFi_Sample DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new WiFi_Sample(); - } - - public static WiFi_Sample getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - public WiFi_Sample parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new WiFi_Sample(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - public WiFi_Sample getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface Mac_ScanOrBuilder extends - // @@protoc_insertion_point(interface_extends:Mac_Scan) - com.google.protobuf.MessageOrBuilder { - - /** - * optional int64 relative_timestamp = 1; - */ - long getRelativeTimestamp(); - - /** - *
-     * Integer encoding of the hex mac address
-     * e.g. 207394925843984
-     * 
- * - * optional int64 mac = 2; - */ - long getMac(); - - /** - *
-     * rssi integer in dBm.
-     * typically between -120 and -10
-     * 
- * - * optional int32 rssi = 3; - */ - int getRssi(); - } - /** - * Protobuf type {@code Mac_Scan} - */ - public static final class Mac_Scan extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:Mac_Scan) - Mac_ScanOrBuilder { - // Use Mac_Scan.newBuilder() to construct. - private Mac_Scan(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Mac_Scan() { - relativeTimestamp_ = 0L; - mac_ = 0L; - rssi_ = 0; - } - - @Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - private Mac_Scan( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!input.skipField(tag)) { - done = true; - } - break; - } - case 8: { - - relativeTimestamp_ = input.readInt64(); - break; - } - case 16: { - - mac_ = input.readInt64(); - break; - } - case 24: { - - rssi_ = input.readInt32(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_Mac_Scan_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_Mac_Scan_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Mac_Scan.class, Builder.class); - } - - public static final int RELATIVE_TIMESTAMP_FIELD_NUMBER = 1; - private long relativeTimestamp_; - /** - * optional int64 relative_timestamp = 1; - */ - public long getRelativeTimestamp() { - return relativeTimestamp_; - } - - public static final int MAC_FIELD_NUMBER = 2; - private long mac_; - /** - *
-     * Integer encoding of the hex mac address
-     * e.g. 207394925843984
-     * 
- * - * optional int64 mac = 2; - */ - public long getMac() { - return mac_; - } - - public static final int RSSI_FIELD_NUMBER = 3; - private int rssi_; - /** - *
-     * rssi integer in dBm.
-     * typically between -120 and -10
-     * 
- * - * optional int32 rssi = 3; - */ - public int getRssi() { - return rssi_; - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (relativeTimestamp_ != 0L) { - output.writeInt64(1, relativeTimestamp_); - } - if (mac_ != 0L) { - output.writeInt64(2, mac_); - } - if (rssi_ != 0) { - output.writeInt32(3, rssi_); - } - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (relativeTimestamp_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, relativeTimestamp_); - } - if (mac_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(2, mac_); - } - if (rssi_ != 0) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(3, rssi_); - } - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @Override - public boolean equals(final Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof Mac_Scan)) { - return super.equals(obj); - } - Mac_Scan other = (Mac_Scan) obj; - - boolean result = true; - result = result && (getRelativeTimestamp() - == other.getRelativeTimestamp()); - result = result && (getMac() - == other.getMac()); - result = result && (getRssi() - == other.getRssi()); - return result; - } - - @Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - hash = (37 * hash) + RELATIVE_TIMESTAMP_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getRelativeTimestamp()); - hash = (37 * hash) + MAC_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getMac()); - hash = (37 * hash) + RSSI_FIELD_NUMBER; - hash = (53 * hash) + getRssi(); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static Mac_Scan parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Mac_Scan parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Mac_Scan parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Mac_Scan parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Mac_Scan parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Mac_Scan parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static Mac_Scan parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static Mac_Scan parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static Mac_Scan parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Mac_Scan parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(Mac_Scan prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code Mac_Scan} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:Mac_Scan) - Mac_ScanOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_Mac_Scan_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_Mac_Scan_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Mac_Scan.class, Builder.class); - } - - // Construct using Traj.Mac_Scan.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - relativeTimestamp_ = 0L; - - mac_ = 0L; - - rssi_ = 0; - - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return Traj.internal_static_Mac_Scan_descriptor; - } - - public Mac_Scan getDefaultInstanceForType() { - return Mac_Scan.getDefaultInstance(); - } - - public Mac_Scan build() { - Mac_Scan result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public Mac_Scan buildPartial() { - Mac_Scan result = new Mac_Scan(this); - result.relativeTimestamp_ = relativeTimestamp_; - result.mac_ = mac_; - result.rssi_ = rssi_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof Mac_Scan) { - return mergeFrom((Mac_Scan)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(Mac_Scan other) { - if (other == Mac_Scan.getDefaultInstance()) return this; - if (other.getRelativeTimestamp() != 0L) { - setRelativeTimestamp(other.getRelativeTimestamp()); - } - if (other.getMac() != 0L) { - setMac(other.getMac()); - } - if (other.getRssi() != 0) { - setRssi(other.getRssi()); - } - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Mac_Scan parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (Mac_Scan) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private long relativeTimestamp_ ; - /** - * optional int64 relative_timestamp = 1; - */ - public long getRelativeTimestamp() { - return relativeTimestamp_; - } - /** - * optional int64 relative_timestamp = 1; - */ - public Builder setRelativeTimestamp(long value) { - - relativeTimestamp_ = value; - onChanged(); - return this; - } - /** - * optional int64 relative_timestamp = 1; - */ - public Builder clearRelativeTimestamp() { - - relativeTimestamp_ = 0L; - onChanged(); - return this; - } - - private long mac_ ; - /** - *
-       * Integer encoding of the hex mac address
-       * e.g. 207394925843984
-       * 
- * - * optional int64 mac = 2; - */ - public long getMac() { - return mac_; - } - /** - *
-       * Integer encoding of the hex mac address
-       * e.g. 207394925843984
-       * 
- * - * optional int64 mac = 2; - */ - public Builder setMac(long value) { - - mac_ = value; - onChanged(); - return this; - } - /** - *
-       * Integer encoding of the hex mac address
-       * e.g. 207394925843984
-       * 
- * - * optional int64 mac = 2; - */ - public Builder clearMac() { - - mac_ = 0L; - onChanged(); - return this; - } - - private int rssi_ ; - /** - *
-       * rssi integer in dBm.
-       * typically between -120 and -10
-       * 
- * - * optional int32 rssi = 3; - */ - public int getRssi() { - return rssi_; - } - /** - *
-       * rssi integer in dBm.
-       * typically between -120 and -10
-       * 
- * - * optional int32 rssi = 3; - */ - public Builder setRssi(int value) { - - rssi_ = value; - onChanged(); - return this; - } - /** - *
-       * rssi integer in dBm.
-       * typically between -120 and -10
-       * 
- * - * optional int32 rssi = 3; - */ - public Builder clearRssi() { - - rssi_ = 0; - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - - // @@protoc_insertion_point(builder_scope:Mac_Scan) - } - - // @@protoc_insertion_point(class_scope:Mac_Scan) - private static final Mac_Scan DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new Mac_Scan(); - } - - public static Mac_Scan getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - public Mac_Scan parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Mac_Scan(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - public Mac_Scan getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface AP_DataOrBuilder extends - // @@protoc_insertion_point(interface_extends:AP_Data) - com.google.protobuf.MessageOrBuilder { - - /** - *
-     * Integer encoding of the hex mac address
-     * e.g. 207394925843984
-     * 
- * - * optional int64 mac = 1; - */ - long getMac(); - - /** - *
-     * E.g. 'Eduroam' or 'Starbucks_free_wifi'
-     * 
- * - * optional string ssid = 2; - */ - String getSsid(); - /** - *
-     * E.g. 'Eduroam' or 'Starbucks_free_wifi'
-     * 
- * - * optional string ssid = 2; - */ - com.google.protobuf.ByteString - getSsidBytes(); - - /** - *
-     * Typically 2.4GHz or 5GHz
-     * 
- * - * optional int64 frequency = 3; - */ - long getFrequency(); - } - /** - * Protobuf type {@code AP_Data} - */ - public static final class AP_Data extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:AP_Data) - AP_DataOrBuilder { - // Use AP_Data.newBuilder() to construct. - private AP_Data(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private AP_Data() { - mac_ = 0L; - ssid_ = ""; - frequency_ = 0L; - } - - @Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - private AP_Data( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!input.skipField(tag)) { - done = true; - } - break; - } - case 8: { - - mac_ = input.readInt64(); - break; - } - case 18: { - String s = input.readStringRequireUtf8(); - - ssid_ = s; - break; - } - case 24: { - - frequency_ = input.readInt64(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_AP_Data_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_AP_Data_fieldAccessorTable - .ensureFieldAccessorsInitialized( - AP_Data.class, Builder.class); - } - - public static final int MAC_FIELD_NUMBER = 1; - private long mac_; - /** - *
-     * Integer encoding of the hex mac address
-     * e.g. 207394925843984
-     * 
- * - * optional int64 mac = 1; - */ - public long getMac() { - return mac_; - } - - public static final int SSID_FIELD_NUMBER = 2; - private volatile Object ssid_; - /** - *
-     * E.g. 'Eduroam' or 'Starbucks_free_wifi'
-     * 
- * - * optional string ssid = 2; - */ - public String getSsid() { - Object ref = ssid_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - ssid_ = s; - return s; - } - } - /** - *
-     * E.g. 'Eduroam' or 'Starbucks_free_wifi'
-     * 
- * - * optional string ssid = 2; - */ - public com.google.protobuf.ByteString - getSsidBytes() { - Object ref = ssid_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (String) ref); - ssid_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int FREQUENCY_FIELD_NUMBER = 3; - private long frequency_; - /** - *
-     * Typically 2.4GHz or 5GHz
-     * 
- * - * optional int64 frequency = 3; - */ - public long getFrequency() { - return frequency_; - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (mac_ != 0L) { - output.writeInt64(1, mac_); - } - if (!getSsidBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, ssid_); - } - if (frequency_ != 0L) { - output.writeInt64(3, frequency_); - } - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (mac_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(1, mac_); - } - if (!getSsidBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, ssid_); - } - if (frequency_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(3, frequency_); - } - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @Override - public boolean equals(final Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof AP_Data)) { - return super.equals(obj); - } - AP_Data other = (AP_Data) obj; - - boolean result = true; - result = result && (getMac() - == other.getMac()); - result = result && getSsid() - .equals(other.getSsid()); - result = result && (getFrequency() - == other.getFrequency()); - return result; - } - - @Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - hash = (37 * hash) + MAC_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getMac()); - hash = (37 * hash) + SSID_FIELD_NUMBER; - hash = (53 * hash) + getSsid().hashCode(); - hash = (37 * hash) + FREQUENCY_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getFrequency()); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static AP_Data parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static AP_Data parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static AP_Data parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static AP_Data parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static AP_Data parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static AP_Data parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static AP_Data parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static AP_Data parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static AP_Data parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static AP_Data parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(AP_Data prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code AP_Data} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:AP_Data) - AP_DataOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_AP_Data_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_AP_Data_fieldAccessorTable - .ensureFieldAccessorsInitialized( - AP_Data.class, Builder.class); - } - - // Construct using Traj.AP_Data.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - mac_ = 0L; - - ssid_ = ""; - - frequency_ = 0L; - - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return Traj.internal_static_AP_Data_descriptor; - } - - public AP_Data getDefaultInstanceForType() { - return AP_Data.getDefaultInstance(); - } - - public AP_Data build() { - AP_Data result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public AP_Data buildPartial() { - AP_Data result = new AP_Data(this); - result.mac_ = mac_; - result.ssid_ = ssid_; - result.frequency_ = frequency_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof AP_Data) { - return mergeFrom((AP_Data)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(AP_Data other) { - if (other == AP_Data.getDefaultInstance()) return this; - if (other.getMac() != 0L) { - setMac(other.getMac()); - } - if (!other.getSsid().isEmpty()) { - ssid_ = other.ssid_; - onChanged(); - } - if (other.getFrequency() != 0L) { - setFrequency(other.getFrequency()); - } - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - AP_Data parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (AP_Data) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private long mac_ ; - /** - *
-       * Integer encoding of the hex mac address
-       * e.g. 207394925843984
-       * 
- * - * optional int64 mac = 1; - */ - public long getMac() { - return mac_; - } - /** - *
-       * Integer encoding of the hex mac address
-       * e.g. 207394925843984
-       * 
- * - * optional int64 mac = 1; - */ - public Builder setMac(long value) { - - mac_ = value; - onChanged(); - return this; - } - /** - *
-       * Integer encoding of the hex mac address
-       * e.g. 207394925843984
-       * 
- * - * optional int64 mac = 1; - */ - public Builder clearMac() { - - mac_ = 0L; - onChanged(); - return this; - } - - private Object ssid_ = ""; - /** - *
-       * E.g. 'Eduroam' or 'Starbucks_free_wifi'
-       * 
- * - * optional string ssid = 2; - */ - public String getSsid() { - Object ref = ssid_; - if (!(ref instanceof String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - ssid_ = s; - return s; - } else { - return (String) ref; - } - } - /** - *
-       * E.g. 'Eduroam' or 'Starbucks_free_wifi'
-       * 
- * - * optional string ssid = 2; - */ - public com.google.protobuf.ByteString - getSsidBytes() { - Object ref = ssid_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (String) ref); - ssid_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - *
-       * E.g. 'Eduroam' or 'Starbucks_free_wifi'
-       * 
- * - * optional string ssid = 2; - */ - public Builder setSsid( - String value) { - if (value == null) { - throw new NullPointerException(); - } - - ssid_ = value; - onChanged(); - return this; - } - /** - *
-       * E.g. 'Eduroam' or 'Starbucks_free_wifi'
-       * 
- * - * optional string ssid = 2; - */ - public Builder clearSsid() { - - ssid_ = getDefaultInstance().getSsid(); - onChanged(); - return this; - } - /** - *
-       * E.g. 'Eduroam' or 'Starbucks_free_wifi'
-       * 
- * - * optional string ssid = 2; - */ - public Builder setSsidBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - ssid_ = value; - onChanged(); - return this; - } - - private long frequency_ ; - /** - *
-       * Typically 2.4GHz or 5GHz
-       * 
- * - * optional int64 frequency = 3; - */ - public long getFrequency() { - return frequency_; - } - /** - *
-       * Typically 2.4GHz or 5GHz
-       * 
- * - * optional int64 frequency = 3; - */ - public Builder setFrequency(long value) { - - frequency_ = value; - onChanged(); - return this; - } - /** - *
-       * Typically 2.4GHz or 5GHz
-       * 
- * - * optional int64 frequency = 3; - */ - public Builder clearFrequency() { - - frequency_ = 0L; - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - - // @@protoc_insertion_point(builder_scope:AP_Data) - } - - // @@protoc_insertion_point(class_scope:AP_Data) - private static final AP_Data DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new AP_Data(); - } - - public static AP_Data getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - public AP_Data parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new AP_Data(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - public AP_Data getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface Sensor_InfoOrBuilder extends - // @@protoc_insertion_point(interface_extends:Sensor_Info) - com.google.protobuf.MessageOrBuilder { - - /** - * optional string name = 1; - */ - String getName(); - /** - * optional string name = 1; - */ - com.google.protobuf.ByteString - getNameBytes(); - - /** - * optional string vendor = 2; - */ - String getVendor(); - /** - * optional string vendor = 2; - */ - com.google.protobuf.ByteString - getVendorBytes(); - - /** - * optional float resolution = 3; - */ - float getResolution(); - - /** - * optional float power = 4; - */ - float getPower(); - - /** - * optional int32 version = 5; - */ - int getVersion(); - - /** - * optional int32 type = 6; - */ - int getType(); - } - /** - * Protobuf type {@code Sensor_Info} - */ - public static final class Sensor_Info extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:Sensor_Info) - Sensor_InfoOrBuilder { - // Use Sensor_Info.newBuilder() to construct. - private Sensor_Info(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Sensor_Info() { - name_ = ""; - vendor_ = ""; - resolution_ = 0F; - power_ = 0F; - version_ = 0; - type_ = 0; - } - - @Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); - } - private Sensor_Info( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!input.skipField(tag)) { - done = true; - } - break; - } - case 10: { - String s = input.readStringRequireUtf8(); - - name_ = s; - break; - } - case 18: { - String s = input.readStringRequireUtf8(); - - vendor_ = s; - break; - } - case 29: { - - resolution_ = input.readFloat(); - break; - } - case 37: { - - power_ = input.readFloat(); - break; - } - case 40: { - - version_ = input.readInt32(); - break; - } - case 48: { - - type_ = input.readInt32(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_Sensor_Info_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_Sensor_Info_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Sensor_Info.class, Builder.class); - } - - public static final int NAME_FIELD_NUMBER = 1; - private volatile Object name_; - /** - * optional string name = 1; - */ - public String getName() { - Object ref = name_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - name_ = s; - return s; - } - } - /** - * optional string name = 1; - */ - public com.google.protobuf.ByteString - getNameBytes() { - Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int VENDOR_FIELD_NUMBER = 2; - private volatile Object vendor_; - /** - * optional string vendor = 2; - */ - public String getVendor() { - Object ref = vendor_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - vendor_ = s; - return s; - } - } - /** - * optional string vendor = 2; - */ - public com.google.protobuf.ByteString - getVendorBytes() { - Object ref = vendor_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (String) ref); - vendor_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int RESOLUTION_FIELD_NUMBER = 3; - private float resolution_; - /** - * optional float resolution = 3; - */ - public float getResolution() { - return resolution_; - } - - public static final int POWER_FIELD_NUMBER = 4; - private float power_; - /** - * optional float power = 4; - */ - public float getPower() { - return power_; - } - - public static final int VERSION_FIELD_NUMBER = 5; - private int version_; - /** - * optional int32 version = 5; - */ - public int getVersion() { - return version_; - } - - public static final int TYPE_FIELD_NUMBER = 6; - private int type_; - /** - * optional int32 type = 6; - */ - public int getType() { - return type_; - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (!getNameBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); - } - if (!getVendorBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, vendor_); - } - if (resolution_ != 0F) { - output.writeFloat(3, resolution_); - } - if (power_ != 0F) { - output.writeFloat(4, power_); - } - if (version_ != 0) { - output.writeInt32(5, version_); - } - if (type_ != 0) { - output.writeInt32(6, type_); - } - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!getNameBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); - } - if (!getVendorBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, vendor_); - } - if (resolution_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(3, resolution_); - } - if (power_ != 0F) { - size += com.google.protobuf.CodedOutputStream - .computeFloatSize(4, power_); - } - if (version_ != 0) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(5, version_); - } - if (type_ != 0) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(6, type_); - } - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @Override - public boolean equals(final Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof Sensor_Info)) { - return super.equals(obj); - } - Sensor_Info other = (Sensor_Info) obj; - - boolean result = true; - result = result && getName() - .equals(other.getName()); - result = result && getVendor() - .equals(other.getVendor()); - result = result && ( - Float.floatToIntBits(getResolution()) - == Float.floatToIntBits( - other.getResolution())); - result = result && ( - Float.floatToIntBits(getPower()) - == Float.floatToIntBits( - other.getPower())); - result = result && (getVersion() - == other.getVersion()); - result = result && (getType() - == other.getType()); - return result; - } - - @Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - hash = (37 * hash) + VENDOR_FIELD_NUMBER; - hash = (53 * hash) + getVendor().hashCode(); - hash = (37 * hash) + RESOLUTION_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getResolution()); - hash = (37 * hash) + POWER_FIELD_NUMBER; - hash = (53 * hash) + Float.floatToIntBits( - getPower()); - hash = (37 * hash) + VERSION_FIELD_NUMBER; - hash = (53 * hash) + getVersion(); - hash = (37 * hash) + TYPE_FIELD_NUMBER; - hash = (53 * hash) + getType(); - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static Sensor_Info parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Sensor_Info parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Sensor_Info parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static Sensor_Info parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static Sensor_Info parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Sensor_Info parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static Sensor_Info parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static Sensor_Info parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static Sensor_Info parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static Sensor_Info parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(Sensor_Info prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code Sensor_Info} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:Sensor_Info) - Sensor_InfoOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return Traj.internal_static_Sensor_Info_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return Traj.internal_static_Sensor_Info_fieldAccessorTable - .ensureFieldAccessorsInitialized( - Sensor_Info.class, Builder.class); - } - - // Construct using Traj.Sensor_Info.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - name_ = ""; - - vendor_ = ""; - - resolution_ = 0F; - - power_ = 0F; - - version_ = 0; - - type_ = 0; - - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return Traj.internal_static_Sensor_Info_descriptor; - } - - public Sensor_Info getDefaultInstanceForType() { - return Sensor_Info.getDefaultInstance(); - } - - public Sensor_Info build() { - Sensor_Info result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public Sensor_Info buildPartial() { - Sensor_Info result = new Sensor_Info(this); - result.name_ = name_; - result.vendor_ = vendor_; - result.resolution_ = resolution_; - result.power_ = power_; - result.version_ = version_; - result.type_ = type_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof Sensor_Info) { - return mergeFrom((Sensor_Info)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(Sensor_Info other) { - if (other == Sensor_Info.getDefaultInstance()) return this; - if (!other.getName().isEmpty()) { - name_ = other.name_; - onChanged(); - } - if (!other.getVendor().isEmpty()) { - vendor_ = other.vendor_; - onChanged(); - } - if (other.getResolution() != 0F) { - setResolution(other.getResolution()); - } - if (other.getPower() != 0F) { - setPower(other.getPower()); - } - if (other.getVersion() != 0) { - setVersion(other.getVersion()); - } - if (other.getType() != 0) { - setType(other.getType()); - } - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Sensor_Info parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (Sensor_Info) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - - private Object name_ = ""; - /** - * optional string name = 1; - */ - public String getName() { - Object ref = name_; - if (!(ref instanceof String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - name_ = s; - return s; - } else { - return (String) ref; - } - } - /** - * optional string name = 1; - */ - public com.google.protobuf.ByteString - getNameBytes() { - Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * optional string name = 1; - */ - public Builder setName( - String value) { - if (value == null) { - throw new NullPointerException(); - } - - name_ = value; - onChanged(); - return this; - } - /** - * optional string name = 1; - */ - public Builder clearName() { - - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - * optional string name = 1; - */ - public Builder setNameBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - name_ = value; - onChanged(); - return this; - } - - private Object vendor_ = ""; - /** - * optional string vendor = 2; - */ - public String getVendor() { - Object ref = vendor_; - if (!(ref instanceof String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - vendor_ = s; - return s; - } else { - return (String) ref; - } - } - /** - * optional string vendor = 2; - */ - public com.google.protobuf.ByteString - getVendorBytes() { - Object ref = vendor_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (String) ref); - vendor_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * optional string vendor = 2; - */ - public Builder setVendor( - String value) { - if (value == null) { - throw new NullPointerException(); - } - - vendor_ = value; - onChanged(); - return this; - } - /** - * optional string vendor = 2; - */ - public Builder clearVendor() { - - vendor_ = getDefaultInstance().getVendor(); - onChanged(); - return this; - } - /** - * optional string vendor = 2; - */ - public Builder setVendorBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - vendor_ = value; - onChanged(); - return this; - } - - private float resolution_ ; - /** - * optional float resolution = 3; - */ - public float getResolution() { - return resolution_; - } - /** - * optional float resolution = 3; - */ - public Builder setResolution(float value) { - - resolution_ = value; - onChanged(); - return this; - } - /** - * optional float resolution = 3; - */ - public Builder clearResolution() { - - resolution_ = 0F; - onChanged(); - return this; - } - - private float power_ ; - /** - * optional float power = 4; - */ - public float getPower() { - return power_; - } - /** - * optional float power = 4; - */ - public Builder setPower(float value) { - - power_ = value; - onChanged(); - return this; - } - /** - * optional float power = 4; - */ - public Builder clearPower() { - - power_ = 0F; - onChanged(); - return this; - } - - private int version_ ; - /** - * optional int32 version = 5; - */ - public int getVersion() { - return version_; - } - /** - * optional int32 version = 5; - */ - public Builder setVersion(int value) { - - version_ = value; - onChanged(); - return this; - } - /** - * optional int32 version = 5; - */ - public Builder clearVersion() { - - version_ = 0; - onChanged(); - return this; - } - - private int type_ ; - /** - * optional int32 type = 6; - */ - public int getType() { - return type_; - } - /** - * optional int32 type = 6; - */ - public Builder setType(int value) { - - type_ = value; - onChanged(); - return this; - } - /** - * optional int32 type = 6; - */ - public Builder clearType() { - - type_ = 0; - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return this; - } - - - // @@protoc_insertion_point(builder_scope:Sensor_Info) - } - - // @@protoc_insertion_point(class_scope:Sensor_Info) - private static final Sensor_Info DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new Sensor_Info(); - } - - public static Sensor_Info getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - public Sensor_Info parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new Sensor_Info(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - public Sensor_Info getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_Trajectory_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_Trajectory_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_Pdr_Sample_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_Pdr_Sample_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_Motion_Sample_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_Motion_Sample_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_Position_Sample_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_Position_Sample_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_Pressure_Sample_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_Pressure_Sample_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_Light_Sample_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_Light_Sample_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_GNSS_Sample_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_GNSS_Sample_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_WiFi_Sample_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_WiFi_Sample_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_Mac_Scan_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_Mac_Scan_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_AP_Data_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_AP_Data_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_Sensor_Info_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_Sensor_Info_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - String[] descriptorData = { - "\n#Cloud/app/src/main/proto/traj.proto\"\337\004" + - "\n\nTrajectory\022\027\n\017android_version\030\001 \001(\t\022 \n" + - "\010imu_data\030\002 \003(\0132\016.Motion_Sample\022\035\n\010pdr_d" + - "ata\030\003 \003(\0132\013.Pdr_Sample\022\'\n\rposition_data\030" + - "\004 \003(\0132\020.Position_Sample\022\'\n\rpressure_data" + - "\030\005 \003(\0132\020.Pressure_Sample\022!\n\nlight_data\030\006" + - " \003(\0132\r.Light_Sample\022\037\n\tgnss_data\030\007 \003(\0132\014" + - ".GNSS_Sample\022\037\n\twifi_data\030\010 \003(\0132\014.WiFi_S" + - "ample\022\032\n\010aps_data\030\t \003(\0132\010.AP_Data\022\027\n\017sta" + - "rt_timestamp\030\n \001(\003\022\027\n\017data_identifier\030\013 ", - "\001(\t\022(\n\022accelerometer_info\030\014 \001(\0132\014.Sensor" + - "_Info\022$\n\016gyroscope_info\030\r \001(\0132\014.Sensor_I" + - "nfo\022*\n\024rotation_vector_info\030\016 \001(\0132\014.Sens" + - "or_Info\022\'\n\021magnetometer_info\030\017 \001(\0132\014.Sen" + - "sor_Info\022$\n\016barometer_info\030\020 \001(\0132\014.Senso" + - "r_Info\022\'\n\021light_sensor_info\030\021 \001(\0132\014.Sens" + - "or_Info\">\n\nPdr_Sample\022\032\n\022relative_timest" + - "amp\030\001 \001(\003\022\t\n\001x\030\002 \001(\002\022\t\n\001y\030\003 \001(\002\"\205\002\n\rMoti" + - "on_Sample\022\032\n\022relative_timestamp\030\001 \001(\003\022\r\n" + - "\005acc_x\030\002 \001(\002\022\r\n\005acc_y\030\003 \001(\002\022\r\n\005acc_z\030\004 \001", - "(\002\022\r\n\005gyr_x\030\005 \001(\002\022\r\n\005gyr_y\030\006 \001(\002\022\r\n\005gyr_" + - "z\030\007 \001(\002\022\031\n\021rotation_vector_x\030\010 \001(\002\022\031\n\021ro" + - "tation_vector_y\030\t \001(\002\022\031\n\021rotation_vector" + - "_z\030\n \001(\002\022\031\n\021rotation_vector_w\030\013 \001(\002\022\022\n\ns" + - "tep_count\030\014 \001(\005\"Z\n\017Position_Sample\022\032\n\022re" + - "lative_timestamp\030\001 \001(\003\022\r\n\005mag_x\030\002 \001(\002\022\r\n" + - "\005mag_y\030\003 \001(\002\022\r\n\005mag_z\030\004 \001(\002\"?\n\017Pressure_" + - "Sample\022\032\n\022relative_timestamp\030\001 \001(\003\022\020\n\010pr" + - "essure\030\002 \001(\002\"9\n\014Light_Sample\022\032\n\022relative" + - "_timestamp\030\001 \001(\003\022\r\n\005light\030\002 \001(\002\"\223\001\n\013GNSS", - "_Sample\022\032\n\022relative_timestamp\030\001 \001(\003\022\020\n\010l" + - "atitude\030\002 \001(\002\022\021\n\tlongitude\030\003 \001(\002\022\020\n\010alti" + - "tude\030\004 \001(\002\022\020\n\010accuracy\030\005 \001(\002\022\r\n\005speed\030\006 " + - "\001(\002\022\020\n\010provider\030\007 \001(\t\"G\n\013WiFi_Sample\022\032\n\022" + - "relative_timestamp\030\001 \001(\003\022\034\n\tmac_scans\030\002 " + - "\003(\0132\t.Mac_Scan\"A\n\010Mac_Scan\022\032\n\022relative_t" + - "imestamp\030\001 \001(\003\022\013\n\003mac\030\002 \001(\003\022\014\n\004rssi\030\003 \001(" + - "\005\"7\n\007AP_Data\022\013\n\003mac\030\001 \001(\003\022\014\n\004ssid\030\002 \001(\t\022" + - "\021\n\tfrequency\030\003 \001(\003\"m\n\013Sensor_Info\022\014\n\004nam" + - "e\030\001 \001(\t\022\016\n\006vendor\030\002 \001(\t\022\022\n\nresolution\030\003 ", - "\001(\002\022\r\n\005power\030\004 \001(\002\022\017\n\007version\030\005 \001(\005\022\014\n\004t" + - "ype\030\006 \001(\005b\006proto3" - }; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - }, assigner); - internal_static_Trajectory_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_Trajectory_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_Trajectory_descriptor, - new String[] { "AndroidVersion", "ImuData", "PdrData", "PositionData", "PressureData", "LightData", "GnssData", "WifiData", "ApsData", "StartTimestamp", "DataIdentifier", "AccelerometerInfo", "GyroscopeInfo", "RotationVectorInfo", "MagnetometerInfo", "BarometerInfo", "LightSensorInfo", }); - internal_static_Pdr_Sample_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_Pdr_Sample_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_Pdr_Sample_descriptor, - new String[] { "RelativeTimestamp", "X", "Y", }); - internal_static_Motion_Sample_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_Motion_Sample_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_Motion_Sample_descriptor, - new String[] { "RelativeTimestamp", "AccX", "AccY", "AccZ", "GyrX", "GyrY", "GyrZ", "RotationVectorX", "RotationVectorY", "RotationVectorZ", "RotationVectorW", "StepCount", }); - internal_static_Position_Sample_descriptor = - getDescriptor().getMessageTypes().get(3); - internal_static_Position_Sample_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_Position_Sample_descriptor, - new String[] { "RelativeTimestamp", "MagX", "MagY", "MagZ", }); - internal_static_Pressure_Sample_descriptor = - getDescriptor().getMessageTypes().get(4); - internal_static_Pressure_Sample_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_Pressure_Sample_descriptor, - new String[] { "RelativeTimestamp", "Pressure", }); - internal_static_Light_Sample_descriptor = - getDescriptor().getMessageTypes().get(5); - internal_static_Light_Sample_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_Light_Sample_descriptor, - new String[] { "RelativeTimestamp", "Light", }); - internal_static_GNSS_Sample_descriptor = - getDescriptor().getMessageTypes().get(6); - internal_static_GNSS_Sample_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_GNSS_Sample_descriptor, - new String[] { "RelativeTimestamp", "Latitude", "Longitude", "Altitude", "Accuracy", "Speed", "Provider", }); - internal_static_WiFi_Sample_descriptor = - getDescriptor().getMessageTypes().get(7); - internal_static_WiFi_Sample_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_WiFi_Sample_descriptor, - new String[] { "RelativeTimestamp", "MacScans", }); - internal_static_Mac_Scan_descriptor = - getDescriptor().getMessageTypes().get(8); - internal_static_Mac_Scan_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_Mac_Scan_descriptor, - new String[] { "RelativeTimestamp", "Mac", "Rssi", }); - internal_static_AP_Data_descriptor = - getDescriptor().getMessageTypes().get(9); - internal_static_AP_Data_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_AP_Data_descriptor, - new String[] { "Mac", "Ssid", "Frequency", }); - internal_static_Sensor_Info_descriptor = - getDescriptor().getMessageTypes().get(10); - internal_static_Sensor_Info_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_Sensor_Info_descriptor, - new String[] { "Name", "Vendor", "Resolution", "Power", "Version", "Type", }); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/app/src/main/java/com/openpositioning/PositionMe/data/remote/ServerCommunications.java b/app/src/main/java/com/openpositioning/PositionMe/data/remote/ServerCommunications.java index 7f7e74b2..42579c63 100644 --- a/app/src/main/java/com/openpositioning/PositionMe/data/remote/ServerCommunications.java +++ b/app/src/main/java/com/openpositioning/PositionMe/data/remote/ServerCommunications.java @@ -6,6 +6,8 @@ import java.io.BufferedReader; import java.io.FileReader; import org.json.JSONObject; +import okhttp3.MediaType; +import okhttp3.RequestBody; import android.os.Environment; @@ -17,7 +19,6 @@ import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Build; -import android.os.Environment; import android.os.Handler; import android.os.Looper; import android.widget.Toast; @@ -25,13 +26,13 @@ import androidx.annotation.NonNull; import androidx.preference.PreferenceManager; -import com.google.protobuf.util.JsonFormat; import com.openpositioning.PositionMe.BuildConfig; import com.openpositioning.PositionMe.Traj; import com.openpositioning.PositionMe.presentation.fragment.FilesFragment; import com.openpositioning.PositionMe.presentation.activity.MainActivity; import com.openpositioning.PositionMe.sensors.Observable; import com.openpositioning.PositionMe.sensors.Observer; +import com.openpositioning.PositionMe.utils.CampaignStore; import java.io.ByteArrayOutputStream; import java.io.File; @@ -44,18 +45,15 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; -import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Headers; -import okhttp3.MediaType; import okhttp3.MultipartBody; import okhttp3.OkHttp; import okhttp3.OkHttpClient; import okhttp3.Request; -import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.ResponseBody; @@ -90,13 +88,17 @@ public class ServerCommunications implements Observable { private static final String masterKey = BuildConfig.OPENPOSITIONING_MASTER_KEY; private static final String uploadURL = "https://openpositioning.org/api/live/trajectory/upload/" + userKey - + "/?key=" + masterKey; + + "?key=" + masterKey; private static final String downloadURL = "https://openpositioning.org/api/live/trajectory/download/" + userKey + "?skip=0&limit=30&key=" + masterKey; private static final String infoRequestURL = "https://openpositioning.org/api/live/users/trajectories/" + userKey + "?key=" + masterKey; + private static final String url = "https://openpositioning.org/api/live/floorplan/request/" + userKey; + + + //end private static final String PROTOCOL_CONTENT_TYPE = "multipart/form-data"; private static final String PROTOCOL_ACCEPT_TYPE = "application/json"; @@ -131,7 +133,8 @@ public void sendTrajectory(Traj.Trajectory trajectory){ logDataSize(trajectory); // Convert the trajectory to byte array - byte[] binaryTrajectory = trajectory.toByteArray(); + Traj.Trajectory patched = patchWifiHeadersIfEmpty(trajectory); + byte[] data = patched.toByteArray(); File path = null; // for android 13 or higher use dedicated external storage @@ -146,15 +149,35 @@ public void sendTrajectory(Traj.Trajectory trajectory){ System.out.println(path.toString()); - // Format the file name according to date + // (EE HUNG)Format the file name according to date SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yy-HH-mm-ss"); Date date = new Date(); - File file = new File(path, "trajectory_" + dateFormat.format(date) + ".txt"); + String dateString = dateFormat.format(date); + +// 1. Get the custom name + String customName = com.openpositioning.PositionMe.sensors.SensorFusion.getInstance().getTrajectoryId(); + +// 2. BUILD THE FILENAME +// We MUST start with "trajectory_" and the date so the List Reader can find it. +// We add your custom name at the end. + String finalFileName; + + if (customName != null && !customName.isEmpty()) { + // Result: trajectory_04-02-26-21-30_LibraryWalk.txt + // EE HUNG (Sanitize the name to remove spaces so it doesn't break) + String safeName = customName.replaceAll("[^a-zA-Z0-9 ]", ""); + finalFileName = "trajectory_" + dateString + "_ " + safeName + ".txt"; + } else { + // Result: trajectory_04-02-26-21-30.txt + finalFileName = "trajectory_" + dateString + ".txt"; + } + + File file = new File(path, finalFileName); try { // Write the binary data to the file FileOutputStream stream = new FileOutputStream(file); - stream.write(binaryTrajectory); + stream.write(data); stream.close(); System.out.println("Recorded binary trajectory for debugging stored in: " + path); } catch (IOException ee) { @@ -273,7 +296,12 @@ private void copyFile(File src, File dst) throws IOException { * * @param localTrajectory the File object of the local trajectory to be uploaded */ - public void uploadLocalTrajectory(File localTrajectory) { + + public void uploadLocalTrajectory(@NonNull String campaign, File localTrajectory) { + + String url = buildUploadUrl(campaign); + Log.e("UPLOAD", "upload url=" + url); + // Instantiate client for HTTP requests OkHttpClient client = new OkHttpClient(); @@ -299,7 +327,7 @@ public void uploadLocalTrajectory(File localTrajectory) { .build(); // Create a POST request with the required headers - okhttp3.Request request = new okhttp3.Request.Builder().url(uploadURL).post(requestBody) + okhttp3.Request request = new okhttp3.Request.Builder().url(url).post(requestBody) .addHeader("accept", PROTOCOL_ACCEPT_TYPE) .addHeader("Content-Type", PROTOCOL_CONTENT_TYPE).build(); @@ -317,7 +345,7 @@ public void onFailure(Call call, IOException e) { new Handler(Looper.getMainLooper()).post(() -> Toast.makeText(context, infoResponse, Toast.LENGTH_SHORT).show()); // show error message to users } - +//end @Override public void onResponse(Call call, Response response) throws IOException { try (ResponseBody responseBody = response.body()) { @@ -346,6 +374,27 @@ public void onResponse(Call call, Response response) throws IOException { assert responseBody != null; System.out.println("UPLOAD SUCCESSFUL: " + responseBody.string()); + //Chen :define the campaign for upload + String campaignName = CampaignStore.get(context); + if (campaignName == null || campaignName.isEmpty()) { + campaignName = "(unknown)"; + } + + String toastText = "Upload successful\nCampaign: " + campaignName; + + android.os.Handler mainHandler = + new android.os.Handler(android.os.Looper.getMainLooper()); + String finalCampaignName = campaignName; + + mainHandler.post(() -> { + android.widget.Toast.makeText( + context, + toastText, + android.widget.Toast.LENGTH_LONG + ).show(); + }); + //END + // Delete local file, set success to true and notify observers success = localTrajectory.delete(); notifyObservers(1); @@ -540,8 +589,8 @@ public void onResponse(Call call, Response response) throws IOException { File file = new File(appSpecificDownloads, fileName); try (FileWriter fileWriter = new FileWriter(file)) { - String receivedTrajectoryString = JsonFormat.printer().print(receivedTrajectory); - fileWriter.write(receivedTrajectoryString); +// REPLACE WITH THIS: + String receivedTrajectoryString = receivedTrajectory.toString(); fileWriter.write(receivedTrajectoryString); fileWriter.flush(); System.err.println("Received trajectory stored in: " + file.getAbsolutePath()); } catch (IOException ee) { @@ -623,11 +672,26 @@ private void checkNetworkStatus() { private void logDataSize(Traj.Trajectory trajectory) { Log.i("ServerCommunications", "IMU Data size: " + trajectory.getImuDataCount()); - Log.i("ServerCommunications", "Position Data size: " + trajectory.getPositionDataCount()); + Log.i("ServerCommunications", "Position Data size: " + trajectory.getMagnetometerDataCount()); Log.i("ServerCommunications", "Pressure Data size: " + trajectory.getPressureDataCount()); + Log.i("ServerCommunications", + "PDR data size: " + trajectory.getPdrDataCount()); + + Log.i("ServerCommunications", + "Corrected positions size: " + trajectory.getCorrectedPositionsCount()); + + Log.i("ServerCommunications", + "Magnetometer data size: " + trajectory.getMagnetometerDataCount()); + Log.i("ServerCommunications", "Pressure Data size: " + trajectory.getPressureDataCount()); Log.i("ServerCommunications", "Light Data size: " + trajectory.getLightDataCount()); Log.i("ServerCommunications", "GNSS Data size: " + trajectory.getGnssDataCount()); - Log.i("ServerCommunications", "WiFi Data size: " + trajectory.getWifiDataCount()); + Log.i("ServerCommunications", "WiFi Data size: " + trajectory.getWifiFingerprintsCount()); Log.i("ServerCommunications", "PDR Data size: " + trajectory.getPdrDataCount()); + Log.i("ServerCommunications", + "WiFi fingerprints count: " + trajectory.getWifiFingerprintsCount()); + + Log.i("ServerCommunications", + "WiFi AP data count: " + trajectory.getApsDataCount()); + Log.i("ServerCommunications", "APS Data size: " + trajectory.getApsDataCount()); Log.i("ServerCommunications", "PDR Data size: " + trajectory.getPdrDataCount()); } @@ -664,4 +728,186 @@ else if (index == 1 && o instanceof MainActivity) { } } } + + //Chen :enable the feedback visible + public interface FloorplanCallback { + void onSuccess(JSONObject response); + void onError(String error); + } + + + public void requestFloorplans(double lat, double lon, List wifiList, + FloorplanCallback cb) { + + OkHttpClient client = new OkHttpClient(); + + JSONObject body = new JSONObject(); + try { + body.put("lat", lat); + body.put("lon", lon); + +// + //Chen :ensure the macs of wifilist correct + org.json.JSONArray macs = new org.json.JSONArray(); + if (wifiList != null) { + for (com.openpositioning.PositionMe.sensors.Wifi w : wifiList) { + if (w == null) continue; + + String mac = formatBssidToMac(w.getBssid()); + macs.put(mac); + } + } + body.put("macs", macs); + + // ===== DEBUG: print request body (macs) ===== + try { + Log.e("Floorplan", "BODY lat=" + lat + " lon=" + lon); + + if (macs == null) { + Log.e("Floorplan", "BODY macs=null"); + } else { + Log.e("Floorplan", "BODY macs size=" + macs.length()); + for (int i = 0; i < macs.length(); i++) { + Log.e("Floorplan", "BODY mac[" + i + "]=" + macs.optString(i)); + } + } + } catch (Exception e) { + Log.e("Floorplan", "BODY log error: " + e.getMessage()); + } +// ===== END DEBUG ===== + + + //end + + } catch (Exception e) { + if (cb != null) cb.onError("JSON build error: " + e.getMessage()); + return; + } + + String url = "https://openpositioning.org/api/live/floorplan/request/" + userKey + "?key=" +masterKey; + Log.e("Floorplan", "POST " + url); + + MediaType JSON = MediaType.parse("application/json; charset=utf-8"); + RequestBody requestBody = RequestBody.create(JSON, body.toString()); + + Request request = new Request.Builder() + .url(url) + .addHeader("accept", PROTOCOL_ACCEPT_TYPE) + .post(requestBody) + .build(); + + + client.newCall(request).enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + if (cb == null) return; + new Handler(Looper.getMainLooper()).post(() -> + cb.onError("Network failure: " + e.getMessage())); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + if (cb == null) return; + + String respStr = ""; + try (ResponseBody rb = response.body()) { + respStr = (rb != null) ? rb.string() : ""; + } catch (Exception ignored) {} + + if (!response.isSuccessful()) { + String err = "HTTP " + response.code() + ": " + respStr; + new Handler(Looper.getMainLooper()).post(() -> cb.onError(err)); + return; + } + + //Chen :Wrap the raw JSON array response into a { results: [...] } object + // to stay compatible with existing floorplan parsing/rendering logic. + try { + // success response:[ {name, outline, map_shapes}, ... ] + org.json.JSONArray arr = new org.json.JSONArray(respStr); + + JSONObject wrapper = new JSONObject(); + wrapper.put("results", arr); + + new Handler(Looper.getMainLooper()).post(() -> cb.onSuccess(wrapper)); + } catch (Exception e) { + String err = "Parse JSON error: " + e.getMessage() + " raw=" + respStr; + new Handler(Looper.getMainLooper()).post(() -> cb.onError(err)); + } + //end + } + }); + } + + private static String formatBssidToMac(long bssid) { + String hex = String.format(java.util.Locale.US, "%012X", bssid); + // AA:BB:CC:DD:EE:FF + return hex.replaceAll("(.{2})(?!$)", "$1:"); + } + + private String buildUploadUrl(@NonNull String campaign) { + try { + String encoded = java.net.URLEncoder.encode(campaign, "UTF-8"); + + // swagger:.../upload/{campaign}/{api_key}/ + String url = "https://openpositioning.org/api/live/trajectory/upload/" + + encoded + "/" + + userKey + "/"; + url += "?key=" + masterKey; + + return url; + } catch (Exception e) { + return "https://openpositioning.org/api/live/trajectory/upload/" + + campaign + "/" + + userKey + "/?key=" + masterKey; + } + } + + private Traj.Trajectory patchWifiHeadersIfEmpty(Traj.Trajectory t) { + try { + Traj.Trajectory.Builder b = t.toBuilder(); + + if (b.getWifiFingerprintsCount() < 2) { + int need = 2 - b.getWifiFingerprintsCount(); + + for (int i = 0; i < need; i++) { + long ts = 1L + b.getWifiFingerprintsCount(); + + Traj.RFScan scan = Traj.RFScan.newBuilder() + .setRelativeTimestamp(ts) + .setMac(0L) + .setRssi(-55 - i) + .setSsid("FAKE_AP") + .setFrequency(2412L) + .build(); + + Traj.Fingerprint fp = Traj.Fingerprint.newBuilder() + .setRelativeTimestamp(ts) + .addRfScans(scan) + .build(); + + b.addWifiFingerprints(fp); + android.util.Log.e("UPLOAD", "Patched fake wifi_fingerprint #" + (b.getWifiFingerprintsCount()) + " @ts=" + ts); + } + } + + if (b.getApsDataCount() == 0) { + Traj.WiFiAPData ap = Traj.WiFiAPData.newBuilder() + .setMac(0L) + .setSsid("FAKE_AP") + .setFrequency(2412L) + .setRttEnabled(false) + .build(); + + b.addApsData(ap); + android.util.Log.e("UPLOAD", "Patched fake aps_data"); + } + + return b.build(); + } catch (Exception e) { + android.util.Log.e("UPLOAD", "patchWifiHeadersIfEmpty failed: " + e.getMessage(), e); + return t; + } + } + } \ No newline at end of file diff --git a/app/src/main/java/com/openpositioning/PositionMe/presentation/activity/MainActivity.java b/app/src/main/java/com/openpositioning/PositionMe/presentation/activity/MainActivity.java index 995f010d..653386e1 100644 --- a/app/src/main/java/com/openpositioning/PositionMe/presentation/activity/MainActivity.java +++ b/app/src/main/java/com/openpositioning/PositionMe/presentation/activity/MainActivity.java @@ -89,7 +89,10 @@ public class MainActivity extends AppCompatActivity implements Observer { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + //EE HUNG (keep app always on) + getWindow().addFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_main); // Set up navigation and fragments @@ -363,4 +366,11 @@ public void update(Object[] objList) { }; //endregion + + //Chen:Expose the SensorFusion instance for accessing fused location and orientation data. + public SensorFusion getSensorFusion() { + return sensorFusion; + } + + //end } \ No newline at end of file diff --git a/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/HomeFragment.java b/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/HomeFragment.java index 8371b04e..e3ec5704 100644 --- a/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/HomeFragment.java +++ b/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/HomeFragment.java @@ -75,7 +75,17 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, ((AppCompatActivity) getActivity()).getSupportActionBar().show(); View rootView = inflater.inflate(R.layout.fragment_home, container, false); getActivity().setTitle("Home"); + + //Chen :enable the button of indoor position to trajectorymafragment + MaterialButton indoorButton = rootView.findViewById(R.id.indoorButton); + indoorButton.setOnClickListener(v -> { + Navigation.findNavController(v) + .navigate(R.id.trajectoryMapFragment); + }); + + //end return rootView; + } /** diff --git a/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/RecordingFragment.java b/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/RecordingFragment.java index 6362a971..6cd0b47d 100644 --- a/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/RecordingFragment.java +++ b/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/RecordingFragment.java @@ -1,4 +1,5 @@ package com.openpositioning.PositionMe.presentation.fragment; +import com.google.android.material.floatingactionbutton.FloatingActionButton; import android.app.AlertDialog; import android.content.Context; @@ -10,6 +11,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.util.Log; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; @@ -32,7 +34,7 @@ import com.openpositioning.PositionMe.utils.UtilFunctions; import com.google.android.gms.maps.model.LatLng; - +import android.widget.Toast; /** * Fragment responsible for managing the recording process of trajectory data. *

@@ -60,6 +62,10 @@ public class RecordingFragment extends Fragment { // UI elements private MaterialButton completeButton, cancelButton; + + private FloatingActionButton testPointButton; + + private ImageView recIcon; private ProgressBar timeRemaining; private TextView elevation, distanceTravelled, gnssError; @@ -71,7 +77,27 @@ public class RecordingFragment extends Fragment { private SensorFusion sensorFusion; private Handler refreshDataHandler; private CountDownTimer autoStop; - + //CHEN 2 SWITCH FLOOR + + private long lastFloorChangeTimeMs = 0L; + //CHEN 2 + + private long allowFloorChangeUntilMs = 0L; + private static final long FLOOR_CHANGE_ALLOW_WINDOW_MS = 3000L; + //END + private static final double VERTICAL_FEATURE_NEAR_THRESHOLD_METERS = 4.0; + private static final long FLOOR_CHANGE_COOLDOWN_MS = 4000L; + + //end + //DISTINGUISH LIFT/STAIRS + private String lastVerticalMode = "unknown"; + private static final float LIFT_HORIZONTAL_MOVE_THRESHOLD = 1.2f; + + private long lastWallToastTimeMs = 0L; + private static final long WALL_TOAST_COOLDOWN_MS = 2000L; + private long lastVerticalHintToastTimeMs = 0L; + private static final long VERTICAL_HINT_TOAST_COOLDOWN_MS = 2000L; + //END // Distance tracking private float distance = 0f; private float previousPosX = 0f; @@ -100,6 +126,19 @@ public void onCreate(Bundle savedInstanceState) { Context context = requireActivity(); this.settings = PreferenceManager.getDefaultSharedPreferences(context); this.refreshDataHandler = new Handler(); + + this.sensorFusion.setWallEventListener(() -> { + long now = System.currentTimeMillis(); + + if (now - lastWallToastTimeMs > WALL_TOAST_COOLDOWN_MS && isAdded()) { + requireActivity().runOnUiThread(() -> + Toast.makeText(requireContext(), + "Wall detected. Cannot pass through.", + Toast.LENGTH_SHORT).show() + ); + lastWallToastTimeMs = now; + } + }); } @Nullable @@ -137,6 +176,10 @@ public void onViewCreated(@NonNull View view, completeButton = view.findViewById(R.id.stopButton); cancelButton = view.findViewById(R.id.cancelButton); + + testPointButton = view.findViewById(R.id.testPointButton); + testPointButton.setOnClickListener(v -> onTestPointClicked()); + recIcon = view.findViewById(R.id.redDot); timeRemaining = view.findViewById(R.id.timeRemainingBar); @@ -149,6 +192,15 @@ public void onViewCreated(@NonNull View view, completeButton.setOnClickListener(v -> { // Stop recording & go to correction if (autoStop != null) autoStop.cancel(); + //Chen :If current location is available, proactively trigger a floorplan request to refresh nearby indoor venues. + if (trajectoryMapFragment != null) { + LatLng loc = trajectoryMapFragment.getCurrentLocation(); + if (loc != null) { + trajectoryMapFragment.requestFloorplansNow(loc); + } + } + + //end sensorFusion.stopRecording(); // Show Correction screen ((RecordingActivity) requireActivity()).showCorrectionScreen(); @@ -207,7 +259,7 @@ public void onFinish() { }.start(); } else { // No set time limit, just keep refreshing - refreshDataHandler.post(refreshDataTask); + //refreshDataHandler.post(refreshDataTask); } } @@ -227,29 +279,129 @@ private void updateUIandPosition() { float elevationVal = sensorFusion.getElevation(); elevation.setText(getString(R.string.elevation, String.format("%.1f", elevationVal))); - // Current location - // Convert PDR coordinates to actual LatLng if you have a known starting lat/lon - // Or simply pass relative data for the TrajectoryMapFragment to handle - // For example: - float[] latLngArray = sensorFusion.getGNSSLatitude(true); - if (latLngArray != null) { - LatLng oldLocation = trajectoryMapFragment.getCurrentLocation(); // or store locally - LatLng newLocation = UtilFunctions.calculateNewPos( - oldLocation == null ? new LatLng(latLngArray[0], latLngArray[1]) : oldLocation, - new float[]{ pdrValues[0] - previousPosX, pdrValues[1] - previousPosY } - ); - - // Pass the location + orientation to the map - if (trajectoryMapFragment != null) { - trajectoryMapFragment.updateUserLocation(newLocation, - (float) Math.toDegrees(sensorFusion.passOrientation())); + // Main displayed position: ONLY use fused result + LatLng fusedLatLng = sensorFusion.getFusedEstimatedLatLng(); + + if (trajectoryMapFragment != null) { + LatLng oldLocation = trajectoryMapFragment.getCurrentLocation(); + LatLng candidateLocation = fusedLatLng; + + if (candidateLocation != null) { + LatLng finalLocation = candidateLocation; + + // Step 1: wall-based map matching + if (oldLocation != null && trajectoryMapFragment.crossesWall(oldLocation, candidateLocation)) { + finalLocation = trajectoryMapFragment.getLastValidPointBeforeWall(oldLocation, candidateLocation); + Log.d("MapMatching", "Blocked by wall, using last valid point"); + + } + + // Step 2: floor-change gating and vertical-mode classification + boolean allowFloorChange = false; + + if (finalLocation != null) { + long now = System.currentTimeMillis(); + + boolean nearStairs = + trajectoryMapFragment.isNearStairs(finalLocation, VERTICAL_FEATURE_NEAR_THRESHOLD_METERS); + + boolean nearLift = + trajectoryMapFragment.isNearLift(finalLocation, VERTICAL_FEATURE_NEAR_THRESHOLD_METERS); + + boolean nearVerticalFeature = nearStairs || nearLift; + + if (now - lastVerticalHintToastTimeMs > VERTICAL_HINT_TOAST_COOLDOWN_MS) { + if (nearStairs) { + Toast.makeText(requireContext(), "Near stairs area", Toast.LENGTH_SHORT).show(); + lastVerticalHintToastTimeMs = now; + } else if (nearLift) { + Toast.makeText(requireContext(), "Near lift area", Toast.LENGTH_SHORT).show(); + lastVerticalHintToastTimeMs = now; + } + } + + boolean cooldownPassed = + (now - lastFloorChangeTimeMs) >= FLOOR_CHANGE_COOLDOWN_MS; + + float horizontalStep = + (float) Math.sqrt( + Math.pow(pdrValues[0] - previousPosX, 2) + + Math.pow(pdrValues[1] - previousPosY, 2) + ); + + String verticalMode = "unknown"; + + if (cooldownPassed) { + if (nearLift && horizontalStep <= LIFT_HORIZONTAL_MOVE_THRESHOLD) { + verticalMode = "lift"; + allowFloorChange = true; + allowFloorChangeUntilMs = now + FLOOR_CHANGE_ALLOW_WINDOW_MS; + lastFloorChangeTimeMs = now; + } else if (nearStairs && horizontalStep > LIFT_HORIZONTAL_MOVE_THRESHOLD) { + verticalMode = "stairs"; + allowFloorChange = true; + allowFloorChangeUntilMs = now + FLOOR_CHANGE_ALLOW_WINDOW_MS; + lastFloorChangeTimeMs = now; + } else if (nearVerticalFeature) { + verticalMode = nearLift ? "lift?" : "stairs?"; + allowFloorChange = true; + allowFloorChangeUntilMs = now + FLOOR_CHANGE_ALLOW_WINDOW_MS; + lastFloorChangeTimeMs = now; + } + } + + lastVerticalMode = verticalMode; + + Log.d("MapMatching", + "elevation=" + elevationVal + + ", horizontalStep=" + horizontalStep + + ", nearStairs=" + nearStairs + + ", nearLift=" + nearLift + + ", verticalMode=" + verticalMode + + ", allowFloorChange=" + allowFloorChange); + } else { + lastVerticalMode = "unknown"; + } + + if (System.currentTimeMillis() < allowFloorChangeUntilMs) { + allowFloorChange = true; + } + + trajectoryMapFragment.setMapMatchingAllowsFloorChange(allowFloorChange); + trajectoryMapFragment.updateUserLocation( + finalLocation, + (float) Math.toDegrees(sensorFusion.passOrientation()) + ); + trajectoryMapFragment.requestFloorplansIfNeeded(finalLocation); + } else { + // No fused result yet -> keep the red main marker still + trajectoryMapFragment.setMapMatchingAllowsFloorChange(false); + lastVerticalMode = "unknown"; + } + + // Keep elevation state updated even when fused is not ready + + // ===== 3.3 last N observations ===== + LatLng gnssObs = sensorFusion.getCurrentGnssLatLng(); + LatLng wifiObs = sensorFusion.getCurrentWifiLatLng(); + LatLng pdrObs = sensorFusion.getCurrentPdrLatLng(); + + if (gnssObs != null) { + trajectoryMapFragment.addGnssObservation(gnssObs); + } + + if (wifiObs != null) { + trajectoryMapFragment.addWifiObservation(wifiObs); + } + + if (pdrObs != null) { + trajectoryMapFragment.addPdrObservation(pdrObs); } } // GNSS logic if you want to show GNSS error, etc. float[] gnss = sensorFusion.getSensorValueMap().get(SensorTypes.GNSSLATLONG); if (gnss != null && trajectoryMapFragment != null) { - // If user toggles showing GNSS in the map, call e.g. if (trajectoryMapFragment.isGnssEnabled()) { LatLng gnssLocation = new LatLng(gnss[0], gnss[1]); LatLng currentLoc = trajectoryMapFragment.getCurrentLocation(); @@ -265,7 +417,7 @@ private void updateUIandPosition() { } } - // Update previous + // Update previous PDR values previousPosX = pdrValues[0]; previousPosY = pdrValues[1]; } @@ -295,4 +447,36 @@ public void onResume() { refreshDataHandler.postDelayed(refreshDataTask, 500); } } + + private int testPointCount = 0; + + // + private void onTestPointClicked() { + if (trajectoryMapFragment == null) { + Toast.makeText(requireContext(), "Map not ready", Toast.LENGTH_SHORT).show(); + return; + } + + LatLng pos = trajectoryMapFragment.getCurrentLocation(); + if (pos == null) { + Toast.makeText(requireContext(), "Position not ready yet", Toast.LENGTH_SHORT).show(); + return; + } + + long timestampMs = System.currentTimeMillis(); + testPointCount++; + + trajectoryMapFragment.addTestPointMarker(pos, testPointCount); + + Log.d("TestPoint", + "TP " + testPointCount + + " ts=" + timestampMs + + " lat=" + pos.latitude + + " lon=" + pos.longitude); + + Toast.makeText(requireContext(), + "Test Point " + testPointCount + " saved", + Toast.LENGTH_SHORT).show(); + } + } diff --git a/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/StartLocationFragment.java b/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/StartLocationFragment.java index ee14f69f..b244abd9 100644 --- a/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/StartLocationFragment.java +++ b/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/StartLocationFragment.java @@ -5,6 +5,9 @@ import android.view.View; import android.view.ViewGroup; import android.widget.Button; +import android.widget.EditText; //EE HUNG added +import android.widget.Toast; // EE HUNG added + import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -48,6 +51,7 @@ public class StartLocationFragment extends Fragment { private float zoom = 19f; // Instance for managing indoor building overlays (if any) private NucleusBuildingManager nucleusBuildingManager; + // Dummy variable for floor index private int FloorNK; @@ -72,6 +76,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, } View rootView = inflater.inflate(R.layout.fragment_startlocation, container, false); + // Obtain the start position from the GPS data from the SensorFusion class startPosition = sensorFusion.getGNSSLatitude(false); // If no location found, zoom the map out @@ -117,6 +122,9 @@ public void onMapReady(GoogleMap mMap) { .draggable(true)); mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(position, zoom)); + + + // Drag listener for the marker to update the start position when dragged mMap.setOnMarkerDragListener(new GoogleMap.OnMarkerDragListener() { /** @@ -147,6 +155,9 @@ public void onMarkerDrag(Marker marker) {} return rootView; } + + + /** * {@inheritDoc} * Button onClick listener enabled to detect when to go to next fragment and start PDR recording. @@ -155,6 +166,7 @@ public void onMarkerDrag(Marker marker) {} public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); + this.button = view.findViewById(R.id.startLocationDone); this.button.setOnClickListener(new View.OnClickListener() { /** @@ -164,13 +176,25 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat */ @Override public void onClick(View view) { + //EE HUNG added + // 1. Find the input field from the XML + EditText nameInput = getView().findViewById(R.id.trajectoryNameInput); + String trajName = nameInput.getText().toString().trim(); + + // 2. Validate: Stop if the name is empty + if (trajName.isEmpty()) { + Toast.makeText(getContext(), "Please enter a trajectory name!", Toast.LENGTH_SHORT).show(); + return; // Stop here, do not start recording + } + + float chosenLat = startPosition[0]; float chosenLon = startPosition[1]; // If the Activity is RecordingActivity if (requireActivity() instanceof RecordingActivity) { // Start sensor recording + set the start location - sensorFusion.startRecording(); + sensorFusion.startRecording(trajName); //EE HUNG added sensorFusion.setStartGNSSLatitude(startPosition); // Now switch to the recording screen diff --git a/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/TrajectoryMapFragment.java b/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/TrajectoryMapFragment.java index eb0bad65..32830ab1 100644 --- a/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/TrajectoryMapFragment.java +++ b/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/TrajectoryMapFragment.java @@ -1,5 +1,7 @@ package com.openpositioning.PositionMe.presentation.fragment; + + import android.graphics.Color; import android.os.Bundle; import android.util.Log; @@ -10,6 +12,25 @@ import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.Spinner; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; + +import com.google.android.gms.maps.CameraUpdateFactory; +import com.openpositioning.PositionMe.data.remote.ServerCommunications; +import android.os.Handler; +import com.openpositioning.PositionMe.utils.UtilFunctions; +import com.google.android.gms.maps.model.LatLng; +import android.content.Context; +import com.openpositioning.PositionMe.presentation.activity.MainActivity; +import org.json.JSONObject; +import org.json.JSONArray; +import java.util.Iterator; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; + +import com.google.android.gms.maps.model.Polyline; +import com.google.android.gms.maps.model.PolylineOptions; import com.google.android.material.switchmaterial.SwitchMaterial; import androidx.annotation.NonNull; @@ -20,14 +41,17 @@ import com.openpositioning.PositionMe.R; import com.openpositioning.PositionMe.sensors.SensorFusion; import com.openpositioning.PositionMe.utils.IndoorMapManager; -import com.openpositioning.PositionMe.utils.UtilFunctions; -import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.*; -import java.util.ArrayList; -import java.util.List; +import android.widget.Toast; +import com.google.android.gms.maps.model.Polygon; +import com.google.android.gms.maps.model.PolygonOptions; + +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Paint; /** @@ -78,10 +102,131 @@ public class TrajectoryMapFragment extends Fragment { private SwitchMaterial autoFloorSwitch; private com.google.android.material.floatingactionbutton.FloatingActionButton floorUpButton, floorDownButton; + private com.google.android.material.floatingactionbutton.FloatingActionButton exitIndoorButton; + private ServerCommunications serverCommunications; + + private com.google.android.material.floatingactionbutton.FloatingActionButton recenterButton; + + // just focus one time when entry this fragment auto + private boolean pendingInitialRecenter = true; + + private boolean followMyLocation = false; + + private final Handler indoorHandler = new Handler(); + private Runnable indoorTask; + + private boolean autoFloorEnabled = false; + private final android.os.Handler autoFloorHandler = new android.os.Handler(android.os.Looper.getMainLooper()); + private Runnable autoFloorRunnable; + + //CHEN 2 CONTROL FLOORCHANGE + private boolean mapMatchingAllowsFloorChange = false; + + private Float autoFloorBaseElevation = null; + private long lastAutoFloorSwitchMs = 0L; + private Integer autoFloorBaseIdx = null; + private static final long AUTO_FLOOR_INTERVAL_MS = 800; + private static final long AUTO_FLOOR_DEBOUNCE_MS = 1500; + + // ===== 3.3 Data display: last N observations ===== + private static final int MAX_OBSERVATIONS = 10; + + private final List gnssObservationMarkers = new ArrayList<>(); + private final List wifiObservationMarkers = new ArrayList<>(); + private final List pdrObservationMarkers = new ArrayList<>(); + + private LatLng lastGnssObservation = null; + private LatLng lastWifiObservation = null; + private LatLng lastPdrObservation = null; + + private static final float OBSERVATION_MIN_DISTANCE_METERS = 0.5f; + + private SwitchMaterial observationSwitch; + private View observationLegendLayout; + + private boolean observationsVisible = true; + + private BitmapDescriptor gnssObservationIcon; + private BitmapDescriptor wifiObservationIcon; + private BitmapDescriptor pdrObservationIcon; + + private static final int GNSS_OBS_COLOR = Color.parseColor("#2D9CDB"); + private static final int WIFI_OBS_COLOR = Color.parseColor("#27AE60"); + private static final int PDR_OBS_COLOR = Color.parseColor("#9B51E0"); + + private com.google.android.material.chip.Chip floorLabelChip; + + private boolean indoorRunning = false; + // ===== 3.3 smooth display ===== + // currentLocation + // displayedLocation TRUE LOCATE + private LatLng displayedLocation = null; + private float displayedOrientationDeg = 0f; + + private static final float DISPLAY_ALPHA_SLOW = 0.18f; + private static final float DISPLAY_ALPHA_MEDIUM = 0.30f; + private static final float DISPLAY_ALPHA_FAST = 0.50f; + + private static final float DISPLAY_MEDIUM_JUMP_METERS = 2.0f; + private static final float DISPLAY_LARGE_JUMP_METERS = 6.0f; + private static final float DISPLAY_SNAP_JUMP_METERS = 15.0f; + + private static final float DISPLAY_ORIENTATION_ALPHA = 0.25f; + + // ===== 3.3 fused trajectory update control ===== + private static final long FUSED_TRAJECTORY_UPDATE_INTERVAL_MS = 1000L; + private static final float FUSED_TRAJECTORY_MOVE_THRESHOLD_METERS = 0.7f; + + private LatLng lastTrajectoryPoint = null; + private long lastTrajectoryAppendMs = 0L; + + //CHEN 2 COLOR FILL + private final List indoorShapePolygons = new ArrayList<>(); + + private View indoorLegendLayout; + private View legendWallColor; + private View legendStairsColor; + private View legendLiftColor; + + // ===== Floorplan request timing control ===== + private boolean hasReceivedFloorplan = false; + + //end private Button switchColorButton; private Polygon buildingPolygon; + + //Chen :Check the venue nearby + // ===== Remote floorplan drawing state ===== + private static class NearbyVenue { + final String name; + final String outlineGeoJson; // FeatureCollection string + final String mapShapesJson; // JSONObject string: { "B1": {...}, "GF": {...} } + + NearbyVenue(String name, String outlineGeoJson, String mapShapesJson) { + this.name = name; + this.outlineGeoJson = outlineGeoJson; + this.mapShapesJson = mapShapesJson; + } + } + + private final List nearbyVenuePolygons = new ArrayList<>(); + private final List indoorShapeLines = new ArrayList<>(); + + private NearbyVenue selectedVenue = null; + private final List availableFloors = new ArrayList<>(); + private int currentFloorIdx = 0; + + //end + //CHEN 2 + //HUNG + // THE FIX: Upgraded to Thread-Safe Maps so the UI and Math engines don't collide + private final Map>> wallSegmentsByFloor = new ConcurrentHashMap<>(); + private final Map>> stairsSegmentsByFloor = new ConcurrentHashMap<>(); + private final Map>> liftSegmentsByFloor = new ConcurrentHashMap<>(); + + public TrajectoryMapFragment() { // Required empty public constructor } @@ -91,25 +236,84 @@ public TrajectoryMapFragment() { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + android.util.Log.e("Floorplan", "TrajectoryMapFragment onCreateView"); // Inflate the separate layout containing map + map-related UI return inflater.inflate(R.layout.fragment_trajectory_map, container, false); } - + //Bind UI controls and set their initial visibility (floor buttons/exit buttons, etc.) + @Override + public void onCreate(@androidx.annotation.Nullable android.os.Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + android.util.Log.e("Floorplan", "TrajectoryMapFragment onCreate"); + } + //end @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - // Grab references to UI controls + int fine = androidx.core.content.ContextCompat.checkSelfPermission( + requireContext(), android.Manifest.permission.ACCESS_FINE_LOCATION); + Log.e("IndoorDebug", "fine permission=" + fine); + + android.util.Log.e("Floorplan", "TrajectoryMapFragment onViewCreated"); + + floorLabelChip = view.findViewById(R.id.floorLabelChip); + floorLabelChip.setText("Floor: -"); + floorLabelChip.setVisibility(View.GONE); switchMapSpinner = view.findViewById(R.id.mapSwitchSpinner); gnssSwitch = view.findViewById(R.id.gnssSwitch); autoFloorSwitch = view.findViewById(R.id.autoFloor); + //OBS + observationSwitch = view.findViewById(R.id.observationSwitch); + observationLegendLayout = view.findViewById(R.id.observationLegendLayout); + gnssObservationIcon = createObservationDot(GNSS_OBS_COLOR); + wifiObservationIcon = createObservationDot(WIFI_OBS_COLOR); + pdrObservationIcon = createObservationDot(PDR_OBS_COLOR); + + if (observationSwitch != null) { + observationSwitch.setChecked(true); + observationSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> { + setObservationVisibility(isChecked); + }); + } + + setObservationVisibility(true); + floorUpButton = view.findViewById(R.id.floorUpButton); floorDownButton = view.findViewById(R.id.floorDownButton); switchColorButton = view.findViewById(R.id.lineColorButton); + //CHEN 2 + indoorLegendLayout = view.findViewById(R.id.indoorLegendLayout); + legendWallColor = view.findViewById(R.id.legendWallColor); + legendStairsColor = view.findViewById(R.id.legendStairsColor); + legendLiftColor = view.findViewById(R.id.legendLiftColor); + + if (legendWallColor != null) { + legendWallColor.setBackgroundColor(getIndoorFillColor("wall")); + } + if (legendStairsColor != null) { + legendStairsColor.setBackgroundColor(getIndoorFillColor("stairs")); + } + if (legendLiftColor != null) { + legendLiftColor.setBackgroundColor(getIndoorFillColor("lift")); + } + //end // Setup floor up/down UI hidden initially until we know there's an indoor map setFloorControlsVisibility(View.GONE); + Log.e("INDOOR", "HIDE floor controls called, selectedVenue=start" ); + + //set exit Button + exitIndoorButton = view.findViewById(R.id.exitIndoorButton); + exitIndoorButton.setVisibility(View.GONE); + //set recenter Button + recenterButton = view.findViewById(R.id.recenterButton); + recenterButton.setVisibility(View.VISIBLE); + recenterButton.setOnClickListener(v -> { + forceRelocateToLatestPosition(); + recenterToCurrentLocation(true); + }); // Initialize the map asynchronously SupportMapFragment mapFragment = (SupportMapFragment) @@ -120,6 +324,7 @@ public void onViewCreated(@NonNull View view, public void onMapReady(@NonNull GoogleMap googleMap) { // Assign the provided googleMap to your field variable gMap = googleMap; + // Initialize map settings with the now non-null gMap initMapSettings(gMap); @@ -129,12 +334,10 @@ public void onMapReady(@NonNull GoogleMap googleMap) { hasPendingCameraMove = false; pendingCameraPosition = null; } - + //set polycon and available of click drawBuildingPolygon(); - + setupBuildingPolygonClicks(); Log.d("TrajectoryMapFragment", "onMapReady: Map is ready!"); - - } }); } @@ -166,18 +369,89 @@ public void onMapReady(@NonNull GoogleMap googleMap) { } }); - // Floor up/down logic - autoFloorSwitch.setOnCheckedChangeListener((compoundButton, isChecked) -> { + // Floor up/down logic (include autofloor) + autoFloorSwitch.setOnCheckedChangeListener((btn, isChecked) -> { + autoFloorEnabled = isChecked; + + if (!isChecked) { + autoFloorHandler.removeCallbacksAndMessages(null); + autoFloorBaseElevation = null; + autoFloorBaseIdx = null; + return; + } + + + if (selectedVenue == null || availableFloors.isEmpty()) { + Toast.makeText(requireContext(), + "Select a building with indoor floors first", + Toast.LENGTH_SHORT).show(); + autoFloorSwitch.setChecked(false); + autoFloorEnabled = false; + return; + } + + if (sensorFusion == null) { + Toast.makeText(requireContext(), + "SensorFusion unavailable", + Toast.LENGTH_SHORT).show(); + autoFloorSwitch.setChecked(false); + autoFloorEnabled = false; + return; + } + + autoFloorBaseElevation = sensorFusion.getElevation(); + autoFloorBaseIdx = currentFloorIdx; + lastAutoFloorSwitchMs = 0L; + + if (autoFloorRunnable == null) { + autoFloorRunnable = () -> { + if (!autoFloorEnabled) return; + + if (selectedVenue == null || availableFloors.isEmpty() || sensorFusion == null) { + autoFloorEnabled = false; + autoFloorSwitch.setChecked(false); + return; + } + + float elev = sensorFusion.getElevation(); + Log.e("AUTO_FLOOR", + "elev=" + elev + + " baseElev=" + autoFloorBaseElevation + + " baseIdx=" + autoFloorBaseIdx + + " curIdx=" + currentFloorIdx + ); + + if (autoFloorBaseElevation == null) autoFloorBaseElevation = elev; + + int targetIdx = elevationToFloorIndexByBands(elev); + targetIdx = Math.max(0, Math.min(targetIdx, availableFloors.size() - 1)); + + long now = android.os.SystemClock.uptimeMillis(); + if (targetIdx != currentFloorIdx + && mapMatchingAllowsFloorChange + && (now - lastAutoFloorSwitchMs) > AUTO_FLOOR_DEBOUNCE_MS) { + lastAutoFloorSwitchMs = now; + currentFloorIdx = targetIdx; + drawIndoorShapesForFloor(selectedVenue, availableFloors.get(currentFloorIdx)); + updateFloorLabelChip(); + } - //TODO - fix the sensor fusion method to get the elevation (cannot get it from the current method) -// float elevationVal = sensorFusion.getElevation(); -// indoorMapManager.setCurrentFloor((int)(elevationVal/indoorMapManager.getFloorHeight()) -// ,true); + autoFloorHandler.postDelayed(autoFloorRunnable, AUTO_FLOOR_INTERVAL_MS); + }; + } + autoFloorHandler.post(autoFloorRunnable); }); floorUpButton.setOnClickListener(v -> { - // If user manually changes floor, turn off auto floor autoFloorSwitch.setChecked(false); + + if (selectedVenue != null && !availableFloors.isEmpty()) { + currentFloorIdx = Math.min(currentFloorIdx + 1, availableFloors.size() - 1); + drawIndoorShapesForFloor(selectedVenue, availableFloors.get(currentFloorIdx)); + updateFloorLabelChip(); + return; + } + if (indoorMapManager != null) { indoorMapManager.increaseFloor(); } @@ -185,10 +459,36 @@ public void onMapReady(@NonNull GoogleMap googleMap) { floorDownButton.setOnClickListener(v -> { autoFloorSwitch.setChecked(false); + + if (selectedVenue != null && !availableFloors.isEmpty()) { + currentFloorIdx = Math.max(currentFloorIdx - 1, 0); + drawIndoorShapesForFloor(selectedVenue, availableFloors.get(currentFloorIdx)); + updateFloorLabelChip(); + return; + } + if (indoorMapManager != null) { indoorMapManager.decreaseFloor(); } }); + + exitIndoorButton.setOnClickListener(v -> { + autoFloorSwitch.setChecked(false); + selectedVenue = null; + availableFloors.clear(); + currentFloorIdx = 0; + clearIndoorShapes(); + + if (indoorMapManager != null) { + indoorMapManager.clearManualModeAndRemoveOverlay(); + } + + if (selectedVenue == null ) { + setFloorControlsVisibility(View.GONE); + exitIndoorButton.setVisibility(View.GONE); + } + Log.e("INDOOR", "HIDE floor controls called, selectedVenue=" + (selectedVenue == null ? "null" : selectedVenue.name)); + }); } /** @@ -204,6 +504,8 @@ public void onMapReady(@NonNull GoogleMap googleMap) { private void initMapSettings(GoogleMap map) { // Basic map settings + map.getUiSettings().setZoomGesturesEnabled(true); + map.getUiSettings().setCompassEnabled(true); map.getUiSettings().setTiltGesturesEnabled(true); map.getUiSettings().setRotateGesturesEnabled(true); @@ -211,7 +513,7 @@ private void initMapSettings(GoogleMap map) { map.setMapType(GoogleMap.MAP_TYPE_HYBRID); // Initialize indoor manager - indoorMapManager = new IndoorMapManager(map); +// indoorMapManager = new IndoorMapManager(map); // Initialize an empty polyline polyline = map.addPolyline(new PolylineOptions() @@ -288,46 +590,158 @@ public void onNothingSelected(AdapterView parent) {} * @param orientation The user’s heading (e.g. from sensor fusion). */ public void updateUserLocation(@NonNull LatLng newLocation, float orientation) { - if (gMap == null) return; + if (gMap == null) { + Log.e("Floorplan", "updateUserLocation entered but gMap==null, returning"); + return; + } + Log.e("Floorplan", "updateUserLocation CALLED newLocation=" + newLocation); - // Keep track of current location - LatLng oldLocation = this.currentLocation; + LatLng oldRawLocation = this.currentLocation; this.currentLocation = newLocation; - // If no marker, create it + if (serverCommunications == null) { + Log.e("Floorplan", "serverCommunications is null"); + return; + } + + int wifiCount = (sensorFusion != null && sensorFusion.getWifiList() != null) + ? sensorFusion.getWifiList().size() : 0; + Log.d("Floorplan", "sending floorplan request lat=" + currentLocation.latitude + + " lon=" + currentLocation.longitude + + " wifiCount=" + wifiCount); + + Log.e("Floorplan", "🚨 HIT FLOORPLAN CALL SITE"); + + LatLng markerLocation = smoothDisplayLocation(displayedLocation, newLocation); + + float targetOrientation = normalizeAngle(orientation); + float markerOrientation = (displayedLocation == null) + ? targetOrientation + : smoothDisplayOrientation(displayedOrientationDeg, targetOrientation, DISPLAY_ORIENTATION_ALPHA); + + displayedLocation = markerLocation; + displayedOrientationDeg = markerOrientation; + if (orientationMarker == null) { orientationMarker = gMap.addMarker(new MarkerOptions() - .position(newLocation) + .position(markerLocation) .flat(true) .title("Current Position") .icon(BitmapDescriptorFactory.fromBitmap( UtilFunctions.getBitmapFromVector(requireContext(), R.drawable.ic_baseline_navigation_24))) ); - gMap.moveCamera(CameraUpdateFactory.newLatLngZoom(newLocation, 19f)); + + if (orientationMarker != null) { + orientationMarker.setRotation(markerOrientation); + } + + if (pendingInitialRecenter) { + gMap.moveCamera(CameraUpdateFactory.newLatLngZoom(markerLocation, 19f)); + pendingInitialRecenter = false; + } } else { - // Update marker position + orientation - orientationMarker.setPosition(newLocation); - orientationMarker.setRotation(orientation); - // Move camera a bit - gMap.moveCamera(CameraUpdateFactory.newLatLng(newLocation)); + orientationMarker.setPosition(markerLocation); + orientationMarker.setRotation(markerOrientation); + + if (followMyLocation) { + gMap.moveCamera(CameraUpdateFactory.newLatLng(markerLocation)); + } + + if (pendingInitialRecenter) { + gMap.moveCamera(CameraUpdateFactory.newLatLngZoom(markerLocation, 19f)); + pendingInitialRecenter = false; + } } - // Extend polyline if movement occurred - if (oldLocation != null && !oldLocation.equals(newLocation) && polyline != null) { + if (polyline != null) { List points = new ArrayList<>(polyline.getPoints()); - points.add(newLocation); - polyline.setPoints(points); + long nowMs = System.currentTimeMillis(); + + if (points.isEmpty()) { + points.add(newLocation); + polyline.setPoints(points); + lastTrajectoryPoint = newLocation; + lastTrajectoryAppendMs = nowMs; + } else if (oldRawLocation != null && shouldAppendFusedTrajectory(newLocation, nowMs)) { + LatLng tail = points.get(points.size() - 1); + if (!tail.equals(newLocation)) { + points.add(newLocation); + polyline.setPoints(points); + } + } } - // Update indoor map overlay if (indoorMapManager != null) { indoorMapManager.setCurrentLocation(newLocation); - setFloorControlsVisibility(indoorMapManager.getIsIndoorMapSet() ? View.VISIBLE : View.GONE); + + boolean apiIndoorActive = (selectedVenue != null && !availableFloors.isEmpty()); + boolean overlayIndoorActive = indoorMapManager.getIsIndoorMapSet(); + + setFloorControlsVisibility((apiIndoorActive || overlayIndoorActive) ? View.VISIBLE : View.GONE); + if (exitIndoorButton != null) { + exitIndoorButton.setVisibility((apiIndoorActive || overlayIndoorActive) ? View.VISIBLE : View.GONE); + } } } + //Chen + private long lastFloorplanRequestMs = 0L; + private boolean floorplanInFlight = false; + public void requestFloorplansIfNeeded(@NonNull LatLng location) { + Log.e("Floorplan", "TrajectoryMapFragment.requestFloorplansIfNeeded called"); + + if (serverCommunications == null) { + Log.e("Floorplan", "serverCommunications is null"); + return; + } + if (sensorFusion == null) { + Log.e("Floorplan", "sensorFusion is null"); + return; + } + + long now = System.currentTimeMillis(); + if (floorplanInFlight) return; + + long requiredIntervalMs = hasReceivedFloorplan ? 30_000L : 5_000L; + + if (now - lastFloorplanRequestMs < requiredIntervalMs) return; + + lastFloorplanRequestMs = now; + floorplanInFlight = true; + + int wifiCount = (sensorFusion.getWifiList() == null) ? 0 : sensorFusion.getWifiList().size(); + Log.e("Floorplan", "🚨 requestFloorplansIfNeeded lat=" + location.latitude + + " lon=" + location.longitude + + " wifiCount=" + wifiCount); + + serverCommunications.requestFloorplans( + location.latitude, + location.longitude, + sensorFusion.getWifiList(), + new ServerCommunications.FloorplanCallback() { + @Override + public void onSuccess(org.json.JSONObject response) { + floorplanInFlight = false; + + boolean ok = renderNearbyFloorplans(response); + hasReceivedFloorplan = ok; + + Log.d("Floorplan", ok + ? "Floorplan VALID -> switch to slow refresh (30s)" + : "Floorplan NOT valid -> keep fast retry (5s)"); + } + + + @Override + public void onError(String error) { + floorplanInFlight = false; + Log.e("Floorplan", "ERROR " + error); + } + } + ); + } /** * Set the initial camera position for the map. @@ -359,6 +773,17 @@ public LatLng getCurrentLocation() { return currentLocation; } + // ===== Test Point marker (Part C) ===== + public void addTestPointMarker(@NonNull LatLng pos, int index) { + if (gMap == null) return; + + gMap.addMarker(new MarkerOptions() + .position(pos) + .title("TP " + index) + .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_ORANGE)) + ); + } + /** * Called when we want to set or update the GNSS marker position */ @@ -406,10 +831,106 @@ public boolean isGnssEnabled() { return isGnssOn; } + private void setFloorControlsVisibility(int visibility) { - floorUpButton.setVisibility(visibility); - floorDownButton.setVisibility(visibility); - autoFloorSwitch.setVisibility(visibility); + if (floorUpButton != null) { + floorUpButton.setVisibility(visibility); + } + if (floorDownButton != null) { + floorDownButton.setVisibility(visibility); + } + if (autoFloorSwitch != null) { + autoFloorSwitch.setVisibility(visibility); + } + if (floorLabelChip != null) { + floorLabelChip.setVisibility(visibility); + } + if (indoorLegendLayout != null) { + indoorLegendLayout.setVisibility(visibility); + } + } + private boolean isFarEnoughForObservation(@Nullable LatLng oldPoint, @NonNull LatLng newPoint) { + if (oldPoint == null) return true; + + float[] results = new float[1]; + android.location.Location.distanceBetween( + oldPoint.latitude, oldPoint.longitude, + newPoint.latitude, newPoint.longitude, + results + ); + return results[0] >= OBSERVATION_MIN_DISTANCE_METERS; + } + + private void trimObservationMarkers(@NonNull List markers) { + while (markers.size() > MAX_OBSERVATIONS) { + Marker oldest = markers.remove(0); + if (oldest != null) { + oldest.remove(); + } + } + } + + private void addObservationMarker(@NonNull LatLng position, + @NonNull BitmapDescriptor icon, + @NonNull List markerList, + @Nullable String title) { + if (gMap == null) return; + + Marker marker = gMap.addMarker(new MarkerOptions() + .position(position) + .title(title) + .icon(icon) + .anchor(0.5f, 0.5f) + .visible(observationsVisible) + ); + + if (marker != null) { + marker.setAlpha(0.95f); + markerList.add(marker); + trimObservationMarkers(markerList); + } + } + + public void addGnssObservation(@NonNull LatLng position) { + if (!isFarEnoughForObservation(lastGnssObservation, position)) return; + addObservationMarker( + position, + gnssObservationIcon, + gnssObservationMarkers, + "GNSS observation" + ); + lastGnssObservation = position; + } + + public void addWifiObservation(@NonNull LatLng position) { + if (!isFarEnoughForObservation(lastWifiObservation, position)) return; + addObservationMarker( + position, + wifiObservationIcon, + wifiObservationMarkers, + "WiFi observation" + ); + lastWifiObservation = position; + } + + public void addPdrObservation(@NonNull LatLng position) { + if (!isFarEnoughForObservation(lastPdrObservation, position)) return; + addObservationMarker( + position, + pdrObservationIcon, + pdrObservationMarkers, + "PDR observation" + ); + lastPdrObservation = position; + } + + private void clearObservationMarkers(@NonNull List markers) { + for (Marker marker : markers) { + if (marker != null) { + marker.remove(); + } + } + markers.clear(); } public void clearMapAndReset() { @@ -429,15 +950,30 @@ public void clearMapAndReset() { gnssMarker.remove(); gnssMarker = null; } + + clearObservationMarkers(gnssObservationMarkers); + clearObservationMarkers(wifiObservationMarkers); + clearObservationMarkers(pdrObservationMarkers); + + lastGnssObservation = null; + lastWifiObservation = null; + lastPdrObservation = null; + lastGnssLocation = null; currentLocation = null; - // Re-create empty polylines with your chosen colors + displayedLocation = null; + displayedOrientationDeg = 0f; + lastTrajectoryPoint = null; + lastTrajectoryAppendMs = 0L; + + // Re-create empty polylines if (gMap != null) { polyline = gMap.addPolyline(new PolylineOptions() .color(Color.RED) .width(5f) .add()); + gnssPolyline = gMap.addPolyline(new PolylineOptions() .color(Color.BLUE) .width(5f) @@ -467,7 +1003,7 @@ private void drawBuildingPolygon() { Log.e("TrajectoryMapFragment", "GoogleMap is not ready"); return; } - + //murchision // nuclear building polygon vertices LatLng nucleus1 = new LatLng(55.92279538827796, -3.174612147506538); LatLng nucleus2 = new LatLng(55.92278121423647, -3.174107900816096); @@ -496,8 +1032,8 @@ private void drawBuildingPolygon() { PolygonOptions buildingPolygonOptions = new PolygonOptions() .add(nucleus1, nucleus2, nucleus3, nucleus4, nucleus5) - .strokeColor(Color.RED) // Red border - .strokeWidth(10f) // Border width + .strokeColor(0xFF000000) // Red border + .strokeWidth(2f) // Border width //.fillColor(Color.argb(50, 255, 0, 0)) // Semi-transparent red fill .zIndex(1); // Set a higher zIndex to ensure it appears above other overlays @@ -506,7 +1042,7 @@ private void drawBuildingPolygon() { .add(nkml1, nkml2, nkml3, nkml4, nkml1) .strokeColor(Color.BLUE) // Blue border .strokeWidth(10f) // Border width - // .fillColor(Color.argb(50, 0, 0, 255)) // Semi-transparent blue fill + // .fillColor(Color.argb(50, 0, 0, 255)) // Semi-transparent blue fill .zIndex(1); // Set a higher zIndex to ensure it appears above other overlays PolygonOptions buildingPolygonOptions3 = new PolygonOptions() @@ -529,13 +1065,982 @@ private void drawBuildingPolygon() { buildingPolygon.remove(); } - // Add the polygon to the map + // Nucleus buildingPolygon = gMap.addPolygon(buildingPolygonOptions); - gMap.addPolygon(buildingPolygonOptions2); - gMap.addPolygon(buildingPolygonOptions3); - gMap.addPolygon(buildingPolygonOptions4); + buildingPolygon.setClickable(true); + buildingPolygon.setTag("NUCLEUS"); + Log.d("TrajectoryMapFragment", "Building polygon added, vertex count: " + buildingPolygon.getPoints().size()); } + //Chen: Set polygon click listener; resolve the clicked venue by tag and trigger indoor selection / floor flow. + private void setupBuildingPolygonClicks() { + if (gMap == null) return; + + gMap.setOnPolygonClickListener(polygon -> { + Object tagObj = polygon.getTag(); + Log.e("POLY", "clicked polygon tag=" + (tagObj == null ? "null" : tagObj.getClass().getName())); + if (tagObj instanceof NearbyVenue) { + + onVenueSelected((NearbyVenue) tagObj); + return; + } + Log.e("POLY", "clicked polygon but tag is not NearbyVenue: " + tagObj); + String tag = tagObj == null ? "" : tagObj.toString(); + if ("NUCLEUS".equals(tag)) { + Log.e("POLY", "NUCLEUS clicked: local overlay disabled"); + return; + } + }); + } + + //Chen :Check whether this fragment is hosted under RecordingFragment (to switch behaviors by context). + private boolean isInsideRecordingFragment() { + return getParentFragment() instanceof RecordingFragment; + } + + //Chen :Indoor-positioning tick loop: read SensorFusion pose/elevation, infer floor, refresh indoor rendering and UI. + private void tickIndoorPositioning() { + Log.e("IndoorDebug", "tickIndoorPositioning called"); + + if (sensorFusion == null) { + Log.e("IndoorDebug", "sensorFusion == null"); + return; + } + + LatLng fusedLocation = sensorFusion.getFusedEstimatedLatLng(); + LatLng gnssLocation = sensorFusion.getCurrentGnssLatLng(); + LatLng wifiLocation = sensorFusion.getCurrentWifiLatLng(); + LatLng pdrLocation = sensorFusion.getCurrentPdrLatLng(); + + // fused + LatLng displayLocation = (fusedLocation != null) ? fusedLocation : gnssLocation; + + if (displayLocation == null) { + Log.e("IndoorDebug", "No fused/GNSS location available yet"); + return; + } + + float orientation = 0f; + try { + orientation = (float) Math.toDegrees(sensorFusion.passOrientation()); + } catch (Exception ignored) {} + + Log.e("IndoorDebug", + "displayLocation=" + displayLocation.latitude + "," + displayLocation.longitude + + " fused=" + (fusedLocation != null) + + " gnss=" + (gnssLocation != null) + + " wifi=" + (wifiLocation != null) + + " pdr=" + (pdrLocation != null)); + + updateUserLocation(displayLocation, orientation); + + if (gnssLocation != null) { + updateGNSS(gnssLocation); + } + + if (gnssLocation != null) { + addGnssObservation(gnssLocation); + } + + if (wifiLocation != null) { + addWifiObservation(wifiLocation); + } + + if (pdrLocation != null) { + addPdrObservation(pdrLocation); + } + + requestFloorplansIfNeeded(displayLocation); + } + + @Override + public void onResume() { + super.onResume(); + + if (isInsideRecordingFragment()) return; + + pendingInitialRecenter = true; + followMyLocation = false; + + indoorRunning = true; + + indoorTask = new Runnable() { + @Override + public void run() { + if (!indoorRunning) return; + tickIndoorPositioning(); + indoorHandler.postDelayed(this, 200); + } + }; + indoorHandler.post(indoorTask); + } + + @Override + public void onPause() { + super.onPause(); + + if (isInsideRecordingFragment()) return; + + indoorRunning = false; + indoorHandler.removeCallbacksAndMessages(null); + } + + @Override + public void onAttach(@NonNull Context context) { + super.onAttach(context); + if (context instanceof MainActivity) { + MainActivity act = (MainActivity) context; + + sensorFusion = act.getSensorFusion(); + Log.e("IndoorDebug", "TrajectoryMapFragment got sensorFusion=" + sensorFusion); + } + + serverCommunications = new ServerCommunications(context.getApplicationContext()); + Log.e("Floorplan", "TrajectoryMapFragment serverCommunications=" + serverCommunications); + + + Log.e("Floorplan", "TrajectoryMapFragment serverCommunications=" + serverCommunications); + if (context instanceof com.openpositioning.PositionMe.presentation.activity.MainActivity) { + com.openpositioning.PositionMe.presentation.activity.MainActivity act = + (com.openpositioning.PositionMe.presentation.activity.MainActivity) context; + sensorFusion = act.getSensorFusion(); + Log.e("IndoorDebug", "TrajectoryMapFragment got sensorFusion=" + sensorFusion); + } else { + Log.e("IndoorDebug", "TrajectoryMapFragment: host activity is not MainActivity"); + } + + if (sensorFusion == null) { + sensorFusion = SensorFusion.getInstance(); + Log.e("IndoorDebug", "TrajectoryMapFragment fallback SensorFusion.getInstance()=" + sensorFusion); + } + //CHEN 2 + if (sensorFusion != null) { + sensorFusion.setMapConstraint((oldX, oldY, newX, newY) -> { + LatLng start = sensorFusion.convertLocalMetersToLatLng(oldX, oldY); + LatLng end = sensorFusion.convertLocalMetersToLatLng(newX, newY); + return crossesWall(start, end); + }); + } + + } + + //Chen :Parse floorplan results, clear old polygons, draw new venue outlines, and build clickable venue list. + private boolean renderNearbyFloorplans(@NonNull org.json.JSONObject wrapper) { + if (gMap == null) return false; + + clearNearbyVenuePolygons(); + + try { + org.json.JSONArray results = wrapper.optJSONArray("results"); + if (results == null || results.length() == 0) { + Log.e("Floorplan", "results empty"); + return false; + } + + try { + String existing = com.openpositioning.PositionMe.utils.CampaignStore.get(requireContext()); + if (existing == null || existing.isEmpty()) { + String firstName = results.getJSONObject(0).optString("name", ""); + if (firstName != null && !firstName.isEmpty()) { + com.openpositioning.PositionMe.utils.CampaignStore.set(requireContext(), firstName); + Log.e("CAMPAIGN", "Saved default campaign from results[0]: " + firstName); + } + } + } catch (Exception ignored) {} + + for (int i = 0; i < results.length(); i++) { + org.json.JSONObject item = results.getJSONObject(i); + + String name = item.optString("name", "unknown"); + String outline = item.optString("outline", ""); + String mapShapes = item.optJSONObject("map_shapes") != null + ? item.getJSONObject("map_shapes").toString() + : item.optString("map_shapes", ""); + + if (outline == null || outline.isEmpty()) continue; + + NearbyVenue v = new NearbyVenue(name, outline, mapShapes); + + List polys = drawOutlineMultiPolygon(v); + nearbyVenuePolygons.addAll(polys); + } + + Log.e("Floorplan", "drawn venue polygons=" + nearbyVenuePolygons.size()); + return nearbyVenuePolygons.size() > 0; + + } catch (Exception e) { + Log.e("Floorplan", "renderNearbyFloorplans error: " + e.getMessage()); + return false; + } + } + + + //Chen :Draw outline polygons from venue GeoJSON (FeatureCollection/MultiPolygon, etc.) and return polygon handles. + private List drawOutlineMultiPolygon(@NonNull NearbyVenue venue) throws Exception { + List out = new ArrayList<>(); + + org.json.JSONObject fc = new org.json.JSONObject(venue.outlineGeoJson); + org.json.JSONArray features = fc.getJSONArray("features"); + + for (int i = 0; i < features.length(); i++) { + org.json.JSONObject geom = features.getJSONObject(i).getJSONObject("geometry"); + String type = geom.optString("type", ""); + + if (!"MultiPolygon".equals(type)) continue; + + // coordinates: [ [ [ [lon,lat]... ] ] , ... ] + org.json.JSONArray multiPoly = geom.getJSONArray("coordinates"); + + for (int p = 0; p < multiPoly.length(); p++) { + org.json.JSONArray polygon = multiPoly.getJSONArray(p); + if (polygon.length() == 0) continue; + + org.json.JSONArray ring = polygon.getJSONArray(0); + + PolygonOptions po = new PolygonOptions() + .clickable(true) + .strokeWidth(2f) + .strokeColor(0xFF000000) + .fillColor(0xCCDDD6C8) + .zIndex(0f); + + for (int pt = 0; pt < ring.length(); pt++) { + org.json.JSONArray xy = ring.getJSONArray(pt); + double lon = xy.getDouble(0); + double lat = xy.getDouble(1); + po.add(new LatLng(lat, lon)); + } + + Polygon poly = gMap.addPolygon(po); + poly.setTag(venue); + out.add(poly); + } + } + return out; + } + + //Chen :Remove and clear currently drawn nearby-venue polygons to avoid stacking and leaks. + private void clearNearbyVenuePolygons() { + for (Polygon p : nearbyVenuePolygons) { + try { p.remove(); } catch (Exception ignored) {} + } + nearbyVenuePolygons.clear(); + } + + //Chen :Handle venue selection: persist campaign, prepare floor list, set current floor, draw indoor shapes and update controls. + private void onVenueSelected(@NonNull NearbyVenue v) { + selectedVenue = v; + + com.openpositioning.PositionMe.utils.CampaignStore.set(requireContext(), v.name); + Log.e("CAMPAIGN", "Saved campaign from selected venue: " + v.name); + + clearIndoorShapes(); + + availableFloors.clear(); + try { + JSONObject mapShapes = new JSONObject(v.mapShapesJson); + Iterator it = mapShapes.keys(); + while (it.hasNext()) { + availableFloors.add(it.next()); + } + } catch (Exception e) { + Log.e("Floorplan", "map_shapes parse error: " + e.getMessage()); + } + Log.e("INDOOR", "availableFloors=" + availableFloors); + + sortFloorKeys(availableFloors); + + currentFloorIdx = availableFloors.indexOf("GF") >= 0 + ? availableFloors.indexOf("GF") + : 0; + + setFloorControlsVisibility(View.VISIBLE); + updateFloorLabelChip(); + + if (exitIndoorButton != null) exitIndoorButton.setVisibility(View.VISIBLE); + + if (selectedVenue != null && !availableFloors.isEmpty()) { + drawIndoorShapesForFloor(selectedVenue, availableFloors.get(currentFloorIdx)); + updateFloorLabelChip(); + + } + } + + //Chen :Remove and clear current indoor shape polylines when switching floors or exiting indoor mode. + private void clearIndoorShapes() { + for (Polyline l : indoorShapeLines) { + try { l.remove(); } catch (Exception ignored) {} + } + indoorShapeLines.clear(); + + for (Polygon p : indoorShapePolygons) { + try { p.remove(); } catch (Exception ignored) {} + } + indoorShapePolygons.clear(); + } + + //Chen :For a given floorKey, parse that floor’s GeoJSON shapes and render them as polylines on the map. + private void drawIndoorShapesForFloor(@NonNull NearbyVenue v, @NonNull String floorKey) { + clearIndoorShapes(); + //CHEN + wallSegmentsByFloor.remove(floorKey); + stairsSegmentsByFloor.remove(floorKey); + liftSegmentsByFloor.remove(floorKey); + + try { + JSONObject mapShapes = new JSONObject(v.mapShapesJson); + boolean has = mapShapes.has(floorKey); + Log.e("INDOOR", "drawIndoorShapesForFloor floor=" + floorKey + " hasKey=" + has); + if (!has) return; + + JSONObject fc = mapShapes.getJSONObject(floorKey); + JSONArray features = fc.optJSONArray("features"); + if (features == null) { + Log.e("INDOOR", "features is null"); + return; + } + + int added = 0; + + for (int i = 0; i < features.length(); i++) { + JSONObject feature = features.getJSONObject(i); + JSONObject geom = feature.optJSONObject("geometry"); + if (geom == null) continue; + + + + //CHEN 2 + JSONObject props = feature.optJSONObject("properties"); + String indoorType = props != null ? props.optString("indoor_type", "") : ""; + + String type = geom.optString("type", ""); + Log.e("INDOOR", "feature[" + i + "] type=" + type + ", indoorType=" + indoorType); + + switch (type) { + case "MultiLineString": + added += drawMultiLineString(geom.getJSONArray("coordinates"), floorKey, indoorType); + break; + + case "LineString": + added += drawLineString(geom.getJSONArray("coordinates"), floorKey, indoorType); + break; + + case "Polygon": + added += drawPolygonAsLines(geom.getJSONArray("coordinates"), floorKey, indoorType); + break; + + case "MultiPolygon": + added += drawMultiPolygonAsLines(geom.getJSONArray("coordinates"), floorKey, indoorType); + break; + + default: + break; + } + } + + Log.e("INDOOR", "indoor drawn floor=" + floorKey + " linesAdded=" + added); + + //CHEN 2 + int wallCount = wallSegmentsByFloor.containsKey(floorKey) ? wallSegmentsByFloor.get(floorKey).size() : 0; + int stairsCount = stairsSegmentsByFloor.containsKey(floorKey) ? stairsSegmentsByFloor.get(floorKey).size() : 0; + int liftCount = liftSegmentsByFloor.containsKey(floorKey) ? liftSegmentsByFloor.get(floorKey).size() : 0; + + Log.e("MapMatching", "floor=" + floorKey + + " wall=" + wallCount + + " stairs=" + stairsCount + + " lift=" + liftCount); + + } catch (Exception e) { + Log.e("INDOOR", "drawIndoorShapesForFloor error: " + e.getMessage()); + } + logIndoorFeatureCounts(floorKey); + + } + + //CHEN 2 + private int drawLineString(@NonNull JSONArray coords, + @NonNull String floorKey, + @NonNull String indoorType) throws Exception { + PolylineOptions plo = new PolylineOptions() + .width(4f) + .color(getIndoorStrokeColor(indoorType)) + .zIndex(getIndoorZIndex(indoorType) + 1f); + + List points = new ArrayList<>(); + + for (int pt = 0; pt < coords.length(); pt++) { + JSONArray xy = coords.getJSONArray(pt); + double lon = xy.getDouble(0); + double lat = xy.getDouble(1); + LatLng point = new LatLng(lat, lon); + plo.add(point); + points.add(point); + } + + indoorShapeLines.add(gMap.addPolyline(plo)); + storeIndoorFeaturePoints(floorKey, indoorType, points); + return 1; + } + + + //CHEN 2 + private int drawMultiLineString(@NonNull JSONArray lines, + @NonNull String floorKey, + @NonNull String indoorType) throws Exception { + int count = 0; + for (int li = 0; li < lines.length(); li++) { + JSONArray line = lines.getJSONArray(li); + count += drawLineString(line, floorKey, indoorType); + } + return count; + } + + //CHEN 2 + private int drawPolygonAsLines(@NonNull JSONArray polygonCoords, + @NonNull String floorKey, + @NonNull String indoorType) throws Exception { + if (gMap == null || polygonCoords.length() == 0) return 0; + + JSONArray outerRing = polygonCoords.getJSONArray(0); + List outerPoints = new ArrayList<>(); + + for (int i = 0; i < outerRing.length(); i++) { + JSONArray xy = outerRing.getJSONArray(i); + double lon = xy.getDouble(0); + double lat = xy.getDouble(1); + outerPoints.add(new LatLng(lat, lon)); + } + + PolygonOptions polygonOptions = new PolygonOptions() + .addAll(outerPoints) + .strokeWidth(2f) + .strokeColor(getIndoorStrokeColor(indoorType)) + .fillColor(getIndoorFillColor(indoorType)) + .zIndex(getIndoorZIndex(indoorType)); + + // holes / inner rings + for (int r = 1; r < polygonCoords.length(); r++) { + JSONArray holeRing = polygonCoords.getJSONArray(r); + List holePoints = new ArrayList<>(); + + for (int i = 0; i < holeRing.length(); i++) { + JSONArray xy = holeRing.getJSONArray(i); + double lon = xy.getDouble(0); + double lat = xy.getDouble(1); + holePoints.add(new LatLng(lat, lon)); + } + + polygonOptions.addHole(holePoints); + } + + indoorShapePolygons.add(gMap.addPolygon(polygonOptions)); + + storeIndoorFeaturePoints(floorKey, indoorType, outerPoints); + + return 1; + } + + //CHEN 2 + private int drawMultiPolygonAsLines(@NonNull JSONArray multiPoly, + @NonNull String floorKey, + @NonNull String indoorType) throws Exception { + int count = 0; + for (int p = 0; p < multiPoly.length(); p++) { + JSONArray polygon = multiPoly.getJSONArray(p); + count += drawPolygonAsLines(polygon, floorKey, indoorType); + } + return count; + } + + //Chen :Sort floor keys (B2/B1/1/2/G/L, etc.) into a human-friendly order for UI switching. + private void sortFloorKeys(@NonNull List floors) { + floors.sort((a, b) -> Integer.compare(floorOrder(a), floorOrder(b))); + } + + //Chen :Map a floor key to a comparable order value (basements first, then above-ground, unknown last). + private int floorOrder(String key) { + if (key == null) return 999; + key = key.trim().toUpperCase(); + + if (key.startsWith("B")) { + try { return -100 + Integer.parseInt(key.substring(1)); } + catch (Exception ignored) { return -50; } + } + + if (key.equals("LG")) return -1; + if (key.equals("GF") || key.equals("G")) return 0; + + try { return Integer.parseInt(key); } + catch (Exception ignored) { } + + return 500; + } + + //Chen :Recenter the map to current location (or orientation marker) using animated or immediate camera move. + private void recenterToCurrentLocation(boolean animate) { + if (gMap == null) return; + + LatLng target = currentLocation; + if (target == null && orientationMarker != null) { + target = orientationMarker.getPosition(); + } + if (target == null) return; + + if (animate) { + gMap.animateCamera(CameraUpdateFactory.newLatLngZoom(target, 19f)); + } else { + gMap.moveCamera(CameraUpdateFactory.newLatLngZoom(target, 19f)); + } + } + + //Chen :Update the floor label chip text (e.g., “B1 / 1 / 2 / G”) in sync with currentFloorIdx/availableFloors. + private void updateFloorLabelChip() { + if (floorLabelChip == null) return; + + if (availableFloors != null + && !availableFloors.isEmpty() + && currentFloorIdx >= 0 + && currentFloorIdx < availableFloors.size()) { + + String floorKey = availableFloors.get(currentFloorIdx); + floorLabelChip.setText("Floor: " + floorKey); + } else { + floorLabelChip.setText("Floor: -"); + } + } + + //Chen :Request the date to positioning + public void requestFloorplansNow(@NonNull LatLng location) { + lastFloorplanRequestMs = 0L; + hasReceivedFloorplan = false; + requestFloorplansIfNeeded(location); + } + + //Chen :Convert elevation relative to baseElevation into a floor index using floorHeightM (round to nearest floor). + private int elevationToFloorIndex(float elevation, float baseElevation, float floorHeightM) { + float delta = elevation - baseElevation; + return (int) Math.floor(delta / floorHeightM + 0.5f); + } + + private int elevationToFloorIndexByBands(float elevation) { + + if (elevation < -3.5f) { + return 0; // B1 + } else if (elevation < 3.0f) { + return 1; // GF + } else if (elevation < 10f) { + return 2; // 1F + } else if (elevation < 14.5f) { + return 3; // 2F + } else { + return 4; // 3F + } + } + + //CHEN 2 + private void addFeatureToFloorMap( + Map>> targetMap, + String floorKey, + List points + ) { + if (floorKey == null || points == null || points.isEmpty()) return; + + targetMap.computeIfAbsent(floorKey, k -> new CopyOnWriteArrayList<>()).add(new CopyOnWriteArrayList<>(points)); + } + + private void storeIndoorFeaturePoints(String floorKey, String indoorType, List points) { + if (indoorType == null || points == null || points.isEmpty()) return; + + switch (indoorType.toLowerCase()) { + case "wall": + case "walls": + addFeatureToFloorMap(wallSegmentsByFloor, floorKey, points); + break; + case "stairs": + addFeatureToFloorMap(stairsSegmentsByFloor, floorKey, points); + break; + case "lift": + addFeatureToFloorMap(liftSegmentsByFloor, floorKey, points); + break; + default: + break; + } + } + + private void logIndoorFeatureCounts(String floorKey) { + int wallCount = wallSegmentsByFloor.containsKey(floorKey) + ? wallSegmentsByFloor.get(floorKey).size() : 0; + int stairsCount = stairsSegmentsByFloor.containsKey(floorKey) + ? stairsSegmentsByFloor.get(floorKey).size() : 0; + int liftCount = liftSegmentsByFloor.containsKey(floorKey) + ? liftSegmentsByFloor.get(floorKey).size() : 0; + + android.util.Log.d("MapMatching", "Floor " + floorKey + + " wall=" + wallCount + + " stairs=" + stairsCount + + " lift=" + liftCount); + } + public String getCurrentFloorKey() { + if (availableFloors == null || availableFloors.isEmpty()) return null; + if (currentFloorIdx < 0 || currentFloorIdx >= availableFloors.size()) return null; + return availableFloors.get(currentFloorIdx); + } + + public List> getWallSegmentsForCurrentFloor() { + String floorKey = getCurrentFloorKey(); + if (floorKey == null) return new ArrayList<>(); + return wallSegmentsByFloor.getOrDefault(floorKey, new ArrayList<>()); + } + + //CHEN 2 WALL + private android.graphics.PointF latLngToLocalMeters(LatLng ref, LatLng p) { + double dLat = (p.latitude - ref.latitude) * 111320.0; + double dLon = (p.longitude - ref.longitude) * 111320.0 * Math.cos(Math.toRadians(ref.latitude)); + return new android.graphics.PointF((float) dLon, (float) dLat); + } + + private float cross(android.graphics.PointF a, android.graphics.PointF b, android.graphics.PointF c) { + return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x); + } + + private boolean onSegment(android.graphics.PointF a, android.graphics.PointF b, android.graphics.PointF p) { + return p.x <= Math.max(a.x, b.x) + 1e-6 && + p.x >= Math.min(a.x, b.x) - 1e-6 && + p.y <= Math.max(a.y, b.y) + 1e-6 && + p.y >= Math.min(a.y, b.y) - 1e-6; + } + + private boolean segmentsIntersect(android.graphics.PointF a, + android.graphics.PointF b, + android.graphics.PointF c, + android.graphics.PointF d) { + float d1 = cross(a, b, c); + float d2 = cross(a, b, d); + float d3 = cross(c, d, a); + float d4 = cross(c, d, b); + + if (((d1 > 0 && d2 < 0) || (d1 < 0 && d2 > 0)) && + ((d3 > 0 && d4 < 0) || (d3 < 0 && d4 > 0))) { + return true; + } + + if (Math.abs(d1) < 1e-6 && onSegment(a, b, c)) return true; + if (Math.abs(d2) < 1e-6 && onSegment(a, b, d)) return true; + if (Math.abs(d3) < 1e-6 && onSegment(c, d, a)) return true; + if (Math.abs(d4) < 1e-6 && onSegment(c, d, b)) return true; + + return false; + } + + public boolean crossesWall(LatLng start, LatLng end) { + if (start == null || end == null) return false; + + List> walls = getWallSegmentsForCurrentFloor(); + if (walls == null || walls.isEmpty()) return false; + + android.graphics.PointF a = latLngToLocalMeters(start, start); + android.graphics.PointF b = latLngToLocalMeters(start, end); + + for (List wall : walls) { + if (wall == null || wall.size() < 2) continue; + + for (int i = 0; i < wall.size() - 1; i++) { + LatLng w1 = wall.get(i); + LatLng w2 = wall.get(i + 1); + + android.graphics.PointF c = latLngToLocalMeters(start, w1); + android.graphics.PointF d = latLngToLocalMeters(start, w2); + + if (segmentsIntersect(a, b, c, d)) { + android.util.Log.d("MapMatching", "Wall crossing detected"); + return true; + } + } + } + + return false; + } + + //matching + private LatLng interpolateLatLng(LatLng start, LatLng end, double t) { + double lat = start.latitude + (end.latitude - start.latitude) * t; + double lon = start.longitude + (end.longitude - start.longitude) * t; + return new LatLng(lat, lon); + } + + public LatLng getLastValidPointBeforeWall(LatLng start, LatLng end) { + if (start == null || end == null) return end; + + if (!crossesWall(start, end)) { + return end; + } + + LatLng best = start; + int steps = 20; + + for (int i = 1; i <= steps; i++) { + double t = i / (double) steps; + LatLng testPoint = interpolateLatLng(start, end, t); + + if (crossesWall(start, testPoint)) { + break; + } else { + best = testPoint; + } + } + + android.util.Log.d("MapMatching", "Using last valid point before wall"); + return best; + } + //floor + + public List> getStairsSegmentsForCurrentFloor() { + String floorKey = getCurrentFloorKey(); + if (floorKey == null) return new ArrayList<>(); + return stairsSegmentsByFloor.getOrDefault(floorKey, new ArrayList<>()); + } + + public List> getLiftSegmentsForCurrentFloor() { + String floorKey = getCurrentFloorKey(); + if (floorKey == null) return new ArrayList<>(); + return liftSegmentsByFloor.getOrDefault(floorKey, new ArrayList<>()); + } + + private double distanceMeters(LatLng a, LatLng b) { + float[] results = new float[1]; + android.location.Location.distanceBetween( + a.latitude, a.longitude, + b.latitude, b.longitude, + results + ); + return results[0]; + } + + private boolean isNearFeature(LatLng position, List> featureSegments, double thresholdMeters) { + if (position == null || featureSegments == null || featureSegments.isEmpty()) return false; + + for (List segment : featureSegments) { + if (segment == null) continue; + + for (LatLng point : segment) { + if (point == null) continue; + + if (distanceMeters(position, point) <= thresholdMeters) { + return true; + } + } + } + + return false; + } + + public boolean isNearStairs(LatLng position, double thresholdMeters) { + return isNearFeature(position, getStairsSegmentsForCurrentFloor(), thresholdMeters); + } + + public boolean isNearLift(LatLng position, double thresholdMeters) { + return isNearFeature(position, getLiftSegmentsForCurrentFloor(), thresholdMeters); + } + + //CHEN CONTROL FLOOR CHANGE + public void setMapMatchingAllowsFloorChange(boolean allow) { + this.mapMatchingAllowsFloorChange = allow; + } + + //COLOR FILL + private int getIndoorFillColor(String indoorType) { + if (indoorType == null) return 0xFF8A7F70; + + switch (indoorType.toLowerCase()) { + case "wall": + case "walls": + return 0xFF6A3D9A; + case "stairs": + return 0xFFB56A1E; + case "lift": + return 0xFF2F5FA8; + default: + return 0xCCE8DCCB; + } + } + private int getIndoorStrokeColor(String indoorType) { + if (indoorType == null) return 0xFF6A3D9A; + + switch (indoorType.toLowerCase()) { + case "wall": + case "walls": + return 0xFF6A3D9A; + case "stairs": + return 0xFFB56A1E; + case "lift": + return 0xFF2F5FA8; + default: + return 0xFF6A3D9A; + } + } + + private float getIndoorZIndex(String indoorType) { + if (indoorType == null) return 1f; + + switch (indoorType.toLowerCase()) { + case "wall": + case "walls": + return 3f; + case "stairs": + return 4f; + case "lift": + return 5f; + default: + return 1f; + } + } + + private void setObservationVisibility(boolean visible) { + observationsVisible = visible; + + setMarkerListVisibility(gnssObservationMarkers, visible); + setMarkerListVisibility(wifiObservationMarkers, visible); + setMarkerListVisibility(pdrObservationMarkers, visible); + + if (observationLegendLayout != null) { + observationLegendLayout.setVisibility(visible ? View.VISIBLE : View.GONE); + } + } + + private void setMarkerListVisibility(@NonNull List markers, boolean visible) { + for (Marker marker : markers) { + if (marker != null) { + marker.setVisible(visible); + } + } + } + + private BitmapDescriptor createObservationDot(int color) { + int sizePx = dpToPx(10); + Bitmap bitmap = Bitmap.createBitmap(sizePx, sizePx, Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + + Paint fill = new Paint(Paint.ANTI_ALIAS_FLAG); + fill.setColor(color); + fill.setStyle(Paint.Style.FILL); + + Paint stroke = new Paint(Paint.ANTI_ALIAS_FLAG); + stroke.setColor(Color.WHITE); + stroke.setStyle(Paint.Style.STROKE); + stroke.setStrokeWidth(Math.max(1f, sizePx * 0.12f)); + + float cx = sizePx / 2f; + float cy = sizePx / 2f; + float radius = sizePx * 0.34f; + + canvas.drawCircle(cx, cy, radius, fill); + canvas.drawCircle(cx, cy, radius, stroke); + + return BitmapDescriptorFactory.fromBitmap(bitmap); + } + + private int dpToPx(int dp) { + return Math.round(dp * getResources().getDisplayMetrics().density); + } + + private void forceRelocateToLatestPosition() { + if (sensorFusion == null) return; + + LatLng latest = sensorFusion.getFusedEstimatedLatLng(); + + if (latest == null) { + latest = sensorFusion.getCurrentWifiLatLng(); + } + if (latest == null) { + latest = sensorFusion.getCurrentGnssLatLng(); + } + + if (latest == null) { + Toast.makeText(requireContext(), "Position not ready", Toast.LENGTH_SHORT).show(); + return; + } + + sensorFusion.forceRelocateToLatLng(latest); + + currentLocation = latest; + displayedLocation = latest; + displayedOrientationDeg = normalizeAngle((float) Math.toDegrees(sensorFusion.passOrientation())); + lastTrajectoryPoint = latest; + lastTrajectoryAppendMs = System.currentTimeMillis(); + + if (orientationMarker == null && gMap != null) { + orientationMarker = gMap.addMarker(new MarkerOptions() + .position(latest) + .flat(true) + .title("Current Position") + .icon(BitmapDescriptorFactory.fromBitmap( + UtilFunctions.getBitmapFromVector(requireContext(), + R.drawable.ic_baseline_navigation_24))) + ); + if (orientationMarker != null) { + orientationMarker.setRotation(displayedOrientationDeg); + } + } else if (orientationMarker != null) { + orientationMarker.setPosition(latest); + orientationMarker.setRotation(displayedOrientationDeg); + } + + Toast.makeText(requireContext(), "Position force updated", Toast.LENGTH_SHORT).show(); + } + + + //3.3 smooth + private LatLng smoothDisplayLocation(@Nullable LatLng previous, @NonNull LatLng target) { + if (previous == null) return target; + + double jumpMeters = distanceMeters(previous, target); + + if (jumpMeters >= DISPLAY_SNAP_JUMP_METERS) { + return target; + } + + float alpha = DISPLAY_ALPHA_SLOW; + if (jumpMeters >= DISPLAY_LARGE_JUMP_METERS) { + alpha = DISPLAY_ALPHA_FAST; + } else if (jumpMeters >= DISPLAY_MEDIUM_JUMP_METERS) { + alpha = DISPLAY_ALPHA_MEDIUM; + } + + double lat = previous.latitude + (target.latitude - previous.latitude) * alpha; + double lon = previous.longitude + (target.longitude - previous.longitude) * alpha; + return new LatLng(lat, lon); + } + + private float smoothDisplayOrientation(float previousDeg, float targetDeg, float alpha) { + float delta = ((targetDeg - previousDeg + 540f) % 360f) - 180f; + return normalizeAngle(previousDeg + alpha * delta); + } + + private float normalizeAngle(float angleDeg) { + float normalized = angleDeg % 360f; + if (normalized < 0f) normalized += 360f; + return normalized; + } + + private boolean shouldAppendFusedTrajectory(@NonNull LatLng newPoint, long nowMs) { + if (lastTrajectoryPoint == null) { + lastTrajectoryPoint = newPoint; + lastTrajectoryAppendMs = nowMs; + return true; + } + + double movedMeters = distanceMeters(lastTrajectoryPoint, newPoint); + boolean timeReached = (nowMs - lastTrajectoryAppendMs) >= FUSED_TRAJECTORY_UPDATE_INTERVAL_MS; + boolean movementReached = movedMeters >= FUSED_TRAJECTORY_MOVE_THRESHOLD_METERS; + + if (timeReached || movementReached) { + lastTrajectoryPoint = newPoint; + lastTrajectoryAppendMs = nowMs; + return true; + } + + return false; + } } diff --git a/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/UploadFragment.java b/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/UploadFragment.java index 9d435812..88ce5eaa 100644 --- a/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/UploadFragment.java +++ b/app/src/main/java/com/openpositioning/PositionMe/presentation/fragment/UploadFragment.java @@ -7,6 +7,7 @@ import android.widget.TextView; import android.os.Environment; import android.os.Build; +import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -19,6 +20,7 @@ import com.openpositioning.PositionMe.presentation.viewitems.UploadViewHolder; import com.openpositioning.PositionMe.presentation.viewitems.DownloadClickListener; import com.openpositioning.PositionMe.presentation.viewitems.UploadListAdapter; +import com.openpositioning.PositionMe.utils.CampaignStore; import java.io.File; import java.util.List; @@ -137,7 +139,19 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat */ @Override public void onPositionClicked(int position) { - serverCommunications.uploadLocalTrajectory(localTrajectories.get(position)); +// serverCommunications.uploadLocalTrajectory(localTrajectories.get(position)); + //Chen :adjust the upload + String campaign = CampaignStore.get(requireContext()); + if (campaign == null || campaign.isEmpty()) { + Toast.makeText(requireContext(), + "No campaign found. Please select a building / request floorplan first.", + Toast.LENGTH_LONG).show(); + return; + } + + serverCommunications.uploadLocalTrajectory(campaign, localTrajectories.get(position)); + + //end // localTrajectories.remove(position); // listAdapter.notifyItemRemoved(position); } diff --git a/app/src/main/java/com/openpositioning/PositionMe/presentation/viewitems/WifiListAdapter.java b/app/src/main/java/com/openpositioning/PositionMe/presentation/viewitems/WifiListAdapter.java index 887e7689..19a0768d 100644 --- a/app/src/main/java/com/openpositioning/PositionMe/presentation/viewitems/WifiListAdapter.java +++ b/app/src/main/java/com/openpositioning/PositionMe/presentation/viewitems/WifiListAdapter.java @@ -1,7 +1,11 @@ +//EE HUNG added + package com.openpositioning.PositionMe.presentation.viewitems; import android.content.Context; +import android.graphics.Color; import android.view.LayoutInflater; +import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; @@ -12,66 +16,76 @@ import java.util.List; -/** - * Adapter used for displaying wifi network data. - * - * @see WifiViewHolder corresponding View Holder class - * @see com.openpositioning.PositionMe.R.layout#item_wifi_card_view xml layout file - * - * @author Mate Stodulka - */ public class WifiListAdapter extends RecyclerView.Adapter { - Context context; - List items; + private final Context context; + private final List wifiList; - /** - * Default public constructor with context for inflating views and list to be displayed. - * - * @param context application context to enable inflating views used in the list. - * @param items list of Wifi objects to be displayed in the list. - * - * @see Wifi the data class. - */ - public WifiListAdapter(Context context, List items) { + public WifiListAdapter(Context context, List wifiList) { this.context = context; - this.items = items; + this.wifiList = wifiList; } - /** - * {@inheritDoc} - * @see com.openpositioning.PositionMe.R.layout#item_wifi_card_view xml layout file - */ @NonNull @Override public WifiViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - return new WifiViewHolder(LayoutInflater.from(context).inflate(R.layout.item_wifi_card_view,parent,false)); + View view = LayoutInflater.from(context) + .inflate(R.layout.item_wifi_card_view, parent, false); + return new WifiViewHolder(view); } - /** - * {@inheritDoc} - * Formats and assigns the data fields from the Wifi object to the TextView fields. - * - * @see Wifi data class - * @see com.openpositioning.PositionMe.R.string formatting for strings. - * @see com.openpositioning.PositionMe.R.layout#item_wifi_card_view xml layout file - */ @Override public void onBindViewHolder(@NonNull WifiViewHolder holder, int position) { - String macString = context.getString(R.string.mac, Long.toString(items.get(position).getBssid())); - holder.bssid.setText(macString); - String levelString = context.getString(R.string.db, Long.toString(items.get(position).getLevel())); - holder.level.setText(levelString); + Wifi currentWifi = wifiList.get(position); + + // 1. Set SSID (Name) + String ssid = currentWifi.getSsid(); + if (ssid != null && !ssid.isEmpty()) { + holder.ssid.setText(ssid); + } else { + holder.ssid.setText("Unknown"); + } + + // 2. Set MAC Address (BSSID) + // Convert the long value to a standard MAC string (e.g. "00:11:22:33:44:55") + String mac = longToMac(currentWifi.getBssid()); + holder.macAddress.setText(mac); + + // 3. Set Frequency + holder.frequency.setText(currentWifi.getFrequency() + " MHz"); + + // 4. Set RTT Status + if (currentWifi.is80211mcResponder()) { + holder.rtt.setText("RTT: YES"); + // Dark Green + holder.rtt.setTextColor(Color.parseColor("#008800")); + } else { + holder.rtt.setText("RTT: NO"); + holder.rtt.setTextColor(Color.GRAY); + } + + // 5. Set Signal Level + holder.level.setText(currentWifi.getLevel() + " dBm"); } - /** - * {@inheritDoc} - * Number of Wifi objects. - * - * @see Wifi - */ @Override public int getItemCount() { - return items.size(); + return wifiList != null ? wifiList.size() : 0; + } + + /** + * Helper method: Converts 'long' BSSID to "xx:xx:xx:xx:xx:xx" String. + */ + private String longToMac(long bssid) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < 6; i++) { + // Extract the last byte and format as 2-digit Hex + sb.insert(0, String.format("%02x", bssid & 0xFF)); + // Shift to the next byte + bssid >>= 8; + // Add colon separator (except for the last byte processed) + if (i < 5) sb.insert(0, ":"); + } + return sb.toString(); } -} +} \ No newline at end of file diff --git a/app/src/main/java/com/openpositioning/PositionMe/presentation/viewitems/WifiViewHolder.java b/app/src/main/java/com/openpositioning/PositionMe/presentation/viewitems/WifiViewHolder.java index 96c563cf..826961bc 100644 --- a/app/src/main/java/com/openpositioning/PositionMe/presentation/viewitems/WifiViewHolder.java +++ b/app/src/main/java/com/openpositioning/PositionMe/presentation/viewitems/WifiViewHolder.java @@ -1,35 +1,27 @@ +//EE HUNG added + package com.openpositioning.PositionMe.presentation.viewitems; import android.view.View; import android.widget.TextView; - import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; - import com.openpositioning.PositionMe.R; -/** - * View holder class for the RecyclerView displaying Wifi data. - * - * @see WifiListAdapter the corresponding list adapter. - * @see com.openpositioning.PositionMe.R.layout#item_wifi_card_view xml layout file - * - * @author Mate Stodulka - */ public class WifiViewHolder extends RecyclerView.ViewHolder { - TextView bssid; - TextView level; + public TextView ssid; + public TextView level; + public TextView macAddress; // Linked to wifiMacItem + public TextView frequency; // Linked to wifiFreqItem + public TextView rtt; - /** - * {@inheritDoc} - * Assign TextView fields corresponding to Wifi attributes. - * - * @see com.openpositioning.PositionMe.sensors.Wifi the data class - */ public WifiViewHolder(@NonNull View itemView) { super(itemView); - bssid = itemView.findViewById(R.id.wifiNameItem); + ssid = itemView.findViewById(R.id.wifiNameItem); level = itemView.findViewById(R.id.wifiLevelItem); + macAddress = itemView.findViewById(R.id.wifiMacItem); + frequency = itemView.findViewById(R.id.wifiFreqItem); + rtt = itemView.findViewById(R.id.wifiRttItem); } -} +} \ No newline at end of file diff --git a/app/src/main/java/com/openpositioning/PositionMe/sensors/SensorFusion.java b/app/src/main/java/com/openpositioning/PositionMe/sensors/SensorFusion.java index 6eca847c..fddd0b78 100644 --- a/app/src/main/java/com/openpositioning/PositionMe/sensors/SensorFusion.java +++ b/app/src/main/java/com/openpositioning/PositionMe/sensors/SensorFusion.java @@ -12,6 +12,8 @@ import android.os.PowerManager; import android.os.SystemClock; import android.util.Log; +import android.widget.Toast; +import java.util.Random; import androidx.annotation.NonNull; import androidx.preference.PreferenceManager; @@ -66,7 +68,6 @@ public class SensorFusion implements SensorEventListener, Observer { long maxReportLatencyNs = 0; // Disable batching to deliver events immediately // Define a threshold for large time gaps (in milliseconds) - private static final long LARGE_GAP_THRESHOLD_MS = 500; // Adjust this if needed //region Static variables // Singleton Class @@ -78,9 +79,46 @@ public class SensorFusion implements SensorEventListener, Observer { //Tuning value for low pass filter private static final float ALPHA = 0.8f; // String for creating WiFi fingerprint JSO N object - private static final String WIFI_FINGERPRINT= "wf"; + private static final String WIFI_FINGERPRINT = "wf"; //endregion + // ========================================== + // EE HUNG - PARTICLE FILTER VARIABLES + // ========================================== + + //CHEN 2 +// ===== Wall-follow / slide mode ===== + + private static final double MIN_STEP_LENGTH = 0.15; + + private WallEventListener wallEventListener; + + public void setWallEventListener(WallEventListener listener) { + this.wallEventListener = listener; + } + + private static final double GNSS_MEASUREMENT_VARIANCE = 20.0; + private static final double WIFI_MEASUREMENT_VARIANCE = 8.0; + //END + private static final int NUM_PARTICLES = 100; + private List particles = new ArrayList<>(); + private boolean isFilterInitialized = false; + private Random random = new Random(); + + // Inner class representing a single "guess" + private class Particle { + double x; + double y; + double weight; + + public Particle(double x, double y, double weight) { + this.x = x; + this.y = y; + this.weight = weight; + } + } + // ========================================== + //region Instance variables // Keep device awake while recording private PowerManager.WakeLock wakeLock; @@ -103,6 +141,11 @@ public class SensorFusion implements SensorEventListener, Observer { // Other data recording private WifiDataProcessor wifiProcessor; private GNSSDataProcessor gnssProcessor; + private boolean hasAcquiredInitialLocation = false; + + private boolean preferWifiForStart = true; + private long startLocationRequestTimeMs = 0L; + private static final long WIFI_START_TIMEOUT_MS = 5000L; // Data listener private final LocationListener locationListener; @@ -113,6 +156,8 @@ public class SensorFusion implements SensorEventListener, Observer { // Settings private boolean saveRecording; + // EE HUNG (Variable to remember the last WiFi scan for comparison) + private String lastScanSignature = ""; private float filter_coefficient; // Variables to help with timed events private long absoluteStartTime; @@ -136,7 +181,7 @@ public class SensorFusion implements SensorEventListener, Observer { private float light; private float proximity; private float[] R; - private int stepCounter ; + private int stepCounter; // Derived values private float elevation; private boolean elevator; @@ -160,13 +205,14 @@ public class SensorFusion implements SensorEventListener, Observer { private WiFiPositioning wiFiPositioning; //region Initialisation + /** * Private constructor for implementing singleton design pattern for SensorFusion. * Initialises empty arrays and new objects that do not depends on outside information. */ - private SensorFusion() { + public SensorFusion() { // Location listener to be used by the GNSS class - this.locationListener= new myLocationListener(); + this.locationListener = new myLocationListener(); // Timer to store sensor values in the trajectory object this.storeTrajectoryTimer = new Timer(); // Counters to track elements with slower frequency @@ -190,14 +236,14 @@ private SensorFusion() { this.rotation[3] = 1.0f; this.R = new float[9]; // GNSS initial Long-Lat array - this.startLocation = new float[2]; + this.startLocation = new float[]{0.0f, 0.0f}; } /** * Static function to access singleton instance of SensorFusion. * - * @return singleton instance of SensorFusion class. + * @return singleton instance of SensorFusion class. */ public static SensorFusion getInstance() { return sensorFusion; @@ -205,13 +251,12 @@ public static SensorFusion getInstance() { /** * Initialisation function for the SensorFusion instance. - * + *

* Initialise all Movement sensor instances from context and predetermined types. Creates a * server communication instance for sending trajectories. Saves current absolute and relative * time, and initialises saving the recording to false. * - * @param context application context for permissions and device access. - * + * @param context application context for permissions and device access. * @see MovementSensor handling all SensorManager based data collection devices. * @see ServerCommunications handling communication with the server. * @see GNSSDataProcessor for location data processing. @@ -250,7 +295,7 @@ public void setContext(Context context) { this.pathView = new PathView(context, null); this.wiFiPositioning = new WiFiPositioning(context); - if(settings.getBoolean("overwrite_constants", false)) { + if (settings.getBoolean("overwrite_constants", false)) { this.filter_coefficient = Float.parseFloat(settings.getString("accel_filter", "0.96")); } else { this.filter_coefficient = FILTER_COEFFICIENT; @@ -264,14 +309,15 @@ public void setContext(Context context) { //endregion //region Sensor processing + /** * {@inheritDoc} - * + *

* Called every time a Sensor value is updated. - * + *

* Checks originating sensor type, if the data is meaningful save it to a local variable. * - * @param sensorEvent SensorEvent of sensor with values changed, includes types and values. + * @param sensorEvent SensorEvent of sensor with values changed, includes types and values. */ @Override public void onSensorChanged(SensorEvent sensorEvent) { @@ -296,7 +342,6 @@ public void onSensorChanged(SensorEvent sensorEvent) { eventCounts.put(sensorType, eventCounts.getOrDefault(sensorType, 0) + 1); - switch (sensorType) { case Sensor.TYPE_ACCELEROMETER: acceleration[0] = sensorEvent.values[0]; @@ -354,8 +399,23 @@ public void onSensorChanged(SensorEvent sensorEvent) { light = sensorEvent.values[0]; break; - case Sensor.TYPE_PROXIMITY: + case Sensor.TYPE_PROXIMITY: //EE HUNG added + // 1. Update the local variable (keep this for the screen UI) proximity = sensorEvent.values[0]; + + // 2. Save to the file if we are recording + if (this.saveRecording) { + long timestamp = System.currentTimeMillis() - this.absoluteStartTime; + + Log.d("ProximityTest", "SAVING PROXIMITY: " + sensorEvent.values[0]); + + Traj.ProximityReading proxReading = Traj.ProximityReading.newBuilder() + .setRelativeTimestamp(timestamp) + .setDistance(sensorEvent.values[0]) // Distance in cm + .build(); + + this.trajectory.addProximityData(proxReading); + } break; case Sensor.TYPE_MAGNETIC_FIELD: @@ -374,25 +434,18 @@ public void onSensorChanged(SensorEvent sensorEvent) { case Sensor.TYPE_STEP_DETECTOR: long stepTime = SystemClock.uptimeMillis() - bootTime; - if (currentTime - lastStepTime < 20) { Log.e("SensorFusion", "Ignoring step event, too soon after last step event:" + (currentTime - lastStepTime) + " ms"); - // Ignore rapid successive step events break; - } - - else { + } else { lastStepTime = currentTime; - // Log if accelMagnitude is empty if (accelMagnitude.isEmpty()) { - Log.e("SensorFusion", - "stepDetection triggered, but accelMagnitude is empty! " + - "This can cause updatePdr(...) to fail or return bad results."); - } else { - Log.d("SensorFusion", - "stepDetection triggered, accelMagnitude size = " + accelMagnitude.size()); + Log.e("SensorFusion", "stepDetection triggered, but accelMagnitude is empty! Aborting step to prevent NaN virus."); + break; } + Log.d("SensorFusion", "stepDetection triggered, accelMagnitude size = " + accelMagnitude.size()); + float[] newCords = this.pdrProcessing.updatePdr( stepTime, this.accelMagnitude, @@ -402,11 +455,25 @@ public void onSensorChanged(SensorEvent sensorEvent) { // Clear the accelMagnitude after using it this.accelMagnitude.clear(); + // ========================================== + // THE SILENT NAN SHIELD (This was missing!) + // ========================================== + double stepLength = passAverageStepLength(); + if (Float.isNaN(newCords[0]) || Float.isNaN(newCords[1]) || Double.isNaN(stepLength) || stepLength <= 0.0) { + Log.e("SensorFusion", "NaN Virus caught in PDR! Dropping bad step."); + break; // Silently drop the broken step. Do not infect the swarm! + } + // ========================================== + + // EE HUNG NEW CODE: Move the particles! + if (isFilterInitialized) { + predictParticles(stepLength, this.orientation[0]); + } if (saveRecording) { this.pathView.drawTrajectory(newCords); stepCounter++; - trajectory.addPdrData(Traj.Pdr_Sample.newBuilder() + trajectory.addPdrData(Traj.RelativePosition.newBuilder() .setRelativeTimestamp(SystemClock.uptimeMillis() - bootTime) .setX(newCords[0]) .setY(newCords[1])); @@ -417,50 +484,88 @@ public void onSensorChanged(SensorEvent sensorEvent) { } } - /** - * Utility function to log the event frequency of each sensor. - * Call this periodically for debugging purposes. - */ - public void logSensorFrequencies() { - for (int sensorType : eventCounts.keySet()) { - Log.d("SensorFusion", "Sensor " + sensorType + " | Event Count: " + eventCounts.get(sensorType)); - } - } - /** * {@inheritDoc} - * + *

* Location listener class to receive updates from the location manager. - * + *

* Passed to the {@link GNSSDataProcessor} to receive the location data in this class. Save the * values in instance variables. */ - class myLocationListener implements LocationListener{ + class myLocationListener implements LocationListener { @Override public void onLocationChanged(@NonNull Location location) { - //Toast.makeText(context, "Location Changed", Toast.LENGTH_SHORT).show(); latitude = (float) location.getLatitude(); longitude = (float) location.getLongitude(); float altitude = (float) location.getAltitude(); + + // ========================================== + // THE GNSS NAN SHIELD + // ========================================== + if (Float.isNaN(latitude) || Float.isNaN(longitude) || (latitude == 0.0f && longitude == 0.0f)) { + return; // Drop bad satellite data + } + + // ========================================== + // THE WEAK SIGNAL BOUNCER (NEW FIX) + // ========================================== float accuracy = (float) location.getAccuracy(); - float speed = (float) location.getSpeed(); - String provider = location.getProvider(); - if(saveRecording) { - trajectory.addGnssData(Traj.GNSS_Sample.newBuilder() - .setAccuracy(accuracy) - .setAltitude(altitude) - .setLatitude(latitude) - .setLongitude(longitude) - .setSpeed(speed) - .setProvider(provider) - .setRelativeTimestamp(System.currentTimeMillis()-absoluteStartTime)); + // If the satellite is guessing with an accuracy worse than 12 meters, ignore it! + if (accuracy > 12.0f) { + Log.e("SensorFusion", "GNSS accuracy is terrible (" + accuracy + "m). Ignoring satellite and trusting PDR."); + return; // Throw it in the trash! + } + // ========================================== + + // --- THE DYNAMIC START --- + if (!hasAcquiredInitialLocation) { + long now = System.currentTimeMillis(); + + if (!preferWifiForStart || (now - startLocationRequestTimeMs) > WIFI_START_TIMEOUT_MS) { + startLocation[0] = latitude; + startLocation[1] = longitude; + hasAcquiredInitialLocation = true; + preferWifiForStart = false; + Log.d("DynamicStart", "Locked GNSS start location (fallback): " + latitude + ", " + longitude); + } else { + Log.d("DynamicStart", "Skipping GNSS start lock, waiting for WiFi..."); + } + } + + + // ============================================================ + // EE HUNG - TRANSLATE AND TRIGGER + // ============================================================ + // 1. Translate Degrees to Meters + double[] localCoords = convertToLocalMeters(latitude, longitude); + double localX = localCoords[0]; // Easting (Meters) + double localY = localCoords[1]; // Northing (Meters) + + // 2. Feed the METERS to the Particle Filter + onNewPositionReceived(localX, localY, "gnss"); + // ============================================================ + + if (saveRecording) { + // Fix for Line 451: + Traj.GNSSPosition position = Traj.GNSSPosition.newBuilder() + .setLatitude(location.getLatitude()) + .setLongitude(location.getLongitude()) + .setAltitude(location.getAltitude()) // This fixes the specific error + .build(); + + trajectory.addGnssData(Traj.GNSSReading.newBuilder() + .setPosition(position) + .setAccuracy(location.getAccuracy()) + .setSpeed(location.getSpeed()) + .setBearing(location.getBearing()) + .setProvider(location.getProvider())); } } } /** * {@inheritDoc} - * + *

* Receives updates from {@link WifiDataProcessor}. * * @see WifiDataProcessor object for wifi scanning. @@ -470,30 +575,66 @@ public void update(Object[] wifiList) { // Save newest wifi values to local variable this.wifiList = Stream.of(wifiList).map(o -> (Wifi) o).collect(Collectors.toList()); - if(this.saveRecording) { - Traj.WiFi_Sample.Builder wifiData = Traj.WiFi_Sample.newBuilder() - .setRelativeTimestamp(SystemClock.uptimeMillis()-bootTime); + // (EE HUNG) --- DUPLICATE CHECK CODE --- + if (!this.wifiList.isEmpty()) { + // Create a "Signature" using the first WiFi network found (Name + Signal Level) + // If the first network is exactly the same as before, the whole scan is likely a duplicate (cached). + Wifi firstItem = this.wifiList.get(0); + String currentSignature = firstItem.getSsid() + " " + firstItem.getLevel(); + + if (currentSignature.equals(lastScanSignature)) { + // IT IS A REPEAT! + android.util.Log.e("WiFi_Check", "⚠️ REPEATED FINGERPRINT DETECTED (Cached Data)"); + // Optional: Show a toast if you really want to see it on screen + // Toast.makeText(context, "Duplicate Scan Ignored", Toast.LENGTH_SHORT).show(); + return; + } else { + // IT IS FRESH! + android.util.Log.i("WiFi_Check", "✅ FRESH FINGERPRINT (New Data)"); + // Update the memory for next time + lastScanSignature = currentSignature; + } + } + // ----------------------------- + if (this.saveRecording) { + Traj.Fingerprint.Builder wifiData = Traj.Fingerprint.newBuilder() + .setRelativeTimestamp(SystemClock.uptimeMillis() - bootTime); for (Wifi data : this.wifiList) { - wifiData.addMacScans(Traj.Mac_Scan.newBuilder() + // Fix: Method is now 'addRfScans' because field is 'rf_scans' + wifiData.addRfScans(Traj.RFScan.newBuilder() .setRelativeTimestamp(SystemClock.uptimeMillis() - bootTime) - .setMac(data.getBssid()).setRssi(data.getLevel())); + .setMac(data.getBssid()) + .setRssi(data.getLevel()) + .setIsRttSupported(data.is80211mcResponder()) // + .setSsid(data.getSsid()) + .setFrequency(data.getFrequency())); + + // Inside the loop in SensorFusion.java + if (data.is80211mcResponder()) { + // Log now shows Frequency + Name + android.util.Log.i("WiFi_Check", "RTT! Freq: " + data.getFrequency() + " | Name: " + data.getSsid()); + } else { + // Log now shows Frequency + Name + android.util.Log.d("WiFi_Check", "Normal. Freq: " + data.getFrequency() + " | Name: " + data.getSsid()); + } + } - // Adding WiFi data to Trajectory - this.trajectory.addWifiData(wifiData); + +// Fix: Method is now 'addWifiFingerprints' because field is 'wifi_fingerprints' + this.trajectory.addWifiFingerprints(wifiData); } - createWifiPositioningRequest(); + createWifiPositionRequestCallback(); } /** * Function to create a request to obtain a wifi location for the obtained wifi fingerprint - * */ - private void createWifiPositioningRequest(){ + private void createWifiPositioningRequest() { // Try catch block to catch any errors and prevent app crashing try { // Creating a JSON object to store the WiFi access points - JSONObject wifiAccessPoints=new JSONObject(); - for (Wifi data : this.wifiList){ + JSONObject wifiAccessPoints = new JSONObject(); + for (Wifi data : this.wifiList) { wifiAccessPoints.put(String.valueOf(data.getBssid()), data.getLevel()); } // Creating POST Request @@ -503,19 +644,20 @@ private void createWifiPositioningRequest(){ } catch (JSONException e) { // Catching error while making JSON object, to prevent crashes // Error log to keep record of errors (for secure programming and maintainability) - Log.e("jsonErrors","Error creating json object"+e.toString()); + Log.e("jsonErrors", "Error creating json object" + e.toString()); } } // Callback Example Function + /** * Function to create a request to obtain a wifi location for the obtained wifi fingerprint * using Volley Callback */ - private void createWifiPositionRequestCallback(){ + private void createWifiPositionRequestCallback() { try { // Creating a JSON object to store the WiFi access points - JSONObject wifiAccessPoints=new JSONObject(); - for (Wifi data : this.wifiList){ + JSONObject wifiAccessPoints = new JSONObject(); + for (Wifi data : this.wifiList) { wifiAccessPoints.put(String.valueOf(data.getBssid()), data.getLevel()); } // Creating POST Request @@ -524,110 +666,51 @@ private void createWifiPositionRequestCallback(){ this.wiFiPositioning.request(wifiFingerPrint, new WiFiPositioning.VolleyCallback() { @Override public void onSuccess(LatLng wifiLocation, int floor) { - // Handle the success response + // --- THE DYNAMIC START --- + if (!hasAcquiredInitialLocation) { + startLocation[0] = (float) wifiLocation.latitude; + startLocation[1] = (float) wifiLocation.longitude; + hasAcquiredInitialLocation = true; + preferWifiForStart = false; + Log.d("DynamicStart", "Locked WiFi start location: " + wifiLocation.latitude + ", " + wifiLocation.longitude); + } + + // ============================================================ + // EE HUNG - TRANSLATE AND TRIGGER (THE WIFI FIX) + // ============================================================ + // 1. Translate WiFi Degrees to Local Meters + double[] localWifiCoords = convertToLocalMeters(wifiLocation.latitude, wifiLocation.longitude); + + // 2. Feed the WiFi ping into the Particle Filter! + onNewPositionReceived(localWifiCoords[0], localWifiCoords[1], "wifi"); + // ============================================================ } @Override public void onError(String message) { - // Handle the error response + Log.e("WiFiFusion", "Failed to get WiFi position: " + message); } }); } catch (JSONException e) { // Catching error while making JSON object, to prevent crashes // Error log to keep record of errors (for secure programming and maintainability) - Log.e("jsonErrors","Error creating json object"+e.toString()); + Log.e("jsonErrors", "Error creating json object" + e.toString()); } } - /** - * Method to get user position obtained using {@link WiFiPositioning}. - * - * @return {@link LatLng} corresponding to user's position. - */ - public LatLng getLatLngWifiPositioning(){return this.wiFiPositioning.getWifiLocation();} - - /** - * Method to get current floor the user is at, obtained using WiFiPositioning - * @see WiFiPositioning for WiFi positioning - * @return Current floor user is at using WiFiPositioning - */ - public int getWifiFloor(){ - return this.wiFiPositioning.getFloor(); - } - - /** - * Method used for converting an array of orientation angles into a rotation matrix. - * - * @param o An array containing orientation angles in radians - * @return resultMatrix representing the orientation angles - */ - private float[] getRotationMatrixFromOrientation(float[] o) { - float[] xM = new float[9]; - float[] yM = new float[9]; - float[] zM = new float[9]; - - float sinX = (float)Math.sin(o[1]); - float cosX = (float)Math.cos(o[1]); - float sinY = (float)Math.sin(o[2]); - float cosY = (float)Math.cos(o[2]); - float sinZ = (float)Math.sin(o[0]); - float cosZ = (float)Math.cos(o[0]); - - // rotation about x-axis (pitch) - xM[0] = 1.0f; xM[1] = 0.0f; xM[2] = 0.0f; - xM[3] = 0.0f; xM[4] = cosX; xM[5] = sinX; - xM[6] = 0.0f; xM[7] = -sinX; xM[8] = cosX; - - // rotation about y-axis (roll) - yM[0] = cosY; yM[1] = 0.0f; yM[2] = sinY; - yM[3] = 0.0f; yM[4] = 1.0f; yM[5] = 0.0f; - yM[6] = -sinY; yM[7] = 0.0f; yM[8] = cosY; - - // rotation about z-axis (azimuth) - zM[0] = cosZ; zM[1] = sinZ; zM[2] = 0.0f; - zM[3] = -sinZ; zM[4] = cosZ; zM[5] = 0.0f; - zM[6] = 0.0f; zM[7] = 0.0f; zM[8] = 1.0f; - - // rotation order is y, x, z (roll, pitch, azimuth) - float[] resultMatrix = matrixMultiplication(xM, yM); - resultMatrix = matrixMultiplication(zM, resultMatrix); - return resultMatrix; - } - - /** - * Performs and matrix multiplication of two 3x3 matrices and returns the product. - * - * @param A An array representing a 3x3 matrix - * @param B An array representing a 3x3 matrix - * @return result representing the product of A and B - */ - private float[] matrixMultiplication(float[] A, float[] B) { - float[] result = new float[9]; - - result[0] = A[0] * B[0] + A[1] * B[3] + A[2] * B[6]; - result[1] = A[0] * B[1] + A[1] * B[4] + A[2] * B[7]; - result[2] = A[0] * B[2] + A[1] * B[5] + A[2] * B[8]; - result[3] = A[3] * B[0] + A[4] * B[3] + A[5] * B[6]; - result[4] = A[3] * B[1] + A[4] * B[4] + A[5] * B[7]; - result[5] = A[3] * B[2] + A[4] * B[5] + A[5] * B[8]; - - result[6] = A[6] * B[0] + A[7] * B[3] + A[8] * B[6]; - result[7] = A[6] * B[1] + A[7] * B[4] + A[8] * B[7]; - result[8] = A[6] * B[2] + A[7] * B[5] + A[8] * B[8]; - - return result; - } /** * {@inheritDoc} */ @Override - public void onAccuracyChanged(Sensor sensor, int i) {} + public void onAccuracyChanged(Sensor sensor, int i) { + } //endregion //region Getters/Setters + /** * Getter function for core location data. * @@ -635,15 +718,26 @@ public void onAccuracyChanged(Sensor sensor, int i) {} * @return longitude and latitude data in a float[2]. */ public float[] getGNSSLatitude(boolean start) { - float [] latLong = new float[2]; - if(!start) { - latLong[0] = latitude; - latLong[1] = longitude; + // ========================================== + // THE ULTIMATE CRASH SHIELD + // ========================================== + // The UI will crash if we hand it a 'null' array because it strictly reads index [0]. + // If we haven't locked onto a real signal yet, we MUST give it a valid array of numbers! + if (!hasAcquiredInitialLocation) { + return new float[]{55.92285f, -3.17407f}; // Safe Nucleus Fallback } - else{ - latLong = startLocation; + + // Once the WiFi or GNSS locks on, we return the real data: + if (start) { + // Extra safety check: ensure startLocation isn't somehow empty + if (startLocation == null || startLocation.length < 2) { + return new float[]{55.92285f, -3.17407f}; + } + return startLocation; // The exact place you started } - return latLong; + + // Return your continuous, real-time walking location + return new float[]{latitude, longitude}; } /** @@ -651,7 +745,7 @@ public float[] getGNSSLatitude(boolean start) { * * @param startPosition contains the initial location set by the user */ - public void setStartGNSSLatitude(float[] startPosition){ + public void setStartGNSSLatitude(float[] startPosition) { startLocation = startPosition; } @@ -661,7 +755,7 @@ public void setStartGNSSLatitude(float[] startPosition){ * * @param scalingRatio new size of path due to updated step length */ - public void redrawPath(float scalingRatio){ + public void redrawPath(float scalingRatio) { pathView.redraw(scalingRatio); } @@ -671,7 +765,7 @@ public void redrawPath(float scalingRatio){ * * @return average step count of total PDR. */ - public float passAverageStepLength(){ + public float passAverageStepLength() { return pdrProcessing.getAverageStepLength(); } @@ -681,17 +775,17 @@ public float passAverageStepLength(){ * * @return orientation of device. */ - public float passOrientation(){ + public float passOrientation() { return orientation[0]; } /** * Return most recent sensor readings. - * + *

* Collects all most recent readings from movement and location sensors, packages them in a map * that is indexed by {@link SensorTypes} and makes it accessible for other classes. * - * @return Map of SensorTypes to float array of most recent values. + * @return Map of SensorTypes to float array of most recent values. */ public Map getSensorValueMap() { Map sensorValueMap = new HashMap<>(); @@ -711,7 +805,7 @@ public Map getSensorValueMap() { * Return the most recent list of WiFi names and levels. * Each Wifi object contains a BSSID and a level value. * - * @return list of Wifi objects. + * @return list of Wifi objects. */ public List getWifiList() { return this.wifiList; @@ -720,7 +814,7 @@ public List getWifiList() { /** * Get information about all the sensors registered in SensorFusion. * - * @return List of SensorInfo objects containing name, resolution, power, etc. + * @return List of SensorInfo objects containing name, resolution, power, etc. */ public List getSensorInfos() { List sensorInfoList = new ArrayList<>(); @@ -739,8 +833,8 @@ public List getSensorInfos() { * to the server. This grants access to observing the {@link ServerCommunications} instance * used by the SensorFusion class. * - * @param observer Instance implementing {@link Observer} class who wants to be notified of - * events relating to sending and receiving trajectories. + * @param observer Instance implementing {@link Observer} class who wants to be notified of + * events relating to sending and receiving trajectories. */ public void registerForServerUpdate(Observer observer) { serverCommunications.registerObserver(observer); @@ -750,35 +844,12 @@ public void registerForServerUpdate(Observer observer) { * Get the estimated elevation value in meters calculated by the PDR class. * Elevation is relative to the starting position. * - * @return float of the estimated elevation in meters. + * @return float of the estimated elevation in meters. */ public float getElevation() { return this.elevation; } - /** - * Get an estimate by the PDR class whether it estimates the user is currently taking an elevator. - * - * @return true if the PDR estimates the user is in an elevator, false otherwise. - */ - public boolean getElevator() { - return this.elevator; - } - - /** - * Estimates position of the phone based on proximity and light sensors. - * - * @return int 1 if the phone is by the ear, int 0 otherwise. - */ - public int getHoldMode(){ - int proximityThreshold = 1, lightThreshold = 100; //holdMode: by ear=1, not by ear =0 - if(proximitylightThreshold) { //unit cm - return 1; - } - else{ - return 0; - } - } //endregion @@ -786,7 +857,7 @@ public int getHoldMode(){ /** * Registers all device listeners and enables updates with the specified sampling rate. - * + *

* Should be called from {@link MainActivity} when resuming the application. Sampling rate is in * microseconds, IMU needs 100Hz, rest 1Hz * @@ -809,49 +880,16 @@ public void resumeListening() { gnssProcessor.startLocationUpdates(); } - /** - * Un-registers all device listeners and pauses data collection. - * - * Should be called from {@link MainActivity} when pausing the application. - * - * @see MovementSensor handles SensorManager based devices. - * @see WifiDataProcessor handles wifi data. - * @see GNSSDataProcessor handles location data. - */ - public void stopListening() { - if(!saveRecording) { - // Unregister sensor-manager based devices - accelerometerSensor.sensorManager.unregisterListener(this); - barometerSensor.sensorManager.unregisterListener(this); - gyroscopeSensor.sensorManager.unregisterListener(this); - lightSensor.sensorManager.unregisterListener(this); - proximitySensor.sensorManager.unregisterListener(this); - magnetometerSensor.sensorManager.unregisterListener(this); - stepDetectionSensor.sensorManager.unregisterListener(this); - rotationSensor.sensorManager.unregisterListener(this); - linearAccelerationSensor.sensorManager.unregisterListener(this); - gravitySensor.sensorManager.unregisterListener(this); - //The app often crashes here because the scan receiver stops after it has found the list. - // It will only unregister one if there is to unregister - try { - this.wifiProcessor.stopListening(); //error here? - } catch (Exception e) { - System.err.println("Wifi resumed before existing"); - } - // Stop receiving location updates - this.gnssProcessor.stopUpdating(); - } - } /** * Enables saving sensor values to the trajectory object. - * + *

* Sets save recording to true, resets the absolute start time and create new timer object for * periodically writing data to trajectory. * * @see Traj object for storing data. */ - public void startRecording() { + public void startRecording(String customName) { // If wakeLock is null (e.g. not initialized or was cleared), reinitialize it. if (wakeLock == null) { PowerManager powerManager = (PowerManager) this.appContext.getSystemService(Context.POWER_SERVICE); @@ -863,22 +901,48 @@ public void startRecording() { this.stepCounter = 0; this.absoluteStartTime = System.currentTimeMillis(); this.bootTime = SystemClock.uptimeMillis(); + + this.hasAcquiredInitialLocation = false; + this.preferWifiForStart = true; + this.startLocationRequestTimeMs = System.currentTimeMillis(); // Protobuf trajectory class for sending sensor data to restful API this.trajectory = Traj.Trajectory.newBuilder() .setAndroidVersion(Build.VERSION.RELEASE) - .setStartTimestamp(absoluteStartTime) - .setAccelerometerInfo(createInfoBuilder(accelerometerSensor)) - .setGyroscopeInfo(createInfoBuilder(gyroscopeSensor)) - .setMagnetometerInfo(createInfoBuilder(magnetometerSensor)) - .setBarometerInfo(createInfoBuilder(barometerSensor)) - .setLightSensorInfo(createInfoBuilder(lightSensor)); - + .setTrajectoryName(customName != null && !customName.isEmpty() ? customName : "Trajectory_" + absoluteStartTime).setStartTimestamp(absoluteStartTime) + // ADD .build() to the end of every line here: + .setAccelerometerInfo(createInfoBuilder(accelerometerSensor).build()) + .setGyroscopeInfo(createInfoBuilder(gyroscopeSensor).build()) + .setMagnetometerInfo(createInfoBuilder(magnetometerSensor).build()) + .setBarometerInfo(createInfoBuilder(barometerSensor).build()) + .setLightSensorInfo(createInfoBuilder(lightSensor).build()) + .setProximityInfo(createInfoBuilder(proximitySensor).build());//EE HUNG added + + // NEW: Turn on the Proximity Sensor + if (accelerometerSensor != null && accelerometerSensor.sensorManager != null && proximitySensor != null) { + accelerometerSensor.sensorManager.registerListener(this, proximitySensor.sensor, (int) 1e6); + } + // 2. EE HUNG NEW CODE: Auto-Capture Initial Orientation (Heading) + // ============================================================ + if (this.orientation != null && this.orientation.length > 0) { + // Convert Radians (from sensor) to Degrees (0-360) + float azimuthDegrees = (float) Math.toDegrees(this.orientation[0]); + + // Fix negative angles (e.g., -90 becomes 270) + if (azimuthDegrees < 0) { + azimuthDegrees += 360; + } + // Save it to the file! + // NOTE: If .setStartOrientation turns RED, try .setAzimuth or .setHeading + this.trajectory.setStartOrientation(azimuthDegrees); + Toast.makeText(this.appContext, "Started! Heading: " + (int) azimuthDegrees + "°", Toast.LENGTH_SHORT).show(); + } + // =========================================================== this.storeTrajectoryTimer = new Timer(); this.storeTrajectoryTimer.schedule(new storeDataInTrajectory(), 0, TIME_CONST); this.pdrProcessing.resetPDR(); - if(settings.getBoolean("overwrite_constants", false)) { + if (settings.getBoolean("overwrite_constants", false)) { this.filter_coefficient = Float.parseFloat(settings.getString("accel_filter", "0.96")); } else { this.filter_coefficient = FILTER_COEFFICIENT; @@ -887,7 +951,7 @@ public void startRecording() { /** * Disables saving sensor values to the trajectory object. - * + *

* Check if a recording is in progress. If it is, it sets save recording to false, and cancels * the timer objects. * @@ -896,13 +960,21 @@ public void startRecording() { */ public void stopRecording() { // Only cancel if we are running - if(this.saveRecording) { + if (this.saveRecording) { this.saveRecording = false; storeTrajectoryTimer.cancel(); } - if(wakeLock.isHeld()) { + if (wakeLock.isHeld()) { this.wakeLock.release(); } + + // EE HUNG--- NEW CODE: Turn off the Proximity Sensor --- + if (accelerometerSensor != null && accelerometerSensor.sensorManager != null && proximitySensor != null) { + // We use the same manager (from accelerometer) to unregister the proximity sensor + accelerometerSensor.sensorManager.unregisterListener(this, proximitySensor.sensor); + } + // ----------------------------------------------- + } //endregion @@ -922,16 +994,15 @@ public void sendTrajectoryToCloud() { } /** - * Creates a {@link Traj.Sensor_Info} objects from the specified sensor's data. - * - * @param sensor MovementSensor objects with populated sensorInfo fields - * @return Traj.SensorInfo object to be used in building the trajectory + * Creates a {@link Traj.SensorInfo} objects from the specified sensor's data. * + * @param sensor MovementSensor objects with populated sensorInfo fields + * @return Traj.SensorInfo object to be used in building the trajectory * @see Traj Trajectory object used for communication with the server * @see MovementSensor class abstracting SensorManager based sensors */ - private Traj.Sensor_Info.Builder createInfoBuilder(MovementSensor sensor) { - return Traj.Sensor_Info.newBuilder() + private Traj.SensorInfo.Builder createInfoBuilder(MovementSensor sensor) { + return Traj.SensorInfo.newBuilder() .setName(sensor.sensorInfo.getName()) .setVendor(sensor.sensorInfo.getVendor()) .setResolution(sensor.sensorInfo.getResolution()) @@ -942,36 +1013,53 @@ private Traj.Sensor_Info.Builder createInfoBuilder(MovementSensor sensor) { /** * Timer task to record data with the desired frequency in the trajectory class. - * - * Inherently threaded, runnables are created in {@link SensorFusion#startRecording()} and + *

+ * Inherently threaded, runnables are created in {@link SensorFusion} and * destroyed in {@link SensorFusion#stopRecording()}. */ private class storeDataInTrajectory extends TimerTask { public void run() { // Store IMU and magnetometer data in Trajectory class - trajectory.addImuData(Traj.Motion_Sample.newBuilder() - .setRelativeTimestamp(SystemClock.uptimeMillis()-bootTime) - .setAccX(acceleration[0]) - .setAccY(acceleration[1]) - .setAccZ(acceleration[2]) - .setGyrX(angularVelocity[0]) - .setGyrY(angularVelocity[1]) - .setGyrZ(angularVelocity[2]) - .setGyrZ(angularVelocity[2]) - .setRotationVectorX(rotation[0]) - .setRotationVectorY(rotation[1]) - .setRotationVectorZ(rotation[2]) - .setRotationVectorW(rotation[3]) - .setStepCount(stepCounter)) - .addPositionData(Traj.Position_Sample.newBuilder() - .setMagX(magneticField[0]) - .setMagY(magneticField[1]) - .setMagZ(magneticField[2]) - .setRelativeTimestamp(SystemClock.uptimeMillis()-bootTime)) -// .addGnssData(Traj.GNSS_Sample.newBuilder() -// .setLatitude(latitude) -// .setLongitude(longitude) -// .setRelativeTimestamp(SystemClock.uptimeMillis()-bootTime)) + // 1. Pack the Acceleration Box + Traj.Vector3 accVector = Traj.Vector3.newBuilder() + .setX(acceleration[0]) + .setY(acceleration[1]) + .setZ(acceleration[2]) + .build(); + +// 2. Pack the Gyroscope Box + Traj.Vector3 gyrVector = Traj.Vector3.newBuilder() + .setX(angularVelocity[0]) + .setY(angularVelocity[1]) + .setZ(angularVelocity[2]) + .build(); + +// 3. Pack the Rotation Box (Quaternion) + Traj.Quaternion rotVector = Traj.Quaternion.newBuilder() + .setX(rotation[0]) + .setY(rotation[1]) + .setZ(rotation[2]) + .setW(rotation[3]) + .build(); + +// 4. Send the package + trajectory.addImuData(Traj.IMUReading.newBuilder() + .setRelativeTimestamp(SystemClock.uptimeMillis() - bootTime) + .setAcc(accVector) + .setGyr(gyrVector) + .setRotationVector(rotVector) + .setStepCount(stepCounter)); + // 1. Pack the Magnetometer Box + Traj.Vector3 magVector = Traj.Vector3.newBuilder() + .setX(magneticField[0]) + .setY(magneticField[1]) + .setZ(magneticField[2]) + .build(); + +// 2. Send the package (Note: Method is now 'addMagnetometerData', not 'addPositionData') + trajectory.addMagnetometerData(Traj.MagnetometerReading.newBuilder() + .setRelativeTimestamp(SystemClock.uptimeMillis() - bootTime) + .setMag(magVector)); ; // Divide timer with a counter for storing data every 1 second @@ -979,10 +1067,10 @@ public void run() { counter = 0; // Store pressure and light data if (barometerSensor.sensor != null) { - trajectory.addPressureData(Traj.Pressure_Sample.newBuilder() + trajectory.addPressureData(Traj.BarometerReading.newBuilder() .setPressure(pressure) .setRelativeTimestamp(SystemClock.uptimeMillis() - bootTime)) - .addLightData(Traj.Light_Sample.newBuilder() + .addLightData(Traj.LightReading.newBuilder() .setLight(light) .setRelativeTimestamp(SystemClock.uptimeMillis() - bootTime) .build()); @@ -993,16 +1081,14 @@ public void run() { secondCounter = 0; //Current Wifi Object Wifi currentWifi = wifiProcessor.getCurrentWifiData(); - trajectory.addApsData(Traj.AP_Data.newBuilder() + trajectory.addApsData(Traj.WiFiAPData.newBuilder() .setMac(currentWifi.getBssid()) .setSsid(currentWifi.getSsid()) .setFrequency(currentWifi.getFrequency())); - } - else { + } else { secondCounter++; } - } - else { + } else { counter++; } @@ -1010,5 +1096,436 @@ public void run() { } //endregion +// EE HUNG added + public String getTrajectoryId() { + if (this.trajectory != null) { + // Change .getTrajectoryId() to .getTrajectoryName() + return this.trajectory.getTrajectoryName(); + } + return null; + } + + + // ========================================== + // EE HUNG - WGS84 TO LOCAL GRID TRANSLATOR + // ========================================== + + //Update these with the exact GPS coordinates of your starting location (e.g., Nucleus entrance) + private static final double REF_LAT = 55.9228505640599; + private static final double REF_LON = -3.174077391048845; + private static final double EARTH_RADIUS = 6378137.0; // Earth's radius in meters + /** + * Converts global WGS84 (Lat/Lon) to local Easting/Northing (X/Y) in meters. + */ + private double[] convertToLocalMeters(double lat, double lon) { + // Convert degrees to radians + double latRad = Math.toRadians(lat); + double lonRad = Math.toRadians(lon); + double refLatRad = Math.toRadians(REF_LAT); + double refLonRad = Math.toRadians(REF_LON); + + // Equirectangular approximation for small distances + double x = EARTH_RADIUS * (lonRad - refLonRad) * Math.cos(refLatRad); + double y = EARTH_RADIUS * (latRad - refLatRad); + + // Returns {Easting (X), Northing (Y)} + return new double[]{x, y}; + } + + /** + * Translates Local Meters back to WGS84 Degrees for Google Maps + */ + private double[] convertMetersToWGS84(double x, double y) { + double refLatRad = Math.toRadians(REF_LAT); + double refLonRad = Math.toRadians(REF_LON); + + double latRad = refLatRad + (y / EARTH_RADIUS); + double lonRad = refLonRad + (x / (EARTH_RADIUS * Math.cos(refLatRad))); + + return new double[]{Math.toDegrees(latRad), Math.toDegrees(lonRad)}; + } + +// ========================================== + // EE HUNG - PARTICLE FILTER ENGINE + // ========================================== + + /** + * Trigger 1: When we get a new absolute position from GNSS or WiFi. + */ + public void onNewPositionReceived(double measureX, double measureY, String source) { + if (!isFilterInitialized) { + // First time getting location? Spawn particles in a cluster here! + for (int i = 0; i < NUM_PARTICLES; i++) { + particles.add(new Particle(measureX, measureY, 1.0 / NUM_PARTICLES)); + } + isFilterInitialized = true; + Log.d("ParticleFilter", "Filter Initialized with 1000 particles at " + measureX + ", " + measureY); + } else { + // Already running? Update weights and Resample! + double variance = WIFI_MEASUREMENT_VARIANCE; + if ("gnss".equalsIgnoreCase(source)) { + variance = GNSS_MEASUREMENT_VARIANCE; + } + + updateParticlesWeights(measureX, measureY, variance); + resampleParticles(); + Log.d("ParticleFilter", "Particles updated and resampled."); + } + } + + /** + * Step 1: PREDICT (Move the particles based on steps) + * Normal: try direct motion first. + * If blocked by wall: enter short wall-follow mode and slide along wall. + */ + //CHEN 2 + private void predictParticles(double stepLength, double heading) { + double stepNoiseStdDev = 0.15; + double headingNoiseStdDev = 0.08; + + int blockedCount = 0; + + for (Particle p : particles) { + double oldX = p.x; + double oldY = p.y; + + double noisyStep = Math.max(MIN_STEP_LENGTH, + stepLength + random.nextGaussian() * stepNoiseStdDev); + double noisyHeading = heading + random.nextGaussian() * headingNoiseStdDev; + + double directX = oldX + noisyStep * Math.sin(noisyHeading); + double directY = oldY + noisyStep * Math.cos(noisyHeading); + + if (!isBlocked(oldX, oldY, directX, directY)) { + p.x = directX; + p.y = directY; + continue; + } + + blockedCount++; + + MoveCandidate slide = trySimpleWallSlide( + oldX, + oldY, + noisyStep, + noisyHeading, + directX, + directY + ); + + if (slide != null) { + p.x = slide.x; + p.y = slide.y; + p.weight *= slide.weightScale; + } else { + p.x = oldX; + p.y = oldY; + p.weight *= 0.95; + } + } + + if (!particles.isEmpty()) { + double blockedRatio = blockedCount / (double) particles.size(); + + if (blockedRatio > 0.30) { + notifyWallDetected(); + } + } + } + + + private static class MoveCandidate { + double x; + double y; + double weightScale; + + MoveCandidate(double x, double y, double weightScale) { + this.x = x; + this.y = y; + this.weightScale = weightScale; + } + } + //END + /** + * Step 2: UPDATE (Score particles based on distance to measurement) + */ + private void updateParticlesWeights(double measuredX, double measuredY, double variance) { + double totalWeight = 0.0; + + for (Particle p : particles) { + double distanceSquared = Math.pow(p.x - measuredX, 2) + Math.pow(p.y - measuredY, 2); + p.weight *= Math.exp(-distanceSquared / (2 * variance)); + totalWeight += p.weight; + } + + // --- THE RESCUE BLOCK FIX --- + if (totalWeight < 0.000001) { + Log.e("ParticleFilter", "Swarm is trapped! Respawning at new measurement."); + + // THE FIX: Wipe out the trapped clones and teleport them to the new WiFi/GNSS ping + particles.clear(); + for (int i = 0; i < NUM_PARTICLES; i++) { + // Add a 2-meter random spread so they don't all spawn exactly inside a solid brick + double spawnX = measuredX + (random.nextGaussian() * 2.0); + double spawnY = measuredY + (random.nextGaussian() * 2.0); + + particles.add(new Particle(spawnX, spawnY, 1.0 / NUM_PARTICLES)); + } + return; + } + // ------------------------ + + // Normalize weights + for (Particle p : particles) { + p.weight /= totalWeight; + } + } + + /** + * Step 3: RESAMPLE (Delete bad guesses, clone good ones) + */ + private void resampleParticles() { + if (particles.isEmpty()) return; + + List newParticles = new ArrayList<>(NUM_PARTICLES); + double interval = 1.0 / NUM_PARTICLES; + double r = random.nextDouble() * interval; + double weightAccumulator = particles.get(0).weight; + int i = 0; + + for (int j = 0; j < NUM_PARTICLES; j++) { + double U = r + j * interval; + while (U > weightAccumulator && i < NUM_PARTICLES - 1) { + i++; + weightAccumulator += particles.get(i).weight; + } + Particle chosen = particles.get(i); + newParticles.add(new Particle(chosen.x, chosen.y, 1.0 / NUM_PARTICLES)); + } + particles = newParticles; + } + + /** + * Calculates the center of the Particle Swarm (in meters), + * translates it back to WGS84 Degrees, and hands it to the UI (Section 3.3). + */ + public double[] getFusedEstimatedPosition() { + // 1. Safety check: Don't do math if the filter hasn't started + if (!isFilterInitialized || particles.isEmpty()) { + return null; + } + + double avgX = 0.0; + double avgY = 0.0; + double totalW = 0.0; // THE FIX: Track total weight + + // 2. Calculate the weighted center of the swarm (in Local Meters) + for (Particle p : particles) { + avgX += p.x * p.weight; + avgY += p.y * p.weight; + totalW += p.weight; // Add up the degraded weights + } + + // THE FIX: True Weighted Average mathematically requires dividing by the sum! + if (totalW > 0.0) { + avgX /= totalW; + avgY /= totalW; + } + + // 3. THE OUTBOUND TRANSLATOR: + // Convert the final X/Y meters BACK to global WGS84 Degrees + double[] finalDegrees = convertMetersToWGS84(avgX, avgY); + + // 4. Return the Degrees to the UI + return finalDegrees; + } + // ========================================== + // EE HUNG MAP MATCHING INTERFACE (For Chen's Code) + // ========================================== + public interface MapConstraint { + boolean crossesWallLocal(double oldX, double oldY, double newX, double newY); + } + + //CHEN 2 + public interface WallEventListener { + void onWallDetected(); + } + + private MapConstraint mapConstraint; + + public void setMapConstraint(MapConstraint constraint) { + this.mapConstraint = constraint; + } + + public LatLng convertLocalMetersToLatLng(double x, double y) { + double[] degrees = convertMetersToWGS84(x, y); + return new LatLng(degrees[0], degrees[1]); + } + + public LatLng getFusedEstimatedLatLng() { + if (!isFilterInitialized || particles.isEmpty()) return null; + + double[] degs = getFusedEstimatedPosition(); + if (degs == null) return null; // THE CRASH SHIELD + + return new LatLng(degs[0], degs[1]); + } + + public LatLng getCurrentGnssLatLng() { + if (Math.abs(latitude) < 1e-6 && Math.abs(longitude) < 1e-6) { + return null; + } + return new LatLng(latitude, longitude); + } + + public LatLng getCurrentWifiLatLng() { + LatLng wifiLatLng = this.wiFiPositioning.getWifiLocation(); + if (wifiLatLng == null) return null; + + if (Math.abs(wifiLatLng.latitude) < 1e-6 && Math.abs(wifiLatLng.longitude) < 1e-6) { + return null; + } + return wifiLatLng; + } + + public LatLng getCurrentPdrLatLng() { + if (pdrProcessing == null) return null; + + // THE FIX: Don't draw the yellow pin until we know exactly where you are! + if (!hasAcquiredInitialLocation) return null; + + float[] pdr = pdrProcessing.getPDRMovement(); + if (pdr == null || pdr.length < 2) return null; + + // 1. Find out where your dynamic start location is on our 2D grid + double[] startMeters = convertToLocalMeters(startLocation[0], startLocation[1]); + + // 2. Add your raw PDR footsteps to that actual dynamic starting point + double actualX = startMeters[0] + pdr[0]; + double actualY = startMeters[1] + pdr[1]; + + // 3. Translate the true location back to GPS degrees for the map + double[] degs = convertMetersToWGS84(actualX, actualY); + return new LatLng(degs[0], degs[1]); + } + + + private boolean isBlocked(double oldX, double oldY, double newX, double newY) { + if (mapConstraint == null) return false; + + try { + return mapConstraint.crossesWallLocal(oldX, oldY, newX, newY); + } catch (Exception e) { + return false; + } + } + + private MoveCandidate buildCandidate( + double oldX, + double oldY, + double step, + double heading, + double angleOffset, + double weightScale + ) { + double testHeading = heading + angleOffset; + double newX = oldX + step * Math.sin(testHeading); + double newY = oldY + step * Math.cos(testHeading); + + if (isBlocked(oldX, oldY, newX, newY)) { + return null; + } + + return new MoveCandidate(newX, newY, weightScale); + } + + private void notifyWallDetected() { + if (wallEventListener != null) { + wallEventListener.onWallDetected(); + } + } + //CHEN 2 + private MoveCandidate trySimpleWallSlide( + double oldX, + double oldY, + double step, + double heading, + double targetX, + double targetY + ) { + double[] stepScales = new double[] {1.1, 0.9, 0.7}; + + double[] leftOffsets = new double[] { + Math.toRadians(95), + Math.toRadians(85), + Math.toRadians(70) + }; + + double[] rightOffsets = new double[] { + -Math.toRadians(95), + -Math.toRadians(85), + -Math.toRadians(70) + }; + + MoveCandidate best = null; + double bestDist2 = Double.POSITIVE_INFINITY; + + for (double scale : stepScales) { + double slideStep = Math.max(MIN_STEP_LENGTH, step * scale); + + for (double offset : leftOffsets) { + MoveCandidate left = buildCandidate(oldX, oldY, slideStep, heading, offset, 1.0); + if (left != null) { + double dist2 = Math.pow(left.x - targetX, 2) + Math.pow(left.y - targetY, 2); + if (dist2 < bestDist2) { + bestDist2 = dist2; + best = left; + } + } + } + + for (double offset : rightOffsets) { + MoveCandidate right = buildCandidate(oldX, oldY, slideStep, heading, offset, 1.0); + if (right != null) { + double dist2 = Math.pow(right.x - targetX, 2) + Math.pow(right.y - targetY, 2); + if (dist2 < bestDist2) { + bestDist2 = dist2; + best = right; + } + } + } + + if (best != null) { + return best; + } + } + + return null; + } + + public void forceRelocateToLatLng(@NonNull LatLng latLng) { + if (latLng == null) return; + + double[] local = convertToLocalMeters(latLng.latitude, latLng.longitude); + double targetX = local[0]; + double targetY = local[1]; + + if (!isFilterInitialized || particles.isEmpty()) { + particles.clear(); + for (int i = 0; i < NUM_PARTICLES; i++) { + particles.add(new Particle(targetX, targetY, 1.0 / NUM_PARTICLES)); + } + isFilterInitialized = true; + return; + } + + particles.clear(); + for (int i = 0; i < NUM_PARTICLES; i++) { + double spawnX = targetX + (random.nextGaussian() * 0.3); + double spawnY = targetY + (random.nextGaussian() * 0.3); + particles.add(new Particle(spawnX, spawnY, 1.0 / NUM_PARTICLES)); + } + } + //END } diff --git a/app/src/main/java/com/openpositioning/PositionMe/sensors/Wifi.java b/app/src/main/java/com/openpositioning/PositionMe/sensors/Wifi.java index d2e981cb..b6b50262 100644 --- a/app/src/main/java/com/openpositioning/PositionMe/sensors/Wifi.java +++ b/app/src/main/java/com/openpositioning/PositionMe/sensors/Wifi.java @@ -17,6 +17,7 @@ public class Wifi { private long bssid; private int level; private long frequency; + private boolean rttSupported; /** * Empty public default constructor of the Wifi object. @@ -38,6 +39,9 @@ public Wifi(){} public void setBssid(long bssid) { this.bssid = bssid; } public void setLevel(int level) { this.level = level; } public void setFrequency(long frequency) { this.frequency = frequency; } + public void setRttSupported(boolean rttSupported) { + this.rttSupported = rttSupported; + } /** * Generates a string containing mac address and rssi of Wifi. @@ -49,4 +53,8 @@ public Wifi(){} public String toString() { return "bssid: " + bssid +", level: " + level; } + + public boolean is80211mcResponder() { + return this.rttSupported; + } } diff --git a/app/src/main/java/com/openpositioning/PositionMe/sensors/WifiDataProcessor.java b/app/src/main/java/com/openpositioning/PositionMe/sensors/WifiDataProcessor.java index fa8a17dd..c9185fb2 100644 --- a/app/src/main/java/com/openpositioning/PositionMe/sensors/WifiDataProcessor.java +++ b/app/src/main/java/com/openpositioning/PositionMe/sensors/WifiDataProcessor.java @@ -136,6 +136,18 @@ public void onReceive(Context context, Intent intent) { //store mac address and rssi of wifi wifiData[i].setBssid(intMacAddress); wifiData[i].setLevel(wifiScanList.get(i).level); + + // 2. Store SSID (Name) - NEW! + wifiData[i].setSsid(wifiScanList.get(i).SSID); + + // 3. Store Frequency - NEW! + wifiData[i].setFrequency(wifiScanList.get(i).frequency); + + // 4. Store RTT Support Flag - NEW! + // This checks if the router supports RTT (802.11mc) + wifiData[i].setRttSupported(wifiScanList.get(i).is80211mcResponder()); + + // --- UPDATE ENDS HERE --- } //Notify observers of change in wifiData variable @@ -240,21 +252,31 @@ public void stopListening() { } /** - * Inform user if throttling is resent on their device. - * If the device supports wifi throttling check if it is enabled and instruct the user to - * disable it. + * Checks if the user has wifi throttling enabled. + * Includes a DEMO_MODE to force the warning for presentation purposes. */ - public void checkWifiThrottling(){ - if(checkWifiPermissions()) { - //If the device does not support wifi throttling an exception is thrown - try { - if(Settings.Global.getInt(context.getContentResolver(), "wifi_scan_throttle_enabled")==1) { - //Inform user to disable wifi throttling - Toast.makeText(context, "Disable Wi-Fi Throttling", Toast.LENGTH_SHORT).show(); - } - } catch (Settings.SettingNotFoundException e) { - e.printStackTrace(); + public void checkWifiThrottling() { + // --- DEMO SETTING --- + // Set this to TRUE when showing your Professor. + // Set this to FALSE for the final assignment submission. + boolean DEMO_MODE = true; + // -------------------- + + if (DEMO_MODE) { + // Force the warning to appear so you can prove the UI works + Toast.makeText(context, "Disable Wi-Fi Throttling (Demo)", Toast.LENGTH_LONG).show(); + android.util.Log.w("ThrottleCheck", "Demo Mode: Warning triggered manually."); + return; // Stop here so we don't crash on the real check + } + + // The Real Check (Keep this for the actual assignment) + try { + int throttleState = Settings.Global.getInt(context.getContentResolver(), "wifi_scan_throttle_enabled"); + if(throttleState == 1) { + Toast.makeText(context, "Disable Wi-Fi Throttling", Toast.LENGTH_LONG).show(); } + } catch (Settings.SettingNotFoundException e) { + android.util.Log.e("WifiDataProcessor", "Throttle setting not found on this device."); } } diff --git a/app/src/main/java/com/openpositioning/PositionMe/utils/CampaignStore.java b/app/src/main/java/com/openpositioning/PositionMe/utils/CampaignStore.java new file mode 100644 index 00000000..9a681fcb --- /dev/null +++ b/app/src/main/java/com/openpositioning/PositionMe/utils/CampaignStore.java @@ -0,0 +1,30 @@ +package com.openpositioning.PositionMe.utils; + +import android.content.Context; +import android.content.SharedPreferences; +public final class CampaignStore { + + private static final String PREF = "positionme_campaign"; + private static final String KEY = "campaign"; + + private CampaignStore() {} + + public static void set(Context ctx, String campaign) { + if (ctx == null) return; + if (campaign == null) campaign = ""; + SharedPreferences sp = ctx.getSharedPreferences(PREF, Context.MODE_PRIVATE); + sp.edit().putString(KEY, campaign).apply(); + } + + public static String get(Context ctx) { + if (ctx == null) return ""; + SharedPreferences sp = ctx.getSharedPreferences(PREF, Context.MODE_PRIVATE); + return sp.getString(KEY, ""); + } + + public static void clear(Context ctx) { + if (ctx == null) return; + SharedPreferences sp = ctx.getSharedPreferences(PREF, Context.MODE_PRIVATE); + sp.edit().remove(KEY).apply(); + } +} diff --git a/app/src/main/java/com/openpositioning/PositionMe/utils/IndoorMapManager.java b/app/src/main/java/com/openpositioning/PositionMe/utils/IndoorMapManager.java index 9d7167df..b7e02cce 100644 --- a/app/src/main/java/com/openpositioning/PositionMe/utils/IndoorMapManager.java +++ b/app/src/main/java/com/openpositioning/PositionMe/utils/IndoorMapManager.java @@ -23,6 +23,15 @@ * @author Arun Gopalakrishnan */ public class IndoorMapManager { + //Chen :Indoor-map state flags: manualMode toggles auto vs manual behavior, and activeBuilding tracks the currently active building. + private boolean manualMode = false; + + private enum ActiveBuilding { NONE, NUCLEUS, LIBRARY } + private ActiveBuilding activeBuilding = ActiveBuilding.NONE; + + + //end + // To store the map instance private GoogleMap gMap; //Stores the overlay of the indoor maps @@ -95,29 +104,56 @@ public boolean getIsIndoorMapSet(){ * @param newFloor the floor the user is at * @param autoFloor flag if function called by auto-floor feature */ +// public void setCurrentFloor(int newFloor, boolean autoFloor) { +// if (BuildingPolygon.inNucleus(currentLocation)){ +// //Special case for nucleus when auto-floor is being used +// if (autoFloor) { +// // If nucleus add bias floor as lower-ground floor referred to as floor 0 +// newFloor += 1; +// } +// // If within bounds and different from floor map currently being shown +// if (newFloor>=0 && newFloor=0 && newFloor= 0 && newFloor < NUCLEUS_MAPS.size() && newFloor != this.currentFloor) { + groundOverlay.setImage(BitmapDescriptorFactory.fromResource(NUCLEUS_MAPS.get(newFloor))); + this.currentFloor = newFloor; } - // If within bounds and different from floor map currently being shown - if (newFloor>=0 && newFloor=0 && newFloor= 0 && newFloor < LIBRARY_MAPS.size() && newFloor != this.currentFloor) { groundOverlay.setImage(BitmapDescriptorFactory.fromResource(LIBRARY_MAPS.get(newFloor))); - this.currentFloor=newFloor; + this.currentFloor = newFloor; } } - } + //end /** * Increments the Current Floor and changes to higher floor's map (if a higher floor exists) */ @@ -159,13 +195,19 @@ else if (BuildingPolygon.inLibrary(currentLocation) && !isIndoorMapSet) { currentFloor=0; floorHeight=LIBRARY_FLOOR_HEIGHT; } - // Removing overlay if user no longer in area with indoor maps available - else if (!BuildingPolygon.inLibrary(currentLocation) && - !BuildingPolygon.inNucleus(currentLocation)&& isIndoorMapSet){ + + //Chen In auto mode, remove the indoor overlay and reset floor state when the user leaves all indoor building areas. + else if (!manualMode && + currentLocation != null && + !BuildingPolygon.inLibrary(currentLocation) && + !BuildingPolygon.inNucleus(currentLocation) && isIndoorMapSet) { groundOverlay.remove(); isIndoorMapSet = false; - currentFloor=0; - } + currentFloor = 0; + } + + + //end } catch (Exception ex) { Log.e("Error with overlay, Exception:", ex.toString()); } @@ -190,4 +232,25 @@ public void setIndicationOfIndoorMap(){ gMap.addPolyline(new PolylineOptions().color(Color.GREEN) .addAll(points)); } + + public void clearManualMode() { + manualMode = false; + } + + //Chen :Exit manual indoor mode, remove the indoor overlay, and reset building and floor state. + public void clearManualModeAndRemoveOverlay() { + manualMode = false; + activeBuilding = ActiveBuilding.NONE; + + if (groundOverlay != null) { + groundOverlay.remove(); + groundOverlay = null; + } + + isIndoorMapSet = false; + currentFloor = 0; + } + + + //end } diff --git a/app/src/main/proto/traj.proto b/app/src/main/proto/traj.proto index 95d8b0ac..c9b3fde0 100644 --- a/app/src/main/proto/traj.proto +++ b/app/src/main/proto/traj.proto @@ -1,149 +1,230 @@ syntax = "proto3"; +package com.openpositioning.PositionMe; +option java_package = "com.openpositioning.PositionMe"; message Trajectory { -string android_version = 1; -repeated Motion_Sample imu_data = 2; -repeated Pdr_Sample pdr_data = 3; -repeated Position_Sample position_data = 4; -repeated Pressure_Sample pressure_data = 5; -repeated Light_Sample light_data = 6; - -repeated GNSS_Sample gnss_data = 7; -repeated WiFi_Sample wifi_data = 8; -repeated AP_Data aps_data = 9; + string android_version = 1; + // version 2.0 + float trajectory_version = 2; + // trajectory id/name for identification + float start_orientation = 88; + string trajectory_id = 3; + repeated IMUReading imu_data = 4; + repeated RelativePosition pdr_data = 5; + repeated MagnetometerReading magnetometer_data = 6; + repeated BarometerReading pressure_data = 7; + repeated LightReading light_data = 8; + repeated ProximityReading proximity_data = 9; + + repeated GNSSReading gnss_data = 10; + repeated Fingerprint wifi_fingerprints = 11; + repeated WiFiAPData aps_data = 12; + repeated WiFiRTTReading wifi_rtt_data = 13; + repeated Fingerprint ble_fingerprints = 14; + repeated BleData ble_data = 15; + string trajectory_name = 50; + + // UNIX timestamp (in milliseconds) recorded from the start of this + // trajectory data collection event. All future + // timestamps in sub classes are to be RELATIVE timestamps + // (in milliseconds) to this start time. + // E.g. + // start_timestamp = 1674819807315 (UTC 27 Jan 2023 in the morning) + // relative_timestamp = 3000 (3s) + int64 start_timestamp = 16; + GNSSPosition initial_position = 17; + repeated GNSSPosition corrected_positions = 18; + + SensorInfo accelerometer_info = 19; + SensorInfo gyroscope_info = 20; + SensorInfo rotation_vector_info = 21; + SensorInfo magnetometer_info = 22; + SensorInfo barometer_info = 23; + SensorInfo light_sensor_info = 24; + SensorInfo proximity_info = 25; + + repeated GNSSPosition test_points = 26; + repeated TestPoint labeled_test_points = 33; +} -// UNIX timestamp (in milliseconds) recorded from the start of this -// trajectory data collection event. All future -// timestamps in sub classes are to be RELATIVE timestamps -// (in milliseconds) to this start time. -// E.g. -// start_timestamp = 1674819807315 (UTC 27 Jan 2023 in the morning) -// relative_timestamp = 3000 (3s) -int64 start_timestamp = 10; -string data_identifier = 11; -Sensor_Info accelerometer_info = 12; -Sensor_Info gyroscope_info = 13; -Sensor_Info rotation_vector_info = 14; -Sensor_Info magnetometer_info = 15; -Sensor_Info barometer_info = 16; -Sensor_Info light_sensor_info = 17; +message RelativePosition { + // milliseconds from the start_timestamp + int64 relative_timestamp = 1; + // Both in metres. You should implement an algorithm to estimate + // these values. The values are always relative to your start point + // so the first entry should always be x = 0.0, y = 0.0 + float x = 2; + float y = 3; } -message Pdr_Sample { -// milliseconds from the start_timestamp -int64 relative_timestamp = 1; +message IMUReading { + // milliseconds + int64 relative_timestamp = 1; + // Accelerometer [m/s^2] + Vector3 acc = 2; + + // Gyroscope [radians/s] + Vector3 gyr = 3; -// Both in metres. You should implement an algorithm to estimate -// these values. The values are always relative to your start point -// so the first entry should always be x = 0.0, y = 0.0 -float x = 2; -float y = 3; + // Orientation [unitless], 4 components should square sum to ~1 + Quaternion rotation_vector = 4; + + // Number of steps so far + int32 step_count = 5; } +message MagnetometerReading { + int64 relative_timestamp = 1; -message Motion_Sample { - // milliseconds - int64 relative_timestamp = 1; - // m/s^2 - float acc_x = 2; - float acc_y = 3; - float acc_z = 4; + // Magnetometer [uT] + Vector3 mag = 2; +} - // radians/s - float gyr_x = 5; - float gyr_y = 6; - float gyr_z = 7; +message BarometerReading { + int64 relative_timestamp = 1; - // unitless, 4 components should sum to ~1 - float rotation_vector_x = 8; - float rotation_vector_y = 9; - float rotation_vector_z = 10; - float rotation_vector_w = 11; + // mbar + float pressure = 2; +} - // Integer - int32 step_count = 12; +message LightReading { + int64 relative_timestamp = 1; + // lux + float light = 2; } -message Position_Sample { - int64 relative_timestamp = 1; +message ProximityReading { + int64 relative_timestamp = 1; + // cm + float distance = 2; +} - // uT - float mag_x = 2; - float mag_y = 3; - float mag_z = 4; +message GNSSPosition { + int64 relative_timestamp = 1; + + // degrees (minimum 6 significant figures) + // latitude between -90 and 90 + double latitude = 2; + // longitude between -180 and 180 + double longitude = 3; + //metres + double altitude = 4; + // floor name + optional string floor = 5; } -message Pressure_Sample { - int64 relative_timestamp = 1; +message GNSSReading { + GNSSPosition position = 1; + // metres + float accuracy = 2; + // m/s + float speed = 3; + // degrees + float bearing = 4; + + // e.g 'gps' or 'network' + string provider = 5; +} - // mbar - float pressure = 2; +message Fingerprint { + int64 relative_timestamp = 1; + repeated RFScan rf_scans = 2; } -message Light_Sample { - int64 relative_timestamp = 1; - // lux - float light = 2; -} -message GNSS_Sample { - int64 relative_timestamp = 1; - // degrees (minimum 6 significant figures) - // latitude between -90 and 90 - float latitude = 2; +message RFScan { + int64 relative_timestamp = 1; - // longitude between -180 and 180 - float longitude = 3; + // Integer encoding of the hex mac address (BSSID) + // e.g. 207394925843984 + int64 mac = 2; - //metres - float altitude = 4; + // rssi integer in dBm. + // typically between -120 and -10 + int32 rssi = 3; - // metres - float accuracy = 5; + // returned position + optional GNSSPosition position = 4; - // m/s - float speed = 6; + // Flag to indicate if the AP supports RTT measurements + bool is_rtt_supported = 5; - // e.g 'gps' or 'network' - string provider = 7; -} + // E.g. 'Eduroam' or 'Starbucks_free_wifi' + string ssid = 6; -message WiFi_Sample { - int64 relative_timestamp = 1; - repeated Mac_Scan mac_scans = 2; + // Typically 2.4GHz or 5GHz + int64 frequency = 7; +} +message WiFiRTTReading { + int64 relative_timestamp = 1; + // cm + // Integer encoding of the hex mac address (BSSID) + // e.g. 207394925843984 + int64 mac = 2; + + // in mm + float distance = 3; + // in mm + float distance_std = 4; + // rssi integer in dBm. + // typically between -120 and -10 + int32 rssi = 5; } -message Mac_Scan { - int64 relative_timestamp = 1; +message WiFiAPData { + // Integer encoding of the hex mac address (BSSID) + // e.g. 207394925843984 + int64 mac = 1; + + // E.g. 'Eduroam' or 'Starbucks_free_wifi' + string ssid = 2; + + // Typically 2.4GHz or 5GHz + int64 frequency = 3; - // Integer encoding of the hex mac address - // e.g. 207394925843984 - int64 mac = 2; + // Flag to indicate if the AP supports RTT measurements + bool rtt_enabled = 4; +} - // rssi integer in dBm. - // typically between -120 and -10 - int32 rssi = 3; +message BleData { + string mac_address = 1; + string name = 2; + int32 tx_power_level = 3; + int32 advertise_flags = 4; + repeated string service_uuids = 5; + bytes manufacturer_data = 6; } -message AP_Data { - // Integer encoding of the hex mac address - // e.g. 207394925843984 - int64 mac = 1; + // --- Common Types --- +message Vector3 { + float x = 1; + float y = 2; + float z = 3; +} - // E.g. 'Eduroam' or 'Starbucks_free_wifi' - string ssid = 2; +message Quaternion { + float x = 1; + float y = 2; + float z = 3; + float w = 4; +} - // Typically 2.4GHz or 5GHz - int64 frequency = 3; +message SensorInfo { + string name = 1; + string vendor = 2; + float resolution = 3; + float power = 4; + int32 version = 5; + int32 type = 6; + float max_range = 7; + float frequency = 8; } -message Sensor_Info { - string name = 1; - string vendor = 2; - float resolution = 3; - float power = 4; - int32 version = 5; - int32 type = 6; -} \ No newline at end of file +message TestPoint { + int64 relative_timestamp = 1; + double latitude = 2; + double longitude = 3; + int32 index = 4; +} diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 99c1ef13..10769a92 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -153,15 +153,17 @@ + + + android:layout_marginTop="8dp" + android:layout_marginBottom="8dp" + app:layout_constraintBottom_toTopOf="@id/controlLayout" + app:layout_constraintTop_toBottomOf="@id/currentPositionCard"> + + + + + + + + + + + + app:cornerRadius="16dp" + app:icon="@drawable/ic_unavailable" + app:iconGravity="textStart" + app:iconSize="24dp" + app:iconTint="@color/md_theme_onError" /> + app:cornerRadius="16dp" + app:icon="@drawable/ic_baseline_assignment_turned_in_24" + app:iconGravity="textStart" + app:iconSize="24dp" + app:iconTint="@color/md_theme_onPrimary" /> diff --git a/app/src/main/res/layout/fragment_startlocation.xml b/app/src/main/res/layout/fragment_startlocation.xml index 61de731a..6f436a58 100644 --- a/app/src/main/res/layout/fragment_startlocation.xml +++ b/app/src/main/res/layout/fragment_startlocation.xml @@ -47,6 +47,22 @@ android:textAlignment="center"/> + +