Skip to content

Commit

Permalink
Cell & Location tracking changes & Other minor updates
Browse files Browse the repository at this point in the history
Current status of cell & location tracking is as follows:
- Enabling Cell Tracking (Only Option) requires GPS enabled to provide location
details for the cell.
- Currently as no other method has been tested the GPS lat/lng coordinates are used
to populate both tables (Cell & Location) until another method is confirmed to work
as required to provide the exact CELL LOCATION to be used within the Cell tracking
table.
- GPS location changes will only be tracked if more then 10 metres change in location
has been registered.

Other minor updates including additional logic checks added to all functions that
request SIM variables to ensure the sim state is ready.
  • Loading branch information
xLaMbChOpSx committed May 27, 2014
1 parent 76bdfc7 commit 7bed14f
Show file tree
Hide file tree
Showing 6 changed files with 295 additions and 186 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

<application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public long insertCell( int lac, int cellID,
cellValues.put("Operator", simOperator);
cellValues.put("OperatorName", simOperatorName);

if (!cellExists(cellID,latitude, longitude, signalInfo)) {
if (!cellExists(cellID, latitude, longitude, signalInfo)) {
return mDb.insert(CELL_TABLE, null, cellValues);
}
}
Expand Down Expand Up @@ -272,6 +272,39 @@ private void populateDefaultMCC(SQLiteDatabase db) {
}
}

/**
* Parses the downloaded CSV from OpenCellID and adds Map Marker to identify known
* Cell ID's
*/
public void updateOpenCellID () {
String fileName = Environment.getExternalStorageDirectory()
+ "/AIMSICD/OpenCellID/opencellid.csv";
File file = new File(fileName);
try {
CSVReader csvReader = new CSVReader(new FileReader(file));
List<String[]> csvCellID = csvReader.readAll();

for (int i=1; i<csvCellID.size(); i++)
{
//Insert details into OpenCellID Database
long result =
insertOpenCell(Double.parseDouble(csvCellID.get(i)[0]),
Double.parseDouble(csvCellID.get(i)[1]),
Integer.parseInt(csvCellID.get(i)[2]), Integer.parseInt(csvCellID.get(i)[3]),
Integer.parseInt(csvCellID.get(i)[4]), Integer.parseInt(csvCellID.get(i)[5]),
Integer.parseInt(csvCellID.get(i)[6]), Integer.parseInt(csvCellID.get(i)[7]));
if (result == -1)
{
Log.e(TAG, "Error inserting OpenCellID database value");
}
}

} catch (Exception e) {
Log.e (TAG, "Error parsing OpenCellID data - " + e.getMessage());
}

}

/**
* Exports the database tables to CSV files
*/
Expand Down
32 changes: 17 additions & 15 deletions app/src/main/java/com/SecUpwN/AIMSICD/fragments/DeviceFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ public void onResume() {
updateUI();
}

@Override
public void onStart() {
super.onStart();
updateUI();
}

@Override
public void onDestroy() {
super.onDestroy();
Expand Down Expand Up @@ -107,9 +101,11 @@ private void updateUI() {
switch (mAimsicdService.getPhoneID()) {
case TelephonyManager.PHONE_TYPE_GSM: {
content = (TextView) mView.findViewById(R.id.network_lac);
content.setText(mAimsicdService.getLAC(true));
content.setText(String.valueOf(mAimsicdService.getLAC(true)));
tr = (TableRow) mView.findViewById(R.id.gsm_cellid);
tr.setVisibility(View.VISIBLE);
content = (TextView) mView.findViewById(R.id.network_cellid);
content.setText(mAimsicdService.getCellId());
content.setText(String.valueOf(mAimsicdService.getCellId()));
break;
}
case TelephonyManager.PHONE_TYPE_CDMA: {
Expand All @@ -118,27 +114,33 @@ private void updateUI() {
TableRow row = (TableRow) tableLayout.getChildAt(i);
if (row != null) {
if (row.getTag().equals("cdma")) {
row.setVisibility(View.GONE);
} else if( row.getTag().equals("gsm_network")) {
row.setVisibility(View.VISIBLE);
} else if( row.getTag().equals("gsm_network")) {
row.setVisibility(View.GONE);
}
}
}
content = (TextView) mView.findViewById(R.id.network_netid);
content.setText(mAimsicdService.getLAC(true));
content.setText(String.valueOf(mAimsicdService.getLAC(true)));
content = (TextView) mView.findViewById(R.id.network_sysid);
content.setText(mAimsicdService.getSID());
content.setText(String.valueOf(mAimsicdService.getSID()));
content = (TextView) mView.findViewById(R.id.network_baseid);
content.setText(mAimsicdService.getCellId());
content.setText(String.valueOf(mAimsicdService.getCellId()));
mAimsicdService.updateCdmaLocation();
double[] location = mAimsicdService.getLastLocation();
content = (TextView) mView.findViewById(R.id.network_cmda_lat);
content.setText(String.valueOf(location[0]));
content = (TextView) mView.findViewById(R.id.network_cmda_long);
content.setText(String.valueOf(location[1]));
break;
}
}

if (mAimsicdService.getNetID(true) == TelephonyManager.NETWORK_TYPE_LTE) {
content = (TextView) mView.findViewById(R.id.network_lte_timing_advance);
content.setText(mAimsicdService.getLteTimingAdvance());
tr = (TableRow) mView.findViewById(R.id.lte_timing_advance);
tr.setVisibility(View.VISIBLE);
content = (TextView) mView.findViewById(R.id.network_lte_timing_advance);
content.setText(String.valueOf(mAimsicdService.getLteTimingAdvance()));
} else {
tr = (TableRow) mView.findViewById(R.id.lte_timing_advance);
tr.setVisibility(View.GONE);
Expand Down
Loading

0 comments on commit 7bed14f

Please sign in to comment.