Skip to content

Commit

Permalink
added nemea and satellite listener
Browse files Browse the repository at this point in the history
  • Loading branch information
chandrakant naik committed Jan 1, 2020
1 parent ed671e3 commit 9c7779a
Show file tree
Hide file tree
Showing 19 changed files with 1,301 additions and 143 deletions.
Binary file modified .gradle/4.6/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/4.6/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/4.6/taskHistory/taskHistory.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
293 changes: 195 additions & 98 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
package="com.transerve.locationservices" >

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.transerve.locationservices.manager;

public class AppConstant {

public static final String HDOP_VALUE = "hdop";
public static final String PDOP_VALUE = "pdop";
public static final String VDOP_VALUE = "vdop";
public static final String SATELLITE_COUNT = "satellieCount";
public static final String NM_GNGSA = "$GNGSA";
public static final String NM_GPGSA = "$GPGSA";

}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright (C) 2016 Sean J. Barbeau (sjbarbeau@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.transerve.locationservices.manager.models;

/**
* Container class for DOP values
*/
public class DilutionOfPrecision {

double mPositionDop;

double mHorizontalDop;

double mVerticalDop;

public DilutionOfPrecision(double positionDop, double horizontalDop, double verticalDop) {
this.mPositionDop = positionDop;
this.mHorizontalDop = horizontalDop;
this.mVerticalDop = verticalDop;
}

public double getPositionDop() {
return mPositionDop;
}

public void setPositionDop(double positionDop) {
this.mPositionDop = positionDop;
}

public double getHorizontalDop() {
return mHorizontalDop;
}

public void setHorizontalDop(double horizontalDop) {
this.mHorizontalDop = horizontalDop;
}

public double getVerticalDop() {
return mVerticalDop;
}

public void setVerticalDop(double verticalDop) {
this.mVerticalDop = verticalDop;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package com.transerve.locationservices.manager.models;

import com.transerve.locationservices.manager.utils.GnssType;
import com.transerve.locationservices.manager.utils.SbasType;

public class SatelliteStatus {

private int svid;
private GnssType gnssType;
private Float cn0DbHz;
private Boolean hasAlmanac;
private Boolean hasEphemeris;
private Boolean usedInFix;
private Float elevationDegrees;
private Float azimuthDegrees;
private SbasType sbasType;
private Boolean hasCarrierFrequency;
private Float carrierFrequencyH ;

public SatelliteStatus(int svid, GnssType gnssType, Float cn0DbHz, Boolean hasAlmanac, Boolean hasEphemeris, Boolean usedInFix, Float elevationDegrees, Float azimuthDegrees) {
this.svid = svid;
this.gnssType = gnssType;
this.cn0DbHz = cn0DbHz;
this.hasAlmanac = hasAlmanac;
this.hasEphemeris = hasEphemeris;
this.usedInFix = usedInFix;
this.elevationDegrees = elevationDegrees;
this.azimuthDegrees = azimuthDegrees;
sbasType = SbasType.UNKNOWN;
hasCarrierFrequency = false;
}

public int getSvid() {
return svid;
}

public void setSvid(int svid) {
this.svid = svid;
}

public GnssType getGnssType() {
return gnssType;
}

public void setGnssType(GnssType gnssType) {
this.gnssType = gnssType;
}

public Float getCn0DbHz() {
return cn0DbHz;
}

public void setCn0DbHz(Float cn0DbHz) {
this.cn0DbHz = cn0DbHz;
}

public Boolean getHasAlmanac() {
return hasAlmanac;
}

public void setHasAlmanac(Boolean hasAlmanac) {
this.hasAlmanac = hasAlmanac;
}

public Boolean getHasEphemeris() {
return hasEphemeris;
}

public void setHasEphemeris(Boolean hasEphemeris) {
this.hasEphemeris = hasEphemeris;
}

public Boolean getUsedInFix() {
return usedInFix;
}

public void setUsedInFix(Boolean usedInFix) {
this.usedInFix = usedInFix;
}

public Float getElevationDegrees() {
return elevationDegrees;
}

public void setElevationDegrees(Float elevationDegrees) {
this.elevationDegrees = elevationDegrees;
}

public Float getAzimuthDegrees() {
return azimuthDegrees;
}

public void setAzimuthDegrees(Float azimuthDegrees) {
this.azimuthDegrees = azimuthDegrees;
}

public SbasType getSbasType() {
return sbasType;
}

public void setSbasType(SbasType sbasType) {
this.sbasType = sbasType;
}

public Boolean getHasCarrierFrequency() {
return hasCarrierFrequency;
}

public void setHasCarrierFrequency(Boolean hasCarrierFrequency) {
this.hasCarrierFrequency = hasCarrierFrequency;
}

public Float getCarrierFrequencyH() {
return carrierFrequencyH;
}

public void setCarrierFrequencyH(Float carrierFrequencyH) {
this.carrierFrequencyH = carrierFrequencyH;
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package com.transerve.locationservices.manager;
package com.transerve.locationservices.manager.models;

import org.json.JSONObject;

public class TTNewLocation {
private Double lat, lng,altitude;
private Boolean isAccurate;
private Float accuracy,bearing;
private Object tag;
private JSONObject extraPayload;

public TTNewLocation(Double lat, Double lng, Boolean isAccurate, Float accuracy, Float bearing, Double altitude) {
public TTNewLocation(Double lat, Double lng, Boolean isAccurate, Float accuracy, Float bearing, Double altitude, JSONObject extraPayload) {
this.lat = lat;
this.lng = lng;
this.isAccurate = isAccurate;
this.accuracy = accuracy;
this.bearing = bearing;
this.altitude = altitude;
this.extraPayload = extraPayload;
}

public Double getLat() {
Expand Down Expand Up @@ -63,12 +66,11 @@ public void setBearing(Float bearing) {
this.bearing = bearing;
}

public Object getTag() {
return tag;
public JSONObject getExtraPayload() {
return extraPayload;
}

public void setTag(Object tag) {
this.tag = tag;
public void setExtraPayload(JSONObject extraPayload) {
this.extraPayload = extraPayload;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.transerve.locationservices.manager.utils;

import android.app.Activity;
import android.content.IntentSender;
import android.content.pm.PackageManager;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.util.Log;

import com.google.android.gms.common.api.ResolvableApiException;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.LocationSettingsRequest;
import com.google.android.gms.location.SettingsClient;
import com.google.android.gms.tasks.Task;
import com.transerve.locationservices.manager.MockActivityCallbackProvider;

import static android.content.ContentValues.TAG;

public class ActivityCallbackProvider {

private Activity activity;
private SettingsClient settingsClient;

public ActivityCallbackProvider(Activity activity) {
if (activity != null) {
this.activity = activity;
settingsClient = LocationServices.getSettingsClient(activity);
}
}

public static ActivityCallbackProvider getMocker() {
return new MockActivityCallbackProvider();
}

public Task checkLocationSettings(LocationSettingsRequest mLocationSettingsRequest) {
return settingsClient.checkLocationSettings(mLocationSettingsRequest);
}

public void requestPermissions(String[] strings, int requestPermissionsRequestCode) {
ActivityCompat.requestPermissions(activity, strings, requestPermissionsRequestCode);
}

public boolean checkSelfPermission(String accessFineLocation) {
int result = ContextCompat.checkSelfPermission(activity
, accessFineLocation);
return result == PackageManager.PERMISSION_GRANTED;
}

public void showGPSSettingDialog(Exception e, int data) {
ResolvableApiException rae = (ResolvableApiException) e;
try {
rae.startResolutionForResult(activity, data);
} catch (IntentSender.SendIntentException e1) {
Log.i(TAG, "PendingIntent unable to execute request.");
}
}

public boolean isAttached() {
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (C) 2013 Sean J. Barbeau
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.transerve.locationservices.manager.utils;

/**
* Types of Global Navigation Satellite Systems
*/
public enum GnssType {
NAVSTAR, GLONASS, GALILEO, QZSS, BEIDOU, IRNSS, SBAS, UNKNOWN
}

0 comments on commit 9c7779a

Please sign in to comment.