|
@@ -151,6 +151,7 @@ public class MainActivity extends AppCompatActivity implements CustomJsonProcess
|
|
|
|
|
|
|
|
/* 定位相关 */
|
|
/* 定位相关 */
|
|
|
private LocationManager locationManager;
|
|
private LocationManager locationManager;
|
|
|
|
|
+ private LocationListener locationListener;
|
|
|
|
|
|
|
|
/* 设备操作日志相关 */
|
|
/* 设备操作日志相关 */
|
|
|
private LogFileManager LogFileManagerOperate;
|
|
private LogFileManager LogFileManagerOperate;
|
|
@@ -228,7 +229,7 @@ public class MainActivity extends AppCompatActivity implements CustomJsonProcess
|
|
|
if (PLATFROM_TYPE_MAICHONG == USER_PLATFORM_TYPE) {
|
|
if (PLATFROM_TYPE_MAICHONG == USER_PLATFORM_TYPE) {
|
|
|
MaiChongPlatformSInit();
|
|
MaiChongPlatformSInit();
|
|
|
|
|
|
|
|
- MacStartLocationUpdates();
|
|
|
|
|
|
|
+ //MacStartLocationUpdates();
|
|
|
MacHideSystemUI();
|
|
MacHideSystemUI();
|
|
|
} else {
|
|
} else {
|
|
|
AidlCallback = new AidlCallback();
|
|
AidlCallback = new AidlCallback();
|
|
@@ -239,6 +240,9 @@ public class MainActivity extends AppCompatActivity implements CustomJsonProcess
|
|
|
bindService(intent, ServiceConnection, BIND_AUTO_CREATE);
|
|
bindService(intent, ServiceConnection, BIND_AUTO_CREATE);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /* 启动GPS位置信息获取服务 */
|
|
|
|
|
+ MacStartLocationUpdates();
|
|
|
|
|
+
|
|
|
/* 修改相机权限及设置缓冲区 */
|
|
/* 修改相机权限及设置缓冲区 */
|
|
|
MacSystemExecuteShellCommand();
|
|
MacSystemExecuteShellCommand();
|
|
|
|
|
|
|
@@ -654,7 +658,7 @@ public class MainActivity extends AppCompatActivity implements CustomJsonProcess
|
|
|
// 获取编辑器并存储数据
|
|
// 获取编辑器并存储数据
|
|
|
String tempTakePhotoWaitExposure = SystemParameterSettings.getString(SYS_PARA_CAMERA_TAKE_PHOTO_WAIT_EXPOSURE,"10");
|
|
String tempTakePhotoWaitExposure = SystemParameterSettings.getString(SYS_PARA_CAMERA_TAKE_PHOTO_WAIT_EXPOSURE,"10");
|
|
|
UserGlobalVariable.CameraTakePhotoWaitExposure = Integer.parseInt(tempTakePhotoWaitExposure);
|
|
UserGlobalVariable.CameraTakePhotoWaitExposure = Integer.parseInt(tempTakePhotoWaitExposure);
|
|
|
-// Log.i(TAG_SYSTEM_PARAMETER_SP,"系统参数#01.2-> 拍照等待曝光时间值: " + UserGlobalVariable.CameraTakePhotoWaitExposure);
|
|
|
|
|
|
|
+ Log.i(TAG_SYSTEM_PARAMETER_SP,"系统参数#01.2-> 拍照等待曝光时间值: " + UserGlobalVariable.CameraTakePhotoWaitExposure);
|
|
|
|
|
|
|
|
String tempLongitude = SystemParameterSettings.getString(SYS_PARA_GPS_LONGITUDE,"0");
|
|
String tempLongitude = SystemParameterSettings.getString(SYS_PARA_GPS_LONGITUDE,"0");
|
|
|
String tempLatitude = SystemParameterSettings.getString(SYS_PARA_GPS_LATITUDE,"0");
|
|
String tempLatitude = SystemParameterSettings.getString(SYS_PARA_GPS_LATITUDE,"0");
|
|
@@ -803,7 +807,6 @@ public class MainActivity extends AppCompatActivity implements CustomJsonProcess
|
|
|
MacSetSystemParameterSP(SYS_PARA_GPS_LATITUDE,String.valueOf(locationInfo.latitude));
|
|
MacSetSystemParameterSP(SYS_PARA_GPS_LATITUDE,String.valueOf(locationInfo.latitude));
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
-
|
|
|
|
|
case AidlConstants.TYPE_KIOSK_MODE:
|
|
case AidlConstants.TYPE_KIOSK_MODE:
|
|
|
|
|
|
|
|
case AidlConstants.TYPE_INSTALL:
|
|
case AidlConstants.TYPE_INSTALL:
|
|
@@ -925,68 +928,77 @@ public class MainActivity extends AppCompatActivity implements CustomJsonProcess
|
|
|
/******************************************** GPS功能部分 ********************************************/
|
|
/******************************************** GPS功能部分 ********************************************/
|
|
|
private void MacStartLocationUpdates() {
|
|
private void MacStartLocationUpdates() {
|
|
|
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
|
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
|
|
- if (locationManager == null) return;
|
|
|
|
|
|
|
|
|
|
- if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
|
|
|
|
|
- != PackageManager.PERMISSION_GRANTED &&
|
|
|
|
|
- ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)
|
|
|
|
|
- != PackageManager.PERMISSION_GRANTED) {
|
|
|
|
|
|
|
+ if (locationManager == null) {
|
|
|
|
|
+ Log.e("GPS Location", "LocationManager is null");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- String provider = getBestProvider();
|
|
|
|
|
- if (provider == null) {
|
|
|
|
|
- Log.e("GPS", "No Location provider available");
|
|
|
|
|
|
|
+ if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
|
|
|
|
+ Log.e("GPS Location", "No GPS permission");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Location location = locationManager.getLastKnownLocation(provider);
|
|
|
|
|
|
|
+ String provider = LocationManager.GPS_PROVIDER;
|
|
|
|
|
+ if (!locationManager.isProviderEnabled(provider)) {
|
|
|
|
|
+ Log.e("GPS Location", "GPS provider disabled");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if (location != null) {
|
|
|
|
|
- handleLocation(location);
|
|
|
|
|
|
|
+ Location lastLocation = locationManager.getLastKnownLocation(provider);
|
|
|
|
|
+ if (lastLocation != null) {
|
|
|
|
|
+ Log.d("GPS Location", "Use last location");
|
|
|
|
|
+ handleLocation(lastLocation);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- try {
|
|
|
|
|
- locationManager.requestSingleUpdate(provider, new LocationListener() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onLocationChanged(Location location) {
|
|
|
|
|
- handleLocation(location);
|
|
|
|
|
|
|
+ Log.d("GPS Location", "Start GPS locating");
|
|
|
|
|
+ locationListener = new LocationListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onLocationChanged(Location location) {
|
|
|
|
|
+ if (location == null) {
|
|
|
|
|
+ Log.e("GPS Location", "location null");
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
|
|
+ Log.d("GPS Location", "location:" + location.getLatitude() + "," + location.getLongitude());
|
|
|
|
|
+ handleLocation(location);
|
|
|
|
|
+ locationManager.removeUpdates(this);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- @Override public void onProviderEnabled(String provider) {}
|
|
|
|
|
- @Override public void onProviderDisabled(String provider) {}
|
|
|
|
|
- @Override public void onStatusChanged(String provider, int status, Bundle extras) {}
|
|
|
|
|
- }, null);
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onProviderEnabled(String provider) {
|
|
|
|
|
+ Log.d("GPS Location", "enabled:" + provider);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- } catch (SecurityException | IllegalArgumentException e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onProviderDisabled(String provider) {
|
|
|
|
|
+ Log.d("GPS Location", "disabled:" + provider);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- private String getBestProvider() {
|
|
|
|
|
- if (locationManager == null) return null;
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onStatusChanged(String provider, int status, Bundle extras) {
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
|
|
|
|
|
- return LocationManager.GPS_PROVIDER;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ locationManager.requestLocationUpdates(
|
|
|
|
|
+ LocationManager.GPS_PROVIDER,
|
|
|
|
|
+ 1000, 0,
|
|
|
|
|
+ locationListener,
|
|
|
|
|
+ Looper.getMainLooper()
|
|
|
|
|
+ );
|
|
|
|
|
+ } catch (SecurityException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
|
|
|
- if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
|
|
|
|
|
- return LocationManager.NETWORK_PROVIDER;
|
|
|
|
|
- }
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
|
|
+ } catch (IllegalArgumentException e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- return null;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void handleLocation(Location location) {
|
|
private void handleLocation(Location location) {
|
|
|
double latitude = location.getLatitude();
|
|
double latitude = location.getLatitude();
|
|
|
double longitude = location.getLongitude();
|
|
double longitude = location.getLongitude();
|
|
|
- Log.d("Location", "Latitude: " + latitude + ", Longitude: " + longitude);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ Log.d("GPS Location", "+++ Latitude: " + latitude + ", Longitude: " + longitude);
|
|
|
if(!UserGlobalVariable.GPS_LocationRefresh){
|
|
if(!UserGlobalVariable.GPS_LocationRefresh){
|
|
|
UserGlobalVariable.GPS_LocationRefresh = true;
|
|
UserGlobalVariable.GPS_LocationRefresh = true;
|
|
|
|
|
|
|
@@ -2689,10 +2701,12 @@ public class MainActivity extends AppCompatActivity implements CustomJsonProcess
|
|
|
serialManager.setDataProcessor(customJsonProcessorManager);
|
|
serialManager.setDataProcessor(customJsonProcessorManager);
|
|
|
UserGlobalVariable.Upgrade_Mcu_Process_Status = false;
|
|
UserGlobalVariable.Upgrade_Mcu_Process_Status = false;
|
|
|
|
|
|
|
|
|
|
+ String endCmd = "{\"cmd\":\"paramconf\",\"ext\":{\"Demo_mode\":0}}";
|
|
|
|
|
+ SerialManager.getInstance().write(endCmd.getBytes());
|
|
|
|
|
+
|
|
|
UserGlobalVariable.Upgrade_Mcu_Status = false;
|
|
UserGlobalVariable.Upgrade_Mcu_Status = false;
|
|
|
MqttCustomPublishFunction("{\"cmd\":\"upgrade\",\"type\":\"mcu\",\"status\":\"5\"}");
|
|
MqttCustomPublishFunction("{\"cmd\":\"upgrade\",\"type\":\"mcu\",\"status\":\"5\"}");
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
} else {
|
|
} else {
|
|
|
Log.i(TAG_UPGRADE_OPERATE,"MCU YModem升级操作结束.");
|
|
Log.i(TAG_UPGRADE_OPERATE,"MCU YModem升级操作结束.");
|
|
|
serialManager.setDataProcessor(customJsonProcessorManager);
|
|
serialManager.setDataProcessor(customJsonProcessorManager);
|
|
@@ -2706,6 +2720,9 @@ public class MainActivity extends AppCompatActivity implements CustomJsonProcess
|
|
|
MqttCustomPublishFunction("{\"cmd\":\"upgrade\",\"type\":\"mcu\",\"status\":\"1\"}");
|
|
MqttCustomPublishFunction("{\"cmd\":\"upgrade\",\"type\":\"mcu\",\"status\":\"1\"}");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ String endCmd = "{\"cmd\":\"paramconf\",\"ext\":{\"Demo_mode\":0}}";
|
|
|
|
|
+ SerialManager.getInstance().write(endCmd.getBytes());
|
|
|
|
|
+
|
|
|
UserGlobalVariable.Upgrade_Mcu_Timeout_Flag = false;
|
|
UserGlobalVariable.Upgrade_Mcu_Timeout_Flag = false;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -2785,13 +2802,12 @@ public class MainActivity extends AppCompatActivity implements CustomJsonProcess
|
|
|
if (MacExecuteShellSilentFlag) {
|
|
if (MacExecuteShellSilentFlag) {
|
|
|
MacExecuteShellSilentFlag = false;
|
|
MacExecuteShellSilentFlag = false;
|
|
|
|
|
|
|
|
- if (USER_PLATFORM_TYPE == PLATFROM_TYPE_WANGFEI) {
|
|
|
|
|
|
|
+ /*if (USER_PLATFORM_TYPE == PLATFROM_TYPE_WANGFEI) {
|
|
|
Log.i(TAG_UPGRADE_OPERATE,"Upgrade#02.01->> 网飞设备由天工平台安装.");
|
|
Log.i(TAG_UPGRADE_OPERATE,"Upgrade#02.01->> 网飞设备由天工平台安装.");
|
|
|
- } else {
|
|
|
|
|
- Log.i(TAG_UPGRADE_OPERATE,"Upgrade#02.01->> 执行安装操作.");
|
|
|
|
|
- MacExecuteShellSilent(String.valueOf(new File(getFilesDir(),"XCT.apk")));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ } else {*/
|
|
|
|
|
+ Log.i(TAG_UPGRADE_OPERATE,"Upgrade#02.01->> 执行安装操作.");
|
|
|
|
|
+ MacExecuteShellSilent(String.valueOf(new File(getFilesDir(),"XCT.apk")));
|
|
|
|
|
+ //}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* 语音播放 */
|
|
/* 语音播放 */
|