2013-05-14 Mark Holland <mark@mark-holland.me.uk>

* src/pandroid/agent/PandroidAgentListener.java: Moved the 
	loading	of the config values to an asynctask to force that updating 
	the values and then contacting the server and creating the 
	notification happens after all the config values have been loaded.

	* src/pandroid/agent/Status.java: On resuming the app
	the loading of the last values has been moved to an asynctask to force
	updating the ui to wait for all the values to be loaded.

	* src/pandroid/agent/*.java: Applied the Correct Indentation function
	of eclipse to all code.

	* res/layout/*.xml: Applied the Correct Indentation function
	of eclipse to all code.

	* Pandroid Agent v3.0_iso-8859-1.apk: Updated to latest version.

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8127 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
markholland 2013-05-14 06:59:20 +00:00
parent 1c49e57a52
commit fe4bcdc14a
23 changed files with 2560 additions and 2571 deletions

View File

@ -15,78 +15,79 @@
// GNU General Public License for more details.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pandroid.agent"
android:versionCode="2"
android:versionName="1.5">
package="pandroid.agent"
android:versionCode="2"
android:versionName="1.5" >
<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-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-feature android:name="android.hardware.sensor.light" />
<uses-feature android:name="android.hardware.location" />
<application android:icon="@drawable/ic_launcher" android:label="@string/app_name">
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".PandroidAgent"
android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation"
android:theme="@style/MainTheme"
>
android:name=".PandroidAgent"
android:configChanges="keyboardHidden|orientation"
android:label="@string/app_name"
android:theme="@style/MainTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Status" />
<activity android:name=".Setup" />
<service android:enabled="true" android:name="pandroid.agent.PandroidAgentListener" />
<receiver android:name="pandroid.agent.EventReceiver" />
<service
android:name="pandroid.agent.PandroidAgentListener"
android:enabled="true" />
<receiver
android:name="pandroid.agent.StartMyServiceAtBootReceiver"
android:enabled="true"
android:exported="true"
android:label="StartMyServiceAtBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service android:enabled="true" android:name="pandroid.agent.MyStartService" />
<activity
android:name=".About"
android:label="@string/pandroid_agent_str"
android:theme="@android:style/Theme.Dialog"
/>
<activity
android:name=".Help"
android:label="@string/help_str"
android:theme="@android:style/Theme.Dialog"
/>
<receiver android:name=".SMSBroadcastReceiver">
<receiver android:name="pandroid.agent.EventReceiver" />
<receiver
android:name="pandroid.agent.StartMyServiceAtBootReceiver"
android:enabled="true"
android:exported="true"
android:label="StartMyServiceAtBootReceiver" >
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED"></action>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service
android:name="pandroid.agent.MyStartService"
android:enabled="true" />
<activity
android:name=".About"
android:label="@string/pandroid_agent_str"
android:theme="@android:style/Theme.Dialog" />
<activity
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>
<uses-sdk android:minSdkVersion="8" />
<uses-sdk android:minSdkVersion="8"/>
</manifest>

View File

@ -1,3 +1,22 @@
2013-05-14 Mark Holland <mark@mark-holland.me.uk>
* src/pandroid/agent/PandroidAgentListener.java: Moved the
loading of the config values to an asynctask to force that updating
the values and then contacting the server and creating the
notification happens after all the config values have been loaded.
* src/pandroid/agent/Status.java: On resuming the app
the loading of the last values has been moved to an asynctask to force
updating the ui to wait for all the values to be loaded.
* src/pandroid/agent/*.java: Applied the Correct Indentation function
of eclipse to all code.
* res/layout/*.xml: Applied the Correct Indentation function
of eclipse to all code.
* Pandroid Agent v3.0_iso-8859-1.apk: Updated to latest version.
2013-05-01 Mark Holland <mark@mark-holland.me.uk>
* src/pandroid/agent/PandroidAgentListener.java: Changed gps module

View File

@ -20,36 +20,36 @@
android:orientation="vertical"
android:padding="10dip" >
<ImageView
android:id="@+id/img_logo_about"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0"
android:contentDescription="@string/about_desc"
android:src="@drawable/pandorafms_logo" />
<ImageView
android:id="@+id/img_logo_about"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0"
android:contentDescription="@string/about_desc"
android:src="@drawable/pandorafms_logo" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pandroid_agent_copyright" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/licensed_under_gpl_str" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:text="@string/develop_team_str" />
<TextView
android:id="@+id/url_pandora"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pandroid_agent_copyright"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/licensed_under_gpl_str"
android:gravity="center_horizontal"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/develop_team_str"
android:gravity="left"
/>
<TextView
android:id="@+id/url_pandora"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
/>
</LinearLayout>

View File

@ -14,25 +14,22 @@
// 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:orientation="vertical"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip"
android:background="#000000"
>
android:orientation="vertical"
android:padding="10dip" >
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="@+id/help_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</ScrollView>
<TextView
android:id="@+id/help_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</ScrollView>
</LinearLayout>

View File

@ -12,7 +12,8 @@
// 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.-->
// GNU General Public License for more details.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/p"
android:layout_width="fill_parent"
@ -28,7 +29,6 @@
android:layout_marginTop="50dp"
android:text="@string/yes" />
<Button
android:id="@+id/no_button"
style="?android:attr/buttonStyleSmall"

View File

@ -12,12 +12,12 @@
// 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. -->
// GNU General Public License for more details.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/setupnosim"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
@ -36,10 +36,10 @@
android:id="@+id/checkNotification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="5sp"
android:text="@string/notificationCheck"
android:textColor="#bbbbbb"
android:textSize="14sp"
android:paddingTop="5sp"/>
android:textSize="14sp" />
<TextView
android:id="@+id/field1"
@ -217,18 +217,17 @@
android:layout_height="wrap_content"
android:text="@string/set_password" />
<Button
<Button
android:id="@+id/stopAgent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/stopAgent" />
<Button
<Button
android:id="@+id/restartAgent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/restartAgent" />
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -2,5 +2,6 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="#00FF00">
android:textColor="#00FF00" >
</TextView>

View File

@ -14,108 +14,94 @@
// 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"
<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" >
<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" >
<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" />
<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" >
<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" />
<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" />
<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_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/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_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/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_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/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"
@ -146,355 +132,310 @@
android:layout_height="wrap_content"
android:layout_below="@id/proximity_label_str"
/>
-->
</RelativeLayout>
-->
</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_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/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_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"
/>
<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"
/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.18" >
<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"
>
<TableRow
android:id="@+id/tableRow0"
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/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/sim_id_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TextView
android:id="@+id/uptime_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"
>
<TableRow
android:id="@+id/tableRow1"
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:text="@string/network_operator"
android:textSize="14sp"
android:textStyle="bold"
android:paddingRight="5dip"
/>
<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/network_operator_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TextView
android:id="@+id/sim_id_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"
>
<TableRow
android:id="@+id/tableRow2"
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_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_type_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/network_operator_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TableRow
android:id="@+id/tableRow4"
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/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/network_type_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TextView
android:id="@+id/phone_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" >
<TableRow
android:id="@+id/tableRow5"
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/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/phone_type_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TextView
android:id="@+id/signal_strength_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" >
<TableRow
android:id="@+id/tableRow6"
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/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/signal_strength_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TextView
android:id="@+id/sms_received_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" >
<TableRow
android:id="@+id/tableRow7"
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_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_received_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TextView
android:id="@+id/sms_sent_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" >
<TableRow
android:id="@+id/tableRow8"
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/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/sms_sent_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TextView
android:id="@+id/incoming_calls_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" >
<TableRow
android:id="@+id/tableRow9"
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/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/incoming_calls_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TextView
android:id="@+id/missed_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" >
<TableRow
android:id="@+id/tableRow10"
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/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/missed_calls_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TextView
android:id="@+id/outgoing_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" >
<TableRow
android:id="@+id/tableRow11"
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/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/outgoing_calls_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TextView
android:id="@+id/receive_bytes_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" >
<TableRow
android:id="@+id/tableRow12"
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/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/receive_bytes_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TextView
android:id="@+id/transmit_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" >
<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/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/roaming_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/transmit_bytes_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
</TableRow>
</TableLayout>
<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" />
<!-- for debugging
<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"
@ -527,8 +468,8 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hide xml" />
-->
</LinearLayout>
-->
</LinearLayout>
</ScrollView>
</ScrollView>
</LinearLayout>

View File

@ -17,10 +17,6 @@
android:paddingTop="20dp"
android:src="@drawable/pandroid_large" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"

View File

@ -14,15 +14,15 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/help_button_menu_options"
android:title="@string/help_label_str"
android:icon="@drawable/help"
/>
<item
android:id="@+id/about_button_menu_options"
android:title="@string/about_label_str"
android:icon="@drawable/about"
/>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/help_button_menu_options"
android:icon="@drawable/help"
android:title="@string/help_label_str"/>
<item
android:id="@+id/about_button_menu_options"
android:icon="@drawable/about"
android:title="@string/about_label_str"/>
</menu>

View File

@ -22,13 +22,13 @@ import android.widget.TextView;
public class About extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.about);
setContentView(R.layout.about);
TextView text = (TextView) findViewById(R.id.url_pandora);
text.setText(Html.fromHtml("<a href='http://pandorafms.com/'>PandoraFMS.com</a>"));
text.setMovementMethod(LinkMovementMethod.getInstance());
TextView text = (TextView) findViewById(R.id.url_pandora);
text.setText(Html.fromHtml("<a href='http://pandorafms.com/'>PandoraFMS.com</a>"));
text.setMovementMethod(LinkMovementMethod.getInstance());
}
}

View File

@ -42,163 +42,163 @@ public class Core {
// DEFAULT CONFIGURATION MODULES //
// //
static volatile public String defaultServerAddr = "firefly.artica.es"; //master address
static volatile public String defaultServerPort = "41121";
static volatile public int defaultInterval = 300;
static volatile public String defaultAgentName = "pandroid";
static volatile public long defaultBufferSize = 256;
static volatile public String defaultmobileWebURL = "firefly.artica.es/pandora_demo/mobile";
static volatile public String defaultTaskStatus = "disabled"; // "disabled" or "enabled"
static volatile public String defaultGpsStatus = "enabled"; // "disabled" or "enabled"
static volatile public String defaultBatteryLevelReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultMemoryStatus = "enabled"; // "disabled" or "enabled"
static volatile public String defaultPasswordCheck = "enabled"; // "disabled" or "enabled"
static volatile public String defaultDeviceUpTimeReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultInventoryReport = "disabled"; // "disabled" or "enabled"
static volatile public String defaultHelloSignalReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultNotificationCheck = "enabled"; // "disabled" or "enabled"
static volatile public String defaultServerAddr = "firefly.artica.es"; //master address
static volatile public String defaultServerPort = "41121";
static volatile public int defaultInterval = 300;
static volatile public String defaultAgentName = "pandroid";
static volatile public long defaultBufferSize = 256;
static volatile public String defaultmobileWebURL = "firefly.artica.es/pandora_demo/mobile";
static volatile public String defaultTaskStatus = "disabled"; // "disabled" or "enabled"
static volatile public String defaultGpsStatus = "enabled"; // "disabled" or "enabled"
static volatile public String defaultBatteryLevelReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultMemoryStatus = "enabled"; // "disabled" or "enabled"
static volatile public String defaultPasswordCheck = "enabled"; // "disabled" or "enabled"
static volatile public String defaultDeviceUpTimeReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultInventoryReport = "disabled"; // "disabled" or "enabled"
static volatile public String defaultHelloSignalReport = "enabled"; // "disabled" or "enabled"
static volatile public String defaultNotificationCheck = "enabled"; // "disabled" or "enabled"
static volatile public boolean defaultHasSim = false;
static volatile public boolean defaultHasSim = false;
//hasSim values
//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"
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 //
// //
// //
// DEFAULT MODULE VALUES //
// //
static volatile public String defaultTask = "";
static volatile public String defaultTaskHumanName = "";
static volatile public String defaultTaskRun = "false";
static volatile public long defaultRam = 0;
static volatile public long defaultContact = 0;
static volatile public int defaultContactError = 0;
static volatile public long defaultUpTime = 0;
static volatile public int defaultHelloSignal = 2;
static volatile public String defaultTask = "";
static volatile public String defaultTaskHumanName = "";
static volatile public String defaultTaskRun = "false";
static volatile public long defaultRam = 0;
static volatile public long defaultContact = 0;
static volatile public int defaultContactError = 0;
static volatile public long defaultUpTime = 0;
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;
//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 String defaultPassword = "";
static volatile public Context con = null;
static volatile public AlarmManager am = null;
static volatile public PendingIntent sender = null;
static volatile public boolean alarmEnabled = false;
static volatile public Context con = null;
static volatile public AlarmManager am = null;
static volatile public PendingIntent sender = null;
static volatile public boolean alarmEnabled = false;
// //
// CONFIGURATION VALUES //
// //
// //
// CONFIGURATION VALUES //
// //
static volatile public String serverAddr = defaultServerAddr;
static volatile public String serverPort = defaultServerPort;
static volatile public int interval = defaultInterval;
static volatile public String agentName = defaultAgentName;
static volatile public long bufferSize = defaultBufferSize;
static volatile public String mobileWebURL = defaultmobileWebURL;
static volatile public String taskStatus = defaultTaskStatus;
static volatile public String task = defaultTask;
static volatile public String taskHumanName = defaultTaskHumanName;
static volatile public String gpsStatus = defaultGpsStatus;
static volatile public String BatteryLevelReport = defaultHelloSignalReport;
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 HelloSignalReport = defaultHelloSignalReport;
static volatile public String RoamingReport = defaultRoamingReport;
static volatile public String NotificationCheck = defaultNotificationCheck;
static volatile public String serverAddr = defaultServerAddr;
static volatile public String serverPort = defaultServerPort;
static volatile public int interval = defaultInterval;
static volatile public String agentName = defaultAgentName;
static volatile public long bufferSize = defaultBufferSize;
static volatile public String mobileWebURL = defaultmobileWebURL;
static volatile public String taskStatus = defaultTaskStatus;
static volatile public String task = defaultTask;
static volatile public String taskHumanName = defaultTaskHumanName;
static volatile public String gpsStatus = defaultGpsStatus;
static volatile public String BatteryLevelReport = defaultHelloSignalReport;
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 HelloSignalReport = defaultHelloSignalReport;
static volatile public String RoamingReport = defaultRoamingReport;
static volatile public String NotificationCheck = defaultNotificationCheck;
//hasSim values
//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 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;
static volatile public String password = defaultPassword;
// //
// MODULES VALUES //
// //
// //
// MODULES VALUES //
// //
static volatile public float latitude = CONST_INVALID_COORDS;
static volatile public float longitude = CONST_INVALID_COORDS;
static volatile public int batteryLevel = CONST_INVALID_BATTERY_LEVEL;
static volatile public float orientation = CONST_INVALID_ORIENTATION;
static volatile public float proximity = CONST_INVALID_PROXIMITY;
static volatile public String taskRun = defaultTaskRun;
static volatile public long availableRamKb = defaultRam;
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 float latitude = CONST_INVALID_COORDS;
static volatile public float longitude = CONST_INVALID_COORDS;
static volatile public int batteryLevel = CONST_INVALID_BATTERY_LEVEL;
static volatile public float orientation = CONST_INVALID_ORIENTATION;
static volatile public float proximity = CONST_INVALID_PROXIMITY;
static volatile public String taskRun = defaultTaskRun;
static volatile public long availableRamKb = defaultRam;
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;
static volatile public long lastContact = CONST_INVALID_CONTACT;
static volatile public int contactError = CONST_CONTACT_ERROR;
static volatile public String simID = defaultSimID;
//hasSim values
//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;
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() {
public Core() {
}
}
static synchronized public void startAgentListener(Context context) {
if (con == null) {
con = context;
}
loadConf(con);
static synchronized public void startAgentListener(Context context) {
if (con == null) {
con = context;
}
loadConf(con);
Intent intentReceiver = new Intent(con, EventReceiver.class);
@ -206,17 +206,17 @@ public class Core {
am = (AlarmManager)con.getSystemService(Context.ALARM_SERVICE);
alarmEnabled = true;
am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), (interval * 1000), sender);
alarmEnabled = true;
am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), (interval * 1000), sender);
}// end startAgentListener
}// end startAgentListener
static synchronized public void stopAgentListener() {
if (am != null){
am.cancel(sender);
alarmEnabled = false;
}
}
static synchronized public void stopAgentListener() {
if (am != null){
am.cancel(sender);
alarmEnabled = false;
}
}
static synchronized public void restartAgentListener(Context context) {
stopAgentListener();
@ -224,21 +224,21 @@ public class Core {
}
static synchronized public void loadLastValues(Context context) {
if (con == null) {
con = context;
}
if (con == null) {
con = context;
}
SharedPreferences agentPreferences = con.getSharedPreferences(
con.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
SharedPreferences agentPreferences = con.getSharedPreferences(
con.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
lastContact = agentPreferences.getLong("lastContact", defaultContact);
lastContact = agentPreferences.getLong("lastContact", defaultContact);
latitude = agentPreferences.getFloat("latitude", CONST_INVALID_COORDS);
longitude = agentPreferences.getFloat("longitude", CONST_INVALID_COORDS);
batteryLevel = agentPreferences.getInt("batteryLevel", CONST_INVALID_BATTERY_LEVEL);
// orientation = agentPreferences.getFloat("orientation", CONST_INVALID_ORIENTATION);
// proximity = agentPreferences.getFloat("proximity", CONST_INVALID_PROXIMITY);
taskStatus = agentPreferences.getString("taskStatus", defaultTaskStatus);
longitude = agentPreferences.getFloat("longitude", CONST_INVALID_COORDS);
batteryLevel = agentPreferences.getInt("batteryLevel", CONST_INVALID_BATTERY_LEVEL);
// orientation = agentPreferences.getFloat("orientation", CONST_INVALID_ORIENTATION);
// proximity = agentPreferences.getFloat("proximity", CONST_INVALID_PROXIMITY);
taskStatus = agentPreferences.getString("taskStatus", defaultTaskStatus);
task = agentPreferences.getString("task", defaultTask);
taskHumanName = agentPreferences.getString("taskHumanName", defaultTaskHumanName);
taskRun = agentPreferences.getString("taskRun", defaultTaskRun);
@ -267,16 +267,16 @@ public class Core {
transmitBytes = agentPreferences.getLong("transmitBytes", defaultTransmitBytes);
roaming = agentPreferences.getInt("roaming", defaultRoaming);
}// end loadLastValues
}// end loadLastValues
static synchronized public void loadConf(Context context) {
if (con == null) {
con = context;
}
static synchronized public void loadConf(Context context) {
if (con == null) {
con = context;
}
SharedPreferences agentPreferences = con.getSharedPreferences(
con.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
SharedPreferences agentPreferences = con.getSharedPreferences(
con.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
serverAddr = agentPreferences.getString("serverAddr", defaultServerAddr);
serverPort = agentPreferences.getString("serverPort", defaultServerPort);
@ -290,66 +290,66 @@ public class Core {
taskRun = agentPreferences.getString("taskRun", defaultTaskRun);
gpsStatus = agentPreferences.getString("gpsStatus", defaultGpsStatus);
BatteryLevelReport = agentPreferences.getString("BatteryLevelReport", defaultBatteryLevelReport);
memoryStatus = agentPreferences.getString("memoryStatus", defaultMemoryStatus);
memoryStatus = agentPreferences.getString("memoryStatus", defaultMemoryStatus);
DeviceUpTimeReport = agentPreferences.getString("DeviceUpTimeReport", defaultDeviceUpTimeReport);
InventoryReport = agentPreferences.getString("InventoryReport", defaultInventoryReport);
HelloSignalReport = agentPreferences.getString("HelloSignalReport", defaultHelloSignalReport);
password = agentPreferences.getString("password", defaultPassword);
HelloSignalReport = agentPreferences.getString("HelloSignalReport", defaultHelloSignalReport);
password = agentPreferences.getString("password", defaultPassword);
passwordCheck = agentPreferences.getString("passwordCheck", defaultPasswordCheck);
NotificationCheck = agentPreferences.getString("NotificationCheck", defaultNotificationCheck);
hasSim = agentPreferences.getBoolean("hasSim", defaultHasSim);
//hasSim values
//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);
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
}// 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,
NotificationCheck
);
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,
NotificationCheck
);
}// end updateConf
}// 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,
String _NotificationCheck ) {
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,
String _NotificationCheck ) {
if (con == null) {
con = context;
}
if (con == null) {
con = context;
}
SharedPreferences agentPreferences = con.getSharedPreferences(
con.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
SharedPreferences agentPreferences = con.getSharedPreferences(
con.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = agentPreferences.edit();
editor.putString("serverAddr", _serverAddr);
@ -410,11 +410,11 @@ public class Core {
}// end updateConf
public synchronized static void putSharedData(String preferenceName, String tokenName, String data, String type) {
public synchronized static void putSharedData(String preferenceName, String tokenName, String data, String type) {
SharedPreferences agentPreferences = con.getSharedPreferences(
con.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
SharedPreferences agentPreferences = con.getSharedPreferences(
con.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = agentPreferences.edit();
@ -435,13 +435,13 @@ public class Core {
}
editor.commit();
}
}
public synchronized static String getSharedData(String preferenceName, String tokenName, String defaultValue, String type) {
public synchronized static String getSharedData(String preferenceName, String tokenName, String defaultValue, String type) {
SharedPreferences agentPreferences = con.getSharedPreferences(
con.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
SharedPreferences agentPreferences = con.getSharedPreferences(
con.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
if(type == "boolean") {
boolean a = agentPreferences.getBoolean(tokenName, Boolean.parseBoolean(defaultValue));
@ -464,6 +464,6 @@ public class Core {
}
return "";
}
}
}

View File

@ -20,9 +20,9 @@ import android.content.Intent;
public class EventReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
context.startService(new Intent(context, PandroidAgentListener.class));
}
@Override
public void onReceive(Context context, Intent intent) {
context.startService(new Intent(context, PandroidAgentListener.class));
}
}

View File

@ -22,13 +22,13 @@ import android.widget.TextView;
public class Help extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.help);
setContentView(R.layout.help);
TextView text = (TextView) findViewById(R.id.help_text);
text.setText(Html.fromHtml(getString(R.string.help_text_str)));
text.setMovementMethod(LinkMovementMethod.getInstance());
TextView text = (TextView) findViewById(R.id.help_text);
text.setText(Html.fromHtml(getString(R.string.help_text_str)));
text.setMovementMethod(LinkMovementMethod.getInstance());
}
}

View File

@ -28,35 +28,35 @@ import android.content.Context;
*/
public class Installation {
private static String sID = null;
private static final String INSTALLATION = "INSTALLATION";
private static String sID = null;
private static final String INSTALLATION = "INSTALLATION";
public synchronized static String id(Context context) {
if (sID == null) {
File installation = new File(context.getFilesDir(), INSTALLATION);
try {
if (!installation.exists())
writeInstallationFile(installation);
sID = readInstallationFile(installation);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return sID;
}
public synchronized static String id(Context context) {
if (sID == null) {
File installation = new File(context.getFilesDir(), INSTALLATION);
try {
if (!installation.exists())
writeInstallationFile(installation);
sID = readInstallationFile(installation);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return sID;
}
private static String readInstallationFile(File installation) throws IOException {
RandomAccessFile f = new RandomAccessFile(installation, "r");
byte[] bytes = new byte[(int) f.length()];
f.readFully(bytes);
f.close();
return new String(bytes);
}
private static String readInstallationFile(File installation) throws IOException {
RandomAccessFile f = new RandomAccessFile(installation, "r");
byte[] bytes = new byte[(int) f.length()];
f.readFully(bytes);
f.close();
return new String(bytes);
}
private static void writeInstallationFile(File installation) throws IOException {
FileOutputStream out = new FileOutputStream(installation);
String id = UUID.randomUUID().toString();
out.write(id.getBytes());
out.close();
}
private static void writeInstallationFile(File installation) throws IOException {
FileOutputStream out = new FileOutputStream(installation);
String id = UUID.randomUUID().toString();
out.write(id.getBytes());
out.close();
}
}

View File

@ -31,16 +31,16 @@ import android.widget.TabHost;
public class PandroidAgent extends TabActivity {
Handler h = new Handler();
int defaultInterval = 300;
TabHost tabHost;
int defaultInterval = 300;
TabHost tabHost;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/*
/*
final Dialog dialog = new Dialog(this,android.R.style.Theme_Black_NoTitleBar_Fullscreen);
dialog.setContentView(R.layout.welcome);
dialog.setCancelable(false);
@ -57,23 +57,23 @@ public class PandroidAgent extends TabActivity {
}
}, 3000);
*/
*/
//Requires The agent name to use installation id
File installation = new File(getApplicationContext().getFilesDir(), "INSTALLATION");
if(!installation.exists()){
Core.restartAgentListener(getApplicationContext());
}
else{
//Core.stopAgentListener();
Core.loadConf(this);
Core.alarmEnabled = true;
//new Intent(this, EventReceiver.class);
}
//Requires The agent name to use installation id
File installation = new File(getApplicationContext().getFilesDir(), "INSTALLATION");
if(!installation.exists()){
Core.restartAgentListener(getApplicationContext());
}
else{
//Core.stopAgentListener();
Core.loadConf(this);
Core.alarmEnabled = true;
//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;
//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"))
@ -84,46 +84,46 @@ public class PandroidAgent extends TabActivity {
//Create layout with 2 tabs
tabHost = getTabHost();
tabHost.addTab
tabHost.addTab
(
tabHost.newTabSpec("Status")
.setIndicator(getString(R.string.status_str))
.setContent(new Intent(this, Status.class))
);
tabHost.newTabSpec("Status")
.setIndicator(getString(R.string.status_str))
.setContent(new Intent(this, Status.class))
);
tabHost.addTab
tabHost.addTab
(
tabHost.newTabSpec("Setup")
.setIndicator(getString(R.string.setup_str))
.setContent(new Intent(this, Setup.class))
);
}
tabHost.newTabSpec("Setup")
.setIndicator(getString(R.string.setup_str))
.setContent(new Intent(this, Setup.class))
);
}
public void onPause(){
super.onPause();
Core.updateConf(getApplicationContext());
//Core.updateDatabase(this);
}
public void onPause(){
super.onPause();
Core.updateConf(getApplicationContext());
//Core.updateDatabase(this);
}
public void onDestroy(){
super.onDestroy();
Core.updateConf(getApplicationContext());
//Core.updateDatabase(this);
public void onDestroy(){
super.onDestroy();
Core.updateConf(getApplicationContext());
//Core.updateDatabase(this);
}
}
//Sets hello signal to 1(first connect since pandroid was closed)
public void onResume(){
super.onResume();
//Sets hello signal to 1(first connect since pandroid was closed)
public void onResume(){
super.onResume();
if(Core.helloSignal == 0)
Core.helloSignal = 1;
Core.updateConf(getApplicationContext());
}
if(Core.helloSignal == 0)
Core.helloSignal = 1;
Core.updateConf(getApplicationContext());
}
// Called from activity to allow tab switching
public void switchTab(int tab){
tabHost.setCurrentTab(tab);
}
// Called from activity to allow tab switching
public void switchTab(int tab){
tabHost.setCurrentTab(tab);
}
}

View File

@ -29,174 +29,174 @@ import android.util.Log;
class tentacle_client {
// Return 0 when success, -1 when error
public int tentacle_client(String args[]) {
public int tentacle_client(String args[]) {
int port = 41121;
String send = null;
String serverResponse = null;
String address = "127.0.0.1";
String data = "";
String parameter = "";
String filePath = null;
boolean verbose = false;
File file = new File("");
int port = 41121;
String send = null;
String serverResponse = null;
String address = "127.0.0.1";
String data = "";
String parameter = "";
String filePath = null;
boolean verbose = false;
File file = new File("");
for (int i=0;i<args.length;i++) {
if(i == (args.length - 1)) {
filePath = args[i];
} else {
// Get the param if is -* format or empty string otherwise
String last_parameter = parameter;
parameter = isParameter(args[i]);
for (int i=0;i<args.length;i++) {
if(i == (args.length - 1)) {
filePath = args[i];
} else {
// Get the param if is -* format or empty string otherwise
String last_parameter = parameter;
parameter = isParameter(args[i]);
// If is not -* param check the previous param
if(parameter.equals("")) {
if(last_parameter.equals("-a")) {
address = args[i];
}
else if(last_parameter.equals("-p")) {
port = Integer.parseInt(args[i]);
}
}
// If is not -* param check the previous param
if(parameter.equals("")) {
if(last_parameter.equals("-a")) {
address = args[i];
}
else if(last_parameter.equals("-p")) {
port = Integer.parseInt(args[i]);
}
}
// The solo params are checked otherwise
if(parameter.equals("-v")) {
verbose = true;
}
}
}
// The solo params are checked otherwise
if(parameter.equals("-v")) {
verbose = true;
}
}
}
if(filePath == null) {
getError("Incorrect parameters. File path is necessary.");
}
if(filePath == null) {
getError("Incorrect parameters. File path is necessary.");
}
getInfo("\n*** Starting tentacle client ***\n",verbose);
getInfo("\n*** Starting tentacle client ***\n",verbose);
Socket socketCliente = new Socket();
Socket socketCliente = new Socket();
// TODO Maybe change socket to higher timeout value
// TODO Maybe change socket to higher timeout value
try {
socketCliente.connect(new InetSocketAddress(address, port), 2000);
try {
socketCliente.connect(new InetSocketAddress(address, port), 2000);
} catch (UnknownHostException e) {
getError("Host don't exists");
return -1;
} catch (IOException e) {
getError("Could not connect: The host is down");
return -1;
}
} catch (UnknownHostException e) {
getError("Host don't exists");
return -1;
} catch (IOException e) {
getError("Could not connect: The host is down");
return -1;
}
DataOutputStream serverOutput = null;
DataOutputStream serverOutput = null;
try {
serverOutput = new DataOutputStream(socketCliente.getOutputStream());
} catch (IOException e1) {
getError("Could not get Data output stream");
}
try {
serverOutput = new DataOutputStream(socketCliente.getOutputStream());
} catch (IOException e1) {
getError("Could not get Data output stream");
}
BufferedReader serverInput = null;
BufferedReader serverInput = null;
try {
serverInput = new BufferedReader(new InputStreamReader(socketCliente.getInputStream()));
} catch (IOException e1) {
getError("Could not get Buffered reader");
}
try {
serverInput = new BufferedReader(new InputStreamReader(socketCliente.getInputStream()));
} catch (IOException e1) {
getError("Could not get Buffered reader");
}
try {
file = new File (filePath);
FileReader fr = new FileReader (file);
BufferedReader br = new BufferedReader(fr);
try {
file = new File (filePath);
FileReader fr = new FileReader (file);
BufferedReader br = new BufferedReader(fr);
getInfo("Reading the file '" + file.getName() + "' content...\n", verbose);
// Reading the file
String line;
while((line=br.readLine())!=null)
data += line + '\n';
getInfo("Reading the file '" + file.getName() + "' content...\n", verbose);
// Reading the file
String line;
while((line=br.readLine())!=null)
data += line + '\n';
br.close();
} catch (IOException e) {
getError("Could not get the file");
}
br.close();
} catch (IOException e) {
getError("Could not get the file");
}
getInfo("*** Start of transference ***\n",verbose);
// Send the file name and length
try {
send = "SEND <" + file.getName() + "> SIZE " + Integer.toString(data.length()) + '\n';
getInfo("Client -> Server: " + send, verbose);
serverOutput.writeBytes(send);
} catch (IOException e) {
getError("Could not write on server");
}
try {
serverResponse = serverInput.readLine();
} catch (IOException e) {
getError("Could not get server response");
}
getInfo("*** Start of transference ***\n",verbose);
// Send the file name and length
try {
send = "SEND <" + file.getName() + "> SIZE " + Integer.toString(data.length()) + '\n';
getInfo("Client -> Server: " + send, verbose);
serverOutput.writeBytes(send);
} catch (IOException e) {
getError("Could not write on server");
}
try {
serverResponse = serverInput.readLine();
} catch (IOException e) {
getError("Could not get server response");
}
getInfo("Server -> Client: " + serverResponse + "\n", verbose);
if (serverResponse != null && serverResponse.equals("SEND OK")) {
try {
getInfo("Client -> Server: [file data]\n", verbose);
serverOutput.writeBytes(data);
getInfo("Server -> Client: " + serverResponse + "\n", verbose);
if (serverResponse != null && serverResponse.equals("SEND OK")) {
try {
getInfo("Client -> Server: [file data]\n", verbose);
serverOutput.writeBytes(data);
} catch (IOException e) {
getError("Could not write on server");
}
try {
serverResponse = serverInput.readLine();
} catch (IOException e) {
getError("Could not get server response");
}
} catch (IOException e) {
getError("Could not write on server");
}
try {
serverResponse = serverInput.readLine();
} catch (IOException e) {
getError("Could not get server response");
}
getInfo("Server -> Client: " + serverResponse + "\n", verbose);
if (serverResponse != null && serverResponse.equals("SEND OK")) {
try {
send = "QUIT\n";
getInfo("Client -> Server: " + send, verbose);
serverOutput.writeBytes("QUIT\n");
} catch (IOException e) {
getError("Could not write on server");
}
getInfo("*** End of transference ***\n", verbose);
}
else {
getError("Bad server response, execution aborted.\n");
}
}
else {
getError("Bad server response, execution aborted.\n");
}
getInfo("Server -> Client: " + serverResponse + "\n", verbose);
if (serverResponse != null && serverResponse.equals("SEND OK")) {
try {
send = "QUIT\n";
getInfo("Client -> Server: " + send, verbose);
serverOutput.writeBytes("QUIT\n");
} catch (IOException e) {
getError("Could not write on server");
}
getInfo("*** End of transference ***\n", verbose);
}
else {
getError("Bad server response, execution aborted.\n");
}
}
else {
getError("Bad server response, execution aborted.\n");
}
return 0;
}
return 0;
}
private String isParameter(String str) {
if(str.equals("-a") || str.equals("-p") || str.equals("-v")) {
return str;
}
else {
return "";
}
}
private String isParameter(String str) {
if(str.equals("-a") || str.equals("-p") || str.equals("-v")) {
return str;
}
else {
return "";
}
}
private void getError(String error_str) {
log("[ERROR] " + error_str + '\n');
}
private void getError(String error_str) {
log("[ERROR] " + error_str + '\n');
}
private void getInfo(String error_str, boolean verbose) {
if(verbose) {
log("[INFO] " + error_str + '\n');
}
}
private void getInfo(String error_str, boolean verbose) {
if(verbose) {
log("[INFO] " + error_str + '\n');
}
}
private void log (String msg) {
//Log.e("Tentacle",msg);
//Context context = getApplicationContext();
//int duration = Toast.LENGTH_SHORT;
private void log (String msg) {
//Log.e("Tentacle",msg);
//Context context = getApplicationContext();
//int duration = Toast.LENGTH_SHORT;
//Toast toast = Toast.makeText(context, msg, duration);
//toast.show();
}
//Toast toast = Toast.makeText(context, msg, duration);
//toast.show();
}
}

View File

@ -22,31 +22,31 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.util.Log;
public class SMSBroadcastReceiver extends BroadcastReceiver {
public class SMSBroadcastReceiver extends BroadcastReceiver {
private static final String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";
private static final String TAG = "SMSBroadcastReceiver";
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());
@Override
public void onReceive(Context context, Intent intent) {
Log.i(TAG, "Intent recieved: " + intent.getAction());
if (intent.getAction().equals(SMS_RECEIVED)) {
if (intent.getAction().equals(SMS_RECEIVED)) {
int defaultSMSReceived = 0;
int mode = Activity.MODE_PRIVATE;
int defaultSMSReceived = 0;
int mode = Activity.MODE_PRIVATE;
SharedPreferences pref = context.getSharedPreferences("PANDROID_DATA", mode);
int sms = pref.getInt("SMSReceived", defaultSMSReceived);
SharedPreferences pref = context.getSharedPreferences("PANDROID_DATA", mode);
int sms = pref.getInt("SMSReceived", defaultSMSReceived);
sms++;
sms++;
SharedPreferences.Editor editor = pref.edit();
editor.putInt("SMSReceived", sms);
editor.commit();
SharedPreferences.Editor editor = pref.edit();
editor.putInt("SMSReceived", sms);
editor.commit();
}//end if
}//end if
}//end onRecieve
}//end onRecieve
}//end class

File diff suppressed because it is too large Load Diff

View File

@ -6,10 +6,10 @@ import android.content.Intent;
public class StartMyServiceAtBootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {
//Core.restartAgentListener(context);
}
}
@Override
public void onReceive(Context context, Intent intent) {
if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {
//Core.restartAgentListener(context);
}
}
}

View File

@ -19,6 +19,7 @@ import java.util.Date;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
@ -31,136 +32,151 @@ public class Status extends Activity {
Handler h = new Handler();
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(Core.hasSim)
setContentView(R.layout.status);
else
setContentView(R.layout.statusnosim);
if(Core.hasSim)
setContentView(R.layout.status);
else
setContentView(R.layout.statusnosim);
// Core.loadLastValues(getApplicationContext());
// showLastValues();
// updateLastContactInfo();
//setButtonEvents();
}
//TODO maybe remove duplicate from onCreate
@Override
public void onResume(){
super.onResume();
// Core.loadLastValues(getApplicationContext());
// showLastValues();
// updateLastContactInfo();
//setButtonEvents();
}
//TODO maybe remove duplicate from onCreate
@Override
public void onResume(){
super.onResume();
if(Core.hasSim)
setContentView(R.layout.status);
else
setContentView(R.layout.statusnosim);
if(Core.hasSim)
setContentView(R.layout.status);
else
setContentView(R.layout.statusnosim);
Core.loadLastValues(getApplicationContext());
new GetLastValuesAsyncTask().execute();
showLastValues();
updateLastContactInfo();
updateLastContactInfo();
}
}
public void onStart(){
super.onStart();
public void onStart(){
super.onStart();
// Update the UI each second
h.post(new Runnable() {
@Override
public void run() {
// Update the UI each second
h.post(new Runnable() {
@Override
public void run() {
new GetLastValuesAsyncTask().execute();
Core.loadLastValues(getApplicationContext());
updateLastContactInfo();
showLastValues();
h.postDelayed(this, 1000);
}
});
}
updateLastContactInfo();
//For options
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.options_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent i;
switch (item.getItemId()) {
case R.id.help_button_menu_options:
i = new Intent(this, Help.class);
startActivity(i);
break;
case R.id.about_button_menu_options:
i = new Intent(this, About.class);
startActivity(i);
break;
}
return true;
}
h.postDelayed(this, 1000);
}
});
}
public class GetLastValuesAsyncTask extends AsyncTask<Void, Void, Void> {
//For options
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.options_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent i;
switch (item.getItemId()) {
case R.id.help_button_menu_options:
i = new Intent(this, Help.class);
startActivity(i);
break;
case R.id.about_button_menu_options:
i = new Intent(this, About.class);
startActivity(i);
break;
}
return true;
}
@Override
protected Void doInBackground(Void... params) {
Core.loadLastValues(getApplicationContext());
return null;
}
private void updateLastContactInfo() {
@Override
protected void onPostExecute(Void unused)
{
showLastValues();
}
}// end onPostExecute
private void updateLastContactInfo() {
long lastContact = Core.lastContact;
int contactError = Core.contactError;
boolean alarmEnabled = Core.alarmEnabled;
Date date = new Date();
long timestamp = date.getTime() / 1000;
long timeAgo = -1;
long timestamp = date.getTime() / 1000;
long timeAgo = -1;
//loading until error or connects
TextView lastContactInfo = (TextView) this.findViewById(R.id.lastContactInfo_label_str);
//loading until error or connects
TextView lastContactInfo = (TextView) this.findViewById(R.id.lastContactInfo_label_str);
lastContactInfo.setTextColor(Color.parseColor("#FF0000"));
lastContactInfo.setText(getString(R.string.loading));
if(lastContact != -1){
timeAgo = timestamp - lastContact;
}
if(lastContact != -1){
timeAgo = timestamp - lastContact;
}
int interval = Core.interval;
if(timeAgo >= interval) {
timeAgo = 0;
}
if(timeAgo >= interval) {
timeAgo = 0;
}
String stringAgo = "";
String stringAgo = "";
if(!alarmEnabled){
lastContactInfo = (TextView) this.findViewById(R.id.lastContactInfo_label_str);
lastContactInfo.setTextColor(Color.parseColor("#FF0000"));
lastContactInfo.setText(getString(R.string.contact_stopped_str));
}
if(!alarmEnabled){
lastContactInfo = (TextView) this.findViewById(R.id.lastContactInfo_label_str);
lastContactInfo.setTextColor(Color.parseColor("#FF0000"));
lastContactInfo.setText(getString(R.string.contact_stopped_str));
}
else if(contactError == 1) {
lastContactInfo = (TextView) this.findViewById(R.id.lastContactInfo_label_str);
lastContactInfo.setTextColor(Color.parseColor("#FF0000"));
lastContactInfo.setText(getString(R.string.conctact_error_str));
else if(contactError == 1) {
lastContactInfo = (TextView) this.findViewById(R.id.lastContactInfo_label_str);
lastContactInfo.setTextColor(Color.parseColor("#FF0000"));
lastContactInfo.setText(getString(R.string.conctact_error_str));
}
else if(lastContact == -1) {
stringAgo = getString(R.string.never_str);
}
else if(timeAgo == 0) {
stringAgo = getString(R.string.now_str);
}
//TODO
else if(contactError == 0) {
stringAgo = timeAgo + " " + getString(R.string.seconds_str);
lastContactInfo = (TextView) this.findViewById(R.id.lastContactInfo_label_str);
lastContactInfo.setTextColor(Color.parseColor("#00FF00"));
lastContactInfo.setText(getString(R.string.last_contact_str) + stringAgo);
}
}
else if(lastContact == -1) {
stringAgo = getString(R.string.never_str);
}
else if(timeAgo == 0) {
stringAgo = getString(R.string.now_str);
}
//TODO
else if(contactError == 0) {
stringAgo = timeAgo + " " + getString(R.string.seconds_str);
lastContactInfo = (TextView) this.findViewById(R.id.lastContactInfo_label_str);
lastContactInfo.setTextColor(Color.parseColor("#00FF00"));
lastContactInfo.setText(getString(R.string.last_contact_str) + stringAgo);
}
}//end updateLastContactInfo
}//end updateLastContactInfo
//Set layout values to current
private void showLastValues() {
private void showLastValues() {
// latitude
TextView textView = (TextView)findViewById(R.id.latitude_value_str);
@ -195,7 +211,7 @@ public class Status extends Activity {
if (Core.proximity != Core.CONST_INVALID_PROXIMITY) {
textView.setText("" + Core.proximity);
}
*/
*/
// task
textView = (TextView)findViewById(R.id.task_value_str);
@ -358,5 +374,5 @@ public class Status extends Activity {
xml.setText("");
}
*/
*/
}