├── .gitignore
├── README.md
├── app
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── tonker
│ │ └── gnss
│ │ ├── activity
│ │ └── MainActivity.java
│ │ ├── constant
│ │ └── Constant.java
│ │ ├── file
│ │ ├── FileSelectView.java
│ │ ├── NmeaConsumer.java
│ │ ├── NmeaProducer.java
│ │ ├── NmeaStorage.java
│ │ ├── OpenFileDialog.java
│ │ └── OpenFileDialogCallback.java
│ │ ├── fragment
│ │ ├── FragmentTabAdapter.java
│ │ ├── MessageCallbacks.java
│ │ ├── MessageFragment.java
│ │ ├── OrientationCallbacks.java
│ │ ├── OrientationFragment.java
│ │ ├── SignalCallbacks.java
│ │ ├── SignalFragment.java
│ │ ├── TimeCallbacks.java
│ │ └── TimeFragment.java
│ │ ├── graphics
│ │ ├── BarChart.java
│ │ ├── BarChartCallbacks.java
│ │ ├── BdsBarChart.java
│ │ ├── BdsBarChartCallbacks.java
│ │ ├── SatelliteView.java
│ │ ├── SatelliteViewCallbacks.java
│ │ ├── SignalScaleBar.java
│ │ └── SignalScaleBarCallbacks.java
│ │ └── location
│ │ ├── LocationAdapter.java
│ │ ├── MySatellite.java
│ │ └── SatelliteAdapter.java
│ └── res
│ ├── drawable-hdpi
│ ├── feedback_title.9.png
│ ├── filedialog_3gp.png
│ ├── filedialog_apk.png
│ ├── filedialog_bmp.png
│ ├── filedialog_cab.png
│ ├── filedialog_chm.png
│ ├── filedialog_doc.png
│ ├── filedialog_folder.jpg
│ ├── filedialog_folder_up.jpg
│ ├── filedialog_jpg.png
│ ├── filedialog_mp3.jpg
│ ├── filedialog_mp4.png
│ ├── filedialog_ppt.png
│ ├── filedialog_root.jpg
│ ├── filedialog_swf.png
│ ├── filedialog_tif.png
│ ├── filedialog_txt.png
│ ├── filedialog_unknown.gif
│ ├── filedialog_wav.jpg
│ ├── filedialog_zip.png
│ ├── gnss_assist.png
│ ├── menu_exit_alert.png
│ ├── tab_message.png
│ ├── tab_orientation.png
│ ├── tab_orientation_compass.jpg
│ ├── tab_select.png
│ ├── tab_select_down.png
│ ├── tab_signal.png
│ ├── tab_time.png
│ ├── title_back_normal.png
│ ├── title_back_pressed.png
│ ├── title_next_normal.png
│ └── title_next_pressed.png
│ ├── drawable
│ ├── border.xml
│ ├── switch_border_pressed.xml
│ ├── switch_buttom_selector.xml
│ ├── tab_background.xml
│ ├── title_back_button_selector.xml
│ └── title_next_button_selector.xml
│ ├── layout
│ ├── filedialog_item.xml
│ ├── main.xml
│ ├── tab_a.xml
│ ├── tab_b.xml
│ ├── tab_c.xml
│ ├── tab_d.xml
│ └── title_bar.xml
│ └── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── drawables.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── import-summary.txt
├── screenshots
├── 01.png
├── 02.png
├── 03.png
├── 04.png
└── app-debug.apk
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | #*.apk
3 | #*.ap_
4 |
5 | # Files for the Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 |
15 | #Gradle files
16 | .gradle
17 | /.gradle/2.2.1/taskArtifacts/
18 | .gradle/2.2.1/taskArtifacts/
19 | build/
20 |
21 | # Local configuration file (sdk path, etc)
22 | local.properties
23 |
24 | # Proguard folder generated by Eclipse
25 | proguard/
26 |
27 | # Log Files
28 | *.log
29 |
30 | signing.properties
31 | CMakeLists.txt
32 |
33 | #IntelliJ IDEA
34 | .idea
35 | .idea/
36 | *.iml
37 |
38 | # OS-specific files
39 | .DS_Store
40 | .DS_Store?
41 | ._*
42 | .Spotlight-V100
43 | .Trashes
44 | ehthumbs.db
45 | Thumbs.db
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # GnssAssist
2 | 一个用于获取、分析和展示手机端导航数据的app
3 |
4 | 这个app主要用于获取手机中到导航数据,分析并进行展示。
5 | 现在主要包括了四个界面:
6 |
7 | - 信号强度展示界面;此界面中分成了上下两部分,上面显示gps和glonass,下面显示bds和Galileo;未定位的是灰色,已定位的是蓝色;
8 |
9 | 
10 |
11 | - 卫星方位展示界面;此界面主要显示了卫星的方位信息。同时显示了可见卫星数目和已连接卫星数目;
12 |
13 | 
14 |
15 | - 定位参数展示界面;此界面主要显示了卫星定位后的参数信息。
16 |
17 | 
18 |
19 | - 导航协议展示界面;此界面主要显示NEMA-0183协议,同时可以保存和查看。
20 |
21 | 
22 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.tonker.gnss"
9 | minSdkVersion 14
10 | targetSdkVersion 23
11 | }
12 |
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile 'com.android.support:support-v4:23.1.1'
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
30 |
31 |
32 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/tonker/gnss/activity/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.tonker.gnss.activity;
2 |
3 | import android.app.AlertDialog;
4 | import android.content.Context;
5 | import android.content.DialogInterface;
6 | import android.location.Location;
7 | import android.location.LocationManager;
8 | import android.os.Bundle;
9 | import android.support.v4.app.FragmentActivity;
10 | import android.support.v4.app.FragmentManager;
11 | import android.widget.ImageView;
12 | import android.widget.RadioGroup;
13 |
14 | import com.tonker.gnss.R;
15 | import com.tonker.gnss.fragment.*;
16 | import com.tonker.gnss.constant.Constant;
17 | import com.tonker.gnss.location.LocationAdapter;
18 |
19 | /**
20 | * 这一个类是开机动画执行完后要执行的类,该类主要用来加载四个标签页,开启获取定位类实例,显示菜单等。
21 | * @author newtonker
22 | * @date 2014-06-10
23 | */
24 | public class MainActivity extends FragmentActivity
25 | {
26 | //管理Fragment类的实例及四个Fragment
27 | private SignalFragment mSignalFragment;
28 | private OrientationFragment mOrientationFragment;
29 | private TimeFragment mTimeFragment;
30 | private MessageFragment mMessageFragment;
31 |
32 | //获取定位类的实例
33 | private LocationManager mLocationManager;
34 | private Location mLocation;
35 | private LocationAdapter mLocationAdapter;
36 |
37 | @Override
38 | protected void onCreate(Bundle savedInstanceState)
39 | {
40 | super.onCreate(savedInstanceState);
41 | //加载主界面
42 | setContentView(R.layout.main);
43 |
44 | //标题栏TextView
45 | ImageView mBackButton = (ImageView) findViewById(R.id.title_back_btn);
46 | ImageView mNextButton = (ImageView) findViewById(R.id.title_next_btn);
47 | //获取管理Fragment的实例
48 | FragmentManager mFragmentManager = this.getSupportFragmentManager();
49 | //创建四个Fragment
50 | mSignalFragment = new SignalFragment();
51 | mOrientationFragment = new OrientationFragment();
52 | mTimeFragment = new TimeFragment();
53 | mMessageFragment = new MessageFragment();
54 | //获取单选按钮组
55 | RadioGroup mRadioGroup = (RadioGroup) findViewById(R.id.group);
56 | //创建FragmentTabAdapter实例,该实例用于控制四个标签页的切换
57 | new FragmentTabAdapter(mBackButton, mNextButton, mFragmentManager, mSignalFragment, mOrientationFragment, mTimeFragment, mMessageFragment, mRadioGroup);
58 |
59 | // 获取系统的LocationManager
60 | mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
61 | // 获取位置信息, 如果不设置查询条件,getLastKnowLocation方法传入参数LocationManager.GPS_PROVIDER
62 | mLocation = mLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
63 | }
64 |
65 | @Override
66 | protected void onStart()
67 | {
68 | super.onStart();
69 | //要先让Fragment建立起来后才能设置进行回调,因此放在onStart中执行
70 | if (null == mLocationAdapter)
71 | {
72 | mLocationAdapter = new LocationAdapter(mSignalFragment, mOrientationFragment, mTimeFragment, mMessageFragment, mLocationManager, mLocation);
73 | }
74 | }
75 |
76 | /**
77 | * 点击后退键时,弹出退出对话框
78 | */
79 | @Override
80 | public void onBackPressed()
81 | {
82 | //获取退出对话框实例,同时设置确定和取消按钮
83 | new AlertDialog.Builder(this).setTitle(Constant.EXIT_TO_CONFIRM).setIcon(R.drawable.menu_exit_alert).setPositiveButton(Constant.EXIT_CONFIRM, new DialogInterface.OnClickListener()
84 | {
85 | @Override
86 | public void onClick(DialogInterface dialog, int which)
87 | {
88 | MainActivity.this.finish();
89 | }
90 | }).setNegativeButton(Constant.EXIT_CANCEL, new DialogInterface.OnClickListener()
91 | {
92 | @Override
93 | public void onClick(DialogInterface dialog, int which)
94 | {
95 | dialog.dismiss();
96 | }
97 | }).create().show();
98 | }
99 |
100 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/tonker/gnss/constant/Constant.java:
--------------------------------------------------------------------------------
1 | package com.tonker.gnss.constant;
2 |
3 | /**
4 | * 这是一个接口,用来定义一些常量,在程序中使用时便于统一管理
5 | */
6 | public class Constant
7 | {
8 | //菜单退出时使用
9 | public final static String EXIT_TO_CONFIRM = "确认退出?";
10 | public final static String EXIT_CONFIRM = "确认";
11 | public final static String EXIT_CANCEL = "取消";
12 |
13 | //SignalFragment中用到的常量
14 | public static final String GNSS_SWITCH_ON = "GNSS已打开";
15 | public static final String GNSS_SWITCH_OFF = "GNSS已关闭";
16 |
17 | //TimeFragment中用到的常量
18 | public final static String UPDATE_DATE_FORMAT = "update_date_format";
19 | public final static String UPDATE_TIME_FORMAT = "update_time_format";
20 | public final static String UPDATE_LONGITUDE_FORMAT = "update_longitude_format";
21 | public final static String UPDATE_ACCURACY_FORMAT = "update_accuracy_format";
22 | public final static String UPDATE_ALTITUDE_FORMAT = "update_altitude_format";
23 | public final static String UPDATE_SPEED_FORMAT = "update_speed_format";
24 | public final static String UPDATE_BEARING_FORMAT = "update_bearing_format";
25 | public final static String UPDATE_DEFAULT_FORMAT = "update_default_format";
26 | public final static String INTEGER_FORMAT = "%.0f";
27 | public final static String DECIMALS_FORMAT = "%.1f";
28 |
29 | //MessageFragment中使用到的常量,设置TextView所能接受的最大行数,文件保存路径等
30 | public final static int MAX_LINE = 60;
31 | public final static int STRING_BUILDER_CAPATICY = 1000;
32 | public final static String MESSAGE_SAVE = "保存";
33 | public final static String MESSAGE_CANCEL_SAVE = "取消";
34 | public final static String MESSAGE_PAUSE = "暂停";
35 | public final static String MESSAGE_CONTINUE = "继续";
36 | public final static String FILE_SAVE_DIR = "/gnss_assist/files/";
37 | public final static String FILE_SAVE_START = "文件保存为:";
38 | public final static String FILE_SAVE_STOP = "结束保存";
39 | public final static String CREATE_DIR_FAILED = "创建存储路径失败";
40 | public final static String CREATE_FILE_FAILED = "创建存储文件失败";
41 |
42 | //BarChart中用到的常量
43 | //设置要显示的柱状图的数量
44 | public final static int BAR_NUM = 16;
45 | //设置坐标系刻度线的数量
46 | public final static int LINE_NUM = 4;
47 | //设置最大SNR值
48 | public final static int MAX_SNR = 60;
49 |
50 | //SignalScaleBar用到的常量
51 | //设置将整个布局分成6份,柱状图画到2、3份中,字体 写到4、5份中
52 | public final static int SCALE_NUM = 5;
53 | //设置柱状图总共有几份
54 | public final static int SCALE_BAR_NUM = 10;
55 | //设置字体从mBarBottom下第几份开始
56 | public final static int FONT_START = 1;
57 |
58 | //LocationAdapter用到的常量
59 | public static final String GNSS_DATA_UNKNOWN = "N/A";
60 | public static final String GNSS_DATA_ZERO = "0";
61 | public static final String FIX_BEGIN = "正在定位";
62 | public static final String FIX_SUCCEED = "已定位";
63 | public static final String FIX_STOP = "未定位";
64 |
65 | //SettingActivity中用到的常量
66 | public final static String SETTING_DATE_FORMAT = "Date_Format";
67 | public final static String SETTING_TIME_FORMAT = "Time_Format";
68 | public final static String SETTING_LONGITUDE_FORMAT = "Longitude_Format";
69 | public final static String SETTING_ACCURACY_FORMAT = "Accuracy_Format";
70 | public final static String SETTING_ALTITUDE_FORMAT = "Altitude_Format";
71 | public final static String SETTING_SPEED_FORMAT = "Speed_Format";
72 | public final static String SETTING_BEARING_FORMAT = "Bearing_Format";
73 | public final static String SETTING_DEFAULT_FORMAT = "Default_Format";
74 |
75 | //FileSelectView中用到的常量
76 | public final static String FILE_ROOT = "/";
77 | public final static String FILE_PARENT = "..";
78 | public final static String FILE_FOLDER = ".";
79 | public final static String FILE_BMP = "bmp";
80 | public final static String FILE_DOC = "doc";
81 | public final static String FILE_JPG = "jpg";
82 | public final static String FILE_MP3 = "mp3";
83 | public final static String FILE_MP4 = "mp4";
84 | public final static String FILE_PPT = "ppt";
85 | public final static String FILE_TXT = "txt";
86 | public final static String FILE_WAV = "wav";
87 | public final static String FILE_ZIP = "zip";
88 | public final static String FILE_3GP = "3gp";
89 | public final static String FILE_CAB = "cab";
90 | public final static String FILE_TIF = "tif";
91 | public final static String FILE_SWF = "swf";
92 | public final static String FILE_CHM = "chm";
93 | public final static String FILE_APK = "apk";
94 | public final static String FILE_UNKNOWN = "unknown";
95 | public final static String ACCESS_ERROR = "没有获取访问文件权限";
96 |
97 | //MIME类型
98 | public final static String[][] MIME_MapTable={
99 | //{后缀名, MIME类型}
100 | {".3gp", "video/3gpp"},
101 | {".apk", "application/vnd.android.package-archive"},
102 | {".asf", "video/x-ms-asf"},
103 | {".avi", "video/x-msvideo"},
104 | {".bin", "application/octet-stream"},
105 | {".bmp", "image/bmp"},
106 | {".c", "text/plain"},
107 | {".class", "application/octet-stream"},
108 | {".conf", "text/plain"},
109 | {".cpp", "text/plain"},
110 | {".doc", "application/msword"},
111 | {".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"},
112 | {".xls", "application/vnd.ms-excel"},
113 | {".xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},
114 | {".exe", "application/octet-stream"},
115 | {".gif", "image/gif"},
116 | {".gtar", "application/x-gtar"},
117 | {".gz", "application/x-gzip"},
118 | {".h", "text/plain"},
119 | {".htm", "text/html"},
120 | {".html", "text/html"},
121 | {".jar", "application/java-archive"},
122 | {".java", "text/plain"},
123 | {".jpeg", "image/jpeg"},
124 | {".jpg", "image/jpeg"},
125 | {".js", "application/x-javascript"},
126 | {".log", "text/plain"},
127 | {".m3u", "audio/x-mpegurl"},
128 | {".m4a", "audio/mp4a-latm"},
129 | {".m4b", "audio/mp4a-latm"},
130 | {".m4p", "audio/mp4a-latm"},
131 | {".m4u", "video/vnd.mpegurl"},
132 | {".m4v", "video/x-m4v"},
133 | {".mov", "video/quicktime"},
134 | {".mp2", "audio/x-mpeg"},
135 | {".mp3", "audio/x-mpeg"},
136 | {".mp4", "video/mp4"},
137 | {".mpc", "application/vnd.mpohun.certificate"},
138 | {".mpe", "video/mpeg"},
139 | {".mpeg", "video/mpeg"},
140 | {".mpg", "video/mpeg"},
141 | {".mpg4", "video/mp4"},
142 | {".mpga", "audio/mpeg"},
143 | {".msg", "application/vnd.ms-outlook"},
144 | {".ogg", "audio/ogg"},
145 | {".pdf", "application/pdf"},
146 | {".png", "image/png"},
147 | {".pps", "application/vnd.ms-powerpoint"},
148 | {".ppt", "application/vnd.ms-powerpoint"},
149 | {".pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"},
150 | {".prop", "text/plain"},
151 | {".rc", "text/plain"},
152 | {".rmvb", "audio/x-pn-realaudio"},
153 | {".rtf", "application/rtf"},
154 | {".sh", "text/plain"},
155 | {".tar", "application/x-tar"},
156 | {".tgz", "application/x-compressed"},
157 | {".txt", "text/plain"},
158 | {".wav", "audio/x-wav"},
159 | {".wma", "audio/x-ms-wma"},
160 | {".wmv", "audio/x-ms-wmv"},
161 | {".wps", "application/vnd.ms-works"},
162 | {".xml", "text/plain"},
163 | {".z", "application/x-compress"},
164 | {".zip", "application/x-zip-compressed"},
165 | {"", "*/*"}
166 | };
167 |
168 | }
169 |
--------------------------------------------------------------------------------
/app/src/main/java/com/tonker/gnss/file/FileSelectView.java:
--------------------------------------------------------------------------------
1 | package com.tonker.gnss.file;
2 |
3 | import java.io.File;
4 | import java.util.ArrayList;
5 | import java.util.HashMap;
6 | import java.util.List;
7 | import java.util.Locale;
8 | import java.util.Map;
9 |
10 | import com.tonker.gnss.R;
11 | import com.tonker.gnss.constant.Constant;
12 |
13 | import android.content.Context;
14 | import android.content.Intent;
15 | import android.net.Uri;
16 | import android.view.View;
17 | import android.widget.AdapterView;
18 | import android.widget.ListView;
19 | import android.widget.SimpleAdapter;
20 | import android.widget.Toast;
21 | import android.widget.AdapterView.OnItemClickListener;
22 |
23 | /**
24 | * 这一个类用来创建ListView列表,显示系统的文件夹和文件
25 | *
26 | * @author newtonker
27 | * @date 2014-07-01
28 | */
29 | public class FileSelectView extends ListView implements OnItemClickListener
30 | {
31 | //获取当前路径
32 | private String path;
33 |
34 | //设置相应文件对应的图标,获取相应路径下的所有文件并添加到列表中
35 | private Map mImageMap;
36 | private File[] files;
37 | private List