Final CRLF/LF fix
authorAlex Kirhenshtein <alk@netxms.org>
Thu, 7 Nov 2013 15:48:50 +0000 (17:48 +0200)
committerAlex Kirhenshtein <alk@netxms.org>
Thu, 7 Nov 2013 15:48:50 +0000 (17:48 +0200)
122 files changed:
android/src/agent/.classpath
android/src/agent/.externalToolBuilders/Generate build_number.xml from SVN revision.launch
android/src/agent/.externalToolBuilders/generate_build.pl
android/src/agent/.project
android/src/agent/.settings/org.eclipse.jdt.core.prefs
android/src/agent/res/drawable/header_background.xml
android/src/agent/res/layout/screen_header_full.xml
android/src/agent/res/values/colors.xml
android/src/agent/src/org/netxms/agent/android/NXApplication.java
android/src/agent/src/org/netxms/agent/android/helpers/DeviceInfoHelper.java
android/src/agent/src/org/netxms/agent/android/helpers/NetHelper.java
android/src/agent/src/org/netxms/agent/android/helpers/SafeParser.java
android/src/agent/src/org/netxms/agent/android/helpers/TimeHelper.java
android/src/agent/src/org/netxms/agent/android/main/activities/AbstractClientActivity.java
android/src/agent/src/org/netxms/agent/android/main/activities/Preferences.java
android/src/agent/src/org/netxms/agent/android/main/settings/TimePreference.java
android/src/agent/src/org/netxms/agent/android/receivers/AlarmIntentReceiver.java
android/src/agent/src/org/netxms/agent/android/receivers/BootCompletedIntentReceiver.java
android/src/agent/src/org/netxms/agent/android/receivers/ConnectivityChangeIntentReceiver.java
android/src/agent/src/org/netxms/agent/android/service/AgentConnectorService.java
android/src/agent/src/org/netxms/agent/android/service/helpers/AndroidLoggingFacility.java
android/src/console/.externalToolBuilders/Generate build_number.xml from SVN revision.launch
android/src/console/.settings/org.eclipse.jdt.core.prefs
android/src/console/res/drawable-v11/list_selection.xml
android/src/console/res/drawable/bw_gradient.xml
android/src/console/res/drawable/explist_selection.xml
android/src/console/res/drawable/header_background.xml
android/src/console/res/drawable/home_screen_background.xml
android/src/console/res/drawable/home_screen_selection.xml
android/src/console/res/drawable/list_selection.xml
android/src/console/res/layout/alarms_fragment.xml
android/src/console/res/layout/fragment_container.xml
android/src/console/res/layout/graph_view_child_layout.xml
android/src/console/res/layout/interfaces_child.xml
android/src/console/res/layout/interfaces_fragment.xml
android/src/console/res/layout/lastvalues_fragment.xml
android/src/console/res/layout/overview_fragment.xml
android/src/console/res/layout/screen_header_full.xml
android/src/console/res/layout/screen_header_small.xml
android/src/console/res/menu/connection_point_actions.xml
android/src/console/res/values/colors.xml
android/src/console/src/org/netxms/ui/android/helpers/Multipliers.java
android/src/console/src/org/netxms/ui/android/helpers/SafeParser.java
android/src/console/src/org/netxms/ui/android/loaders/AlarmLoader.java
android/src/console/src/org/netxms/ui/android/loaders/DciValueLoader.java
android/src/console/src/org/netxms/ui/android/loaders/GenericObjectChildrenLoader.java
android/src/console/src/org/netxms/ui/android/loaders/GenericObjectLoader.java
android/src/console/src/org/netxms/ui/android/main/activities/AbstractComparisonChart.java
android/src/console/src/org/netxms/ui/android/main/activities/ConnectionPointBrowser.java
android/src/console/src/org/netxms/ui/android/main/activities/ConsolePreferences.java
android/src/console/src/org/netxms/ui/android/main/activities/DashboardActivity.java
android/src/console/src/org/netxms/ui/android/main/activities/DrawBarChart.java
android/src/console/src/org/netxms/ui/android/main/activities/DrawGraph.java
android/src/console/src/org/netxms/ui/android/main/activities/DrawPieChart.java
android/src/console/src/org/netxms/ui/android/main/activities/GraphBrowser.java
android/src/console/src/org/netxms/ui/android/main/activities/NodeBrowser.java
android/src/console/src/org/netxms/ui/android/main/activities/NodePollerActivity.java
android/src/console/src/org/netxms/ui/android/main/activities/TableLastValues.java
android/src/console/src/org/netxms/ui/android/main/activities/helpers/XmlDateConverter.java
android/src/console/src/org/netxms/ui/android/main/adapters/ActivityListAdapter.java
android/src/console/src/org/netxms/ui/android/main/adapters/AlarmListAdapter.java
android/src/console/src/org/netxms/ui/android/main/adapters/ConnectionPointListAdapter.java
android/src/console/src/org/netxms/ui/android/main/adapters/GraphAdapter.java
android/src/console/src/org/netxms/ui/android/main/adapters/InterfaceDetailsAdapter.java
android/src/console/src/org/netxms/ui/android/main/adapters/InterfacesAdapter.java
android/src/console/src/org/netxms/ui/android/main/adapters/LastValuesAdapter.java
android/src/console/src/org/netxms/ui/android/main/adapters/ObjectListAdapter.java
android/src/console/src/org/netxms/ui/android/main/adapters/OverviewAdapter.java
android/src/console/src/org/netxms/ui/android/main/dashboards/configs/AbstractChartConfig.java
android/src/console/src/org/netxms/ui/android/main/dashboards/configs/BarChartConfig.java
android/src/console/src/org/netxms/ui/android/main/dashboards/configs/ComparisonChartConfig.java
android/src/console/src/org/netxms/ui/android/main/dashboards/configs/DashboardElementConfig.java
android/src/console/src/org/netxms/ui/android/main/dashboards/configs/DashboardElementLayout.java
android/src/console/src/org/netxms/ui/android/main/dashboards/configs/DialChartConfig.java
android/src/console/src/org/netxms/ui/android/main/dashboards/configs/EmbeddedDashboardConfig.java
android/src/console/src/org/netxms/ui/android/main/dashboards/configs/LabelConfig.java
android/src/console/src/org/netxms/ui/android/main/dashboards/configs/LineChartConfig.java
android/src/console/src/org/netxms/ui/android/main/dashboards/configs/PieChartConfig.java
android/src/console/src/org/netxms/ui/android/main/dashboards/configs/TableBarChartConfig.java
android/src/console/src/org/netxms/ui/android/main/dashboards/configs/TableComparisonChartConfig.java
android/src/console/src/org/netxms/ui/android/main/dashboards/configs/TablePieChartConfig.java
android/src/console/src/org/netxms/ui/android/main/dashboards/configs/TableTubeChartConfig.java
android/src/console/src/org/netxms/ui/android/main/dashboards/configs/TubeChartConfig.java
android/src/console/src/org/netxms/ui/android/main/dashboards/elements/AbstractDashboardElement.java
android/src/console/src/org/netxms/ui/android/main/dashboards/elements/BarChartElement.java
android/src/console/src/org/netxms/ui/android/main/dashboards/elements/DialChartElement.java
android/src/console/src/org/netxms/ui/android/main/dashboards/elements/LabelElement.java
android/src/console/src/org/netxms/ui/android/main/dashboards/elements/LineChartElement.java
android/src/console/src/org/netxms/ui/android/main/dashboards/elements/PieChartElement.java
android/src/console/src/org/netxms/ui/android/main/dashboards/elements/TableBarChartElement.java
android/src/console/src/org/netxms/ui/android/main/dashboards/elements/TablePieChartElement.java
android/src/console/src/org/netxms/ui/android/main/fragments/AbstractFragmentActivity.java
android/src/console/src/org/netxms/ui/android/main/fragments/AbstractListFragment.java
android/src/console/src/org/netxms/ui/android/main/fragments/AlarmBrowserFragment.java
android/src/console/src/org/netxms/ui/android/main/fragments/AlarmsFragment.java
android/src/console/src/org/netxms/ui/android/main/fragments/ConsolePreferencesFragment.java
android/src/console/src/org/netxms/ui/android/main/fragments/InterfacesFragment.java
android/src/console/src/org/netxms/ui/android/main/fragments/LastValuesFragment.java
android/src/console/src/org/netxms/ui/android/main/fragments/OverviewFragment.java
android/src/console/src/org/netxms/ui/android/main/settings/TimePreference.java
android/src/console/src/org/netxms/ui/android/main/views/ActivityListElement.java
android/src/console/src/org/netxms/ui/android/main/views/CheckableLinearLayout.java
android/src/console/src/org/netxms/ui/android/main/views/DashboardView.java
android/src/console/src/org/netxms/ui/android/main/views/DialChart.java
android/src/console/src/org/netxms/ui/android/main/views/ExtendedLineGraphView.java
android/src/console/src/org/netxms/ui/android/main/views/helpers/ChartItem.java
android/src/console/src/org/netxms/ui/android/receivers/AlarmIntentReceiver.java
android/src/console/src/org/netxms/ui/android/receivers/BootCompletedIntentReceiver.java
android/src/console/src/org/netxms/ui/android/receivers/ConnectivityChangeIntentReceiver.java
android/src/console/src/org/netxms/ui/android/service/ClientConnectorService.java
android/src/console/src/org/netxms/ui/android/service/helpers/AndroidLoggingFacility.java
android/src/console/src/org/netxms/ui/android/service/tasks/ConnectTask.java
android/src/console/src/org/netxms/ui/android/service/tasks/ExecActionTask.java
doc/RadenSolutions-C-Formatter.xml
doc/asn1.npp.styling.xml
doc/internal/db_driver_api.txt
doc/internal/dci_perftab.txt
doc/internal/release_procedure.txt
doc/internal/sleak_debug.options
include/nxdbapi.h
include/nxlpapi.h
sdk/install/netxms-sdk.iss

index dd76b24..4a9c9df 100644 (file)
@@ -1,12 +1,12 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
-       <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>\r
-       <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>\r
-       <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>\r
-       <classpathentry kind="lib" path="libs/acra-4.4.0.jar"/>\r
-       <classpathentry kind="src" path="src"/>\r
-       <classpathentry kind="src" path="gen"/>\r
-       <classpathentry kind="lib" path="libs/netxms-base-1.2.9.jar"/>\r
-       <classpathentry kind="lib" path="libs/netxms-mobile-agent-1.2.9.jar"/>\r
-       <classpathentry kind="output" path="bin/classes"/>\r
-</classpath>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+       <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+       <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
+       <classpathentry kind="lib" path="libs/acra-4.4.0.jar"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="src" path="gen"/>
+       <classpathentry kind="lib" path="libs/netxms-base-1.2.9.jar"/>
+       <classpathentry kind="lib" path="libs/netxms-mobile-agent-1.2.9.jar"/>
+       <classpathentry kind="output" path="bin/classes"/>
+</classpath>
index 2cd27ab..c16d2e4 100644 (file)
@@ -1,15 +1,15 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">\r
-<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>\r
-<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>\r
-<booleanAttribute key="org.eclipse.debug.core.capture_output" value="false"/>\r
-<booleanAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON" value="false"/>\r
-<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>\r
-<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>\r
-<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>\r
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="android-agent"/>\r
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/android-agent/.externalToolBuilders/generate_build_number.xml}"/>\r
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>\r
-<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>\r
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/android-agent/.externalToolBuilders}"/>\r
-</launchConfiguration>\r
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
+<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
+<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
+<booleanAttribute key="org.eclipse.debug.core.capture_output" value="false"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON" value="false"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="android-agent"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/android-agent/.externalToolBuilders/generate_build_number.xml}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/android-agent/.externalToolBuilders}"/>
+</launchConfiguration>
index 6d3fb22..833b786 100644 (file)
@@ -1,19 +1,19 @@
-#!/usr/bin/perl\r
-\r
-$version = `svnversion`;\r
-chomp $version;\r
-if ($version =~ /[0-9]+\:([0-9]+)/)\r
-{\r
-       $version = $1;\r
-}\r
-print "Setting build number to $version\n";\r
-\r
-open(OUT, ">build_number.xml") || die "out: $!";\r
-\r
-print OUT "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";\r
-print OUT "<resources>\n";\r
-print OUT "\t<string name=\"build_number\">$version</string>\n";\r
-print OUT "</resources>\n";\r
-\r
-close OUT;\r
-exit 0;\r
+#!/usr/bin/perl
+
+$version = `svnversion`;
+chomp $version;
+if ($version =~ /[0-9]+\:([0-9]+)/)
+{
+       $version = $1;
+}
+print "Setting build number to $version\n";
+
+open(OUT, ">build_number.xml") || die "out: $!";
+
+print OUT "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
+print OUT "<resources>\n";
+print OUT "\t<string name=\"build_number\">$version</string>\n";
+print OUT "</resources>\n";
+
+close OUT;
+exit 0;
index 9af7d2a..fab7f3c 100644 (file)
@@ -1,43 +1,43 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<projectDescription>\r
-       <name>android-agent</name>\r
-       <comment></comment>\r
-       <projects>\r
-       </projects>\r
-       <buildSpec>\r
-               <buildCommand>\r
-                       <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>\r
-                       <triggers>full,incremental,</triggers>\r
-                       <arguments>\r
-                               <dictionary>\r
-                                       <key>LaunchConfigHandle</key>\r
-                                       <value>&lt;project&gt;/.externalToolBuilders/Generate build_number.xml from SVN revision.launch</value>\r
-                               </dictionary>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>org.eclipse.jdt.core.javabuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>com.android.ide.eclipse.adt.ApkBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-       </buildSpec>\r
-       <natures>\r
-               <nature>com.android.ide.eclipse.adt.AndroidNature</nature>\r
-               <nature>org.eclipse.jdt.core.javanature</nature>\r
-       </natures>\r
-</projectDescription>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>android-agent</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+                       <triggers>full,incremental,</triggers>
+                       <arguments>
+                               <dictionary>
+                                       <key>LaunchConfigHandle</key>
+                                       <value>&lt;project&gt;/.externalToolBuilders/Generate build_number.xml from SVN revision.launch</value>
+                               </dictionary>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
index 54e493c..8000cd6 100644 (file)
@@ -1,11 +1,11 @@
-eclipse.preferences.version=1\r
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve\r
-org.eclipse.jdt.core.compiler.compliance=1.6\r
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate\r
-org.eclipse.jdt.core.compiler.debug.localVariable=generate\r
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate\r
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
-org.eclipse.jdt.core.compiler.source=1.6\r
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
index 3435280..11a16a7 100644 (file)
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<shape xmlns:android="http://schemas.android.com/apk/res/android"\r
-    android:shape="rectangle">\r
-  <gradient\r
-      android:startColor="#306A8A"\r
-      android:endColor="#245168"\r
-      android:angle="270" />\r
-</shape>\r
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+  <gradient
+      android:startColor="#306A8A"
+      android:endColor="#245168"
+      android:angle="270" />
+</shape>
index cb8ab59..a31307a 100644 (file)
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<LinearLayout android:id="@+id/ScreenTitle" \r
-               android:orientation="vertical" \r
-               android:gravity="fill_horizontal" \r
-               android:layout_width="fill_parent" \r
-               android:layout_height="wrap_content"\r
-               android:background="@drawable/header_background"\r
-               xmlns:android="http://schemas.android.com/apk/res/android">\r
-       <TextView android:id="@+id/ScreenTitlePrimary" \r
-                       android:text="@string/main_title" \r
-                       android:textSize="20sp" \r
-                       android:textColor="#ffffff" \r
-                       android:paddingTop="2sp" \r
-                       android:paddingBottom="2sp" \r
-                       android:paddingLeft="5sp" \r
-                       android:paddingRight="5sp" \r
-                       android:layout_width="fill_parent" \r
-                       android:layout_height="wrap_content">\r
-       </TextView>\r
-</LinearLayout>\r
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout android:id="@+id/ScreenTitle" 
+               android:orientation="vertical" 
+               android:gravity="fill_horizontal" 
+               android:layout_width="fill_parent" 
+               android:layout_height="wrap_content"
+               android:background="@drawable/header_background"
+               xmlns:android="http://schemas.android.com/apk/res/android">
+       <TextView android:id="@+id/ScreenTitlePrimary" 
+                       android:text="@string/main_title" 
+                       android:textSize="20sp" 
+                       android:textColor="#ffffff" 
+                       android:paddingTop="2sp" 
+                       android:paddingBottom="2sp" 
+                       android:paddingLeft="5sp" 
+                       android:paddingRight="5sp" 
+                       android:layout_width="fill_parent" 
+                       android:layout_height="wrap_content">
+       </TextView>
+</LinearLayout>
index c9b5cf9..d52d4ba 100644 (file)
@@ -1,12 +1,12 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<resources>\r
-    <color name="item_body">#ebeae1</color>\r
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="item_body">#ebeae1</color>
        <color name="text_color">#FF404040</color>
        <color name="item_home_background">#FFFFFFFF</color>
        <color name="item_home_border">#FF000000</color>
        <color name="notify_connected">#FF00FF00</color>
        <color name="notify_disconnected">#FFFF0000</color>
        <color name="notify_connecting">#FFFFFF00</color>
-       <color name="notify_connection_failed">#FFFF0000</color>\r
-       <color name="notify_no_connection">#FFFF0000</color>\r
-</resources>\r
+       <color name="notify_connection_failed">#FFFF0000</color>
+       <color name="notify_no_connection">#FFFF0000</color>
+</resources>
index 9cec8b8..6b2da23 100644 (file)
@@ -1,35 +1,35 @@
-package org.netxms.agent.android;\r
-\r
-import org.acra.ACRA;\r
-import org.acra.annotation.ReportsCrashes;\r
-\r
-import android.app.Application;\r
-\r
-@ReportsCrashes(formKey = "dGJ5RFRpbmg2ZVRvT2tERU9seHVlTWc6MQ")\r
-public class NXApplication extends Application\r
-{\r
-       private static boolean activityVisible;\r
-\r
-       @Override\r
-       public void onCreate()\r
-       {\r
-               ACRA.init(this);\r
-               ACRA.getErrorReporter().checkReportsOnApplicationStart();\r
-               super.onCreate();\r
-       }\r
-\r
-       public static boolean isActivityVisible()\r
-       {\r
-               return activityVisible;\r
-       }\r
-\r
-       public static void activityResumed()\r
-       {\r
-               activityVisible = true;\r
-       }\r
-\r
-       public static void activityPaused()\r
-       {\r
-               activityVisible = false;\r
-       }\r
-}\r
+package org.netxms.agent.android;
+
+import org.acra.ACRA;
+import org.acra.annotation.ReportsCrashes;
+
+import android.app.Application;
+
+@ReportsCrashes(formKey = "dGJ5RFRpbmg2ZVRvT2tERU9seHVlTWc6MQ")
+public class NXApplication extends Application
+{
+       private static boolean activityVisible;
+
+       @Override
+       public void onCreate()
+       {
+               ACRA.init(this);
+               ACRA.getErrorReporter().checkReportsOnApplicationStart();
+               super.onCreate();
+       }
+
+       public static boolean isActivityVisible()
+       {
+               return activityVisible;
+       }
+
+       public static void activityResumed()
+       {
+               activityVisible = true;
+       }
+
+       public static void activityPaused()
+       {
+               activityVisible = false;
+       }
+}
index 5c62d90..deaf899 100644 (file)
-package org.netxms.agent.android.helpers;\r
-\r
-import java.util.regex.Pattern;\r
-\r
-import android.accounts.Account;\r
-import android.accounts.AccountManager;\r
-import android.annotation.SuppressLint;\r
-import android.content.Context;\r
-import android.content.Intent;\r
-import android.content.IntentFilter;\r
-import android.os.BatteryManager;\r
-import android.os.Build;\r
-import android.provider.Settings.Secure;\r
-import android.telephony.TelephonyManager;\r
-import android.util.Log;\r
-import android.util.Patterns;\r
-\r
-/**\r
- * Helper for gathering device info\r
- * \r
- * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)\r
- *\r
- */\r
-\r
-public class DeviceInfoHelper\r
-{\r
-       private static final String TAG = "DeviceInfoHelper";\r
-\r
-       /**\r
-        * Get device serial number (starting from HoneyComb)\r
-        * \r
-        * @return Device serial number if available \r
-        */\r
-       @SuppressLint("NewApi")\r
-       static public String getSerial()\r
-       {\r
-               return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ? Build.SERIAL : "";\r
-       }\r
-\r
-       /**\r
-        * Get device manufacturer\r
-        * \r
-        * @return Device manufacturer \r
-        */\r
-       static public String getManufacturer()\r
-       {\r
-               return Build.MANUFACTURER;\r
-       }\r
-\r
-       /**\r
-        * Get device model\r
-        * \r
-        * @return Device model\r
-        */\r
-       static public String getModel()\r
-       {\r
-               return Build.MODEL;\r
-       }\r
-\r
-       /**\r
-        * Get device OS relese\r
-        * \r
-        * @return OS release number\r
-        */\r
-       static public String getRelease()\r
-       {\r
-               return Build.VERSION.RELEASE;\r
-       }\r
-\r
-       /**\r
-        * Get device user\r
-        * \r
-        * @param context       context on which to operate\r
-        * @return main Google account user\r
-        */\r
-       static public String getUser(Context context)\r
-       {\r
-               if (context != null)\r
-               {\r
-                       try\r
-                       {\r
-                               Pattern emailPattern = Patterns.EMAIL_ADDRESS; // API level 8+\r
-                               Account[] accounts = AccountManager.get(context).getAccounts();\r
-                               for (Account account : accounts)\r
-                                       if (emailPattern.matcher(account.name).matches())\r
-                                               return account.name;\r
-                       }\r
-                       catch (Exception e)\r
-                       {\r
-                               Log.e(TAG, "Exception in getUser()", e);\r
-                       }\r
-               }\r
-               return "";\r
-       }\r
-\r
-       /**\r
-        * Get device id\r
-        * \r
-        * @param context       context on which to operate\r
-        * @return IMEI number or Android ID for phoneless devices \r
-        */\r
-       static public String getDeviceId(Context context)\r
-       {\r
-               String id = "";\r
-               if (context != null)\r
-               {\r
-                       TelephonyManager tman = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);\r
-                       id = (tman != null) ? tman.getDeviceId() : null;\r
-                       if (id == null)\r
-                       {\r
-                               id = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);\r
-                       }\r
-               }\r
-               return id;\r
-       }\r
-\r
-       /**\r
-        * Get OS nickname\r
-        * \r
-        * @return OS nick name \r
-        */\r
-       static public String getOSName()\r
-       {\r
-               switch (Build.VERSION.SDK_INT)\r
-               {\r
-                       case Build.VERSION_CODES.BASE:\r
-                               return "ANDROID (BASE)";\r
-                       case Build.VERSION_CODES.BASE_1_1:\r
-                               return "ANDROID (BASE_1_1)";\r
-                       case Build.VERSION_CODES.CUR_DEVELOPMENT:\r
-                               return "ANDROID (CUR_DEVELOPMENT)";\r
-                       case Build.VERSION_CODES.DONUT:\r
-                               return "ANDROID (DONUT)";\r
-                       case Build.VERSION_CODES.ECLAIR:\r
-                               return "ANDROID (ECLAIR)";\r
-                       case Build.VERSION_CODES.ECLAIR_0_1:\r
-                               return "ANDROID (ECLAIR_0_1)";\r
-                       case Build.VERSION_CODES.ECLAIR_MR1:\r
-                               return "ANDROID (ECLAIR_MR1)";\r
-                       case Build.VERSION_CODES.FROYO:\r
-                               return "ANDROID (FROYO)";\r
-                       case Build.VERSION_CODES.GINGERBREAD:\r
-                               return "ANDROID (GINGERBREAD)";\r
-                       case Build.VERSION_CODES.GINGERBREAD_MR1:\r
-                               return "ANDROID (GINGERBREAD_MR1)";\r
-                       case Build.VERSION_CODES.HONEYCOMB:\r
-                               return "ANDROID (HONEYCOMB)";\r
-                       case Build.VERSION_CODES.HONEYCOMB_MR1:\r
-                               return "ANDROID (HONEYCOMB_MR1)";\r
-                       case Build.VERSION_CODES.HONEYCOMB_MR2:\r
-                               return "ANDROID (HONEYCOMB_MR2)";\r
-                       case Build.VERSION_CODES.ICE_CREAM_SANDWICH:\r
-                               return "ANDROID (ICE_CREAM_SANDWICH)";\r
-                       case Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1:\r
-                               return "ANDROID (ICE_CREAM_SANDWICH_MR1)";\r
-                       case Build.VERSION_CODES.JELLY_BEAN:\r
-                               return "ANDROID (JELLY_BEAN)";\r
-                       case Build.VERSION_CODES.JELLY_BEAN_MR1:\r
-                               return "ANDROID (JELLY_BEAN_MR1)";\r
-                       case Build.VERSION_CODES.JELLY_BEAN_MR2:\r
-                               return "ANDROID (JELLY_BEAN_MR2)";\r
-                       case Build.VERSION_CODES.KITKAT:\r
-                               return "ANDROID (KITKAT)";\r
-               }\r
-               return "ANDROID (UNKNOWN)";\r
-       }\r
-\r
-       /**\r
-        * Get battery level as percentage\r
-        * \r
-        * @param context       context on which to operate\r
-        * @return battery level (percentage), -1 if value is not available\r
-        */\r
-       static public int getBatteryLevel(Context context)\r
-       {\r
-               double level = -1;\r
-               if (context != null)\r
-               {\r
-                       Intent battIntent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));\r
-                       if (battIntent != null)\r
-                       {\r
-                               int rawlevel = battIntent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);\r
-                               double scale = battIntent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);\r
-//                             int temp = battIntent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, -1);\r
-//                 int voltage = battIntent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, -1);\r
-                               if (rawlevel >= 0 && scale > 0)\r
-                                       level = (rawlevel * 100) / scale + 0.5; // + 0.5 for round on cast\r
-                       }\r
-               }\r
-               return (int)level;\r
-       }\r
-}\r
+package org.netxms.agent.android.helpers;
+
+import java.util.regex.Pattern;
+
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.BatteryManager;
+import android.os.Build;
+import android.provider.Settings.Secure;
+import android.telephony.TelephonyManager;
+import android.util.Log;
+import android.util.Patterns;
+
+/**
+ * Helper for gathering device info
+ * 
+ * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)
+ *
+ */
+
+public class DeviceInfoHelper
+{
+       private static final String TAG = "DeviceInfoHelper";
+
+       /**
+        * Get device serial number (starting from HoneyComb)
+        * 
+        * @return Device serial number if available 
+        */
+       @SuppressLint("NewApi")
+       static public String getSerial()
+       {
+               return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ? Build.SERIAL : "";
+       }
+
+       /**
+        * Get device manufacturer
+        * 
+        * @return Device manufacturer 
+        */
+       static public String getManufacturer()
+       {
+               return Build.MANUFACTURER;
+       }
+
+       /**
+        * Get device model
+        * 
+        * @return Device model
+        */
+       static public String getModel()
+       {
+               return Build.MODEL;
+       }
+
+       /**
+        * Get device OS relese
+        * 
+        * @return OS release number
+        */
+       static public String getRelease()
+       {
+               return Build.VERSION.RELEASE;
+       }
+
+       /**
+        * Get device user
+        * 
+        * @param context       context on which to operate
+        * @return main Google account user
+        */
+       static public String getUser(Context context)
+       {
+               if (context != null)
+               {
+                       try
+                       {
+                               Pattern emailPattern = Patterns.EMAIL_ADDRESS; // API level 8+
+                               Account[] accounts = AccountManager.get(context).getAccounts();
+                               for (Account account : accounts)
+                                       if (emailPattern.matcher(account.name).matches())
+                                               return account.name;
+                       }
+                       catch (Exception e)
+                       {
+                               Log.e(TAG, "Exception in getUser()", e);
+                       }
+               }
+               return "";
+       }
+
+       /**
+        * Get device id
+        * 
+        * @param context       context on which to operate
+        * @return IMEI number or Android ID for phoneless devices 
+        */
+       static public String getDeviceId(Context context)
+       {
+               String id = "";
+               if (context != null)
+               {
+                       TelephonyManager tman = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
+                       id = (tman != null) ? tman.getDeviceId() : null;
+                       if (id == null)
+                       {
+                               id = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
+                       }
+               }
+               return id;
+       }
+
+       /**
+        * Get OS nickname
+        * 
+        * @return OS nick name 
+        */
+       static public String getOSName()
+       {
+               switch (Build.VERSION.SDK_INT)
+               {
+                       case Build.VERSION_CODES.BASE:
+                               return "ANDROID (BASE)";
+                       case Build.VERSION_CODES.BASE_1_1:
+                               return "ANDROID (BASE_1_1)";
+                       case Build.VERSION_CODES.CUR_DEVELOPMENT:
+                               return "ANDROID (CUR_DEVELOPMENT)";
+                       case Build.VERSION_CODES.DONUT:
+                               return "ANDROID (DONUT)";
+                       case Build.VERSION_CODES.ECLAIR:
+                               return "ANDROID (ECLAIR)";
+                       case Build.VERSION_CODES.ECLAIR_0_1:
+                               return "ANDROID (ECLAIR_0_1)";
+                       case Build.VERSION_CODES.ECLAIR_MR1:
+                               return "ANDROID (ECLAIR_MR1)";
+                       case Build.VERSION_CODES.FROYO:
+                               return "ANDROID (FROYO)";
+                       case Build.VERSION_CODES.GINGERBREAD:
+                               return "ANDROID (GINGERBREAD)";
+                       case Build.VERSION_CODES.GINGERBREAD_MR1:
+                               return "ANDROID (GINGERBREAD_MR1)";
+                       case Build.VERSION_CODES.HONEYCOMB:
+                               return "ANDROID (HONEYCOMB)";
+                       case Build.VERSION_CODES.HONEYCOMB_MR1:
+                               return "ANDROID (HONEYCOMB_MR1)";
+                       case Build.VERSION_CODES.HONEYCOMB_MR2:
+                               return "ANDROID (HONEYCOMB_MR2)";
+                       case Build.VERSION_CODES.ICE_CREAM_SANDWICH:
+                               return "ANDROID (ICE_CREAM_SANDWICH)";
+                       case Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1:
+                               return "ANDROID (ICE_CREAM_SANDWICH_MR1)";
+                       case Build.VERSION_CODES.JELLY_BEAN:
+                               return "ANDROID (JELLY_BEAN)";
+                       case Build.VERSION_CODES.JELLY_BEAN_MR1:
+                               return "ANDROID (JELLY_BEAN_MR1)";
+                       case Build.VERSION_CODES.JELLY_BEAN_MR2:
+                               return "ANDROID (JELLY_BEAN_MR2)";
+                       case Build.VERSION_CODES.KITKAT:
+                               return "ANDROID (KITKAT)";
+               }
+               return "ANDROID (UNKNOWN)";
+       }
+
+       /**
+        * Get battery level as percentage
+        * 
+        * @param context       context on which to operate
+        * @return battery level (percentage), -1 if value is not available
+        */
+       static public int getBatteryLevel(Context context)
+       {
+               double level = -1;
+               if (context != null)
+               {
+                       Intent battIntent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
+                       if (battIntent != null)
+                       {
+                               int rawlevel = battIntent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
+                               double scale = battIntent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
+//                             int temp = battIntent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, -1);
+//                 int voltage = battIntent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, -1);
+                               if (rawlevel >= 0 && scale > 0)
+                                       level = (rawlevel * 100) / scale + 0.5; // + 0.5 for round on cast
+                       }
+               }
+               return (int)level;
+       }
+}
index 4895cdb..5a2f2a1 100644 (file)
@@ -1,76 +1,76 @@
-package org.netxms.agent.android.helpers;\r
-\r
-import java.net.InetAddress;\r
-import java.net.NetworkInterface;\r
-import java.util.Enumeration;\r
-\r
-import android.content.Context;\r
-import android.net.ConnectivityManager;\r
-import android.net.NetworkInfo;\r
-import android.util.Log;\r
-\r
-/**\r
- * Helper for network related tasks\r
- * \r
- * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)\r
- *\r
- */\r
-\r
-public class NetHelper\r
-{\r
-       private static final String TAG = "NetHelper";\r
-\r
-       /**\r
-        * Get internet address. NB must run on background thread (as per honeycomb specs)\r
-        * \r
-        * @return Internet address, null if no addresses are available\r
-        */\r
-       static public InetAddress getInetAddress()\r
-       {\r
-               try\r
-               {\r
-                       Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();\r
-                       while (interfaces.hasMoreElements())\r
-                       {\r
-                               NetworkInterface iface = interfaces.nextElement();\r
-                               Enumeration<InetAddress> addrList = iface.getInetAddresses();\r
-                               while (addrList.hasMoreElements())\r
-                               {\r
-                                       InetAddress addr = addrList.nextElement();\r
-                                       if (!addr.isAnyLocalAddress() && !addr.isLinkLocalAddress() && !addr.isLoopbackAddress() && !addr.isMulticastAddress())\r
-                                               return addr;\r
-                               }\r
-                       }\r
-                       return InetAddress.getLocalHost();\r
-               }\r
-               catch (Exception e)\r
-               {\r
-                       Log.e(TAG, "Exception in getInetAddress()", e);\r
-               }\r
-               return null;\r
-       }\r
-\r
-       /**\r
-        * Check for internet connectivity \r
-        * \r
-        * @param context       context on which to operate\r
-        * @return true if access to internet is available\r
-        */\r
-       static public boolean isInternetOn(Context context)\r
-       {\r
-               if (context != null)\r
-               {\r
-                       ConnectivityManager conn = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);\r
-                       if (conn != null)\r
-                       {\r
-                               NetworkInfo wifi = conn.getNetworkInfo(ConnectivityManager.TYPE_WIFI);\r
-                               if (wifi != null && wifi.getState() == NetworkInfo.State.CONNECTED)\r
-                                       return true;\r
-                               NetworkInfo mobile = conn.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);\r
-                               if (mobile != null && mobile.getState() == NetworkInfo.State.CONNECTED)\r
-                                       return true;\r
-                       }\r
-               }\r
-               return false;\r
-       }\r
-}\r
+package org.netxms.agent.android.helpers;
+
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.util.Enumeration;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.util.Log;
+
+/**
+ * Helper for network related tasks
+ * 
+ * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)
+ *
+ */
+
+public class NetHelper
+{
+       private static final String TAG = "NetHelper";
+
+       /**
+        * Get internet address. NB must run on background thread (as per honeycomb specs)
+        * 
+        * @return Internet address, null if no addresses are available
+        */
+       static public InetAddress getInetAddress()
+       {
+               try
+               {
+                       Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
+                       while (interfaces.hasMoreElements())
+                       {
+                               NetworkInterface iface = interfaces.nextElement();
+                               Enumeration<InetAddress> addrList = iface.getInetAddresses();
+                               while (addrList.hasMoreElements())
+                               {
+                                       InetAddress addr = addrList.nextElement();
+                                       if (!addr.isAnyLocalAddress() && !addr.isLinkLocalAddress() && !addr.isLoopbackAddress() && !addr.isMulticastAddress())
+                                               return addr;
+                               }
+                       }
+                       return InetAddress.getLocalHost();
+               }
+               catch (Exception e)
+               {
+                       Log.e(TAG, "Exception in getInetAddress()", e);
+               }
+               return null;
+       }
+
+       /**
+        * Check for internet connectivity 
+        * 
+        * @param context       context on which to operate
+        * @return true if access to internet is available
+        */
+       static public boolean isInternetOn(Context context)
+       {
+               if (context != null)
+               {
+                       ConnectivityManager conn = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
+                       if (conn != null)
+                       {
+                               NetworkInfo wifi = conn.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
+                               if (wifi != null && wifi.getState() == NetworkInfo.State.CONNECTED)
+                                       return true;
+                               NetworkInfo mobile = conn.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
+                               if (mobile != null && mobile.getState() == NetworkInfo.State.CONNECTED)
+                                       return true;
+                       }
+               }
+               return false;
+       }
+}
index 04f2f60..867c100 100644 (file)
@@ -1,83 +1,83 @@
-package org.netxms.agent.android.helpers;\r
-\r
-/**\r
- * Helper for safe parsing of values (from string)\r
- * \r
- * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)\r
- *\r
- */\r
-\r
-public class SafeParser\r
-{\r
-       /**\r
-        * Parse int without throwing exception\r
-        * @param text text to parse\r
-        * @param defVal default value to be used in case of parse error\r
-        * @return parsed value\r
-        */\r
-       static public int parseInt(String text, int defVal)\r
-       {\r
-               try\r
-               {\r
-                       return Integer.parseInt(text);\r
-               }\r
-               catch (NumberFormatException e)\r
-               {\r
-               }\r
-               return defVal;\r
-       }\r
-\r
-       /**\r
-        * Parse long without throwing exception\r
-        * @param text text to parse\r
-        * @param defVal default value to be used in case of parse error\r
-        * @return parsed value\r
-        */\r
-       static public long parseLong(String text, long defVal)\r
-       {\r
-               try\r
-               {\r
-                       return Long.parseLong(text);\r
-               }\r
-               catch (NumberFormatException e)\r
-               {\r
-               }\r
-               return defVal;\r
-       }\r
-\r
-       /**\r
-        * Parse float without throwing exception\r
-        * @param text text to parse\r
-        * @param defVal default value to be used in case of parse error\r
-        * @return parsed value\r
-        */\r
-       static public float parseFloat(String text, float defVal)\r
-       {\r
-               try\r
-               {\r
-                       return Float.parseFloat(text);\r
-               }\r
-               catch (NumberFormatException e)\r
-               {\r
-               }\r
-               return defVal;\r
-       }\r
-\r
-       /**\r
-        * Parse double without throwing exception\r
-        * @param text text to parse\r
-        * @param defVal default value to be used in case of parse error\r
-        * @return parsed value\r
-        */\r
-       static public double parseDouble(String text, double defVal)\r
-       {\r
-               try\r
-               {\r
-                       return Double.parseDouble(text);\r
-               }\r
-               catch (NumberFormatException e)\r
-               {\r
-               }\r
-               return defVal;\r
-       }\r
-}\r
+package org.netxms.agent.android.helpers;
+
+/**
+ * Helper for safe parsing of values (from string)
+ * 
+ * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)
+ *
+ */
+
+public class SafeParser
+{
+       /**
+        * Parse int without throwing exception
+        * @param text text to parse
+        * @param defVal default value to be used in case of parse error
+        * @return parsed value
+        */
+       static public int parseInt(String text, int defVal)
+       {
+               try
+               {
+                       return Integer.parseInt(text);
+               }
+               catch (NumberFormatException e)
+               {
+               }
+               return defVal;
+       }
+
+       /**
+        * Parse long without throwing exception
+        * @param text text to parse
+        * @param defVal default value to be used in case of parse error
+        * @return parsed value
+        */
+       static public long parseLong(String text, long defVal)
+       {
+               try
+               {
+                       return Long.parseLong(text);
+               }
+               catch (NumberFormatException e)
+               {
+               }
+               return defVal;
+       }
+
+       /**
+        * Parse float without throwing exception
+        * @param text text to parse
+        * @param defVal default value to be used in case of parse error
+        * @return parsed value
+        */
+       static public float parseFloat(String text, float defVal)
+       {
+               try
+               {
+                       return Float.parseFloat(text);
+               }
+               catch (NumberFormatException e)
+               {
+               }
+               return defVal;
+       }
+
+       /**
+        * Parse double without throwing exception
+        * @param text text to parse
+        * @param defVal default value to be used in case of parse error
+        * @return parsed value
+        */
+       static public double parseDouble(String text, double defVal)
+       {
+               try
+               {
+                       return Double.parseDouble(text);
+               }
+               catch (NumberFormatException e)
+               {
+               }
+               return defVal;
+       }
+}
index de32993..9b3203e 100644 (file)
@@ -1,28 +1,28 @@
-package org.netxms.agent.android.helpers;\r
-\r
-import java.util.Calendar;\r
-\r
-/**\r
- * Helper time related tasks\r
- * \r
- * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)\r
- *\r
- */\r
-\r
-public class TimeHelper\r
-{\r
-       /**\r
-        * Get a locale string from specified amount of milliseconds\r
-        * \r
-        * @param millis amount of milliseconds to convert\r
-        * @return time string in local time\r
-        */\r
-       @SuppressWarnings("deprecation")\r
-       static public String getTimeString(long millis)\r
-       {\r
-               Calendar cal = Calendar.getInstance();\r
-               if (millis != 0)\r
-                       cal.setTimeInMillis(millis);\r
-               return cal.getTime().toLocaleString();\r
-       }\r
-}\r
+package org.netxms.agent.android.helpers;
+
+import java.util.Calendar;
+
+/**
+ * Helper time related tasks
+ * 
+ * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)
+ *
+ */
+
+public class TimeHelper
+{
+       /**
+        * Get a locale string from specified amount of milliseconds
+        * 
+        * @param millis amount of milliseconds to convert
+        * @return time string in local time
+        */
+       @SuppressWarnings("deprecation")
+       static public String getTimeString(long millis)
+       {
+               Calendar cal = Calendar.getInstance();
+               if (millis != 0)
+                       cal.setTimeInMillis(millis);
+               return cal.getTime().toLocaleString();
+       }
+}
index 590942a..e46f222 100644 (file)
-package org.netxms.agent.android.main.activities;\r
-\r
-import org.netxms.agent.android.NXApplication;\r
-import org.netxms.agent.android.R;\r
-import org.netxms.agent.android.service.AgentConnectorService;\r
-\r
-import android.app.Activity;\r
-import android.content.ComponentName;\r
-import android.content.Intent;\r
-import android.content.ServiceConnection;\r
-import android.os.Bundle;\r
-import android.os.IBinder;\r
-import android.util.Log;\r
-import android.view.Menu;\r
-import android.view.MenuInflater;\r
-import android.view.MenuItem;\r
-\r
-/**\r
- * Abstract base class for all activities in the client. Implements\r
- * common functionality for connecting to service and handling common items\r
- * in options menu.\r
- */\r
-public abstract class AbstractClientActivity extends Activity implements ServiceConnection\r
-{\r
-       private static final String TAG = "nxagent/AbstractClientActivity";\r
-\r
-       protected AgentConnectorService service;\r
-\r
-       /* (non-Javadoc)\r
-        * @see android.app.Activity#onCreate(android.os.Bundle)\r
-        */\r
-       @Override\r
-       protected void onCreate(Bundle savedInstanceState)\r
-       {\r
-               super.onCreate(savedInstanceState);\r
-               onCreateStep2(savedInstanceState);\r
-               startService(new Intent(this, AgentConnectorService.class));\r
-               bindService(new Intent(this, AgentConnectorService.class), this, 0);\r
-\r
-               // the following is required if target API version is 14:\r
-               //getActionBar().setHomeButtonEnabled(true);\r
-       }\r
-\r
-       /**\r
-        * Called by AbstractClientActivity.onCreate before service binding\r
-        * to allow inherited classes to do initialization before onServiceConnected call\r
-        * \r
-        * @param savedInstanceState\r
-        */\r
-       protected abstract void onCreateStep2(Bundle savedInstanceState);\r
-\r
-       /* (non-Javadoc)\r
-        * @see android.app.Activity#onDestroy()\r
-        */\r
-       @Override\r
-       protected void onDestroy()\r
-       {\r
-               unbindService(this);\r
-               super.onDestroy();\r
-       }\r
-\r
-       /* (non-Javadoc)\r
-        * @see android.app.Activity#onResume()\r
-        */\r
-       @Override\r
-       protected void onResume()\r
-       {\r
-               super.onResume();\r
-               NXApplication.activityResumed();\r
-               if (service != null)\r
-                       service.reconnect(false);\r
-       }\r
-\r
-       /* (non-Javadoc)\r
-        * @see android.app.Activity#onPause()\r
-        */\r
-       @Override\r
-       protected void onPause()\r
-       {\r
-               super.onStop();\r
-               NXApplication.activityPaused();\r
-       }\r
-\r
-       /* (non-Javadoc)\r
-        * @see android.app.Activity#onCreateOptionsMenu(android.view.Menu)\r
-        */\r
-       @Override\r
-       public boolean onCreateOptionsMenu(Menu menu)\r
-       {\r
-               MenuInflater inflater = getMenuInflater();\r
-               inflater.inflate(R.menu.main_menu, menu);\r
-               return true;\r
-       }\r
-\r
-       /* (non-Javadoc)\r
-        * @see android.app.Activity#onOptionsItemSelected(android.view.MenuItem)\r
-        */\r
-       @Override\r
-       public boolean onOptionsItemSelected(MenuItem item)\r
-       {\r
-               Log.d(TAG, "onOptionsItemSelected: id=" + android.R.id.home);\r
-\r
-               if (item.getItemId() == R.id.settings)\r
-               {\r
-                       startActivity(new Intent(this, Preferences.class));\r
-                       return true;\r
-               }\r
-               return super.onOptionsItemSelected(item);\r
-       }\r
-\r
-       /* (non-Javadoc)\r
-        * @see android.content.ServiceConnection#onServiceConnected(android.content.ComponentName, android.os.IBinder)\r
-        */\r
-       @Override\r
-       public void onServiceConnected(ComponentName name, IBinder binder)\r
-       {\r
-               service = ((AgentConnectorService.AgentConnectorBinder)binder).getService();\r
-               if (service != null)\r
-                       service.reconnect(false);\r
-       }\r
-\r
-       /* (non-Javadoc)\r
-        * @see android.content.ServiceConnection#onServiceDisconnected(android.content.ComponentName)\r
-        */\r
-       @Override\r
-       public void onServiceDisconnected(ComponentName name)\r
-       {\r
-       }\r
-}\r
+package org.netxms.agent.android.main.activities;
+
+import org.netxms.agent.android.NXApplication;
+import org.netxms.agent.android.R;
+import org.netxms.agent.android.service.AgentConnectorService;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+
+/**
+ * Abstract base class for all activities in the client. Implements
+ * common functionality for connecting to service and handling common items
+ * in options menu.
+ */
+public abstract class AbstractClientActivity extends Activity implements ServiceConnection
+{
+       private static final String TAG = "nxagent/AbstractClientActivity";
+
+       protected AgentConnectorService service;
+
+       /* (non-Javadoc)
+        * @see android.app.Activity#onCreate(android.os.Bundle)
+        */
+       @Override
+       protected void onCreate(Bundle savedInstanceState)
+       {
+               super.onCreate(savedInstanceState);
+               onCreateStep2(savedInstanceState);
+               startService(new Intent(this, AgentConnectorService.class));
+               bindService(new Intent(this, AgentConnectorService.class), this, 0);
+
+               // the following is required if target API version is 14:
+               //getActionBar().setHomeButtonEnabled(true);
+       }
+
+       /**
+        * Called by AbstractClientActivity.onCreate before service binding
+        * to allow inherited classes to do initialization before onServiceConnected call
+        * 
+        * @param savedInstanceState
+        */
+       protected abstract void onCreateStep2(Bundle savedInstanceState);
+
+       /* (non-Javadoc)
+        * @see android.app.Activity#onDestroy()
+        */
+       @Override
+       protected void onDestroy()
+       {
+               unbindService(this);
+               super.onDestroy();
+       }
+
+       /* (non-Javadoc)
+        * @see android.app.Activity#onResume()
+        */
+       @Override
+       protected void onResume()
+       {
+               super.onResume();
+               NXApplication.activityResumed();
+               if (service != null)
+                       service.reconnect(false);
+       }
+
+       /* (non-Javadoc)
+        * @see android.app.Activity#onPause()
+        */
+       @Override
+       protected void onPause()
+       {
+               super.onStop();
+               NXApplication.activityPaused();
+       }
+
+       /* (non-Javadoc)
+        * @see android.app.Activity#onCreateOptionsMenu(android.view.Menu)
+        */
+       @Override
+       public boolean onCreateOptionsMenu(Menu menu)
+       {
+               MenuInflater inflater = getMenuInflater();
+               inflater.inflate(R.menu.main_menu, menu);
+               return true;
+       }
+
+       /* (non-Javadoc)
+        * @see android.app.Activity#onOptionsItemSelected(android.view.MenuItem)
+        */
+       @Override
+       public boolean onOptionsItemSelected(MenuItem item)
+       {
+               Log.d(TAG, "onOptionsItemSelected: id=" + android.R.id.home);
+
+               if (item.getItemId() == R.id.settings)
+               {
+                       startActivity(new Intent(this, Preferences.class));
+                       return true;
+               }
+               return super.onOptionsItemSelected(item);
+       }
+
+       /* (non-Javadoc)
+        * @see android.content.ServiceConnection#onServiceConnected(android.content.ComponentName, android.os.IBinder)
+        */
+       @Override
+       public void onServiceConnected(ComponentName name, IBinder binder)
+       {
+               service = ((AgentConnectorService.AgentConnectorBinder)binder).getService();
+               if (service != null)
+                       service.reconnect(false);
+       }
+
+       /* (non-Javadoc)
+        * @see android.content.ServiceConnection#onServiceDisconnected(android.content.ComponentName)
+        */
+       @Override
+       public void onServiceDisconnected(ComponentName name)
+       {
+       }
+}
index 4da0620..3c715a3 100644 (file)
@@ -1,67 +1,67 @@
-/**\r
- * \r
- */\r
-package org.netxms.agent.android.main.activities;\r
-\r
-import org.netxms.agent.android.R;\r
-import org.netxms.agent.android.service.AgentConnectorService;\r
-\r
-import android.content.Intent;\r
-import android.os.Bundle;\r
-import android.preference.Preference;\r
-import android.preference.PreferenceActivity;\r
-import android.preference.PreferenceScreen;\r
-\r
-/**\r
- * Console preferences\r
- *\r
- * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)\r
- *\r
- */\r
-\r
-public class Preferences extends PreferenceActivity\r
-{\r
-       /* (non-Javadoc)\r
-        * @see android.preference.PreferenceActivity#onCreate(android.os.Bundle)\r
-        */\r
-       @SuppressWarnings("deprecation")\r
-       @Override\r
-       protected void onCreate(Bundle savedInstanceState)\r
-       {\r
-               super.onCreate(savedInstanceState);\r
-               addPreferencesFromResource(R.xml.preferences);\r
-       }\r
-\r
-       /* (non-Javadoc)\r
-        * @see android.app.Activity#onPause()\r
-        */\r
-       @Override\r
-       protected void onPause()\r
-       {\r
-               super.onPause();\r
-       }\r
-\r
-       /* (non-Javadoc)\r
-        * @see android.preference.PreferenceActivity#onDestroy()\r
-        */\r
-       @Override\r
-       protected void onDestroy()\r
-       {\r
-               Intent i = new Intent(this, AgentConnectorService.class);\r
-               i.setAction(AgentConnectorService.ACTION_CONFIGURE);\r
-               startService(i);\r
-               super.onDestroy();\r
-       }\r
-\r
-       @SuppressWarnings("deprecation")\r
-       @Override\r
-       public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference)\r
-       {\r
-               super.onPreferenceTreeClick(preferenceScreen, preference);\r
-               if (preference != null)\r
-                       if (preference instanceof PreferenceScreen)\r
-                               if (((PreferenceScreen)preference).getDialog() != null)\r
-                                       ((PreferenceScreen)preference).getDialog().getWindow().getDecorView().setBackgroundDrawable(this.getWindow().getDecorView().getBackground().getConstantState().newDrawable());\r
-               return false;\r
-       }\r
-}\r
+/**
+ * 
+ */
+package org.netxms.agent.android.main.activities;
+
+import org.netxms.agent.android.R;
+import org.netxms.agent.android.service.AgentConnectorService;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.preference.Preference;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceScreen;
+
+/**
+ * Console preferences
+ *
+ * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)
+ *
+ */
+
+public class Preferences extends PreferenceActivity
+{
+       /* (non-Javadoc)
+        * @see android.preference.PreferenceActivity#onCreate(android.os.Bundle)
+        */
+       @SuppressWarnings("deprecation")
+       @Override
+       protected void onCreate(Bundle savedInstanceState)
+       {
+               super.onCreate(savedInstanceState);
+               addPreferencesFromResource(R.xml.preferences);
+       }
+
+       /* (non-Javadoc)
+        * @see android.app.Activity#onPause()
+        */
+       @Override
+       protected void onPause()
+       {
+               super.onPause();
+       }
+
+       /* (non-Javadoc)
+        * @see android.preference.PreferenceActivity#onDestroy()
+        */
+       @Override
+       protected void onDestroy()
+       {
+               Intent i = new Intent(this, AgentConnectorService.class);
+               i.setAction(AgentConnectorService.ACTION_CONFIGURE);
+               startService(i);
+               super.onDestroy();
+       }
+
+       @SuppressWarnings("deprecation")
+       @Override
+       public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference)
+       {
+               super.onPreferenceTreeClick(preferenceScreen, preference);
+               if (preference != null)
+                       if (preference instanceof PreferenceScreen)
+                               if (((PreferenceScreen)preference).getDialog() != null)
+                                       ((PreferenceScreen)preference).getDialog().getWindow().getDecorView().setBackgroundDrawable(this.getWindow().getDecorView().getBackground().getConstantState().newDrawable());
+               return false;
+       }
+}
index db5cd30..7d304ea 100644 (file)
-package org.netxms.agent.android.main.settings;\r
-\r
-import org.netxms.agent.android.R;\r
-\r
-import android.content.Context;\r
-import android.content.res.TypedArray;\r
-import android.preference.DialogPreference;\r
-import android.text.format.DateFormat;\r
-import android.util.AttributeSet;\r
-import android.view.View;\r
-import android.widget.TimePicker;\r
-\r
-/**\r
- * Custom handler for time picker\r
- * \r
- * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)\r
- * \r
- */\r
-\r
-public class TimePreference extends DialogPreference\r
-{\r
-       private int lastHour = 0;\r
-       private int lastMinute = 0;\r
-       private TimePicker picker = null;\r
-\r
-       public static int getHour(String time)\r
-       {\r
-               String[] pieces = time.split(":");\r
-\r
-               return (Integer.parseInt(pieces[0]));\r
-       }\r
-\r
-       public static int getMinute(String time)\r
-       {\r
-               String[] pieces = time.split(":");\r
-\r
-               return (Integer.parseInt(pieces[1]));\r
-       }\r
-\r
-       public TimePreference(Context ctxt)\r
-       {\r
-               this(ctxt, null);\r
-       }\r
-\r
-       public TimePreference(Context ctxt, AttributeSet attrs)\r
-       {\r
-               this(ctxt, attrs, android.R.attr.dialogPreferenceStyle);\r
-       }\r
-\r
-       public TimePreference(Context ctxt, AttributeSet attrs, int defStyle)\r
-       {\r
-               super(ctxt, attrs, defStyle);\r
-\r
-               setPositiveButtonText(ctxt.getResources().getString(R.string.set));\r
-               setNegativeButtonText(ctxt.getResources().getString(R.string.cancel));\r
-       }\r
-\r
-       @Override\r
-       protected View onCreateDialogView()\r
-       {\r
-               picker = new TimePicker(getContext());\r
-               picker.setIs24HourView(DateFormat.is24HourFormat(this.getContext()));\r
-               picker.setAddStatesFromChildren(true);\r
-               return (picker);\r
-       }\r
-\r
-       @Override\r
-       protected void onBindDialogView(View v)\r
-       {\r
-               super.onBindDialogView(v);\r
-\r
-               picker.setCurrentHour(lastHour);\r
-               picker.setCurrentMinute(lastMinute);\r
-       }\r
-\r
-       @Override\r
-       protected void onDialogClosed(boolean positiveResult)\r
-       {\r
-               picker.clearFocus(); // Force reading of values input by keyboard\r
-               super.onDialogClosed(positiveResult);\r
-\r
-               if (positiveResult)\r
-               {\r
-                       lastHour = picker.getCurrentHour();\r
-                       lastMinute = picker.getCurrentMinute();\r
-\r
-                       String time = (lastHour < 9 ? "0" : "") + String.valueOf(lastHour) + (lastMinute < 9 ? ":0" : ":") + String.valueOf(lastMinute);\r
-\r
-                       if (callChangeListener(time))\r
-                               persistString(time);\r
-               }\r
-       }\r
-\r
-       @Override\r
-       protected Object onGetDefaultValue(TypedArray a, int index)\r
-       {\r
-               return (a.getString(index));\r
-       }\r
-\r
-       @Override\r
-       protected void onSetInitialValue(boolean restoreValue, Object defaultValue)\r
-       {\r
-               String time = null;\r
-\r
-               if (restoreValue)\r
-               {\r
-                       if (defaultValue == null)\r
-                               time = getPersistedString("00:00");\r
-                       else\r
-                               time = getPersistedString(defaultValue.toString());\r
-               }\r
-               else\r
-               {\r
-                       time = defaultValue.toString();\r
-               }\r
-               lastHour = getHour(time);\r
-               lastMinute = getMinute(time);\r
-       }\r
-}\r
+package org.netxms.agent.android.main.settings;
+
+import org.netxms.agent.android.R;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.preference.DialogPreference;
+import android.text.format.DateFormat;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.TimePicker;
+
+/**
+ * Custom handler for time picker
+ * 
+ * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)
+ * 
+ */
+
+public class TimePreference extends DialogPreference
+{
+       private int lastHour = 0;
+       private int lastMinute = 0;
+       private TimePicker picker = null;
+
+       public static int getHour(String time)
+       {
+               String[] pieces = time.split(":");
+
+               return (Integer.parseInt(pieces[0]));
+       }
+
+       public static int getMinute(String time)
+       {
+               String[] pieces = time.split(":");
+
+               return (Integer.parseInt(pieces[1]));
+       }
+
+       public TimePreference(Context ctxt)
+       {
+               this(ctxt, null);
+       }
+
+       public TimePreference(Context ctxt, AttributeSet attrs)
+       {
+               this(ctxt, attrs, android.R.attr.dialogPreferenceStyle);
+       }
+
+       public TimePreference(Context ctxt, AttributeSet attrs, int defStyle)
+       {
+               super(ctxt, attrs, defStyle);
+
+               setPositiveButtonText(ctxt.getResources().getString(R.string.set));
+               setNegativeButtonText(ctxt.getResources().getString(R.string.cancel));
+       }
+
+       @Override
+       protected View onCreateDialogView()
+       {
+               picker = new TimePicker(getContext());
+               picker.setIs24HourView(DateFormat.is24HourFormat(this.getContext()));
+               picker.setAddStatesFromChildren(true);
+               return (picker);
+       }
+
+       @Override
+       protected void onBindDialogView(View v)
+       {
+               super.onBindDialogView(v);
+
+               picker.setCurrentHour(lastHour);
+               picker.setCurrentMinute(lastMinute);
+       }
+
+       @Override
+       protected void onDialogClosed(boolean positiveResult)
+       {
+               picker.clearFocus(); // Force reading of values input by keyboard
+               super.onDialogClosed(positiveResult);
+
+               if (positiveResult)
+               {
+                       lastHour = picker.getCurrentHour();
+                       lastMinute = picker.getCurrentMinute();
+
+                       String time = (lastHour < 9 ? "0" : "") + String.valueOf(lastHour) + (lastMinute < 9 ? ":0" : ":") + String.valueOf(lastMinute);
+
+                       if (callChangeListener(time))
+                               persistString(time);
+               }
+       }
+
+       @Override
+       protected Object onGetDefaultValue(TypedArray a, int index)
+       {
+               return (a.getString(index));
+       }
+
+       @Override
+       protected void onSetInitialValue(boolean restoreValue, Object defaultValue)
+       {
+               String time = null;
+
+               if (restoreValue)
+               {
+                       if (defaultValue == null)
+                               time = getPersistedString("00:00");
+                       else
+                               time = getPersistedString(defaultValue.toString());
+               }
+               else
+               {
+                       time = defaultValue.toString();
+               }
+               lastHour = getHour(time);
+               lastMinute = getMinute(time);
+       }
+}
index 8e5a10c..e5a6caf 100644 (file)
@@ -1,32 +1,32 @@
-package org.netxms.agent.android.receivers;\r
-\r
-import org.netxms.agent.android.main.activities.HomeScreen;\r
-import org.netxms.agent.android.service.AgentConnectorService;\r
-\r
-import android.content.BroadcastReceiver;\r
-import android.content.Context;\r
-import android.content.Intent;\r
-import android.content.SharedPreferences;\r
-import android.preference.PreferenceManager;\r
-\r
-/**\r
- * Intent receiver for timer (alarm) broadcast message\r
- * \r
- * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)\r
- * \r
- */\r
-\r
-public class AlarmIntentReceiver extends BroadcastReceiver\r
-{\r
-       @Override\r
-       public void onReceive(Context context, Intent intent)\r
-       {\r
-               SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);\r
-               if (!sp.getBoolean(HomeScreen.INTENTIONAL_EXIT_KEY, false) && sp.getBoolean("global.activate", false))\r
-               {\r
-                       Intent i = new Intent(context, AgentConnectorService.class);\r
-                       i.setAction(AgentConnectorService.ACTION_CONNECT);\r
-                       context.startService(i);\r
-               }\r
-       }\r
-}\r
+package org.netxms.agent.android.receivers;
+
+import org.netxms.agent.android.main.activities.HomeScreen;
+import org.netxms.agent.android.service.AgentConnectorService;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
+
+/**
+ * Intent receiver for timer (alarm) broadcast message
+ * 
+ * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)
+ * 
+ */
+
+public class AlarmIntentReceiver extends BroadcastReceiver
+{
+       @Override
+       public void onReceive(Context context, Intent intent)
+       {
+               SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
+               if (!sp.getBoolean(HomeScreen.INTENTIONAL_EXIT_KEY, false) && sp.getBoolean("global.activate", false))
+               {
+                       Intent i = new Intent(context, AgentConnectorService.class);
+                       i.setAction(AgentConnectorService.ACTION_CONNECT);
+                       context.startService(i);
+               }
+       }
+}
index 19c3c62..baf1b82 100644 (file)
@@ -1,31 +1,31 @@
-package org.netxms.agent.android.receivers;\r
-\r
-import org.netxms.agent.android.service.AgentConnectorService;\r
-\r
-import android.content.BroadcastReceiver;\r
-import android.content.Context;\r
-import android.content.Intent;\r
-import android.content.SharedPreferences;\r
-import android.preference.PreferenceManager;\r
-\r
-/**\r
- * Intent receiver for boot completed broadcast message\r
- * \r
- * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)\r
- * \r
- */\r
-\r
-public class BootCompletedIntentReceiver extends BroadcastReceiver\r
-{\r
-       @Override\r
-       public void onReceive(Context context, Intent intent)\r
-       {\r
-               SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);\r
-               if (sp.getBoolean("global.autostart", false) && sp.getBoolean("global.activate", false))\r
-               {\r
-                       Intent i = new Intent(context, AgentConnectorService.class);\r
-                       i.setAction(AgentConnectorService.ACTION_FORCE_CONNECT);\r
-                       context.startService(i);\r
-               }\r
-       }\r
-}\r
+package org.netxms.agent.android.receivers;
+
+import org.netxms.agent.android.service.AgentConnectorService;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
+
+/**
+ * Intent receiver for boot completed broadcast message
+ * 
+ * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)
+ * 
+ */
+
+public class BootCompletedIntentReceiver extends BroadcastReceiver
+{
+       @Override
+       public void onReceive(Context context, Intent intent)
+       {
+               SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
+               if (sp.getBoolean("global.autostart", false) && sp.getBoolean("global.activate", false))
+               {
+                       Intent i = new Intent(context, AgentConnectorService.class);
+                       i.setAction(AgentConnectorService.ACTION_FORCE_CONNECT);
+                       context.startService(i);
+               }
+       }
+}
index 0571793..3a0fa42 100644 (file)
@@ -1,42 +1,42 @@
-package org.netxms.agent.android.receivers;\r
-\r
-import org.netxms.agent.android.main.activities.HomeScreen;\r
-import org.netxms.agent.android.service.AgentConnectorService;\r
-\r
-import android.content.BroadcastReceiver;\r
-import android.content.Context;\r
-import android.content.Intent;\r
-import android.content.SharedPreferences;\r
-import android.net.ConnectivityManager;\r
-import android.net.NetworkInfo;\r
-import android.preference.PreferenceManager;\r
-\r
-/**\r
- * Intent receiver for connectivity change broadcast message\r
- * \r
- * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)\r
- * \r
- */\r
-\r
-public class ConnectivityChangeIntentReceiver extends BroadcastReceiver\r
-{\r
-       @SuppressWarnings("deprecation")\r
-       @Override\r
-       public void onReceive(Context context, Intent intent)\r
-       {\r
-               SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);\r
-               if (!sp.getBoolean(HomeScreen.INTENTIONAL_EXIT_KEY, false) &&\r
-                               sp.getBoolean("global.activate", false) &&\r
-                               sp.getBoolean("connection.override", false))\r
-                       if (intent.getExtras() != null)\r
-                       {\r
-                               NetworkInfo ni = (NetworkInfo)intent.getExtras().get(ConnectivityManager.EXTRA_NETWORK_INFO);\r
-                               if (ni != null && ni.getState() == NetworkInfo.State.CONNECTED)\r
-                               {\r
-                                       Intent i = new Intent(context, AgentConnectorService.class);\r
-                                       i.setAction(AgentConnectorService.ACTION_FORCE_CONNECT);\r
-                                       context.startService(i);\r
-                               }\r
-                       }\r
-       }\r
-}\r
+package org.netxms.agent.android.receivers;
+
+import org.netxms.agent.android.main.activities.HomeScreen;
+import org.netxms.agent.android.service.AgentConnectorService;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.preference.PreferenceManager;
+
+/**
+ * Intent receiver for connectivity change broadcast message
+ * 
+ * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)
+ * 
+ */
+
+public class ConnectivityChangeIntentReceiver extends BroadcastReceiver
+{
+       @SuppressWarnings("deprecation")
+       @Override
+       public void onReceive(Context context, Intent intent)
+       {
+               SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
+               if (!sp.getBoolean(HomeScreen.INTENTIONAL_EXIT_KEY, false) &&
+                               sp.getBoolean("global.activate", false) &&
+                               sp.getBoolean("connection.override", false))
+                       if (intent.getExtras() != null)
+                       {
+                               NetworkInfo ni = (NetworkInfo)intent.getExtras().get(ConnectivityManager.EXTRA_NETWORK_INFO);
+                               if (ni != null && ni.getState() == NetworkInfo.State.CONNECTED)
+                               {
+                                       Intent i = new Intent(context, AgentConnectorService.class);
+                                       i.setAction(AgentConnectorService.ACTION_FORCE_CONNECT);
+                                       context.startService(i);
+                               }
+                       }
+       }
+}
index 9725032..6ff8f5b 100644 (file)
-/**\r
- * \r
- */\r
-package org.netxms.agent.android.service;\r
-\r
-import java.io.IOException;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\r
-\r
-import org.netxms.agent.android.R;\r
-import org.netxms.agent.android.helpers.DeviceInfoHelper;\r
-import org.netxms.agent.android.helpers.NetHelper;\r
-import org.netxms.agent.android.helpers.SafeParser;\r
-import org.netxms.agent.android.helpers.TimeHelper;\r
-import org.netxms.agent.android.main.activities.HomeScreen;\r
-import org.netxms.agent.android.receivers.AlarmIntentReceiver;\r
-import org.netxms.agent.android.service.helpers.AndroidLoggingFacility;\r
-import org.netxms.base.GeoLocation;\r
-import org.netxms.base.Logger;\r
-import org.netxms.mobile.agent.MobileAgentException;\r
-import org.netxms.mobile.agent.Session;\r
-\r
-import android.app.AlarmManager;\r
-import android.app.PendingIntent;\r
-import android.app.Service;\r
-import android.content.BroadcastReceiver;\r
-import android.content.Context;\r
-import android.content.Intent;\r
-import android.content.IntentFilter;\r
-import android.content.SharedPreferences;\r
-import android.content.SharedPreferences.Editor;\r
-import android.location.Criteria;\r
-import android.location.Location;\r
-import android.location.LocationListener;\r
-import android.location.LocationManager;\r
-import android.os.AsyncTask;\r
-import android.os.Binder;\r
-import android.os.Bundle;\r
-import android.os.Handler;\r
-import android.os.IBinder;\r
-import android.preference.PreferenceManager;\r
-import android.util.Log;\r
-import android.widget.Toast;\r
-\r
-/**\r
- * Background communication service for NetXMS agent.\r
- * \r
- * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)\r
- * \r
- */\r
-\r
-public class AgentConnectorService extends Service implements LocationListener\r
-{\r
-       public enum ConnectionStatus\r
-       {\r
-               CS_NOCONNECTION, CS_INPROGRESS, CS_ALREADYCONNECTED, CS_CONNECTED, CS_DISCONNECTED, CS_ERROR\r
-       };\r
-\r
-       public static final String ACTION_CONNECT = "org.netxms.agent.android.ACTION_CONNECT";\r
-       public static final String ACTION_FORCE_CONNECT = "org.netxms.agent.android.ACTION_FORCE_CONNECT";\r
-       public static final String ACTION_SCHEDULE = "org.netxms.agent.android.ACTION_SCHEDULE";\r
-       public static final String ACTION_CONFIGURE = "org.netxms.agent.android.ACTION_CONFIGURE";\r
-\r
-       public static boolean gettingNewLocation = false;\r
-\r
-       private static final String TAG = "nxagent/AgentConnectorService";\r
-       private static final int ONE_DAY_MINUTES = 24 * 60;\r
-       private static final int NETXMS_REQUEST_CODE = 123456;\r
-       private static final int STRATEGY_NET_ONLY = 0;\r
-       private static final int STRATEGY_GPS_ONLY = 1;\r
-       private static final int STRATEGY_NET_AND_GPS = 2;\r
-\r
-       private final Binder binder = new AgentConnectorBinder();\r
-       private Handler uiThreadHandler = null;\r
-       private Handler locationHandler = null;\r
-       private ConnectionStatus connectionStatus = ConnectionStatus.CS_DISCONNECTED;\r
-       private BroadcastReceiver receiver = null;\r
-       private SharedPreferences sp;\r
-       private LocationManager locationManager = null;\r
-       private HomeScreen homeScreen = null;\r
-       private boolean sendDeviceSystemInfo = true;\r
-       private boolean agentActive;\r
-       private boolean notifyToast;\r
-       private String connectionServer;\r
-       private int connectionPort;\r
-       private String connectionLogin;\r
-       private String connectionPassword;\r
-       private boolean connectionEncrypt;\r
-       private boolean schedulerDaily;\r
-       private int connectionInterval;\r
-       private boolean locationForce;\r
-       private int locationInterval;\r
-       private int locationDuration;\r
-       private int locationStrategy;\r
-       private String locationProvider = "";\r
-       private String allowedProviders = "";\r
-\r
-       /**\r
-        * Class for clients to access. Because we know this service always runs in\r
-        * the same process as its clients, we don't need to deal with IPC.\r
-        */\r
-       public class AgentConnectorBinder extends Binder\r
-       {\r
-               public AgentConnectorService getService()\r
-               {\r
-                       return AgentConnectorService.this;\r
-               }\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * \r
-        * @see android.app.Service#onCreate()\r
-        */\r
-       @Override\r
-       public void onCreate()\r
-       {\r
-               super.onCreate();\r
-               uiThreadHandler = new Handler(getMainLooper());\r
-               showToast(getString(R.string.notify_started));\r
-\r
-               sp = PreferenceManager.getDefaultSharedPreferences(this);\r
-               Logger.setLoggingFacility(new AndroidLoggingFacility());\r
-               locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);\r
-               configure();\r
-\r
-               receiver = new BroadcastReceiver()\r
-               {\r
-                       @Override\r
-                       public void onReceive(Context context, Intent intent)\r
-                       {\r
-                               Intent i = new Intent(context, AgentConnectorService.class);\r
-                               i.setAction(ACTION_SCHEDULE);\r
-                               context.startService(i);\r
-                       }\r
-               };\r
-               registerReceiver(receiver, new IntentFilter(Intent.ACTION_TIME_TICK));\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * \r
-        * @see android.app.Service#onStartCommand(android.content.Intent, int, int)\r
-        */\r
-       @Override\r
-       public int onStartCommand(Intent intent, int flags, int startId)\r
-       {\r
-               if ((intent != null) && (intent.getAction() != null))\r
-               {\r
-                       Log.i(TAG, "onStartCommand: " + intent.getAction());\r
-                       if (intent.getAction().equals(ACTION_CONNECT))\r
-                               reconnect(false);\r
-                       else if (intent.getAction().equals(ACTION_FORCE_CONNECT))\r
-                       {\r
-                               sendDeviceSystemInfo = true;\r
-                               reconnect(true);\r
-                       }\r
-                       else if (intent.getAction().equals(ACTION_CONFIGURE))\r
-                       {\r
-                               sendDeviceSystemInfo = true;\r
-                               configure();\r
-                               reconnect(true);\r
-                       }\r
-               }\r
-               return super.onStartCommand(intent, flags, startId);\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * \r
-        * @see android.app.Service#onBind(android.content.Intent)\r
-        */\r
-       @Override\r
-       public IBinder onBind(Intent intent)\r
-       {\r
-               return binder;\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * \r
-        * @see android.app.Service#onDestroy()\r
-        */\r
-       @Override\r
-       public void onDestroy()\r
-       {\r
-               super.onDestroy();\r
-       }\r
-\r
-       /**\r
-        * Configure background service\r
-        */\r
-       void configure()\r
-       {\r
-               updateLocationStatus("");\r
-               refreshHomeScreen();\r
-               agentActive = sp.getBoolean("global.activate", false);\r
-               notifyToast = sp.getBoolean("notification.toast", true);\r
-               connectionServer = sp.getString("connection.server", "");\r
-               connectionPort = SafeParser.parseInt(sp.getString("connection.port", "4747"), 4747);\r
-               connectionLogin = sp.getString("connection.login", "");\r
-               connectionPassword = sp.getString("connection.password", "");\r
-               connectionEncrypt = sp.getBoolean("connection.encrypt", false);\r
-               connectionInterval = SafeParser.parseInt(sp.getString("connection.interval", "15"), 15) * 60 * 1000;\r
-               schedulerDaily = sp.getBoolean("scheduler.daily.enable", false);\r
-               locationStrategy = SafeParser.parseInt(sp.getString("location.strategy", "0"), 0);\r
-               locationInterval = SafeParser.parseInt(sp.getString("location.interval", "30"), 30) * 60 * 1000;\r
-               locationDuration = SafeParser.parseInt(sp.getString("location.duration", "2"), 2) * 60 * 1000;\r
-               locationForce = sp.getBoolean("location.force", false);\r
-               if (locationHandler != null)\r
-                       locationHandler.removeCallbacks(locationTask);\r
-               if (locationManager != null)\r
-                       if (agentActive)\r
-                       {\r
-                               if (locationHandler == null)\r
-                                       locationHandler = new Handler(getMainLooper());\r
-                               if (locationHandler != null)\r
-                               {\r
-                                       AgentConnectorService.gettingNewLocation = false;\r
-                                       locationProvider = "";\r
-                                       locationHandler.post(locationTask);\r
-                               }\r
-                       }\r
-                       else\r
-                               locationManager.removeUpdates(AgentConnectorService.this);\r
-       }\r
-\r
-       /**\r
-        * Shutdown background service\r
-        */\r
-       public void shutdown()\r
-       {\r
-               updateLocationStatus("");\r
-               cancelConnectionSchedule();\r
-               unregisterReceiver(receiver);\r
-               stopSelf();\r
-       }\r
-\r
-       /**\r
-        * Show status notification\r
-        * \r
-        * @param status        connection status\r
-        * @param extra extra text to add at the end of the toast\r
-        */\r
-       public void statusNotification(ConnectionStatus status, String extra)\r
-       {\r
-               connectionStatus = status;\r
-               String text = "";\r
-               switch (status)\r
-               {\r
-                       case CS_CONNECTED:\r
-                               text = getString(R.string.notify_connected, extra);\r
-                               break;\r
-                       case CS_ERROR:\r
-                               text = getString(R.string.notify_connection_failed, extra);\r
-                               break;\r
-                       case CS_NOCONNECTION:\r
-                       case CS_INPROGRESS:\r
-                       case CS_ALREADYCONNECTED:\r
-                       default:\r
-                               return;\r
-               }\r
-               if (notifyToast)\r
-                       showToast(text);\r
-       }\r
-\r
-       /**\r
-        * Reconnect to server.\r
-        * \r
-        * @param force if set to true forces reconnection bypassing the scheduler\r
-        */\r
-       public void reconnect(boolean force)\r
-       {\r
-               if (agentActive && (force || isConnectionScheduleExpired()) &&\r
-                               connectionStatus != ConnectionStatus.CS_INPROGRESS &&\r
-                               connectionStatus != ConnectionStatus.CS_CONNECTED)\r
-               {\r
-                       new PushDataTask(connectionServer, connectionPort,\r
-                                       DeviceInfoHelper.getDeviceId(getApplicationContext()),\r
-                                       connectionLogin, connectionPassword, connectionEncrypt).execute();\r
-               }\r
-       }\r
-\r
-       /**\r
-        * @param homeScreen\r
-        */\r
-       public void registerHomeScreen(HomeScreen homeScreen)\r
-       {\r
-               this.homeScreen = homeScreen;\r
-       }\r
-\r
-       /**\r
-        * Show toast with given text\r
-        * \r
-        * @param text message text\r
-        */\r
-       public void showToast(final String text)\r
-       {\r
-               if (uiThreadHandler != null)\r
-                       uiThreadHandler.post(new Runnable()\r
-                       {\r
-                               @Override\r
-                               public void run()\r
-                               {\r
-                                       Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT).show();\r
-                               }\r
-                       });\r
-       }\r
-\r
-       /**\r
-        * Refresh homescreen  activity\r
-        */\r
-       private void refreshHomeScreen()\r
-       {\r
-               if (homeScreen != null)\r
-               {\r
-                       homeScreen.runOnUiThread(new Runnable()\r
-                       {\r
-                               @Override\r
-                               public void run()\r
-                               {\r
-                                       homeScreen.refreshStatus();\r
-                               }\r
-                       });\r
-               }\r
-       }\r
-\r
-       /**\r
-        * Gets stored time settings in minutes\r
-        */\r
-       private int getMinutes(String time)\r
-       {\r
-               String[] vals = sp.getString(time, "00:00").split(":");\r
-               return Integer.parseInt(vals[0]) * 60 + Integer.parseInt(vals[1]);\r
-       }\r
-\r
-       /**\r
-        * Sets the offset used to compute the next schedule\r
-        */\r
-       private void setDayOffset(Calendar cal, int minutes)\r
-       {\r
-               cal.set(Calendar.HOUR_OF_DAY, 0);\r
-               cal.set(Calendar.MINUTE, 0);\r
-               cal.set(Calendar.SECOND, 0);\r
-               cal.set(Calendar.MILLISECOND, 0);\r
-               cal.add(Calendar.MINUTE, minutes);\r
-       }\r
-\r
-       /**\r
-        * Get the next schedule based on daily interval, if set\r
-        * \r
-        * @param interval      expected schedule in milliseconds\r
-        * @return new schedule in milliseconds adjusted as necessary\r
-        */\r
-       private long getNextSchedule(int interval)\r
-       {\r
-               if (!schedulerDaily)\r
-                       return interval;\r
-               Calendar cal = Calendar.getInstance(); // get a Calendar object with current time\r
-               long now = cal.getTimeInMillis();\r
-               int on = getMinutes("scheduler.daily.on");\r
-               int off = getMinutes("scheduler.daily.off");\r
-               if (off < on)\r
-                       off += ONE_DAY_MINUTES; // Next day!\r
-               Calendar calOn = (Calendar)cal.clone();\r
-               setDayOffset(calOn, on);\r
-               Calendar calOff = (Calendar)cal.clone();\r
-               setDayOffset(calOff, off);\r
-               cal.add(Calendar.MILLISECOND, interval);\r
-               if (cal.before(calOn))\r
-               {\r
-                       cal = (Calendar)calOn.clone();\r
-                       Log.i(TAG, "Rescheduled for daily interval (before 'on')");\r
-               }\r
-               else if (cal.after(calOff))\r
-               {\r
-                       cal = (Calendar)calOn.clone();\r
-                       setDayOffset(cal, on + ONE_DAY_MINUTES); // Move to the next activation of the excluded range\r
-                       Log.i(TAG, "Rescheduled for daily interval (after 'off')");\r
-               }\r
-               Log.i(TAG, "Next schedule in " + (cal.getTimeInMillis() - now) / 1000 + " seconds");\r
-               return cal.getTimeInMillis() - now;\r
-       }\r
-\r
-       /**\r
-        * Check for expired pending connection schedule\r
-        */\r
-       private boolean isConnectionScheduleExpired()\r
-       {\r
-               Calendar cal = Calendar.getInstance(); // get a Calendar object with current time\r
-               return cal.getTimeInMillis() > sp.getLong("scheduler.next_activation", 0);\r
-       }\r
-\r
-       /**\r
-        * Set a connection schedule\r
-        * \r
-        * @param milliseconds  time for new schedule\r
-        */\r
-       private void setConnectionSchedule(long milliseconds)\r
-       {\r
-               Log.i(TAG, "setSchedule to: " + TimeHelper.getTimeString(milliseconds));\r
-               Intent intent = new Intent(this, AlarmIntentReceiver.class);\r
-               PendingIntent sender = PendingIntent.getBroadcast(this, NETXMS_REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT);\r
-               ((AlarmManager)getSystemService(ALARM_SERVICE)).set(AlarmManager.RTC_WAKEUP, milliseconds, sender);\r
-               Editor e = sp.edit();\r
-               e.putLong("scheduler.next_activation", milliseconds);\r
-               e.commit();\r
-       }\r
-\r
-       /**\r
-        * Cancel a pending connection schedule (if any)\r
-        */\r
-       private void cancelConnectionSchedule()\r
-       {\r
-               Log.i(TAG, "cancelSchedule");\r
-               Intent intent = new Intent(this, AlarmIntentReceiver.class);\r
-               PendingIntent sender = PendingIntent.getBroadcast(this, NETXMS_REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT);\r
-               ((AlarmManager)getSystemService(ALARM_SERVICE)).cancel(sender);\r
-               Editor e = sp.edit();\r
-               e.putLong("scheduler.next_activation", 0);\r
-               e.commit();\r
-       }\r
-\r
-       /**\r
-        * Get flags. Currently not used.\r
-        */\r
-       private int getFlags()\r
-       {\r
-               return 0;\r
-       }\r
-\r
-       /**\r
-        * Internal task for connecting and pushing data\r
-        */\r
-       private class PushDataTask extends AsyncTask<Object, Void, Boolean>\r
-       {\r
-               private final String server;\r
-               private final Integer port;\r
-               private final String deviceId;\r
-               private final String login;\r
-               private final String password;\r
-               private final boolean encrypt;\r
-               private String connMsg = "";\r
-\r
-               protected PushDataTask(String server, Integer port, String deviceId, String login, String password, boolean encrypt)\r
-               {\r
-                       this.server = server;\r
-                       this.port = port;\r
-                       this.deviceId = deviceId;\r
-                       this.login = login;\r
-                       this.password = password;\r
-                       this.encrypt = encrypt;\r
-               }\r
-\r
-               @Override\r
-               protected Boolean doInBackground(Object... params)\r
-               {\r
-                       Log.d(TAG, "PushDataTask.doInBackground: reconnecting...");\r
-                       statusNotification(ConnectionStatus.CS_INPROGRESS, "");\r
-                       if (NetHelper.isInternetOn(getApplicationContext()))\r
-                       {\r
-                               Session session = new Session(server, port, deviceId, login, password, encrypt);\r
-                               try\r
-                               {\r
-                                       session.connect();\r
-                                       Log.d(TAG, "PushDataTask.doInBackground: connected");\r
-                                       statusNotification(ConnectionStatus.CS_CONNECTED, getString(R.string.notify_pushing_data));\r
-                                       if (sendDeviceSystemInfo)\r
-                                       {\r
-                                               Log.d(TAG, "PushDataTask.doInBackground: sending DeviceSystemInfo");\r
-                                               session.reportDeviceSystemInfo(DeviceInfoHelper.getManufacturer(), DeviceInfoHelper.getModel(),\r
-                                                               DeviceInfoHelper.getOSName(), DeviceInfoHelper.getRelease(), DeviceInfoHelper.getSerial(),\r
-                                                               DeviceInfoHelper.getUser(getApplicationContext()));\r
-                                               sendDeviceSystemInfo = false;\r
-                                       }\r
-                                       session.reportDeviceStatus(NetHelper.getInetAddress(), getGeoLocation(), getFlags(),\r
-                                                       DeviceInfoHelper.getBatteryLevel(getApplicationContext()));\r
-                                       session.disconnect();\r
-                                       Log.d(TAG, "PushDataTask.doInBackground: data transfer completed");\r
-                                       connMsg = getString(R.string.notify_connected, server + ":" + port);\r
-                                       return true;\r
-                               }\r
-                               catch (IOException e)\r
-                               {\r
-                                       Log.e(TAG, "IOException while executing PushDataTask.doInBackground on connect", e);\r
-                                       connMsg = e.getLocalizedMessage();\r
-                               }\r
-                               catch (MobileAgentException e)\r
-                               {\r
-                                       Log.e(TAG, "MobileAgentException while executing PushDataTask.doInBackground on connect", e);\r
-                                       connMsg = e.getLocalizedMessage();\r
-                               }\r
-                       }\r
-                       else\r
-                       {\r
-                               Log.w(TAG, "PushDataTask.doInBackground: no internet connection");\r
-                               connMsg = getString(R.string.notify_no_connection);\r
-                       }\r
-                       return false;\r
-               }\r
-\r
-               @Override\r
-               protected void onPostExecute(Boolean result)\r
-               {\r
-                       if (result == true)\r
-                       {\r
-                               Log.d(TAG, "PushDataTask.onPostExecute: disconnecting...");\r
-                               statusNotification(ConnectionStatus.CS_DISCONNECTED, "");\r
-                       }\r
-                       else\r
-                       {\r
-                               Log.e(TAG, "PushDataTask.onPostExecute: error: " + connMsg);\r
-                               statusNotification(ConnectionStatus.CS_ERROR, connMsg);\r
-                       }\r
-                       Editor e = sp.edit();\r
-                       e.putLong("scheduler.last_activation", Calendar.getInstance().getTimeInMillis());\r
-                       e.putString("scheduler.last_activation_msg", connMsg);\r
-                       e.commit();\r
-                       if (agentActive)\r
-                               setConnectionSchedule(Calendar.getInstance().getTimeInMillis() + getNextSchedule(connectionInterval));\r
-                       else\r
-                               cancelConnectionSchedule();\r
-                       refreshHomeScreen();\r
-               }\r
-       }\r
-\r
-       /**\r
-        * Updates last location status\r
-        * \r
-        * @pasam status        status of last location\r
-        */\r
-       private void updateLocationStatus(String status)\r
-       {\r
-               Editor e = sp.edit();\r
-               e.putString("location.last_status", status);\r
-               e.commit();\r
-       }\r
-\r
-       /**\r
-        * Convert location provider from Android type to NetXMS type.\r
-        * \r
-        * @return Provider type\r
-        */\r
-       private int getProviderType(String provider)\r
-       {\r
-               if (provider.compareTo(LocationManager.GPS_PROVIDER) == 0)\r
-                       return GeoLocation.GPS;\r
-               else if (provider.compareTo(LocationManager.NETWORK_PROVIDER) == 0)\r
-                       return GeoLocation.NETWORK;\r
-               return GeoLocation.UNSET;\r
-       }\r
-\r
-       /**\r
-        * Get last known geolocation (depending on strategy used it could be very old).\r
-        * If no provider available, try to get a last position from any available provider\r
-        * identifyed by the system using the ACCURACY_COARSE criteria.\r
-        * \r
-        * @return Last known location or null if not known\r
-        */\r
-       private GeoLocation getGeoLocation()\r
-       {\r
-               if (locationManager != null)\r
-               {\r
-                       Location location = null;\r
-                       if (locationProvider.length() > 0) // Did we get an updated position?\r
-                               location = locationManager.getLastKnownLocation(locationProvider);\r
-                       else\r
-                       {       // Try to get it using the best provider available\r
-                               Criteria criteria = new Criteria();\r
-                               if (criteria != null)\r
-                               {\r
-                                       criteria.setAccuracy(Criteria.ACCURACY_COARSE);\r
-                                       String bestProvider = locationManager.getBestProvider(criteria, true);\r
-                                       if (bestProvider != null)\r
-                                               location = locationManager.getLastKnownLocation(bestProvider);\r
-                               }\r
-                       }\r
-                       if (location != null)\r
-                       {\r
-                               String locStatus = getString(R.string.info_location_good,\r
-                                               TimeHelper.getTimeString(location.getTime()),\r
-                                               location.getProvider(),\r
-                                               Float.toString((float)location.getLatitude()),\r
-                                               Float.toString((float)location.getLongitude()),\r
-                                               Float.toString(location.getAccuracy()));\r
-                               Log.i(TAG, locStatus);\r
-                               updateLocationStatus(locStatus);\r
-                               return new GeoLocation(location.getLatitude(),\r
-                                               location.getLongitude(),\r
-                                               getProviderType(location.getProvider()),\r
-                                               (int)location.getAccuracy(),\r
-                                               new Date(location.getTime()));\r
-                       }\r
-               }\r
-               return null;\r
-       }\r
-       /**\r
-        * Get list of enabled location provider based on selected strategy\r
-        * \r
-        * @param       strategy: provider location strategy\r
-        * @return      List of enabled provider based on selected strategy\r
-        */\r
-       private List<String> getLocationProviderList(int strategy)\r
-       {\r
-               List<String> providerList = new ArrayList<String>(0);\r
-               providerList.clear();\r
-               switch (strategy)\r
-               {\r
-                       case STRATEGY_NET_ONLY:\r
-                               if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER))\r
-                                       providerList.add(LocationManager.NETWORK_PROVIDER);\r
-                               break;\r
-                       case STRATEGY_GPS_ONLY:\r
-                               if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER))\r
-                                       providerList.add(LocationManager.GPS_PROVIDER);\r
-                               break;\r
-                       case STRATEGY_NET_AND_GPS:\r
-                               if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER))\r
-                                       providerList.add(LocationManager.NETWORK_PROVIDER);\r
-                               if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER))\r
-                                       providerList.add(LocationManager.GPS_PROVIDER);\r
-                               break;\r
-               }\r
-               return providerList;\r
-       }\r
-\r
-       /**\r
-        * Internal handler to get new location based on location strategy set\r
-        */\r
-       private final Runnable locationTask = new Runnable()\r
-       {\r
-               @Override\r
-               public void run()\r
-               {\r
-                       locationHandler.removeCallbacks(locationTask);\r
-                       if (AgentConnectorService.gettingNewLocation)\r
-                       {\r
-                               AgentConnectorService.gettingNewLocation = false;\r
-                               locationManager.removeUpdates(AgentConnectorService.this);\r
-                               locationHandler.postDelayed(locationTask, getNextSchedule(locationInterval));\r
-                               String locStatus = getString(R.string.info_location_timeout, allowedProviders);\r
-                               Log.d(TAG, locStatus);\r
-                               updateLocationStatus(locStatus);\r
-                               refreshHomeScreen();\r
-                       }\r
-                       else if (locationForce)\r
-                       {\r
-                               locationProvider = "";\r
-                               String locStatus = getString(R.string.info_location_no_provider);\r
-                               List<String> providerList = getLocationProviderList(locationStrategy);\r
-                               if (providerList.size() > 0)\r
-                               {\r
-                                       allowedProviders = "";\r
-                                       for (int i = 0; i < providerList.size(); i++)\r
-                                       {\r
-                                               allowedProviders += (i > 0 ? ", " : "") + providerList.get(i);\r
-                                               locationManager.requestLocationUpdates(providerList.get(i), 0, 0, AgentConnectorService.this); // 0, 0 to have it ASAP\r
-                                       }\r
-                                       AgentConnectorService.gettingNewLocation = true;\r
-                                       locationHandler.postDelayed(locationTask, getNextSchedule(locationDuration));\r
-                                       locStatus = getString(R.string.info_location_acquiring, allowedProviders);\r
-                               }\r
-                               else\r
-                                       locationHandler.postDelayed(locationTask, getNextSchedule(locationInterval));\r
-                               Log.d(TAG, locStatus);\r
-                               updateLocationStatus(locStatus);\r
-                               refreshHomeScreen();\r
-                       }\r
-                       else\r
-                               locationManager.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER, 0, 0, AgentConnectorService.this); // 0, 0 to have it ASAP\r
-               }\r
-       };\r
-\r
-       @Override\r
-       public void onLocationChanged(Location location)\r
-       {\r
-               String locStatus = getString(R.string.info_location_good,\r
-                               TimeHelper.getTimeString(location.getTime()),\r
-                               locationProvider = location.getProvider(),\r
-                               Float.toString((float)location.getLatitude()),\r
-                               Float.toString((float)location.getLongitude()),\r
-                               Float.toString(location.getAccuracy()));\r
-               Log.d(TAG, locStatus);\r
-               updateLocationStatus(locStatus);\r
-               locationManager.removeUpdates(AgentConnectorService.this);\r
-               gettingNewLocation = false;\r
-               locationHandler.removeCallbacks(locationTask);\r
-               locationHandler.postDelayed(locationTask, locationInterval);\r
-               refreshHomeScreen();\r
-       }\r
-\r
-       @Override\r
-       public void onProviderDisabled(String provider)\r
-       {\r
-               Log.d(TAG, "onProviderDisabled: " + provider);\r
-       }\r
-\r
-       @Override\r
-       public void onProviderEnabled(String provider)\r
-       {\r
-               Log.d(TAG, "onProviderEnabled: " + provider);\r
-       }\r
-\r
-       @Override\r
-       public void onStatusChanged(String provider, int status, Bundle extras)\r
-       {\r
-               Log.d(TAG, "onStatusChanged: " + provider + " status: " + status);\r
-       }\r
-}\r
+/**
+ * 
+ */
+package org.netxms.agent.android.service;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import org.netxms.agent.android.R;
+import org.netxms.agent.android.helpers.DeviceInfoHelper;
+import org.netxms.agent.android.helpers.NetHelper;
+import org.netxms.agent.android.helpers.SafeParser;
+import org.netxms.agent.android.helpers.TimeHelper;
+import org.netxms.agent.android.main.activities.HomeScreen;
+import org.netxms.agent.android.receivers.AlarmIntentReceiver;
+import org.netxms.agent.android.service.helpers.AndroidLoggingFacility;
+import org.netxms.base.GeoLocation;
+import org.netxms.base.Logger;
+import org.netxms.mobile.agent.MobileAgentException;
+import org.netxms.mobile.agent.Session;
+
+import android.app.AlarmManager;
+import android.app.PendingIntent;
+import android.app.Service;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
+import android.location.Criteria;
+import android.location.Location;
+import android.location.LocationListener;
+import android.location.LocationManager;
+import android.os.AsyncTask;
+import android.os.Binder;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.IBinder;
+import android.preference.PreferenceManager;
+import android.util.Log;
+import android.widget.Toast;
+
+/**
+ * Background communication service for NetXMS agent.
+ * 
+ * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)
+ * 
+ */
+
+public class AgentConnectorService extends Service implements LocationListener
+{
+       public enum ConnectionStatus
+       {
+               CS_NOCONNECTION, CS_INPROGRESS, CS_ALREADYCONNECTED, CS_CONNECTED, CS_DISCONNECTED, CS_ERROR
+       };
+
+       public static final String ACTION_CONNECT = "org.netxms.agent.android.ACTION_CONNECT";
+       public static final String ACTION_FORCE_CONNECT = "org.netxms.agent.android.ACTION_FORCE_CONNECT";
+       public static final String ACTION_SCHEDULE = "org.netxms.agent.android.ACTION_SCHEDULE";
+       public static final String ACTION_CONFIGURE = "org.netxms.agent.android.ACTION_CONFIGURE";
+
+       public static boolean gettingNewLocation = false;
+
+       private static final String TAG = "nxagent/AgentConnectorService";
+       private static final int ONE_DAY_MINUTES = 24 * 60;
+       private static final int NETXMS_REQUEST_CODE = 123456;
+       private static final int STRATEGY_NET_ONLY = 0;
+       private static final int STRATEGY_GPS_ONLY = 1;
+       private static final int STRATEGY_NET_AND_GPS = 2;
+
+       private final Binder binder = new AgentConnectorBinder();
+       private Handler uiThreadHandler = null;
+       private Handler locationHandler = null;
+       private ConnectionStatus connectionStatus = ConnectionStatus.CS_DISCONNECTED;
+       private BroadcastReceiver receiver = null;
+       private SharedPreferences sp;
+       private LocationManager locationManager = null;
+       private HomeScreen homeScreen = null;
+       private boolean sendDeviceSystemInfo = true;
+       private boolean agentActive;
+       private boolean notifyToast;
+       private String connectionServer;
+       private int connectionPort;
+       private String connectionLogin;
+       private String connectionPassword;
+       private boolean connectionEncrypt;
+       private boolean schedulerDaily;
+       private int connectionInterval;
+       private boolean locationForce;
+       private int locationInterval;
+       private int locationDuration;
+       private int locationStrategy;
+       private String locationProvider = "";
+       private String allowedProviders = "";
+
+       /**
+        * Class for clients to access. Because we know this service always runs in
+        * the same process as its clients, we don't need to deal with IPC.
+        */
+       public class AgentConnectorBinder extends Binder
+       {
+               public AgentConnectorService getService()
+               {
+                       return AgentConnectorService.this;
+               }
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see android.app.Service#onCreate()
+        */
+       @Override
+       public void onCreate()
+       {
+               super.onCreate();
+               uiThreadHandler = new Handler(getMainLooper());
+               showToast(getString(R.string.notify_started));
+
+               sp = PreferenceManager.getDefaultSharedPreferences(this);
+               Logger.setLoggingFacility(new AndroidLoggingFacility());
+               locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
+               configure();
+
+               receiver = new BroadcastReceiver()
+               {
+                       @Override
+                       public void onReceive(Context context, Intent intent)
+                       {
+                               Intent i = new Intent(context, AgentConnectorService.class);
+                               i.setAction(ACTION_SCHEDULE);
+                               context.startService(i);
+                       }
+               };
+               registerReceiver(receiver, new IntentFilter(Intent.ACTION_TIME_TICK));
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see android.app.Service#onStartCommand(android.content.Intent, int, int)
+        */
+       @Override
+       public int onStartCommand(Intent intent, int flags, int startId)
+       {
+               if ((intent != null) && (intent.getAction() != null))
+               {
+                       Log.i(TAG, "onStartCommand: " + intent.getAction());
+                       if (intent.getAction().equals(ACTION_CONNECT))
+                               reconnect(false);
+                       else if (intent.getAction().equals(ACTION_FORCE_CONNECT))
+                       {
+                               sendDeviceSystemInfo = true;
+                               reconnect(true);
+                       }
+                       else if (intent.getAction().equals(ACTION_CONFIGURE))
+                       {
+                               sendDeviceSystemInfo = true;
+                               configure();
+                               reconnect(true);
+                       }
+               }
+               return super.onStartCommand(intent, flags, startId);
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see android.app.Service#onBind(android.content.Intent)
+        */
+       @Override
+       public IBinder onBind(Intent intent)
+       {
+               return binder;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see android.app.Service#onDestroy()
+        */
+       @Override
+       public void onDestroy()
+       {
+               super.onDestroy();
+       }
+
+       /**
+        * Configure background service
+        */
+       void configure()
+       {
+               updateLocationStatus("");
+               refreshHomeScreen();
+               agentActive = sp.getBoolean("global.activate", false);
+               notifyToast = sp.getBoolean("notification.toast", true);
+               connectionServer = sp.getString("connection.server", "");
+               connectionPort = SafeParser.parseInt(sp.getString("connection.port", "4747"), 4747);
+               connectionLogin = sp.getString("connection.login", "");
+               connectionPassword = sp.getString("connection.password", "");
+               connectionEncrypt = sp.getBoolean("connection.encrypt", false);
+               connectionInterval = SafeParser.parseInt(sp.getString("connection.interval", "15"), 15) * 60 * 1000;
+               schedulerDaily = sp.getBoolean("scheduler.daily.enable", false);
+               locationStrategy = SafeParser.parseInt(sp.getString("location.strategy", "0"), 0);
+               locationInterval = SafeParser.parseInt(sp.getString("location.interval", "30"), 30) * 60 * 1000;
+               locationDuration = SafeParser.parseInt(sp.getString("location.duration", "2"), 2) * 60 * 1000;
+               locationForce = sp.getBoolean("location.force", false);
+               if (locationHandler != null)
+                       locationHandler.removeCallbacks(locationTask);
+               if (locationManager != null)
+                       if (agentActive)
+                       {
+                               if (locationHandler == null)
+                                       locationHandler = new Handler(getMainLooper());
+                               if (locationHandler != null)
+                               {
+                                       AgentConnectorService.gettingNewLocation = false;
+                                       locationProvider = "";
+                                       locationHandler.post(locationTask);
+                               }
+                       }
+                       else
+                               locationManager.removeUpdates(AgentConnectorService.this);
+       }
+
+       /**
+        * Shutdown background service
+        */
+       public void shutdown()
+       {
+               updateLocationStatus("");
+               cancelConnectionSchedule();
+               unregisterReceiver(receiver);
+               stopSelf();
+       }
+
+       /**
+        * Show status notification
+        * 
+        * @param status        connection status
+        * @param extra extra text to add at the end of the toast
+        */
+       public void statusNotification(ConnectionStatus status, String extra)
+       {
+               connectionStatus = status;
+               String text = "";
+               switch (status)
+               {
+                       case CS_CONNECTED:
+                               text = getString(R.string.notify_connected, extra);
+                               break;
+                       case CS_ERROR:
+                               text = getString(R.string.notify_connection_failed, extra);
+                               break;
+                       case CS_NOCONNECTION:
+                       case CS_INPROGRESS:
+                       case CS_ALREADYCONNECTED:
+                       default:
+                               return;
+               }
+               if (notifyToast)
+                       showToast(text);
+       }
+
+       /**
+        * Reconnect to server.
+        * 
+        * @param force if set to true forces reconnection bypassing the scheduler
+        */
+       public void reconnect(boolean force)
+       {
+               if (agentActive && (force || isConnectionScheduleExpired()) &&
+                               connectionStatus != ConnectionStatus.CS_INPROGRESS &&
+                               connectionStatus != ConnectionStatus.CS_CONNECTED)
+               {
+                       new PushDataTask(connectionServer, connectionPort,
+                                       DeviceInfoHelper.getDeviceId(getApplicationContext()),
+                                       connectionLogin, connectionPassword, connectionEncrypt).execute();
+               }
+       }
+
+       /**
+        * @param homeScreen
+        */
+       public void registerHomeScreen(HomeScreen homeScreen)
+       {
+               this.homeScreen = homeScreen;
+       }
+
+       /**
+        * Show toast with given text
+        * 
+        * @param text message text
+        */
+       public void showToast(final String text)
+       {
+               if (uiThreadHandler != null)
+                       uiThreadHandler.post(new Runnable()
+                       {
+                               @Override
+                               public void run()
+                               {
+                                       Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT).show();
+                               }
+                       });
+       }
+
+       /**
+        * Refresh homescreen  activity
+        */
+       private void refreshHomeScreen()
+       {
+               if (homeScreen != null)
+               {
+                       homeScreen.runOnUiThread(new Runnable()
+                       {
+                               @Override
+                               public void run()
+                               {
+                                       homeScreen.refreshStatus();
+                               }
+                       });
+               }
+       }
+
+       /**
+        * Gets stored time settings in minutes
+        */
+       private int getMinutes(String time)
+       {
+               String[] vals = sp.getString(time, "00:00").split(":");
+               return Integer.parseInt(vals[0]) * 60 + Integer.parseInt(vals[1]);
+       }
+
+       /**
+        * Sets the offset used to compute the next schedule
+        */
+       private void setDayOffset(Calendar cal, int minutes)
+       {
+               cal.set(Calendar.HOUR_OF_DAY, 0);
+               cal.set(Calendar.MINUTE, 0);
+               cal.set(Calendar.SECOND, 0);
+               cal.set(Calendar.MILLISECOND, 0);
+               cal.add(Calendar.MINUTE, minutes);
+       }
+
+       /**
+        * Get the next schedule based on daily interval, if set
+        * 
+        * @param interval      expected schedule in milliseconds
+        * @return new schedule in milliseconds adjusted as necessary
+        */
+       private long getNextSchedule(int interval)
+       {
+               if (!schedulerDaily)
+                       return interval;
+               Calendar cal = Calendar.getInstance(); // get a Calendar object with current time
+               long now = cal.getTimeInMillis();
+               int on = getMinutes("scheduler.daily.on");
+               int off = getMinutes("scheduler.daily.off");
+               if (off < on)
+                       off += ONE_DAY_MINUTES; // Next day!
+               Calendar calOn = (Calendar)cal.clone();
+               setDayOffset(calOn, on);
+               Calendar calOff = (Calendar)cal.clone();
+               setDayOffset(calOff, off);
+               cal.add(Calendar.MILLISECOND, interval);
+               if (cal.before(calOn))
+               {
+                       cal = (Calendar)calOn.clone();
+                       Log.i(TAG, "Rescheduled for daily interval (before 'on')");
+               }
+               else if (cal.after(calOff))
+               {
+                       cal = (Calendar)calOn.clone();
+                       setDayOffset(cal, on + ONE_DAY_MINUTES); // Move to the next activation of the excluded range
+                       Log.i(TAG, "Rescheduled for daily interval (after 'off')");
+               }
+               Log.i(TAG, "Next schedule in " + (cal.getTimeInMillis() - now) / 1000 + " seconds");
+               return cal.getTimeInMillis() - now;
+       }
+
+       /**
+        * Check for expired pending connection schedule
+        */
+       private boolean isConnectionScheduleExpired()
+       {
+               Calendar cal = Calendar.getInstance(); // get a Calendar object with current time
+               return cal.getTimeInMillis() > sp.getLong("scheduler.next_activation", 0);
+       }
+
+       /**
+        * Set a connection schedule
+        * 
+        * @param milliseconds  time for new schedule
+        */
+       private void setConnectionSchedule(long milliseconds)
+       {
+               Log.i(TAG, "setSchedule to: " + TimeHelper.getTimeString(milliseconds));
+               Intent intent = new Intent(this, AlarmIntentReceiver.class);
+               PendingIntent sender = PendingIntent.getBroadcast(this, NETXMS_REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT);
+               ((AlarmManager)getSystemService(ALARM_SERVICE)).set(AlarmManager.RTC_WAKEUP, milliseconds, sender);
+               Editor e = sp.edit();
+               e.putLong("scheduler.next_activation", milliseconds);
+               e.commit();
+       }
+
+       /**
+        * Cancel a pending connection schedule (if any)
+        */
+       private void cancelConnectionSchedule()
+       {
+               Log.i(TAG, "cancelSchedule");
+               Intent intent = new Intent(this, AlarmIntentReceiver.class);
+               PendingIntent sender = PendingIntent.getBroadcast(this, NETXMS_REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT);
+               ((AlarmManager)getSystemService(ALARM_SERVICE)).cancel(sender);
+               Editor e = sp.edit();
+               e.putLong("scheduler.next_activation", 0);
+               e.commit();
+       }
+
+       /**
+        * Get flags. Currently not used.
+        */
+       private int getFlags()
+       {
+               return 0;
+       }
+
+       /**
+        * Internal task for connecting and pushing data
+        */
+       private class PushDataTask extends AsyncTask<Object, Void, Boolean>
+       {
+               private final String server;
+               private final Integer port;
+               private final String deviceId;
+               private final String login;
+               private final String password;
+               private final boolean encrypt;
+               private String connMsg = "";
+
+               protected PushDataTask(String server, Integer port, String deviceId, String login, String password, boolean encrypt)
+               {
+                       this.server = server;
+                       this.port = port;
+                       this.deviceId = deviceId;
+                       this.login = login;
+                       this.password = password;
+                       this.encrypt = encrypt;
+               }
+
+               @Override
+               protected Boolean doInBackground(Object... params)
+               {
+                       Log.d(TAG, "PushDataTask.doInBackground: reconnecting...");
+                       statusNotification(ConnectionStatus.CS_INPROGRESS, "");
+                       if (NetHelper.isInternetOn(getApplicationContext()))
+                       {
+                               Session session = new Session(server, port, deviceId, login, password, encrypt);
+                               try
+                               {
+                                       session.connect();
+                                       Log.d(TAG, "PushDataTask.doInBackground: connected");
+                                       statusNotification(ConnectionStatus.CS_CONNECTED, getString(R.string.notify_pushing_data));
+                                       if (sendDeviceSystemInfo)
+                                       {
+                                               Log.d(TAG, "PushDataTask.doInBackground: sending DeviceSystemInfo");
+                                               session.reportDeviceSystemInfo(DeviceInfoHelper.getManufacturer(), DeviceInfoHelper.getModel(),
+                                                               DeviceInfoHelper.getOSName(), DeviceInfoHelper.getRelease(), DeviceInfoHelper.getSerial(),
+                                                               DeviceInfoHelper.getUser(getApplicationContext()));
+                                               sendDeviceSystemInfo = false;
+                                       }
+                                       session.reportDeviceStatus(NetHelper.getInetAddress(), getGeoLocation(), getFlags(),
+                                                       DeviceInfoHelper.getBatteryLevel(getApplicationContext()));
+                                       session.disconnect();
+                                       Log.d(TAG, "PushDataTask.doInBackground: data transfer completed");
+                                       connMsg = getString(R.string.notify_connected, server + ":" + port);
+                                       return true;
+                               }
+                               catch (IOException e)
+                               {
+                                       Log.e(TAG, "IOException while executing PushDataTask.doInBackground on connect", e);
+                                       connMsg = e.getLocalizedMessage();
+                               }
+                               catch (MobileAgentException e)
+                               {
+                                       Log.e(TAG, "MobileAgentException while executing PushDataTask.doInBackground on connect", e);
+                                       connMsg = e.getLocalizedMessage();
+                               }
+                       }
+                       else
+                       {
+                               Log.w(TAG, "PushDataTask.doInBackground: no internet connection");
+                               connMsg = getString(R.string.notify_no_connection);
+                       }
+                       return false;
+               }
+
+               @Override
+               protected void onPostExecute(Boolean result)
+               {
+                       if (result == true)
+                       {
+                               Log.d(TAG, "PushDataTask.onPostExecute: disconnecting...");
+                               statusNotification(ConnectionStatus.CS_DISCONNECTED, "");
+                       }
+                       else
+                       {
+                               Log.e(TAG, "PushDataTask.onPostExecute: error: " + connMsg);
+                               statusNotification(ConnectionStatus.CS_ERROR, connMsg);
+                       }
+                       Editor e = sp.edit();
+                       e.putLong("scheduler.last_activation", Calendar.getInstance().getTimeInMillis());
+                       e.putString("scheduler.last_activation_msg", connMsg);
+                       e.commit();
+                       if (agentActive)
+                               setConnectionSchedule(Calendar.getInstance().getTimeInMillis() + getNextSchedule(connectionInterval));
+                       else
+                               cancelConnectionSchedule();
+                       refreshHomeScreen();
+               }
+       }
+
+       /**
+        * Updates last location status
+        * 
+        * @pasam status        status of last location
+        */
+       private void updateLocationStatus(String status)
+       {
+               Editor e = sp.edit();
+               e.putString("location.last_status", status);
+               e.commit();
+       }
+
+       /**
+        * Convert location provider from Android type to NetXMS type.
+        * 
+        * @return Provider type
+        */
+       private int getProviderType(String provider)
+       {
+               if (provider.compareTo(LocationManager.GPS_PROVIDER) == 0)
+                       return GeoLocation.GPS;
+               else if (provider.compareTo(LocationManager.NETWORK_PROVIDER) == 0)
+                       return GeoLocation.NETWORK;
+               return GeoLocation.UNSET;
+       }
+
+       /**
+        * Get last known geolocation (depending on strategy used it could be very old).
+        * If no provider available, try to get a last position from any available provider
+        * identifyed by the system using the ACCURACY_COARSE criteria.
+        * 
+        * @return Last known location or null if not known
+        */
+       private GeoLocation getGeoLocation()
+       {
+               if (locationManager != null)
+               {
+                       Location location = null;
+                       if (locationProvider.length() > 0) // Did we get an updated position?
+                               location = locationManager.getLastKnownLocation(locationProvider);
+                       else
+                       {       // Try to get it using the best provider available
+                               Criteria criteria = new Criteria();
+                               if (criteria != null)
+                               {
+                                       criteria.setAccuracy(Criteria.ACCURACY_COARSE);
+                                       String bestProvider = locationManager.getBestProvider(criteria, true);
+                                       if (bestProvider != null)
+                                               location = locationManager.getLastKnownLocation(bestProvider);
+                               }
+                       }
+                       if (location != null)
+                       {
+                               String locStatus = getString(R.string.info_location_good,
+                                               TimeHelper.getTimeString(location.getTime()),
+                                               location.getProvider(),
+                                               Float.toString((float)location.getLatitude()),
+                                               Float.toString((float)location.getLongitude()),
+                                               Float.toString(location.getAccuracy()));
+                               Log.i(TAG, locStatus);
+                               updateLocationStatus(locStatus);
+                               return new GeoLocation(location.getLatitude(),
+                                               location.getLongitude(),
+                                               getProviderType(location.getProvider()),
+                                               (int)location.getAccuracy(),
+                                               new Date(location.getTime()));
+                       }
+               }
+               return null;
+       }
+       /**
+        * Get list of enabled location provider based on selected strategy
+        * 
+        * @param       strategy: provider location strategy
+        * @return      List of enabled provider based on selected strategy
+        */
+       private List<String> getLocationProviderList(int strategy)
+       {
+               List<String> providerList = new ArrayList<String>(0);
+               providerList.clear();
+               switch (strategy)
+               {
+                       case STRATEGY_NET_ONLY:
+                               if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER))
+                                       providerList.add(LocationManager.NETWORK_PROVIDER);
+                               break;
+                       case STRATEGY_GPS_ONLY:
+                               if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER))
+                                       providerList.add(LocationManager.GPS_PROVIDER);
+                               break;
+                       case STRATEGY_NET_AND_GPS:
+                               if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER))
+                                       providerList.add(LocationManager.NETWORK_PROVIDER);
+                               if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER))
+                                       providerList.add(LocationManager.GPS_PROVIDER);
+                               break;
+               }
+               return providerList;
+       }
+
+       /**
+        * Internal handler to get new location based on location strategy set
+        */
+       private final Runnable locationTask = new Runnable()
+       {
+               @Override
+               public void run()
+               {
+                       locationHandler.removeCallbacks(locationTask);
+                       if (AgentConnectorService.gettingNewLocation)
+                       {
+                               AgentConnectorService.gettingNewLocation = false;
+                               locationManager.removeUpdates(AgentConnectorService.this);
+                               locationHandler.postDelayed(locationTask, getNextSchedule(locationInterval));
+                               String locStatus = getString(R.string.info_location_timeout, allowedProviders);
+                               Log.d(TAG, locStatus);
+                               updateLocationStatus(locStatus);
+                               refreshHomeScreen();
+                       }
+                       else if (locationForce)
+                       {
+                               locationProvider = "";
+                               String locStatus = getString(R.string.info_location_no_provider);
+                               List<String> providerList = getLocationProviderList(locationStrategy);
+                               if (providerList.size() > 0)
+                               {
+                                       allowedProviders = "";
+                                       for (int i = 0; i < providerList.size(); i++)
+                                       {
+                                               allowedProviders += (i > 0 ? ", " : "") + providerList.get(i);
+                                               locationManager.requestLocationUpdates(providerList.get(i), 0, 0, AgentConnectorService.this); // 0, 0 to have it ASAP
+                                       }
+                                       AgentConnectorService.gettingNewLocation = true;
+                                       locationHandler.postDelayed(locationTask, getNextSchedule(locationDuration));
+                                       locStatus = getString(R.string.info_location_acquiring, allowedProviders);
+                               }
+                               else
+                                       locationHandler.postDelayed(locationTask, getNextSchedule(locationInterval));
+                               Log.d(TAG, locStatus);
+                               updateLocationStatus(locStatus);
+                               refreshHomeScreen();
+                       }
+                       else
+                               locationManager.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER, 0, 0, AgentConnectorService.this); // 0, 0 to have it ASAP
+               }
+       };
+
+       @Override
+       public void onLocationChanged(Location location)
+       {
+               String locStatus = getString(R.string.info_location_good,
+                               TimeHelper.getTimeString(location.getTime()),
+                               locationProvider = location.getProvider(),
+                               Float.toString((float)location.getLatitude()),
+                               Float.toString((float)location.getLongitude()),
+                               Float.toString(location.getAccuracy()));
+               Log.d(TAG, locStatus);
+               updateLocationStatus(locStatus);
+               locationManager.removeUpdates(AgentConnectorService.this);
+               gettingNewLocation = false;
+               locationHandler.removeCallbacks(locationTask);
+               locationHandler.postDelayed(locationTask, locationInterval);
+               refreshHomeScreen();
+       }
+
+       @Override
+       public void onProviderDisabled(String provider)
+       {
+               Log.d(TAG, "onProviderDisabled: " + provider);
+       }
+
+       @Override
+       public void onProviderEnabled(String provider)
+       {
+               Log.d(TAG, "onProviderEnabled: " + provider);
+       }
+
+       @Override
+       public void onStatusChanged(String provider, int status, Bundle extras)
+       {
+               Log.d(TAG, "onStatusChanged: " + provider + " status: " + status);
+       }
+}
index e57766f..89f0f2d 100644 (file)
@@ -1,50 +1,50 @@
-/**\r
- * \r
- */\r
-package org.netxms.agent.android.service.helpers;\r
-\r
-import org.netxms.base.LoggingFacility;\r
-\r
-import android.util.Log;\r
-\r
-/**\r
- * Logging facility for NetXMS client library\r
- *\r
- */\r
-public class AndroidLoggingFacility implements LoggingFacility\r
-{\r
-       /* (non-Javadoc)\r
-        * @see org.netxms.base.LoggingFacility#writeLog(int, java.lang.String, java.lang.String, java.lang.Throwable)\r
-        */\r
-       @Override\r
-       public void writeLog(int level, String tag, String message, Throwable t)\r
-       {\r
-               switch (level)\r
-               {\r
-                       case LoggingFacility.DEBUG:\r
-                               if (t != null)\r
-                                       Log.d(tag, message, t);\r
-                               else\r
-                                       Log.d(tag, message);\r
-                               break;\r
-                       case LoggingFacility.INFO:\r
-                               if (t != null)\r
-                                       Log.i(tag, message, t);\r
-                               else\r
-                                       Log.i(tag, message);\r
-                               break;\r
-                       case LoggingFacility.WARNING:\r
-                               if (t != null)\r
-                                       Log.w(tag, message, t);\r
-                               else\r
-                                       Log.w(tag, message);\r
-                               break;\r
-                       case LoggingFacility.ERROR:\r
-                               if (t != null)\r
-                                       Log.e(tag, message, t);\r
-                               else\r
-                                       Log.e(tag, message);\r
-                               break;\r
-               }\r
-       }\r
-}\r
+/**
+ * 
+ */
+package org.netxms.agent.android.service.helpers;
+
+import org.netxms.base.LoggingFacility;
+
+import android.util.Log;
+
+/**
+ * Logging facility for NetXMS client library
+ *
+ */
+public class AndroidLoggingFacility implements LoggingFacility
+{
+       /* (non-Javadoc)
+        * @see org.netxms.base.LoggingFacility#writeLog(int, java.lang.String, java.lang.String, java.lang.Throwable)
+        */
+       @Override
+       public void writeLog(int level, String tag, String message, Throwable t)
+       {
+               switch (level)
+               {
+                       case LoggingFacility.DEBUG:
+                               if (t != null)
+                                       Log.d(tag, message, t);
+                               else
+                                       Log.d(tag, message);
+                               break;
+                       case LoggingFacility.INFO:
+                               if (t != null)
+                                       Log.i(tag, message, t);
+                               else
+                                       Log.i(tag, message);
+                               break;
+                       case LoggingFacility.WARNING:
+                               if (t != null)
+                                       Log.w(tag, message, t);
+                               else
+                                       Log.w(tag, message);
+                               break;
+                       case LoggingFacility.ERROR:
+                               if (t != null)
+                                       Log.e(tag, message, t);
+                               else
+                                       Log.e(tag, message);
+                               break;
+               }
+       }
+}
index e1de668..3d7ee31 100644 (file)
@@ -1,21 +1,21 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
-<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">\r
-<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>\r
-<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>\r
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">\r
-<listEntry value="/android-console"/>\r
-</listAttribute>\r
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">\r
-<listEntry value="4"/>\r
-</listAttribute>\r
-<booleanAttribute key="org.eclipse.debug.core.capture_output" value="false"/>\r
-<booleanAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON" value="false"/>\r
-<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>\r
-<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>\r
-<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>\r
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="android-console"/>\r
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/android-console/.externalToolBuilders/generate_build_number.xml}"/>\r
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>\r
-<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>\r
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/android-console/.externalToolBuilders}"/>\r
-</launchConfiguration>\r
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
+<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
+<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/android-console"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.capture_output" value="false"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON" value="false"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="android-console"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/android-console/.externalToolBuilders/generate_build_number.xml}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/android-console/.externalToolBuilders}"/>
+</launchConfiguration>
index 54e493c..8000cd6 100644 (file)
@@ -1,11 +1,11 @@
-eclipse.preferences.version=1\r
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve\r
-org.eclipse.jdt.core.compiler.compliance=1.6\r
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate\r
-org.eclipse.jdt.core.compiler.debug.localVariable=generate\r
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate\r
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
-org.eclipse.jdt.core.compiler.source=1.6\r
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
index 4d8d9c1..ff413be 100644 (file)
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<shape xmlns:android="http://schemas.android.com/apk/res/android"\r
-       android:shape="rectangle">\r
-       <gradient \r
-               android:startColor="#ff33b5e5" \r
-               android:endColor="#ff33b5e5"\r
-        android:angle="270"/>\r
-</shape>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+       android:shape="rectangle">
+       <gradient 
+               android:startColor="#ff33b5e5" 
+               android:endColor="#ff33b5e5"
+        android:angle="270"/>
+</shape>
index 7b1b407..3ef8473 100644 (file)
@@ -1,9 +1,9 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<shape xmlns:android="http://schemas.android.com/apk/res/android"\r
-    android:shape="rectangle">\r
-  <gradient\r
-      android:startColor="#00000000"\r
-      android:centerColor="#FFFFFFFF"\r
-      android:endColor="#00000000"\r
-      android:angle="0" />\r
-</shape>\r
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+  <gradient
+      android:startColor="#00000000"
+      android:centerColor="#FFFFFFFF"
+      android:endColor="#00000000"
+      android:angle="0" />
+</shape>
index 194930c..2faee27 100644 (file)
@@ -1,11 +1,11 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<selector xmlns:android="http://schemas.android.com/apk/res/android">\r
-       <item android:state_pressed="true" android:state_enabled="true"\r
-               android:drawable="@drawable/list_selection" />\r
-       <item android:state_enabled="true" android:state_selected="true"\r
-               android:state_window_focused="true"\r
-               android:drawable="@drawable/list_selection" />\r
-       <item android:state_enabled="true" android:state_window_focused="true"\r
-               android:drawable="@color/item_body" />\r
-       <item android:drawable="@color/item_body" />\r
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+       <item android:state_pressed="true" android:state_enabled="true"
+               android:drawable="@drawable/list_selection" />
+       <item android:state_enabled="true" android:state_selected="true"
+               android:state_window_focused="true"
+               android:drawable="@drawable/list_selection" />
+       <item android:state_enabled="true" android:state_window_focused="true"
+               android:drawable="@color/item_body" />
+       <item android:drawable="@color/item_body" />
 </selector>
\ No newline at end of file
index 3435280..11a16a7 100644 (file)
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<shape xmlns:android="http://schemas.android.com/apk/res/android"\r
-    android:shape="rectangle">\r
-  <gradient\r
-      android:startColor="#306A8A"\r
-      android:endColor="#245168"\r
-      android:angle="270" />\r
-</shape>\r
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+  <gradient
+      android:startColor="#306A8A"
+      android:endColor="#245168"
+      android:angle="270" />
+</shape>
index 1ce9a28..cacd596 100644 (file)
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<shape xmlns:android="http://schemas.android.com/apk/res/android"\r
-    android:shape="rectangle">\r
-  <gradient\r
-      android:startColor="@color/item_body"\r
-      android:endColor="@color/item_body"\r
-      android:angle="0" />\r
-</shape>\r
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+  <gradient
+      android:startColor="@color/item_body"
+      android:endColor="@color/item_body"
+      android:angle="0" />
+</shape>
index 3c19423..0a9252e 100644 (file)
@@ -1,13 +1,13 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<shape xmlns:android="http://schemas.android.com/apk/res/android"\r
-       android:shape="rectangle">\r
-       <gradient \r
-               android:startColor="#50e8bc38" \r
-               android:endColor="#50f0d37b"\r
-        android:angle="270"/>\r
-    <corners\r
-       android:bottomRightRadius="8dp"\r
-       android:bottomLeftRadius="8dp"\r
-               android:topLeftRadius="8dp"\r
-               android:topRightRadius="8dp"/>\r
-</shape>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+       android:shape="rectangle">
+       <gradient 
+               android:startColor="#50e8bc38" 
+               android:endColor="#50f0d37b"
+        android:angle="270"/>
+    <corners
+       android:bottomRightRadius="8dp"
+       android:bottomLeftRadius="8dp"
+               android:topLeftRadius="8dp"
+               android:topRightRadius="8dp"/>
+</shape>
index 5a3b4a9..54101c9 100644 (file)
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<shape xmlns:android="http://schemas.android.com/apk/res/android"\r
-       android:shape="rectangle">\r
-       <gradient \r
-               android:startColor="#ffe8bc38" \r
-               android:endColor="#fff0d37b"\r
-        android:angle="270"/>\r
-</shape>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+       android:shape="rectangle">
+       <gradient 
+               android:startColor="#ffe8bc38" 
+               android:endColor="#fff0d37b"
+        android:angle="270"/>
+</shape>
index 172d2d4..87c876f 100644 (file)
@@ -1,52 +1,52 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
-       android:layout_width="match_parent"\r
-    android:layout_height="match_parent"\r
-       android:background="@color/item_body">\r
-    \r
-       <LinearLayout android:id="@+id/progressContainer"\r
-       android:orientation="vertical"\r
-        android:layout_width="match_parent" \r
-        android:layout_height="match_parent"\r
-               android:background="@color/item_body"\r
-        android:visibility="gone"\r
-        android:gravity="center">\r
-\r
-        <ProgressBar style="?android:attr/progressBarStyleLarge"\r
-               android:layout_width="wrap_content"\r
-            android:layout_height="wrap_content" />\r
-        <TextView android:layout_width="wrap_content"\r
-            android:layout_height="wrap_content"\r
-            android:textAppearance="?android:attr/textAppearanceSmall"\r
-            android:text="@string/progress_gathering_data"\r
-            android:paddingTop="4dip"\r
-            android:singleLine="true" />\r
-    </LinearLayout>\r
-    \r
-    <FrameLayout android:id="@+id/listContainer" \r
-        android:orientation="vertical"\r
-               android:layout_width="fill_parent"\r
-               android:layout_height="fill_parent"\r
-               android:background="@color/item_body">\r
-               <ListView android:id="@android:id/list"\r
-                   android:layout_width="fill_parent"\r
-                       android:textColor="@color/text_color"\r
-                       android:background="@color/item_body"\r
-                       android:cacheColorHint="@color/item_body" \r
-                   android:listSelector="@drawable/list_selection"\r
-               android:choiceMode="multipleChoice"\r
-                       android:layout_height="wrap_content">\r
-               </ListView>\r
-\r
-        <TextView\r
-            android:id="@android:id/empty"\r
-            android:layout_width="match_parent"\r
-            android:layout_height="match_parent"\r
-                       android:background="@color/item_body"\r
-            android:gravity="center_vertical|center_horizontal"\r
-            android:text="@string/no_items"\r
-            android:textAppearance="?android:attr/textAppearanceMedium"\r
-            android:textColor="@color/text_no_items" />\r
-        \r
-       </FrameLayout>\r
-</FrameLayout>\r
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+       android:layout_width="match_parent"
+    android:layout_height="match_parent"
+       android:background="@color/item_body">
+    
+       <LinearLayout android:id="@+id/progressContainer"
+       android:orientation="vertical"
+        android:layout_width="match_parent" 
+        android:layout_height="match_parent"
+               android:background="@color/item_body"
+        android:visibility="gone"
+        android:gravity="center">
+
+        <ProgressBar style="?android:attr/progressBarStyleLarge"
+               android:layout_width="wrap_content"
+            android:layout_height="wrap_content" />
+        <TextView android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:text="@string/progress_gathering_data"
+            android:paddingTop="4dip"
+            android:singleLine="true" />
+    </LinearLayout>
+    
+    <FrameLayout android:id="@+id/listContainer" 
+        android:orientation="vertical"
+               android:layout_width="fill_parent"
+               android:layout_height="fill_parent"
+               android:background="@color/item_body">
+               <ListView android:id="@android:id/list"
+                   android:layout_width="fill_parent"
+                       android:textColor="@color/text_color"
+                       android:background="@color/item_body"
+                       android:cacheColorHint="@color/item_body" 
+                   android:listSelector="@drawable/list_selection"
+               android:choiceMode="multipleChoice"
+                       android:layout_height="wrap_content">
+               </ListView>
+
+        <TextView
+            android:id="@android:id/empty"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+                       android:background="@color/item_body"
+            android:gravity="center_vertical|center_horizontal"
+            android:text="@string/no_items"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textColor="@color/text_no_items" />
+        
+       </FrameLayout>
+</FrameLayout>
index 3cbc434..7c9ce00 100644 (file)
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
-       android:id="@+id/fragment_container"\r
-       android:layout_width="match_parent"\r
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+       android:id="@+id/fragment_container"
+       android:layout_width="match_parent"
        android:layout_height="match_parent" />
\ No newline at end of file
index 466fad9..8c79040 100644 (file)
@@ -1,19 +1,19 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
-    android:id="@+id/graph_view_child_layout"\r
-    android:layout_width="fill_parent"\r
-       android:layout_height="fill_parent">\r
-       <TextView \r
-               android:id="@+id/tvChild"\r
-               android:textIsSelectable="false"\r
-           android:layout_width="fill_parent"\r
-               android:layout_height="36dp"\r
-               android:paddingLeft="5dp"\r
-               android:paddingRight="5dp"\r
-               android:gravity="center_vertical"\r
-               android:textSize="17sp"\r
-               android:textColor="@color/text_color"\r
-               android:cacheColorHint="@color/item_body"\r
-               android:background="@drawable/explist_selection">\r
-       </TextView>\r
-</LinearLayout>\r
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/graph_view_child_layout"
+    android:layout_width="fill_parent"
+       android:layout_height="fill_parent">
+       <TextView 
+               android:id="@+id/tvChild"
+               android:textIsSelectable="false"
+           android:layout_width="fill_parent"
+               android:layout_height="36dp"
+               android:paddingLeft="5dp"
+               android:paddingRight="5dp"
+               android:gravity="center_vertical"
+               android:textSize="17sp"
+               android:textColor="@color/text_color"
+               android:cacheColorHint="@color/item_body"
+               android:background="@drawable/explist_selection">
+       </TextView>
+</LinearLayout>
index 8174ee1..01af97a 100644 (file)
@@ -1,17 +1,17 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
-    android:id="@+id/interface_view_child_layout"\r
-    android:layout_width="fill_parent"\r
-       android:layout_height="fill_parent">\r
-       <ListView \r
-               android:id="@+id/interfacesChild"\r
-           android:layout_width="fill_parent"\r
-               android:layout_height="fill_parent"\r
-               android:paddingLeft="20dip"\r
-               android:paddingRight="5dip"\r
-               android:gravity="center_vertical"\r
-               android:textColor="@color/text_color"\r
-               android:cacheColorHint="@color/item_body"\r
-               android:background="@drawable/explist_selection">\r
-       </ListView>\r
-</LinearLayout>\r
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/interface_view_child_layout"
+    android:layout_width="fill_parent"
+       android:layout_height="fill_parent">
+       <ListView 
+               android:id="@+id/interfacesChild"
+           android:layout_width="fill_parent"
+               android:layout_height="fill_parent"
+               android:paddingLeft="20dip"
+               android:paddingRight="5dip"
+               android:gravity="center_vertical"
+               android:textColor="@color/text_color"
+               android:cacheColorHint="@color/item_body"
+               android:background="@drawable/explist_selection">
+       </ListView>
+</LinearLayout>
index 38fa463..993aa6c 100644 (file)
@@ -1,52 +1,52 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
-       android:layout_width="match_parent"\r
-    android:layout_height="match_parent"\r
-       android:background="@color/item_body">\r
-    \r
-       <LinearLayout android:id="@+id/progressContainer"\r
-       android:orientation="vertical"\r
-        android:layout_width="match_parent" \r
-        android:layout_height="match_parent"\r
-               android:background="@color/item_body"\r
-        android:visibility="gone"\r
-        android:gravity="center">\r
-\r
-        <ProgressBar style="?android:attr/progressBarStyleLarge"\r
-               android:layout_width="wrap_content"\r
-            android:layout_height="wrap_content" />\r
-        <TextView android:layout_width="wrap_content"\r
-            android:layout_height="wrap_content"\r
-            android:textAppearance="?android:attr/textAppearanceSmall"\r
-            android:text="@string/progress_gathering_data"\r
-            android:paddingTop="4dip"\r
-            android:singleLine="true" />\r
-    </LinearLayout>\r
-    \r
-    <FrameLayout android:id="@+id/listContainer" \r
-        android:orientation="vertical"\r
-               android:layout_width="fill_parent"\r
-               android:layout_height="fill_parent"\r
-               android:textColor="@color/text_color"\r
-               android:background="@color/item_body"> \r
-               <ExpandableListView \r
-                       android:id="@android:id/list" \r
-                       android:layout_width="fill_parent"\r
-                   android:layout_height="fill_parent" \r
-                       android:textColor="@color/text_color"\r
-                       android:background="@color/item_body" \r
-                       android:cacheColorHint="@color/item_body" >\r
-               </ExpandableListView>\r
-\r
-        <TextView\r
-            android:id="@android:id/empty"\r
-            android:layout_width="match_parent"\r
-            android:layout_height="match_parent"\r
-                       android:background="@color/item_body"\r
-            android:gravity="center_vertical|center_horizontal"\r
-            android:text="@string/no_items"\r
-            android:textAppearance="?android:attr/textAppearanceMedium"\r
-            android:textColor="@color/text_no_items" />\r
-\r
-       </FrameLayout>\r
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+       android:layout_width="match_parent"
+    android:layout_height="match_parent"
+       android:background="@color/item_body">
+    
+       <LinearLayout android:id="@+id/progressContainer"
+       android:orientation="vertical"
+        android:layout_width="match_parent" 
+        android:layout_height="match_parent"
+               android:background="@color/item_body"
+        android:visibility="gone"
+        android:gravity="center">
+
+        <ProgressBar style="?android:attr/progressBarStyleLarge"
+               android:layout_width="wrap_content"
+            android:layout_height="wrap_content" />
+        <TextView android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:text="@string/progress_gathering_data"
+            android:paddingTop="4dip"
+            android:singleLine="true" />
+    </LinearLayout>
+    
+    <FrameLayout android:id="@+id/listContainer" 
+        android:orientation="vertical"
+               android:layout_width="fill_parent"
+               android:layout_height="fill_parent"
+               android:textColor="@color/text_color"
+               android:background="@color/item_body"> 
+               <ExpandableListView 
+                       android:id="@android:id/list" 
+                       android:layout_width="fill_parent"
+                   android:layout_height="fill_parent" 
+                       android:textColor="@color/text_color"
+                       android:background="@color/item_body" 
+                       android:cacheColorHint="@color/item_body" >
+               </ExpandableListView>
+
+        <TextView
+            android:id="@android:id/empty"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+                       android:background="@color/item_body"
+            android:gravity="center_vertical|center_horizontal"
+            android:text="@string/no_items"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textColor="@color/text_no_items" />
+
+       </FrameLayout>
 </FrameLayout>
\ No newline at end of file
index 771b490..d53dc10 100644 (file)
@@ -1,52 +1,52 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
-       android:layout_width="match_parent"\r
-    android:layout_height="match_parent"\r
-       android:background="@color/item_body">\r
-    \r
-       <LinearLayout android:id="@+id/progressContainer"\r
-       android:orientation="vertical"\r
-        android:layout_width="match_parent" \r
-        android:layout_height="match_parent"\r
-               android:background="@color/item_body"\r
-        android:visibility="gone"\r
-        android:gravity="center">\r
-\r
-        <ProgressBar style="?android:attr/progressBarStyleLarge"\r
-               android:layout_width="wrap_content"\r
-            android:layout_height="wrap_content" />\r
-        <TextView android:layout_width="wrap_content"\r
-            android:layout_height="wrap_content"\r
-            android:textAppearance="?android:attr/textAppearanceSmall"\r
-            android:text="@string/progress_gathering_data"\r
-            android:paddingTop="4dip"\r
-            android:singleLine="true" />\r
-    </LinearLayout>\r
-    \r
-    <FrameLayout android:id="@+id/listContainer" \r
-        android:orientation="vertical"\r
-               android:layout_width="fill_parent"\r
-               android:layout_height="fill_parent"\r
-               android:background="@color/item_body"> \r
-               <ListView android:id="@android:id/list"\r
-                   android:layout_width="fill_parent"\r
-                       android:textColor="@color/text_no_items"\r
-                       android:background="@color/item_body"\r
-                       android:cacheColorHint="@color/item_body" \r
-                   android:listSelector="@drawable/list_selection"\r
-               android:choiceMode="multipleChoice"\r
-                       android:layout_height="wrap_content">\r
-               </ListView>\r
-\r
-        <TextView\r
-            android:id="@android:id/empty"\r
-            android:layout_width="match_parent"\r
-            android:layout_height="match_parent"\r
-                       android:background="@color/item_body"\r
-            android:gravity="center_vertical|center_horizontal"\r
-            android:text="@string/no_items"\r
-            android:textAppearance="?android:attr/textAppearanceMedium"\r
-            android:textColor="@color/text_no_items" />\r
-\r
-       </FrameLayout>\r
-</FrameLayout>\r
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+       android:layout_width="match_parent"
+    android:layout_height="match_parent"
+       android:background="@color/item_body">
+    
+       <LinearLayout android:id="@+id/progressContainer"
+       android:orientation="vertical"
+        android:layout_width="match_parent" 
+        android:layout_height="match_parent"
+               android:background="@color/item_body"
+        android:visibility="gone"
+        android:gravity="center">
+
+        <ProgressBar style="?android:attr/progressBarStyleLarge"
+               android:layout_width="wrap_content"
+            android:layout_height="wrap_content" />
+        <TextView android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:text="@string/progress_gathering_data"
+            android:paddingTop="4dip"
+            android:singleLine="true" />
+    </LinearLayout>
+    
+    <FrameLayout android:id="@+id/listContainer" 
+        android:orientation="vertical"
+               android:layout_width="fill_parent"
+               android:layout_height="fill_parent"
+               android:background="@color/item_body"> 
+               <ListView android:id="@android:id/list"
+                   android:layout_width="fill_parent"
+                       android:textColor="@color/text_no_items"
+                       android:background="@color/item_body"
+                       android:cacheColorHint="@color/item_body" 
+                   android:listSelector="@drawable/list_selection"
+               android:choiceMode="multipleChoice"
+                       android:layout_height="wrap_content">
+               </ListView>
+
+        <TextView
+            android:id="@android:id/empty"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+                       android:background="@color/item_body"
+            android:gravity="center_vertical|center_horizontal"
+            android:text="@string/no_items"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textColor="@color/text_no_items" />
+
+       </FrameLayout>
+</FrameLayout>
index 657a4e5..517558d 100644 (file)
@@ -1,51 +1,51 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"\r
-       android:layout_width="match_parent"\r
-    android:layout_height="match_parent"\r
-       android:background="@color/item_body">\r
-    \r
-       <LinearLayout android:id="@+id/progressContainer"\r
-       android:orientation="vertical"\r
-        android:layout_width="match_parent" \r
-        android:layout_height="match_parent"\r
-               android:background="@color/item_body"\r
-        android:visibility="gone"\r
-        android:gravity="center">\r
-\r
-        <ProgressBar style="?android:attr/progressBarStyleLarge"\r
-               android:layout_width="wrap_content"\r
-            android:layout_height="wrap_content" />\r
-        <TextView android:layout_width="wrap_content"\r
-            android:layout_height="wrap_content"\r
-            android:textAppearance="?android:attr/textAppearanceSmall"\r
-            android:text="@string/progress_gathering_data"\r
-            android:paddingTop="4dip"\r
-            android:singleLine="true" />\r
-    </LinearLayout>\r
-    \r
-    <FrameLayout android:id="@+id/listContainer" \r
-        android:orientation="vertical"\r
-               android:layout_width="fill_parent"\r
-               android:layout_height="fill_parent"\r
-               android:background="@color/item_body"> \r
-               <ListView android:id="@android:id/list"\r
-                   android:layout_width="fill_parent"\r
-                       android:textColor="@color/text_color"\r
-                       android:background="@color/item_body"\r
-                       android:cacheColorHint="@color/item_body" \r
-                   android:listSelector="@drawable/list_selection"\r
-                       android:layout_height="wrap_content">\r
-               </ListView>\r
-\r
-        <TextView\r
-            android:id="@android:id/empty"\r
-            android:layout_width="match_parent"\r
-            android:layout_height="match_parent"\r
-                       android:background="@color/item_body"\r
-            android:gravity="center_vertical|center_horizontal"\r
-            android:text="@string/no_items"\r
-            android:textAppearance="?android:attr/textAppearanceMedium"\r
-            android:textColor="@color/text_no_items" />\r
-\r
-       </FrameLayout>\r
-</FrameLayout>\r
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+       android:layout_width="match_parent"
+    android:layout_height="match_parent"
+       android:background="@color/item_body">
+    
+       <LinearLayout android:id="@+id/progressContainer"
+       android:orientation="vertical"
+        android:layout_width="match_parent" 
+        android:layout_height="match_parent"
+               android:background="@color/item_body"
+        android:visibility="gone"
+        android:gravity="center">
+
+        <ProgressBar style="?android:attr/progressBarStyleLarge"
+               android:layout_width="wrap_content"
+            android:layout_height="wrap_content" />
+        <TextView android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:text="@string/progress_gathering_data"
+            android:paddingTop="4dip"
+            android:singleLine="true" />
+    </LinearLayout>
+    
+    <FrameLayout android:id="@+id/listContainer" 
+        android:orientation="vertical"
+               android:layout_width="fill_parent"
+               android:layout_height="fill_parent"
+               android:background="@color/item_body"> 
+               <ListView android:id="@android:id/list"
+                   android:layout_width="fill_parent"
+                       android:textColor="@color/text_color"
+                       android:background="@color/item_body"
+                       android:cacheColorHint="@color/item_body" 
+                   android:listSelector="@drawable/list_selection"
+                       android:layout_height="wrap_content">
+               </ListView>
+
+        <TextView
+            android:id="@android:id/empty"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+                       android:background="@color/item_body"
+            android:gravity="center_vertical|center_horizontal"
+            android:text="@string/no_items"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textColor="@color/text_no_items" />
+
+       </FrameLayout>
+</FrameLayout>
index 8f4c765..8fcccdc 100644 (file)
@@ -1,31 +1,31 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<LinearLayout android:id="@+id/ScreenTitle" \r
-               android:orientation="vertical" \r
-               android:gravity="fill_horizontal" \r
-               android:layout_width="fill_parent" \r
-               android:layout_height="wrap_content"\r
-               android:background="@drawable/header_background"\r
-               xmlns:android="http://schemas.android.com/apk/res/android">\r
-       <TextView android:id="@+id/ScreenTitlePrimary" \r
-                       android:text="@string/main_title" \r
-                       android:textSize="20sp" \r
-                       android:textColor="#ffffff" \r
-                       android:paddingTop="2sp" \r
-                       android:paddingBottom="2sp" \r
-                       android:paddingLeft="5sp" \r
-                       android:paddingRight="5sp" \r
-                       android:layout_width="fill_parent" \r
-                       android:layout_height="wrap_content">\r
-       </TextView>\r
-       <TextView android:id="@+id/ScreenTitleSecondary" \r
-                       android:text="@string/main_title" \r
-                       android:textSize="12sp" \r
-                       android:textColor="#ffffff" \r
-                       android:paddingTop="0sp" \r
-                       android:paddingBottom="4sp" \r
-                       android:paddingLeft="5sp" \r
-                       android:paddingRight="5sp" \r
-                       android:layout_width="fill_parent" \r
-                       android:layout_height="wrap_content">\r
-       </TextView>\r
-</LinearLayout>\r
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout android:id="@+id/ScreenTitle" 
+               android:orientation="vertical" 
+               android:gravity="fill_horizontal" 
+               android:layout_width="fill_parent" 
+               android:layout_height="wrap_content"
+               android:background="@drawable/header_background"
+               xmlns:android="http://schemas.android.com/apk/res/android">
+       <TextView android:id="@+id/ScreenTitlePrimary" 
+                       android:text="@string/main_title" 
+                       android:textSize="20sp" 
+                       android:textColor="#ffffff" 
+                       android:paddingTop="2sp" 
+                       android:paddingBottom="2sp" 
+                       android:paddingLeft="5sp" 
+                       android:paddingRight="5sp" 
+                       android:layout_width="fill_parent" 
+                       android:layout_height="wrap_content">
+       </TextView>
+       <TextView android:id="@+id/ScreenTitleSecondary" 
+                       android:text="@string/main_title" 
+                       android:textSize="12sp" 
+                       android:textColor="#ffffff" 
+                       android:paddingTop="0sp" 
+                       android:paddingBottom="4sp" 
+                       android:paddingLeft="5sp" 
+                       android:paddingRight="5sp" 
+                       android:layout_width="fill_parent" 
+                       android:layout_height="wrap_content">
+       </TextView>
+</LinearLayout>
index 8e49531..fe7668f 100644 (file)
@@ -1,14 +1,14 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<TextView android:id="@+id/ScreenTitlePrimary" \r
-               android:text="@string/main_title" \r
-               android:textSize="20sp" \r
-               android:textColor="#ffffff" \r
-               android:background="@drawable/header_background"\r
-               android:paddingTop="2sp" \r
-               android:paddingBottom="4sp" \r
-               android:paddingLeft="5sp" \r
-               android:paddingRight="5sp" \r
-               android:layout_width="fill_parent" \r
-               android:layout_height="wrap_content"\r
-               xmlns:android="http://schemas.android.com/apk/res/android">\r
-</TextView>\r
+<?xml version="1.0" encoding="utf-8"?>
+<TextView android:id="@+id/ScreenTitlePrimary" 
+               android:text="@string/main_title" 
+               android:textSize="20sp" 
+               android:textColor="#ffffff" 
+               android:background="@drawable/header_background"
+               android:paddingTop="2sp" 
+               android:paddingBottom="4sp" 
+               android:paddingLeft="5sp" 
+               android:paddingRight="5sp" 
+               android:layout_width="fill_parent" 
+               android:layout_height="wrap_content"
+               xmlns:android="http://schemas.android.com/apk/res/android">
+</TextView>
index 4ee45e1..c7eb755 100644 (file)
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="utf-8"?>\r
+<?xml version="1.0" encoding="utf-8"?>
 <menu xmlns:android="http://schemas.android.com/apk/res/android" >
     <item android:id="@+id/connection_point_delete_one" android:title="@string/connection_point_delete_one" android:enabled="true" android:visible="true"></item>
-    <item android:id="@+id/connection_point_delete_all" android:title="@string/connection_point_delete_all" android:enabled="true" android:visible="true" android:checkable="false" android:checked="false"></item>\r
-    \r
-\r
+    <item android:id="@+id/connection_point_delete_all" android:title="@string/connection_point_delete_all" android:enabled="true" android:visible="true" android:checkable="false" android:checked="false"></item>
+    
+
 </menu>
\ No newline at end of file
index 6d4b7e2..2f881ba 100644 (file)
@@ -1,25 +1,25 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<resources>\r
-    <color name="item_body">#ebeae1</color>\r
-       <color name="text_color">#FF404040</color>\r
-       <color name="text_no_items">#FF808080</color>\r
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="item_body">#ebeae1</color>
+       <color name="text_color">#FF404040</color>
+       <color name="text_no_items">#FF808080</color>
        <color name="item_home_background">#FFFFFFFF</color>
        <color name="item_home_border">#FF000000</color>
        <color name="notify_connected">#FF00FF00</color>
        <color name="notify_disconnected">#FFFF0000</color>
        <color name="notify_connecting">#FFFFFF00</color>
-       <color name="notify_connection_failed">#FFFF0000</color>\r
-       <color name="notify_no_connection">#FFFF0000</color>\r
-       <color name="status_normal">#FF00FF00</color>\r
-       <color name="status_warning">#FFFF0000</color>\r
-       <color name="status_minor">#FFFF0000</color>\r
-       <color name="status_major">#FFFF0000</color>\r
-       <color name="status_critical">#FFFF0000</color>\r
-       <color name="status_unknown">#FF0000FF</color>\r
-       <color name="status_unmanaged">#FF404040</color>\r
-       <color name="status_disabled">#FF404040</color>\r
-       <color name="status_testing">#FF404040</color>\r
-       <color name="if_up">#FF00FF00</color>\r
-       <color name="if_down">#FFFF0000</color>\r
-       <color name="if_ignore">#FF404040</color>\r
-</resources>\r
+       <color name="notify_connection_failed">#FFFF0000</color>
+       <color name="notify_no_connection">#FFFF0000</color>
+       <color name="status_normal">#FF00FF00</color>
+       <color name="status_warning">#FFFF0000</color>
+       <color name="status_minor">#FFFF0000</color>
+       <color name="status_major">#FFFF0000</color>
+       <color name="status_critical">#FFFF0000</color>
+       <color name="status_unknown">#FF0000FF</color>
+       <color name="status_unmanaged">#FF404040</color>
+       <color name="status_disabled">#FF404040</color>
+       <color name="status_testing">#FF404040</color>
+       <color name="if_up">#FF00FF00</color>
+       <color name="if_down">#FFFF0000</color>
+       <color name="if_ignore">#FF404040</color>
+</resources>
index f876cb2..81e0879 100644 (file)
@@ -1,51 +1,51 @@
-package org.netxms.ui.android.helpers;\r
-\r
-/**\r
- * Helper for multipliers\r
- * \r
- * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)\r
- *\r
- */\r
-\r
-public class Multipliers\r
-{\r
-       public static final int K = 0;\r
-       public static final int M = 1;\r
-       public static final int G = 2;\r
-       public static final int T = 3;\r
-       public static final int P = 4;\r
-       public static final int E = 5;\r
-       public static final int Z = 5;\r
-       public static final int Y = 5;\r
-\r
-       static public String getLabel(int type, int mul)\r
-       {\r
-               String labels[][] =\r
-               {\r
-                               { "", "", "", "", "", "", "", "" }, // No multiplier\r
-                               { "K", "M", "G", "T", "P", "E", "Z", "Y" }, // Decimal multiplier\r
-                               { "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi", "Yi" } // Binary multiplier\r
-               };\r
-               return labels[type][mul];\r
-       }\r
-\r
-       static public double getValue(int type, int mul)\r
-       {\r
-               double values[][] =\r
-               {\r
-                               { 1, 1, 1, 1, 1, 1, 1, 1 },\r
-                               { 1E3, 1E6, 1E9, 1E12, 1E15, 1E18, 1E21, 1E24 },\r
-                               {\r
-                                               1024.,\r
-                                               1024. * 1024,\r
-                                               1024. * 1024 * 1024,\r
-                                               1024. * 1024 * 1024 * 1024,\r
-                                               1024. * 1024 * 1024 * 1024 * 1024,\r
-                                               1024. * 1024 * 1024 * 1024 * 1024 * 1024,\r
-                                               1024. * 1024 * 1024 * 1024 * 1024 * 1024 * 1024,\r
-                                               1024. * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024\r
-                               },\r
-               };\r
-               return values[type][mul];\r
-       }\r
-}\r
+package org.netxms.ui.android.helpers;
+
+/**
+ * Helper for multipliers
+ * 
+ * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)
+ *
+ */
+
+public class Multipliers
+{
+       public static final int K = 0;
+       public static final int M = 1;
+       public static final int G = 2;
+       public static final int T = 3;
+       public static final int P = 4;
+       public static final int E = 5;
+       public static final int Z = 5;
+       public static final int Y = 5;
+
+       static public String getLabel(int type, int mul)
+       {
+               String labels[][] =
+               {
+                               { "", "", "", "", "", "", "", "" }, // No multiplier
+                               { "K", "M", "G", "T", "P", "E", "Z", "Y" }, // Decimal multiplier
+                               { "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi", "Yi" } // Binary multiplier
+               };
+               return labels[type][mul];
+       }
+
+       static public double getValue(int type, int mul)
+       {
+               double values[][] =
+               {
+                               { 1, 1, 1, 1, 1, 1, 1, 1 },
+                               { 1E3, 1E6, 1E9, 1E12, 1E15, 1E18, 1E21, 1E24 },
+                               {
+                                               1024.,
+                                               1024. * 1024,
+                                               1024. * 1024 * 1024,
+                                               1024. * 1024 * 1024 * 1024,
+                                               1024. * 1024 * 1024 * 1024 * 1024,
+                                               1024. * 1024 * 1024 * 1024 * 1024 * 1024,
+                                               1024. * 1024 * 1024 * 1024 * 1024 * 1024 * 1024,
+                                               1024. * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024
+                               },
+               };
+               return values[type][mul];
+       }
+}
index d54fa22..c5cc961 100644 (file)
@@ -1,83 +1,83 @@
-package org.netxms.ui.android.helpers;\r
-\r
-/**\r
- * Helper for safe parsing of values (from string)\r
- * \r
- * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)\r
- *\r
- */\r
-\r
-public class SafeParser\r
-{\r
-       /**\r
-        * Parse int without throwing exception\r
-        * @param text text to parse\r
-        * @param defVal default value to be used in case of parse error\r
-        * @return parsed value\r
-        */\r
-       static public int parseInt(String text, int defVal)\r
-       {\r
-               try\r
-               {\r
-                       return Integer.parseInt(text);\r
-               }\r
-               catch (NumberFormatException e)\r
-               {\r
-               }\r
-               return defVal;\r
-       }\r
-\r
-       /**\r
-        * Parse long without throwing exception\r
-        * @param text text to parse\r
-        * @param defVal default value to be used in case of parse error\r
-        * @return parsed value\r
-        */\r
-       static public long parseLong(String text, long defVal)\r
-       {\r
-               try\r
-               {\r
-                       return Long.parseLong(text);\r
-               }\r
-               catch (NumberFormatException e)\r
-               {\r
-               }\r
-               return defVal;\r
-       }\r
-\r
-       /**\r
-        * Parse float without throwing exception\r
-        * @param text text to parse\r
-        * @param defVal default value to be used in case of parse error\r
-        * @return parsed value\r
-        */\r
-       static public float parseFloat(String text, float defVal)\r
-       {\r
-               try\r
-               {\r
-                       return Float.parseFloat(text);\r
-               }\r
-               catch (NumberFormatException e)\r
-               {\r
-               }\r
-               return defVal;\r
-       }\r
-\r
-       /**\r
-        * Parse double without throwing exception\r
-        * @param text text to parse\r
-        * @param defVal default value to be used in case of parse error\r
-        * @return parsed value\r
-        */\r
-       static public double parseDouble(String text, double defVal)\r
-       {\r
-               try\r
-               {\r
-                       return Double.parseDouble(text);\r
-               }\r
-               catch (NumberFormatException e)\r
-               {\r
-               }\r
-               return defVal;\r
-       }\r
-}\r
+package org.netxms.ui.android.helpers;
+
+/**
+ * Helper for safe parsing of values (from string)
+ * 
+ * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)
+ *
+ */
+
+public class SafeParser
+{
+       /**
+        * Parse int without throwing exception
+        * @param text text to parse
+        * @param defVal default value to be used in case of parse error
+        * @return parsed value
+        */
+       static public int parseInt(String text, int defVal)
+       {
+               try
+               {
+                       return Integer.parseInt(text);
+               }
+               catch (NumberFormatException e)
+               {
+               }
+               return defVal;
+       }
+
+       /**
+        * Parse long without throwing exception
+        * @param text text to parse
+        * @param defVal default value to be used in case of parse error
+        * @return parsed value
+        */
+       static public long parseLong(String text, long defVal)
+       {
+               try
+               {
+                       return Long.parseLong(text);
+               }
+               catch (NumberFormatException e)
+               {
+               }
+               return defVal;
+       }
+
+       /**
+        * Parse float without throwing exception
+        * @param text text to parse
+        * @param defVal default value to be used in case of parse error
+        * @return parsed value
+        */
+       static public float parseFloat(String text, float defVal)
+       {
+               try
+               {
+                       return Float.parseFloat(text);
+               }
+               catch (NumberFormatException e)
+               {
+               }
+               return defVal;
+       }
+
+       /**
+        * Parse double without throwing exception
+        * @param text text to parse
+        * @param defVal default value to be used in case of parse error
+        * @return parsed value
+        */
+       static public double parseDouble(String text, double defVal)
+       {
+               try
+               {
+                       return Double.parseDouble(text);
+               }
+               catch (NumberFormatException e)
+               {
+               }
+               return defVal;
+       }
+}
index 90b1dca..c29d3a4 100644 (file)
-package org.netxms.ui.android.loaders;\r
-\r
-import java.util.Map;\r
-\r
-import org.netxms.client.events.Alarm;\r
-import org.netxms.ui.android.service.ClientConnectorService;\r
-\r
-import android.content.Context;\r
-import android.support.v4.content.AsyncTaskLoader;\r
-import android.util.Log;\r
-\r
-/**\r
- * Background loader for Alarm objects. Notifies the fragment on job complete\r
- * \r
- * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)\r
- *\r
- */\r
-\r
-public class AlarmLoader extends AsyncTaskLoader<Alarm[]>\r
-{\r
-       private static final String TAG = "nxclient/AlarmLoader";\r
-\r
-       private ClientConnectorService service = null;\r
-       private Alarm[] alarms = null;\r
-\r
-       public AlarmLoader(Context context)\r
-       {\r
-               // Loaders may be used across multiple Activitys (assuming they aren't\r
-               // bound to the LoaderManager), so NEVER hold a reference to the context\r
-               // directly. Doing so will cause you to leak an entire Activity's context.\r
-               // The superclass constructor will store a reference to the Application\r
-               // Context instead, and can be retrieved with a call to getContext().\r
-               super(context);\r
-       }\r
-\r
-       public void setService(ClientConnectorService service)\r
-       {\r
-               this.service = service;\r
-               if (service != null)\r
-                       service.registerAlarmLoader(this);\r
-       }\r
-\r
-       @Override\r
-       public Alarm[] loadInBackground()\r
-       {\r
-               try\r
-               {\r
-                       alarms = null;\r
-                       if (service != null && service.getSession() != null)\r
-                       {\r
-                               Map<Long, Alarm> list = service.getSession().getAlarms();\r
-                               if (list != null)\r
-                                       alarms = list.values().toArray(new Alarm[list.size()]);\r
-                       }\r
-                       else\r
-                               Log.d(TAG, "loadInBackground: service or session null!");\r
-               }\r
-               catch (Exception e)\r
-               {\r
-                       Log.w(TAG, "Exception while executing loadInBackground", e);\r
-               }\r
-               return alarms;\r
-       }\r
-\r
-       @Override\r
-       public void deliverResult(Alarm[] values)\r
-       {\r
-               if (isReset())\r
-               {\r
-                       Log.w(TAG, "Warning! An async query came in while the Loader was reset!");\r
-                       // The Loader has been reset; ignore the result and invalidate the data.\r
-                       // This can happen when the Loader is reset while an asynchronous query\r
-                       // is working in the background. That is, when the background thread\r
-                       // finishes its work and attempts to deliver the results to the client,\r
-                       // it will see here that the Loader has been reset and discard any\r
-                       // resources associated with the new data as necessary.\r
-                       if (values != null)\r
-                       {\r
-                               onReleaseResources(values);\r
-                               return;\r
-                       }\r
-               }\r
-               // Hold a reference to the old data so it doesn't get garbage collected.\r
-               // The old data may still be in use (i.e. bound to an adapter, etc.), so\r
-               // we must protect it until the new data has been delivered.\r
-               Alarm[] oldValues = alarms;\r
-               alarms = values;\r
-\r
-               if (isStarted())\r
-               {\r
-                       // If the Loader is in a started state, have the superclass deliver the\r
-                       // results to the client.\r
-                       super.deliverResult(values);\r
-               }\r
-\r
-               // Invalidate the old data as we don't need it any more.\r
-               if (oldValues != null && oldValues != values)\r
-               {\r
-                       onReleaseResources(oldValues);\r
-               }\r
-       }\r
-\r
-       @Override\r
-       protected void onStartLoading()\r
-       {\r
-               if (alarms != null)\r
-               {\r
-                       // Deliver any previously loaded data immediately.\r
-                       Log.i(TAG, "Delivering previously loaded data to the client...");\r
-                       deliverResult(alarms);\r
-               }\r
-\r
-               // Register the observers that will notify the Loader when changes are made.\r
-               if (service != null)\r
-                       service.registerAlarmLoader(this);\r
-\r
-               if (takeContentChanged())\r
-               {\r
-                       // When the observer detects a new installed application, it will call\r
-                       // onContentChanged() on the Loader, which will cause the next call to\r
-                       // takeContentChanged() to return true. If this is ever the case (or if\r
-                       // the current data is null), we force a new load.\r
-                       Log.i(TAG, "A content change has been detected... so force load!");\r
-                       forceLoad();\r
-               }\r
-               else if (alarms == null)\r
-               {\r
-                       // If the current data is null... then we should make it non-null! :)\r
-                       Log.i(TAG, "The current data is null... so force load!");\r
-                       forceLoad();\r
-               }\r
-       }\r
-\r
-       @Override\r
-       protected void onStopLoading()\r
-       {\r
-               // The Loader has been put in a stopped state, so we should attempt to\r
-               // cancel the current load (if there is one).\r
-               cancelLoad();\r
-\r
-               // Note that we leave the observer as is; Loaders in a stopped state\r
-               // should still monitor the data source for changes so that the Loader\r
-               // will know to force a new load if it is ever started again.\r
-       }\r
-\r
-       @Override\r
-       protected void onReset()\r
-       {\r
-               // Ensure the loader is stopped.\r
-               onStopLoading();\r
-\r
-               // At this point we can release the resources associated with 'apps'.\r
-               if (alarms != null)\r
-               {\r
-                       onReleaseResources(alarms);\r
-                       alarms = null;\r
-               }\r
-\r
-               // The Loader is being reset, so we should stop monitoring for changes.\r
-               if (service != null)\r
-                       service.unregisterAlarmLoader(this);\r
-       }\r
-\r
-       @Override\r
-       public void onCanceled(Alarm[] values)\r
-       {\r
-               // Attempt to cancel the current asynchronous load.\r
-               super.onCanceled(values);\r
-\r
-               // The load has been canceled, so we should release the resources\r
-               // associated with 'alarms'.\r
-               onReleaseResources(values);\r
-       }\r
-\r
-       @Override\r
-       public void forceLoad()\r
-       {\r
-               super.forceLoad();\r
-       }\r
-\r
-       /**\r
-        * Helper method to take care of releasing resources associated with an\r
-        * actively loaded data set.\r
-        */\r
-       protected void onReleaseResources(Alarm[] values)\r
-       {\r
-               // For a simple List, there is nothing to do. For something like a Cursor,\r
-               // we would close it in this method. All resources associated with the\r
-               // Loader should be released here.\r
-       }\r
-}\r
+package org.netxms.ui.android.loaders;
+
+import java.util.Map;
+
+import org.netxms.client.events.Alarm;
+import org.netxms.ui.android.service.ClientConnectorService;
+
+import android.content.Context;
+import android.support.v4.content.AsyncTaskLoader;
+import android.util.Log;
+
+/**
+ * Background loader for Alarm objects. Notifies the fragment on job complete
+ * 
+ * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)
+ *
+ */
+
+public class AlarmLoader extends AsyncTaskLoader<Alarm[]>
+{
+       private static final String TAG = "nxclient/AlarmLoader";
+
+       private ClientConnectorService service = null;
+       private Alarm[] alarms = null;
+
+       public AlarmLoader(Context context)
+       {
+               // Loaders may be used across multiple Activitys (assuming they aren't
+               // bound to the LoaderManager), so NEVER hold a reference to the context
+               // directly. Doing so will cause you to leak an entire Activity's context.
+               // The superclass constructor will store a reference to the Application
+               // Context instead, and can be retrieved with a call to getContext().
+               super(context);
+       }
+
+       public void setService(ClientConnectorService service)
+       {
+               this.service = service;
+               if (service != null)
+                       service.registerAlarmLoader(this);
+       }
+
+       @Override
+       public Alarm[] loadInBackground()
+       {
+               try
+               {
+                       alarms = null;
+                       if (service != null && service.getSession() != null)
+                       {
+                               Map<Long, Alarm> list = service.getSession().getAlarms();
+                               if (list != null)
+                                       alarms = list.values().toArray(new Alarm[list.size()]);
+                       }
+                       else
+                               Log.d(TAG, "loadInBackground: service or session null!");
+               }
+               catch (Exception e)
+               {
+                       Log.w(TAG, "Exception while executing loadInBackground", e);
+               }
+               return alarms;
+       }
+
+       @Override
+       public void deliverResult(Alarm[] values)
+       {
+               if (isReset())
+               {
+                       Log.w(TAG, "Warning! An async query came in while the Loader was reset!");
+                       // The Loader has been reset; ignore the result and invalidate the data.
+                       // This can happen when the Loader is reset while an asynchronous query
+                       // is working in the background. That is, when the background thread
+                       // finishes its work and attempts to deliver the results to the client,
+                       // it will see here that the Loader has been reset and discard any
+                       // resources associated with the new data as necessary.
+                       if (values != null)
+                       {
+                               onReleaseResources(values);
+                               return;
+                       }
+               }
+               // Hold a reference to the old data so it doesn't get garbage collected.
+               // The old data may still be in use (i.e. bound to an adapter, etc.), so
+               // we must protect it until the new data has been delivered.
+               Alarm[] oldValues = alarms;
+               alarms = values;
+
+               if (isStarted())
+               {
+                       // If the Loader is in a started state, have the superclass deliver the
+                       // results to the client.
+                       super.deliverResult(values);
+               }
+
+               // Invalidate the old data as we don't need it any more.
+               if (oldValues != null && oldValues != values)
+               {
+                       onReleaseResources(oldValues);
+               }
+       }
+
+       @Override
+       protected void onStartLoading()
+       {
+               if (alarms != null)
+               {
+                       // Deliver any previously loaded data immediately.
+                       Log.i(TAG, "Delivering previously loaded data to the client...");
+                       deliverResult(alarms);
+               }
+
+               // Register the observers that will notify the Loader when changes are made.
+               if (service != null)
+                       service.registerAlarmLoader(this);
+
+               if (takeContentChanged())
+               {
+                       // When the observer detects a new installed application, it will call
+                       // onContentChanged() on the Loader, which will cause the next call to
+                       // takeContentChanged() to return true. If this is ever the case (or if
+                       // the current data is null), we force a new load.
+                       Log.i(TAG, "A content change has been detected... so force load!");
+                       forceLoad();
+               }
+               else if (alarms == null)
+               {
+                       // If the current data is null... then we should make it non-null! :)
+                       Log.i(TAG, "The current data is null... so force load!");
+                       forceLoad();
+               }
+       }
+
+       @Override
+       protected void onStopLoading()
+       {
+               // The Loader has been put in a stopped state, so we should attempt to
+               // cancel the current load (if there is one).
+               cancelLoad();
+
+               // Note that we leave the observer as is; Loaders in a stopped state
+               // should still monitor the data source for changes so that the Loader
+               // will know to force a new load if it is ever started again.
+       }
+
+       @Override
+       protected void onReset()
+       {
+               // Ensure the loader is stopped.
+               onStopLoading();
+
+               // At this point we can release the resources associated with 'apps'.
+               if (alarms != null)
+               {
+                       onReleaseResources(alarms);
+                       alarms = null;
+               }
+
+               // The Loader is being reset, so we should stop monitoring for changes.
+               if (service != null)
+                       service.unregisterAlarmLoader(this);
+       }
+
+       @Override
+       public void onCanceled(Alarm[] values)
+       {
+               // Attempt to cancel the current asynchronous load.
+               super.onCanceled(values);
+
+               // The load has been canceled, so we should release the resources
+               // associated with 'alarms'.
+               onReleaseResources(values);
+       }
+
+       @Override
+       public void forceLoad()
+       {
+               super.forceLoad();
+       }
+
+       /**
+        * Helper method to take care of releasing resources associated with an
+        * actively loaded data set.
+        */
+       protected void onReleaseResources(Alarm[] values)
+       {
+               // For a simple List, there is nothing to do. For something like a Cursor,
+               // we would close it in this method. All resources associated with the
+               // Loader should be released here.
+       }
+}
index 601b49b..5906f6d 100644 (file)
-package org.netxms.ui.android.loaders;\r
-\r
-import org.netxms.client.NXCSession;\r
-import org.netxms.client.datacollection.DciValue;\r
-import org.netxms.ui.android.service.ClientConnectorService;\r
-\r
-import android.content.Context;\r
-import android.support.v4.content.AsyncTaskLoader;\r
-import android.util.Log;\r
-\r
-/**\r
- * Background loader for DciValue objects. Notifies the fragment on job complete\r
- * \r
- * @author Marco Incalcaterra (marco.incalcaterra@thinksoft.it)\r
- *\r
- */\r
-\r
-public class DciValueLoader extends AsyncTaskLoader<DciValue[]>\r
-{\r
-       private static final String TAG = "nxclient/DciValueLoader";\r
-\r
-       private ClientConnectorService service = null;\r
-       private long nodeId = 0;\r
-       private DciValue[] dciValues = null;\r
-\r
-       public DciValueLoader(Context context)\r
-       {\r
-               // Loaders may be used across multiple Activitys (assuming they aren't\r
-               // bound to the LoaderManager), so NEVER hold a reference to the context\r
-               // directly. Doing so will cause you to leak an entire Activity's context.\r
-               // The superclass constructor will store a reference to the Application\r
-               // Context instead, and can be retrieved with a call to getContext().\r
-               super(context);\r
-       }\r
-\r
-       public void setObjId(long id)\r
-       {\r
-               this.nodeId = id;\r
-       }\r
-\r
-       public void setService(ClientConnectorService service)\r
-       {\r
-               this.service = service;\r
-               if (service != null)\r
-                       service.registerDciValueLoader(this);\r
-       }\r
-\r
-       @Override\r
-       public DciValue[] loadInBackground()\r
-       {\r
-               try\r
-               {\r
-                       dciValues = null;\r
-                       if (service != null && service.getSession() != null)\r
-                       {\r
-                               service.getSession().syncObjectSet(new long[] { nodeId }, false, NXCSession.OBJECT_SYNC_WAIT);\r
-                               dciValues = service.getSession().getLastValues(nodeId);\r
-                       }\r
-                       else\r
-                               Log.d(TAG, "loadInBackground: service or session null!");\r
-               }\r
-               catch (Exception e)\r
-               {\r
-                       Log.w(TAG, "Exception while executing loadInBackground", e);\r
-               }\r
-               return dciValues;\r
-       }\r
-\r
-       @Override\r
-       public void deliverResult(DciValue[] values)\r
-       {\r
-               if (isReset())\r
-               {\r
-                       Log.w(TAG, "Warning! An async query came in while the Loader was reset!");\r
-                       // The Loader has been reset; ignore the result and invalidate the data.\r
-                       // This can happen when the Loader is reset while an asynchronous query\r
-                       // is working in the background. That is, when the background thread\r
-                       // finishes its work and attempts to deliver the results to the client,\r
-                       // it will see here that the Loader has been reset and discard any\r
-                       // resources associated with the new data as necessary.\r
-                       if (values != null)\r
-                       {\r
-                               onReleaseResources(values);\r
-                               return;\r
-                       }\r
-               }\r
-               // Hold a reference to the old data so it doesn't get garbage collected.\r
-               // The old data may still be in use (i.e. bound to an adapter, etc.), so\r
-               // we must protect it until the new data has been delivered.\r
-               DciValue[] oldValues = dciValues;\r
-               dciValues = values;\r
-\r
-               if (isStarted())\r
-               {\r
-                       // If the Loader is in a started state, have the superclass deliver the\r
-                       // results to the client.\r
-                       super.deliverResult(values);\r
-               }\r
-\r
-               // Invalidate the old data as we don't need it any more.\r
-               if (oldValues != null && oldValues != values)\r
-               {\r
-                       Log.i(TAG, "Releasing any old data associated with this Loader.");\r
-                       onReleaseResources(oldValues);\r
-               }\r
-       }\r
-\r
-       @Override\r
-       protected void onStartLoading()\r
-       {\r
-\r
-               if (dciValues != null)\r
-               {\r
-                       // Deliver any previously loaded data immediately.\r
-                       Log.i(TAG, "Delivering previously loaded data to the client...");\r
-                       deliverResult(dciValues);\r
-               }\r
-\r
-               // Register the observers that will notify the Loader when changes are made.\r
-               if (service != null)\r
-                       service.registerDciValueLoader(this);\r
-\r
-               if (takeContentChanged())\r
-               {\r
-                       // When the observer detects a new installed application, it will call\r
-                       // onContentChanged() on the Loader, which will cause the next call to\r
-                       // takeContentChanged() to return true. If this is ever the case (or if\r
-                       // the current data is null), we force a new load.\r
-                       Log.i(TAG, "A content change has been detected... so force load!");\r
-                       forceLoad();\r
-               }\r
-               else if (dciValues == null)\r
-               {\r
-                       // If the current data is null... then we should make it non-null! :)\r
-                       Log.i(TAG, "The current data is null... so force load!");\r
-                       forceLoad();\r
-               }\r
-       }\r
-\r
-       @Override\r
-       protected void onStopLoading()\r
-       {\r
-               // The Loader has been put in a stopped state, so we should attempt to\r
-               // cancel the current load (if there is one).\r
-               cancelLoad();\r
-\r
-               // Note that we leave the observer as is; Loaders in a stopped state\r
-               // should still monitor the data source for changes so that the Loader\r
-               // will know to force a new load if it is ever started again.\r
-       }\r
-\r
-       @Override\r
-       protected void onReset()\r
-       {\r
-               // Ensure the loader is stopped.\r
-               onStopLoading();\r
-\r
-               // At this point we can release the resources associated with 'apps'.