2013-08-10 Miguel de Dios <miguel.dedios@artica.es>

* tablet/*: updated the tablet version.






git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9201 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-12-10 14:49:18 +00:00
parent 791c399780
commit ef5ba03eee
11 changed files with 73 additions and 1625 deletions

View File

@ -1,3 +1,7 @@
2013-08-10 Miguel de Dios <miguel.dedios@artica.es>
* tablet/*: updated the tablet version.
2013-08-10 Miguel de Dios <miguel.dedios@artica.es>
* mobile/AndroidManifest.xml: update the version number, and added

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Pandroid Agent v1.0</name>
<name>Pandroid Agent v1.0_Tablet</name>
<comment></comment>
<projects>
</projects>

View File

@ -16,26 +16,27 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pandroid.agent"
android:versionCode="103"
android:versionCode="2002"
android:versionName="3.0" >
<supports-screens
android:smallScreens="false"
android:normalScreens="false"
android:largeScreens="true"
android:xlargeScreens="true" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.BATTERY_STATS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-feature android:name="android.hardware.sensor.light" />
<uses-feature android:name="android.hardware.location" />
<uses-sdk android:minSdkVersion="8" />
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" />
<application
android:allowBackup="true"
@ -82,12 +83,5 @@
android:name=".Help"
android:label="@string/help_str"
android:theme="@android:style/Theme.Dialog" />
<receiver android:name=".SMSBroadcastReceiver" >
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" >
</action>
</intent-filter>
</receiver>
</application>
</manifest>

View File

@ -1,343 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/setup"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<CheckBox
android:id="@+id/checkNotification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/notificationCheck"
android:textColor="#bbbbbb"
android:textSize="14sp"
android:paddingTop="5sp"/>
<TextView
android:id="@+id/field1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:text="@string/serverAddr" />
<EditText
android:id="@+id/serverAddrInput"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textNoSuggestions"
android:singleLine="true" />
<TextView
android:id="@+id/field2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/serverPort" />
<EditText
android:id="@+id/serverPortInput"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:singleLine="true" />
<TextView
android:id="@+id/field3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/interval" />
<EditText
android:id="@+id/intervalInput"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:singleLine="true" />
<TextView
android:id="@+id/field4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/agent" />
<EditText
android:id="@+id/agentNameInput"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textNoSuggestions"
android:singleLine="true" />
<TextView
android:id="@+id/field5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/bufferSize" />
<EditText
android:id="@+id/bufferSize"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLines="1"
/>
<TextView
android:id="@+id/field6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/mobileWebURL" />
<EditText
android:id="@+id/mobileWebURLInput"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textUri"
android:singleLine="true" />
<Button
android:id="@+id/goToWebButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/go_to_web" />
<TextView
android:id="@+id/field7"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/taskToReport" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ProgressBar
android:id="@+id/loading_task_anim"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Spinner
android:id="@+id/processes_combo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
<CheckBox
android:id="@+id/checkTaskReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/taskReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkGpsReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/gpsReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkBatteryLevelReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/BatteryLevelReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkMemoryReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/memoryReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkDeviceUpTimeReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/uptimeReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkInventoryReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/InventoryReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkHelloSignalReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/HelloSignalReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkSimIDReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/simIDReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkNetworkOperatorReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/NetworkOperatorReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkNetworkTypeReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/NetworkTypeReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkPhoneTypeReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/PhoneTypeReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkSignalStrengthReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/SignalStrengthReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkReceivedSMSReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ReceivedSMSReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkSentSMSReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/SentSMSReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkIncomingCallsReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/IncomingCallsReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkMissedCallsReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/MissedCallsReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkOutgoingCallsReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/OutgoingCallsReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkBytesReceivedReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/BytesReceivedReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkBytesSentReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/BytesSentReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<CheckBox
android:id="@+id/checkRoamingReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/RoamingReport"
android:textColor="#bbbbbb"
android:textSize="14sp" />
<Button
android:id="@+id/update"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/update" />
<Button
android:id="@+id/set_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/set_password" />
<Button
android:id="@+id/stopAgent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/stopAgent" />
<Button
android:id="@+id/restartAgent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/restartAgent" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</RelativeLayout>

View File

@ -1,475 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="5dp" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/last_values_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/last_values"
android:textSize="18sp"
android:textStyle="bold" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/lastContactInfo_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/img_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:padding="5dp"
android:src="@drawable/logo" />
<TextView
android:id="@+id/latitude_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/lastContactInfo_label_str"
android:text="@string/latitude"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/latitude_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/latitude_label_str" />
<TextView
android:id="@+id/longitude_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/latitude_value_str"
android:text="@string/longitude"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/longitude_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/longitude_label_str" />
<TextView
android:id="@+id/battery_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/longitude_value_str"
android:text="@string/battery_level"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/battery_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/battery_label_str" />
<!--
<TextView
android:id="@+id/orientation_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/orientation"
android:textSize="14dip"
android:textStyle="bold"
android:layout_below="@id/battery_value_str"
/>
<TextView
android:id="@+id/orientation_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/orientation_label_str"
/>
<TextView
android:id="@+id/proximity_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/proximity"
android:textSize="14dip"
android:textStyle="bold"
android:layout_below="@id/battery_value_str"
/>
<TextView
android:id="@+id/proximity_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/proximity_label_str"
/>
-->
</RelativeLayout>
<TextView
android:id="@+id/task_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/task"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/task_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/memory_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/memory"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/memory_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.18" >
<TableRow
android:id="@+id/tableRow0"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/uptime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/uptime"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/uptime_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/sim_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sim_id"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/sim_id_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/network_operator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="5dip"
android:text="@string/network_operator"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/network_operator_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/network_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/network_type"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/network_type_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/phone_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/phone_type"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/phone_type_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/signal_strength"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/signal_strength"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/signal_strength_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow6"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/sms_received"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sms_received"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/sms_received_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow7"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/sms_sent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sms_sent"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/sms_sent_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow8"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/incoming_calls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/incoming_calls"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/incoming_calls_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow9"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/missed_calls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/missed_calls"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/missed_calls_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow10"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/outgoing_calls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/outgoing_calls"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/outgoing_calls_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow11"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/receive_bytes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/receive_bytes"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/receive_bytes_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow12"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/transmit_bytes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/transmit_bytes"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/transmit_bytes_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow13"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/roaming"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/roaming"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/roaming_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
</TableLayout>
<!--
for debugging
<Button
android:id="@+id/start"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="@string/start" />
<Button
android:id="@+id/stop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Stop" />
<Button
android:id="@+id/get_xml"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Get xml" />
<TextView
android:id="@+id/xml"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:text="..." />
<Button
android:id="@+id/hide_xml"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hide xml" />
-->
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -42,7 +42,7 @@ public class Core {
// DEFAULT CONFIGURATION MODULES //
// //
static volatile public String defaultServerAddr = "firefly.artica.es"; //master address
static volatile public String defaultServerAddr = "192.168.70.182"; //master address
static volatile public String defaultServerPort = "41121";
static volatile public int defaultInterval = 300;
static volatile public String defaultAgentName = "pandroid";
@ -58,24 +58,6 @@ public class Core {
static volatile public String defaultHelloSignalReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultNotificationCheck = "enabled"; // "disabled" or "enabled"
static volatile public boolean defaultHasSim = false;
//hasSim values
static volatile public String defaultSimIDReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultNetworkOperatorReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultNetworkTypeReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultPhoneTypeReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultSignalStrengthReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultReceivedSMSReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultSentSMSReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultIncomingCallsReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultMissedCallsReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultOutgoingCallsReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultBytesReceivedReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultBytesSentReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultRoamingReport = "enabled"; // "disabled" or "enabled"
// //
// DEFAULT MODULE VALUES //
@ -91,22 +73,6 @@ public class Core {
static volatile public int defaultHelloSignal = 2;
//hasSim values
static volatile public String defaultSimID = "";
static volatile public String defaultNetworkOperator = "";
static volatile public String defaultNetworkType = "";
static volatile public String defaultPhoneType = "";
static volatile public int defaultSignalStrength = 0;
static volatile public int defaultSMSReceived = 0;
static volatile public int defaultSMSSent = 0;
static volatile public int defaultIncomingCalls = 0;
static volatile public int defaultMissedCalls = 0;
static volatile public int defaultOutgoingCalls = 0;
static volatile public long defaultReceiveBytes = 0;
static volatile public long defaultTransmitBytes = 0;
static volatile public int defaultRoaming = 0;
static volatile public String defaultPassword = "";
static volatile public Context con = null;
@ -132,27 +98,10 @@ public class Core {
static volatile public String memoryStatus = defaultMemoryStatus;
static volatile public String passwordCheck = defaultPasswordCheck;
static volatile public String DeviceUpTimeReport = defaultDeviceUpTimeReport;
static volatile public String InventoryReport = defaultRoamingReport;
static volatile public String InventoryReport = defaultInventoryReport;
static volatile public String HelloSignalReport = defaultHelloSignalReport;
static volatile public String RoamingReport = defaultRoamingReport;
static volatile public String NotificationCheck = defaultNotificationCheck;
//hasSim values
static volatile public boolean hasSim = defaultHasSim;
static volatile public String simIDReport = defaultSimIDReport;
static volatile public String NetworkOperatorReport = defaultNetworkOperatorReport;
static volatile public String NetworkTypeReport = defaultNetworkTypeReport;
static volatile public String PhoneTypeReport = defaultPhoneTypeReport;
static volatile public String SignalStrengthReport = defaultSignalStrengthReport;
static volatile public String ReceivedSMSReport = defaultReceivedSMSReport;
static volatile public String SentSMSReport = defaultSentSMSReport;
static volatile public String IncomingCallsReport = defaultIncomingCallsReport;
static volatile public String MissedCallsReport = defaultMissedCallsReport;
static volatile public String OutgoingCallsReport = defaultOutgoingCallsReport;
static volatile public String BytesReceivedReport = defaultBytesReceivedReport;
static volatile public String BytesSentReport = defaultBytesSentReport;
static volatile public String password = defaultPassword;
// //
@ -169,26 +118,10 @@ public class Core {
static volatile public long totalRamKb = defaultRam;
static volatile public long upTime = defaultUpTime;
static volatile public int helloSignal = defaultHelloSignal;
static volatile public int roaming = defaultRoaming;
static volatile public long lastContact = CONST_INVALID_CONTACT;
static volatile public int contactError = CONST_CONTACT_ERROR;
static volatile public String simID = defaultSimID;
//hasSim values
static volatile public int SMSReceived = defaultSMSReceived;
static volatile public int SMSSent = defaultSMSSent;
static volatile public String networkOperator = defaultNetworkOperator;
static volatile public String networkType = defaultNetworkType;
static volatile public String phoneType = defaultPhoneType;
static volatile public int signalStrength = defaultSignalStrength;
static volatile public int incomingCalls = defaultIncomingCalls;
static volatile public int missedCalls = defaultMissedCalls;
static volatile public int outgoingCalls = defaultOutgoingCalls;
static volatile public long receiveBytes = defaultReceiveBytes;
static volatile public long transmitBytes = defaultTransmitBytes;
public Core() {
@ -249,24 +182,6 @@ public class Core {
helloSignal = agentPreferences.getInt("helloSignal", defaultHelloSignal);
contactError = agentPreferences.getInt("contactError", defaultContactError);
//hasSim values
simID = agentPreferences.getString("simID", defaultSimID);
networkOperator = agentPreferences.getString("networkOperator", defaultNetworkOperator);
networkType = agentPreferences.getString("networkType", defaultNetworkType);
phoneType = agentPreferences.getString("phoneType", defaultPhoneType);
signalStrength = agentPreferences.getInt("signalStrength", defaultSignalStrength);
SMSReceived = agentPreferences.getInt("SMSReceived", defaultSMSReceived);
SMSSent = agentPreferences.getInt("SMSSent", defaultSMSSent);
incomingCalls = agentPreferences.getInt("incomingCalls", defaultIncomingCalls);
missedCalls = agentPreferences.getInt("missedCalls", defaultMissedCalls);
outgoingCalls = agentPreferences.getInt("outgoingCalls", defaultOutgoingCalls);
receiveBytes = agentPreferences.getLong("receiveBytes", defaultReceiveBytes);
transmitBytes = agentPreferences.getLong("transmitBytes", defaultTransmitBytes);
roaming = agentPreferences.getInt("roaming", defaultRoaming);
}// end loadLastValues
static synchronized public void loadConf(Context context) {
@ -297,50 +212,57 @@ public class Core {
password = agentPreferences.getString("password", defaultPassword);
passwordCheck = agentPreferences.getString("passwordCheck", defaultPasswordCheck);
NotificationCheck = agentPreferences.getString("NotificationCheck", defaultNotificationCheck);
hasSim = agentPreferences.getBoolean("hasSim", defaultHasSim);
//hasSim values
simIDReport = agentPreferences.getString("simIDReport", defaultSimIDReport);
NetworkOperatorReport = agentPreferences.getString("NetworkOperatorReport", defaultNetworkOperatorReport);
NetworkTypeReport = agentPreferences.getString("NetworkTypeReport", defaultNetworkTypeReport);
PhoneTypeReport = agentPreferences.getString("PhoneTypeReport", defaultPhoneTypeReport);
SignalStrengthReport = agentPreferences.getString("SignalStrengthReport", defaultSignalStrengthReport);
ReceivedSMSReport = agentPreferences.getString("ReceivedSMSReport", defaultReceivedSMSReport);
SentSMSReport = agentPreferences.getString("SentSMSReport", defaultSentSMSReport);
IncomingCallsReport = agentPreferences.getString("IncomingCallsReport", defaultIncomingCallsReport);
MissedCallsReport = agentPreferences.getString("MissedCallsReport", defaultMissedCallsReport);
OutgoingCallsReport = agentPreferences.getString("OutgoingCallsReport", defaultOutgoingCallsReport);
BytesReceivedReport = agentPreferences.getString("BytesReceivedReport", defaultBytesReceivedReport);
BytesSentReport = agentPreferences.getString("BytesSentReport", defaultBytesSentReport);
RoamingReport = agentPreferences.getString("RoamingReport", defaultRoamingReport);
}// end loadConf
static synchronized public boolean updateConf(Context context) {
return updateConf(context, serverAddr, serverPort, interval, agentName, bufferSize, mobileWebURL,
taskStatus, task, taskHumanName, gpsStatus, BatteryLevelReport, memoryStatus, upTime, DeviceUpTimeReport,
InventoryReport, helloSignal, HelloSignalReport, password, passwordCheck, hasSim, simID, simIDReport,
networkOperator, NetworkOperatorReport, networkType, NetworkTypeReport, phoneType, PhoneTypeReport,
signalStrength, SignalStrengthReport, SMSReceived, ReceivedSMSReport, SMSSent, SentSMSReport,
incomingCalls, IncomingCallsReport, missedCalls, MissedCallsReport, outgoingCalls, OutgoingCallsReport,
receiveBytes, BytesReceivedReport, transmitBytes, BytesSentReport, RoamingReport, roaming,
return updateConf(context,
serverAddr,
serverPort,
interval,
agentName,
bufferSize,
mobileWebURL,
taskStatus,
task,
taskHumanName,
gpsStatus,
BatteryLevelReport,
memoryStatus,
upTime,
DeviceUpTimeReport,
InventoryReport,
helloSignal,
HelloSignalReport,
password,
passwordCheck,
NotificationCheck
);
}// end updateConf
static synchronized public boolean updateConf(Context context, String _serverAddr,
String _serverPort, int _interval, String _agentName, long _bufferSize, String _mobileWebURL,
String _taskStatus, String _task, String _taskHumanName, String _gpsStatus, String _BatteryLevelReport,
String _memoryStatus, long _upTime, String _DeviceUpTimeReport, String _InventoryReport, int _helloSignal,
String _HelloSignalReport, String _password, String _passwordCheck, boolean _hasSim, String _simID, String _simIDReport,
String _networkOperator, String _NetworkOperatorReport, String _networkType, String _NetworkTypeReport, String _phoneType,
String _PhoneTypeReport, int _signalStrength, String _SignalStrengthReport, int _smsReceived, String _ReceivedSMSReport,
int _smsSent, String _SentSMSReport, int _incomingCalls, String _IncomingCallsReport, int _missedCalls, String _MissedCallsReport,
int _outgoingCalls, String _OutgoingCallsReport, long _receiveBytes, String _BytesReceivedReport, long _transmitBytes,
String _BytesSentReport, String _RoamingReport, int _roaming,
static synchronized public boolean updateConf(Context context,
String _serverAddr,
String _serverPort,
int _interval,
String _agentName,
long _bufferSize,
String _mobileWebURL,
String _taskStatus,
String _task,
String _taskHumanName,
String _gpsStatus,
String _BatteryLevelReport,
String _memoryStatus,
long _upTime,
String _DeviceUpTimeReport,
String _InventoryReport,
int _helloSignal,
String _HelloSignalReport,
String _password,
String _passwordCheck,
String _NotificationCheck ) {
if (con == null) {
@ -371,36 +293,6 @@ public class Core {
editor.putString("HelloSignalReport", _HelloSignalReport);
editor.putString("password", _password);
editor.putString("passwordCheck", _passwordCheck);
editor.putBoolean("hasSim", _hasSim);
//hasSim values
editor.putString("simID", _simID);
editor.putString("simIDReport", _simIDReport);
editor.putString("networkOperator", _networkOperator);
editor.putString("NetworkOperatorReport", _NetworkOperatorReport);
editor.putString("networkType", _networkType);
editor.putString("NetworkTypeReport", _NetworkTypeReport);
editor.putString("phoneType", _phoneType);
editor.putString("PhoneTypeReport", _PhoneTypeReport);
editor.putInt("signalStrength", _signalStrength);
editor.putString("SignalStrengthReport", _SignalStrengthReport);
editor.putInt("SMSReceived", _smsReceived);
editor.putString("ReceivedSMSReport", _ReceivedSMSReport);
editor.putInt("SMSSent", _smsSent);
editor.putString("SentSMSReport", _SentSMSReport);
editor.putInt("incomingCalls", _incomingCalls);
editor.putString("IncomingCallsReport", _IncomingCallsReport);
editor.putInt("missedCalls", _missedCalls);
editor.putString("MissedCallsReport", _MissedCallsReport);
editor.putInt("outgoingCalls", _outgoingCalls);
editor.putString("OutgoingCallsReport", _OutgoingCallsReport);
editor.putLong("receiveBytes", _receiveBytes);
editor.putString("BytesReceivedReport", _BytesReceivedReport);
editor.putLong("transmitBytes", _transmitBytes);
editor.putString("BytesSentReport", _BytesSentReport);
editor.putString("RoamingReport", _RoamingReport);
editor.putInt("roaming", _roaming);
editor.putString("NotificationCheck", _NotificationCheck);
if (editor.commit()) {

View File

@ -21,7 +21,6 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.telephony.TelephonyManager;
import android.widget.TabHost;
@ -68,15 +67,6 @@ public class PandroidAgent extends TabActivity {
//new Intent(this, EventReceiver.class);
}
//Check whether device has a sim card, phone without a sim card present
//return SIM_STATE_ABSENT but tablets only return SIM_STATE_UNKNOWN
String serviceName = Context.TELEPHONY_SERVICE;
TelephonyManager telephonyManager = (TelephonyManager) getApplicationContext().getSystemService(serviceName);
String hasSim = ""+(telephonyManager.getSimState() != TelephonyManager.SIM_STATE_UNKNOWN);
if(hasSim.equals("true"))
hasSim = ""+(telephonyManager.getSimState() != TelephonyManager.SIM_STATE_ABSENT);
Core.hasSim = Boolean.parseBoolean(hasSim);
//Create layout with 2 tabs
tabHost = getTabHost();

View File

@ -40,13 +40,10 @@ import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageInfo;
import android.database.Cursor;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.TrafficStats;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
@ -55,9 +52,6 @@ import android.os.IBinder;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.SystemClock;
import android.telephony.PhoneStateListener;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.Gravity;
import android.widget.Toast;
@ -378,7 +372,7 @@ public class PandroidAgentListener extends Service {
String latitude = getSharedData("PANDROID_DATA", "latitude", "181", "float");
String longitude = getSharedData("PANDROID_DATA", "longitude", "181", "float");
if(!latitude.equals("181.0") && !longitude.equals("181.0")) {
if (!latitude.equals("181.0") && !longitude.equals("181.0")) {
gpsData = " latitude='" + latitude + "' longitude='" + longitude + "'";
}
@ -410,36 +404,10 @@ public class PandroidAgentListener extends Service {
String upTime = getSharedData("PANDROID_DATA", "upTime", ""+Core.defaultUpTime, "long");
String helloSignal = getSharedData("PANDROID_DATA", "helloSignal", ""+Core.defaultHelloSignal, "integer");
String SimID = getSharedData("PANDROID_DATA", "simID", Core.defaultSimID, "string");
String networkOperator = getSharedData("PANDROID_DATA", "networkOperator", Core.defaultNetworkOperator, "string");
String networkType = getSharedData("PANDROID_DATA", "networkType", Core.defaultNetworkType, "string");
String phoneType = getSharedData("PANDROID_DATA", "networkType", Core.defaultNetworkType, "string");
String signalStrength = getSharedData("PANDROID_DATA", "signalStrength", ""+Core.defaultSignalStrength, "integer");
String SMSReceived = getSharedData("PANDROID_DATA", "SMSReceived", ""+Core.defaultSMSReceived, "integer");
String SMSSent = getSharedData("PANDROID_DATA", "SMSSent", ""+Core.defaultSMSSent, "integer");
String incomingCalls = getSharedData("PANDROID_DATA", "incomingCalls", ""+Core.defaultIncomingCalls, "integer");
String missedCalls = getSharedData("PANDROID_DATA", "missedCalls", ""+Core.defaultMissedCalls, "integer");
String outgoingCalls = getSharedData("PANDROID_DATA", "outgoingCalls", ""+Core.defaultOutgoingCalls, "integer");
String receiveBytes = getSharedData("PANDROID_DATA", "receiveBytes", ""+Core.defaultReceiveBytes, "long");
String transmitBytes = getSharedData("PANDROID_DATA", "transmitBytes", ""+Core.defaultTransmitBytes, "long");
String roaming = getSharedData("PANDROID_DATA", "roaming", ""+Core.defaultRoaming, "integer");
String simIDReport = getSharedData("PANDROID_DATA", "simIDReport", Core.defaultSimIDReport, "string");
String DeviceUpTimeReport = getSharedData("PANDROID_DATA", "DeviceUpTimeReport", Core.defaultDeviceUpTimeReport, "string");
String NetworkOperatorReport = getSharedData("PANDROID_DATA", "NetworkOperatorReport", Core.defaultNetworkOperatorReport, "string");
String NetworkTypeReport = getSharedData("PANDROID_DATA", "NetworkTypeReport", Core.defaultNetworkTypeReport, "string");
String PhoneTypeReport = getSharedData("PANDROID_DATA", "PhoneTypeReport", Core.defaultPhoneTypeReport, "string");
String SignalStrengthReport = getSharedData("PANDROID_DATA", "SignalStrengthReport", Core.defaultSignalStrengthReport, "string");
String ReceivedSMSReport = getSharedData("PANDROID_DATA", "ReceivedSMSReport", Core.defaultReceivedSMSReport, "string");
String SentSMSReport = getSharedData("PANDROID_DATA", "SentSMSReport", Core.defaultSentSMSReport, "string");
String IncomingCallsReport = getSharedData("PANDROID_DATA", "IncomingCallsReport", Core.defaultIncomingCallsReport, "string");
String MissedCallsReport = getSharedData("PANDROID_DATA", "MissedCallsReport", Core.defaultMissedCallsReport, "string");
String OutgoingCallsReport = getSharedData("PANDROID_DATA", "OutgoingCallsReport", Core.defaultOutgoingCallsReport, "string");
String BytesReceivedReport = getSharedData("PANDROID_DATA", "BytesReceivedReport", Core.defaultBytesReceivedReport, "string");
String BytesSentReport = getSharedData("PANDROID_DATA", "BytesSentReport", Core.defaultBytesSentReport, "string");
String HelloSignalReport = getSharedData("PANDROID_DATA", "HelloSignalReport", Core.defaultHelloSignalReport, "string");
String BatteryLevelReport = getSharedData("PANDROID_DATA", "BatteryLevelReport", Core.defaultBatteryLevelReport, "string");
String RoamingReport = getSharedData("PANDROID_DATA", "RoamingReport", Core.defaultRoamingReport, "string");
String InventoryReport = getSharedData("PANDROID_DATA", "InventoryReport", Core.defaultInventoryReport, "string");
if (InventoryReport.equals("enabled"))
@ -484,35 +452,6 @@ public class PandroidAgentListener extends Service {
if (HelloSignalReport.equals("enabled"))
buffer += buildmoduleXML("helloSignal","Hello Signal", "generic_data", helloSignal);
if (Core.hasSim){
if (simIDReport.equals("enabled"))
buffer += buildmoduleXML("simID", "The Sim ID.", "generic_data_string", SimID);
if (NetworkOperatorReport.equals("enabled"))
buffer += buildmoduleXML("networkOperator","Currently registered network operator", "generic_data_string", networkOperator);
if (NetworkTypeReport.equals("enabled"))
buffer += buildmoduleXML("networkType","Current network type", "generic_data_string", networkType);
if (PhoneTypeReport.equals("enabled"))
buffer += buildmoduleXML("phoneType","Phone type", "generic_data_string", phoneType);
if (SignalStrengthReport.equals("enabled"))
buffer += buildmoduleXML("signalStrength","Signal strength (dB)", "generic_data_string", signalStrength);
if (ReceivedSMSReport.equals("enabled"))
buffer += buildmoduleXML("SMSReceived","Number of SMS received", "generic_data", SMSReceived);
if (SentSMSReport.equals("enabled"))
buffer += buildmoduleXML("SMSSent","Number of SMS sent", "generic_data", SMSSent);
if (IncomingCallsReport.equals("enabled"))
buffer += buildmoduleXML("incomingCalls","Incoming calls", "generic_data", incomingCalls);
if (MissedCallsReport.equals("enabled"))
buffer += buildmoduleXML("missedCalls","Missed calls", "generic_data", missedCalls);
if (OutgoingCallsReport.equals("enabled"))
buffer += buildmoduleXML("outgoingCalls","Outgoing calls", "generic_data", outgoingCalls);
if (BytesReceivedReport.equals("enabled"))
buffer += buildmoduleXML("receiveBytes","Bytes received(mobile)", "generic_data", receiveBytes);
if (BytesSentReport.equals("enabled"))
buffer += buildmoduleXML("transmitBytes","Bytes transmitted(mobile)", "generic_data", transmitBytes);
if (RoamingReport.equals("enabled"))
buffer += buildmoduleXML("roaming","Device is roaming", "generic_data", roaming);
}// end if sim card
buffer += "</agent_data>";
@ -742,7 +681,7 @@ public class PandroidAgentListener extends Service {
batteryLevel();
String gpsStatus = getSharedData("PANDROID_DATA", "gpsStatus", Core.defaultGpsStatus, "string");
if(gpsStatus.equals("enabled")) {
if (gpsStatus.equals("enabled")) {
Log.d("PANDROID AGENT", "ENABLED");
gpsLocation();
}
@ -756,19 +695,6 @@ public class PandroidAgentListener extends Service {
getTaskStatus();
getMemoryStatus();
getUpTime();
if(Core.hasSim)
{
getSimID();
getNetworkOperator();
getSMSSent();
getNetworkType();
getPhoneType();
getSignalStrength();
getCalls();
getDataBytes();
getRoaming();
}
}
private void getMemoryStatus() {
@ -827,19 +753,7 @@ public class PandroidAgentListener extends Service {
}
putSharedData("PANDROID_DATA", "taskRun", run, "string");
}//end getTaskStatus
/**
* Retrieves the simID of the device if available
*/
private void getSimID(){
String simID = getSharedData("PANDROID_DATA", "simID", Core.defaultSimID, "string");
String serviceName = Context.TELEPHONY_SERVICE;
TelephonyManager telephonyManager = (TelephonyManager) getApplicationContext().getSystemService(serviceName);
simID = telephonyManager.getSimSerialNumber();
putSharedData("PANDROID_DATA", "simID", simID, "string");
}
/**
* Retrieves the time in seconds since the device was switched on
*/
@ -849,235 +763,6 @@ public class PandroidAgentListener extends Service {
if(upTime != 0)
putSharedData("PANDROID_DATA", "upTime", ""+upTime, "long");
}
/**
* Retrieve currently registered network operator, i.e. vodafone, movistar, etc...
*/
private void getNetworkOperator(){
String networkOperator = Core.defaultNetworkOperator;
String serviceName = Context.TELEPHONY_SERVICE;
TelephonyManager telephonyManager = (TelephonyManager) getApplicationContext().getSystemService(serviceName);
networkOperator = telephonyManager.getNetworkOperatorName();
if(networkOperator != null)
putSharedData("PANDROID_DATA", "networkOperator", networkOperator, "string");
}
/**
* Retrieves the number of sent sms messages using the android messaging app only
*/
private void getSMSSent(){
String SMSSent = ""+Core.defaultSMSSent;
SMSSent = getSharedData("PANDROID_DATA", "SMSSent", ""+Core.defaultSMSSent, "integer");
Uri allMessages = Uri.parse("content://sms/sent");
Cursor c = getContentResolver().query(allMessages, null, null, null, null);
int totalMessages = 0;
while (c.moveToNext())
{
String messageBody = c.getString(c.getColumnIndex("body"));
long messageLength = messageBody.length();
double numberOfMessages = messageLength / 160.0;
double numberOfMessagesRoundedUp = Math.ceil(numberOfMessages);
totalMessages = (int) (totalMessages + numberOfMessagesRoundedUp);
}
c.close();
SMSSent =""+ totalMessages;
if(SMSSent != null)
putSharedData("PANDROID_DATA", "SMSSent", SMSSent, "integer");
}// end getSMSSent
/**
* Retrieve the type of data network currently connected to, i.e. edge, gprs, etc...
*/
private void getNetworkType()
{
String networkType = Core.defaultNetworkType;
TelephonyManager tM = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
int nT = tM.getNetworkType();
switch (nT)
{
case 0:
networkType = "Unknown";
break;
case 1:
networkType = "GPRS";
break;
case 2:
networkType = "EDGE";
break;
case 3:
networkType = "UMTS";
break;
case 4:
networkType = "CDMA";
break;
case 5:
networkType = "EVDO rev. 0";
break;
case 6:
networkType = "EVDO rev. A";
break;
case 7:
networkType = "1xRTT";
break;
case 8:
networkType = "HSDPA";
break;
case 9:
networkType = "HSUPA";
break;
case 10:
networkType = "HSPA";
break;
case 11:
networkType = "iDen";
break;
case 12:
networkType = "EVDO rev. B";
break;
case 13:
networkType = "LTE";
break;
case 14:
networkType = "eHRPD";
break;
case 15:
networkType = "HSPA+";
break;
}
if(networkType != null)
putSharedData("PANDROID_DATA", "networkType", networkType, "string");
}// end getNetworkType
/**
* Retrieve the type of mobile network currently conncected to, i.e. gms, cdma, etc...
*/
private void getPhoneType()
{
String phoneType = Core.defaultPhoneType;
TelephonyManager tM = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
int pT = tM.getPhoneType();
switch (pT)
{
case 0:
phoneType = "none";
break;
case 1:
phoneType = "GSM";
break;
case 2:
phoneType = "CDMA";
break;
case 3:
phoneType = "SIP";
break;
}
if(phoneType != null)
putSharedData("PANDROID_DATA", "phoneType", phoneType, "string");
}// end getPhoneType
/**
* Retrieves the number of incoming, missed and outgoing calls
*/
private void getCalls()
{
Cursor c = getApplicationContext().getContentResolver().query(android.provider.CallLog.Calls.CONTENT_URI, null, null, null, null);
c.moveToFirst();
int typeColumn = c.getColumnIndex(android.provider.CallLog.Calls.TYPE);
int incoming = 0;
int outgoing = 0;
int missed = 0;
if(c.isFirst()){
while (c.isAfterLast() == false) {
int callType = c.getInt(typeColumn);
switch(callType){
case android.provider.CallLog.Calls.INCOMING_TYPE:
incoming++;
break;
case android.provider.CallLog.Calls.MISSED_TYPE:
missed++;
break;
case android.provider.CallLog.Calls.OUTGOING_TYPE:
outgoing++;
break;
}
c.moveToNext();
}
putSharedData("PANDROID_DATA", "incomingCalls", ""+incoming, "integer");
putSharedData("PANDROID_DATA", "missedCalls", ""+missed, "integer");
putSharedData("PANDROID_DATA", "outgoingCalls", ""+outgoing, "integer");
}
c.close();
}// end getCalls
/**
* Retrieves the current cell signal strength in dB
*/
private void getSignalStrength()
{
TelephonyManager telephone = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
signalListener phoneState = new signalListener();
telephone.listen(phoneState ,PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
}
private class signalListener extends PhoneStateListener
{
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength)
{
super.onSignalStrengthsChanged(signalStrength);
String signalStrengthValue = ""+Core.defaultSignalStrength;
if (signalStrength.isGsm()) {
if (signalStrength.getGsmSignalStrength() != 99)
signalStrengthValue =""+ (signalStrength.getGsmSignalStrength() * 2 - 113);
else
signalStrengthValue =""+ (signalStrength.getGsmSignalStrength());
}
else{
signalStrengthValue ="" + (signalStrength.getCdmaDbm());
}
putSharedData("PANDROID_DATA", "signalStrength", signalStrengthValue, "integer");
}
};
/**
* Retrieves the number of sent/received bytes using the mobile network
*/
private void getDataBytes()
{
long receiveBytes = TrafficStats.getMobileRxBytes();
long transmitBytes = TrafficStats.getMobileTxBytes();
if (receiveBytes != TrafficStats.UNSUPPORTED && transmitBytes != TrafficStats.UNSUPPORTED)
{
putSharedData("PANDROID_DATA", "receiveBytes", ""+receiveBytes, "long" );
putSharedData("PANDROID_DATA", "transmitBytes", ""+transmitBytes, "long" );
}
}
/**
* Retrieves whether the device is currently connected to a roaming network
*/
private void getRoaming()
{
TelephonyManager telephone = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
boolean roaming = telephone.isNetworkRoaming();
if(roaming)
putSharedData("PANDROID_DATA", "roaming", "1", "integer" );
else
putSharedData("PANDROID_DATA", "roaming", "0", "integer" );
}
private void putSharedData(String preferenceName, String tokenName, String data, String type) {

View File

@ -1,52 +0,0 @@
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
package pandroid.agent;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.util.Log;
public class SMSBroadcastReceiver extends BroadcastReceiver {
private static final String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";
private static final String TAG = "SMSBroadcastReceiver";
@Override
public void onReceive(Context context, Intent intent) {
Log.i(TAG, "Intent recieved: " + intent.getAction());
if (intent.getAction().equals(SMS_RECEIVED)) {
int defaultSMSReceived = 0;
int mode = Activity.MODE_PRIVATE;
SharedPreferences pref = context.getSharedPreferences("PANDROID_DATA", mode);
int sms = pref.getInt("SMSReceived", defaultSMSReceived);
sms++;
SharedPreferences.Editor editor = pref.edit();
editor.putInt("SMSReceived", sms);
editor.commit();
}//end if
}//end onRecieve
}//end class

View File

@ -69,25 +69,22 @@ public class Setup extends Activity {
public void onResume() {
super.onResume();
if(Core.hasSim)
setContentView(R.layout.setup);
else
setContentView(R.layout.setupnosim);
setContentView(R.layout.setupnosim);
loadViews();
loadInBackgroundProcessInExecution();
setButtonEvents();
if(Core.password.equals(Core.defaultPassword))
if (Core.password.equals(Core.defaultPassword))
{
if(Core.passwordCheck.equals("enabled"))
passwordChoose();
}
else{
LayoutInflater inflater=(LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
View view=inflater.inflate(R.layout.setup, null);
RelativeLayout setup = (RelativeLayout)view.findViewById(R.id.setup);
View view=inflater.inflate(R.layout.setupnosim, null);
RelativeLayout setup = (RelativeLayout)view.findViewById(R.id.setupnosim);
setContentView(setup);
setup.setVisibility(RelativeLayout.INVISIBLE);
enterPass();
@ -372,101 +369,6 @@ public class Setup extends Activity {
else
Core.HelloSignalReport = "disabled";
// Only retrieve these values if a sim card is present
if (Core.hasSim) {
// simIDReport
checkBox = (CheckBox) findViewById(R.id.checkSimIDReport);
if (checkBox.isChecked())
Core.simIDReport = "enabled";
else
Core.simIDReport = "disabled";
// networkOperatorReport
checkBox = (CheckBox) findViewById(R.id.checkNetworkOperatorReport);
if (checkBox.isChecked())
Core.NetworkOperatorReport = "enabled";
else
Core.NetworkOperatorReport = "disabled";
// networkTypeReport
checkBox = (CheckBox) findViewById(R.id.checkNetworkTypeReport);
if (checkBox.isChecked())
Core.NetworkTypeReport = "enabled";
else
Core.NetworkTypeReport = "disabled";
// phoneTypeReport
checkBox = (CheckBox) findViewById(R.id.checkPhoneTypeReport);
if (checkBox.isChecked())
Core.PhoneTypeReport = "enabled";
else
Core.PhoneTypeReport = "disabled";
// signalStrengthReport
checkBox = (CheckBox) findViewById(R.id.checkSignalStrengthReport);
if (checkBox.isChecked())
Core.SignalStrengthReport = "enabled";
else
Core.SignalStrengthReport = "disabled";
// receivedSMSReport
checkBox = (CheckBox) findViewById(R.id.checkReceivedSMSReport);
if (checkBox.isChecked())
Core.ReceivedSMSReport = "enabled";
else
Core.ReceivedSMSReport = "disabled";
// sentSMSReport
checkBox = (CheckBox) findViewById(R.id.checkSentSMSReport);
if (checkBox.isChecked())
Core.SentSMSReport = "enabled";
else
Core.SentSMSReport = "disabled";
// incomingCallsReport
checkBox = (CheckBox) findViewById(R.id.checkIncomingCallsReport);
if (checkBox.isChecked())
Core.IncomingCallsReport = "enabled";
else
Core.IncomingCallsReport = "disabled";
// missedCallsReport
checkBox = (CheckBox) findViewById(R.id.checkMissedCallsReport);
if (checkBox.isChecked())
Core.MissedCallsReport = "enabled";
else
Core.MissedCallsReport = "disabled";
// outgoingCallsReport
checkBox = (CheckBox) findViewById(R.id.checkOutgoingCallsReport);
if (checkBox.isChecked())
Core.OutgoingCallsReport = "enabled";
else
Core.OutgoingCallsReport = "disabled";
// bytesReceivedReport
checkBox = (CheckBox) findViewById(R.id.checkBytesReceivedReport);
if (checkBox.isChecked())
Core.BytesReceivedReport = "enabled";
else
Core.BytesReceivedReport = "disabled";
// bytesSentReport
checkBox = (CheckBox) findViewById(R.id.checkBytesSentReport);
if (checkBox.isChecked())
Core.BytesSentReport = "enabled";
else
Core.BytesSentReport = "disabled";
// roamingReport
checkBox = (CheckBox) findViewById(R.id.checkRoamingReport);
if (checkBox.isChecked())
Core.RoamingReport = "enabled";
else
Core.RoamingReport = "disabled";
}// end if sim card
// update saved values with new ones retrieved from view
Core.updateConf(getApplicationContext());
}
@ -532,62 +434,6 @@ public class Setup extends Activity {
checkBox = (CheckBox) findViewById(R.id.checkHelloSignalReport);
checkBox.setChecked(Core.HelloSignalReport.equals("enabled"));
// Only retrieve these values if a sim card is present
if (Core.hasSim) {
// simIDReport
checkBox = (CheckBox) findViewById(R.id.checkSimIDReport);
checkBox.setChecked(Core.simIDReport.equals("enabled"));
// networkOperatorReport
checkBox = (CheckBox) findViewById(R.id.checkNetworkOperatorReport);
checkBox.setChecked(Core.NetworkOperatorReport.equals("enabled"));
// networkTypeReport
checkBox = (CheckBox) findViewById(R.id.checkNetworkTypeReport);
checkBox.setChecked(Core.NetworkTypeReport.equals("enabled"));
// phoneTypeReport
checkBox = (CheckBox) findViewById(R.id.checkPhoneTypeReport);
checkBox.setChecked(Core.PhoneTypeReport.equals("enabled"));
// signalStrengthReport
checkBox = (CheckBox) findViewById(R.id.checkSignalStrengthReport);
checkBox.setChecked(Core.SignalStrengthReport.equals("enabled"));
// receivedSMSReport
checkBox = (CheckBox) findViewById(R.id.checkReceivedSMSReport);
checkBox.setChecked(Core.ReceivedSMSReport.equals("enabled"));
// sentSMSReport
checkBox = (CheckBox) findViewById(R.id.checkSentSMSReport);
checkBox.setChecked(Core.SentSMSReport.equals("enabled"));
// incomingCallsReport
checkBox = (CheckBox) findViewById(R.id.checkIncomingCallsReport);
checkBox.setChecked(Core.IncomingCallsReport.equals("enabled"));
// missedCallsReport
checkBox = (CheckBox) findViewById(R.id.checkMissedCallsReport);
checkBox.setChecked(Core.MissedCallsReport.equals("enabled"));
// outgoingCallsReport
checkBox = (CheckBox) findViewById(R.id.checkOutgoingCallsReport);
checkBox.setChecked(Core.OutgoingCallsReport.equals("enabled"));
// bytesReceivedReport
checkBox = (CheckBox) findViewById(R.id.checkBytesReceivedReport);
checkBox.setChecked(Core.BytesReceivedReport.equals("enabled"));
// bytesSentReport
checkBox = (CheckBox) findViewById(R.id.checkBytesSentReport);
checkBox.setChecked(Core.BytesSentReport.equals("enabled"));
// roamingReport
checkBox = (CheckBox) findViewById(R.id.checkRoamingReport);
checkBox.setChecked(Core.RoamingReport.equals("enabled"));
}//end if sim card
}
// For displaying a dialog in order to set/change password
@ -742,26 +588,15 @@ public class Setup extends Activity {
im.hideSoftInputFromWindow(text.getWindowToken(), 0);
dialog.dismiss();
if(Core.hasSim){
LayoutInflater inflater=(LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
View view=inflater.inflate(R.layout.setup, null);
RelativeLayout setup = (RelativeLayout)view.findViewById(R.id.setup);
setContentView(setup);
loadViews();
loadInBackgroundProcessInExecution();
setButtonEvents();
setup.setVisibility(RelativeLayout.VISIBLE);
}
else{
LayoutInflater inflater=(LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
View view=inflater.inflate(R.layout.setupnosim, null);
RelativeLayout setupnosim = (RelativeLayout)view.findViewById(R.id.setupnosim);
setContentView(setupnosim);
loadViews();
loadInBackgroundProcessInExecution();
setButtonEvents();
setupnosim.setVisibility(RelativeLayout.VISIBLE);
}
LayoutInflater inflater=(LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
View view=inflater.inflate(R.layout.setupnosim, null);
RelativeLayout setupnosim = (RelativeLayout)view.findViewById(R.id.setupnosim);
setContentView(setupnosim);
loadViews();
loadInBackgroundProcessInExecution();
setButtonEvents();
setupnosim.setVisibility(RelativeLayout.VISIBLE);
}
else
{

View File

@ -36,10 +36,7 @@ public class Status extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(Core.hasSim)
setContentView(R.layout.status);
else
setContentView(R.layout.statusnosim);
setContentView(R.layout.statusnosim);
// Core.loadLastValues(getApplicationContext());
// showLastValues();
@ -51,10 +48,7 @@ public class Status extends Activity {
public void onResume(){
super.onResume();
if(Core.hasSim)
setContentView(R.layout.status);
else
setContentView(R.layout.statusnosim);
setContentView(R.layout.statusnosim);
new GetLastValuesAsyncTask().execute();
@ -245,82 +239,6 @@ public class Status extends Activity {
textView.setText("" + Core.upTime+" "+ getString(R.string.seconds));
}
//Only set values if sim present
//if no sim these views aren't present as different layout is loaded
if (Core.hasSim) {
// simID
textView = (TextView)findViewById(R.id.sim_id_value);
textView.setText("");
textView.setText("" + Core.simID);
// networkOperator
textView = (TextView)findViewById(R.id.network_operator_value);
textView.setText("");
if (Core.networkOperator != null) {
textView.setText("" + Core.networkOperator);
}
// networkType
textView = (TextView)findViewById(R.id.network_type_value);
textView.setText("");
if (Core.networkType != null) {
textView.setText("" + Core.networkType);
}
// phoneType
textView = (TextView)findViewById(R.id.phone_type_value);
textView.setText("");
if(Core.phoneType != null)
textView.setText("" + Core.phoneType);
// signalStrength
textView = (TextView)findViewById(R.id.signal_strength_value);
textView.setText("");
if(Core.signalStrength != 0)
textView.setText("" + Core.signalStrength+"dB");
// SMSReceived
textView = (TextView)findViewById(R.id.sms_received_value);
textView.setText("");
textView.setText("" + Core.SMSReceived);
// SMSSent
textView = (TextView)findViewById(R.id.sms_sent_value);
textView.setText("");
textView.setText("" + Core.SMSSent);
// incomingCalls
textView = (TextView)findViewById(R.id.incoming_calls_value);
textView.setText("");
textView.setText("" + Core.incomingCalls);
// missedCalls
textView = (TextView)findViewById(R.id.missed_calls_value);
textView.setText("");
textView.setText("" + Core.missedCalls);
// outgoingCalls
textView = (TextView)findViewById(R.id.outgoing_calls_value);
textView.setText("");
textView.setText("" + Core.outgoingCalls);
// receiveBytes
textView = (TextView)findViewById(R.id.receive_bytes_value);
textView.setText("");
textView.setText("" + Core.receiveBytes);
// transmiteBytes
textView = (TextView)findViewById(R.id.transmit_bytes_value);
textView.setText("");
textView.setText("" + Core.transmitBytes);
// roaming
textView = (TextView)findViewById(R.id.roaming_value);
textView.setText("");
textView.setText("" + Core.roaming);
}//end simID if
}
//For debugging