diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..7bc01d9 --- /dev/null +++ b/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/.project b/.project new file mode 100644 index 0000000..321d2ac --- /dev/null +++ b/.project @@ -0,0 +1,33 @@ + + + swan-train-sensor + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + diff --git a/AndroidManifest.xml b/AndroidManifest.xml new file mode 100644 index 0000000..f91593d --- /dev/null +++ b/AndroidManifest.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/gen/com/google/android/gms/R.java b/gen/com/google/android/gms/R.java new file mode 100644 index 0000000..098d0e6 --- /dev/null +++ b/gen/com/google/android/gms/R.java @@ -0,0 +1,113 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ +package com.google.android.gms; + +public final class R { + public static final class attr { + public static final int cameraBearing = 0x7f010001; + public static final int cameraTargetLat = 0x7f010002; + public static final int cameraTargetLng = 0x7f010003; + public static final int cameraTilt = 0x7f010004; + public static final int cameraZoom = 0x7f010005; + public static final int mapType = 0x7f010000; + public static final int uiCompass = 0x7f010006; + public static final int uiRotateGestures = 0x7f010007; + public static final int uiScrollGestures = 0x7f010008; + public static final int uiTiltGestures = 0x7f010009; + public static final int uiZoomControls = 0x7f01000a; + public static final int uiZoomGestures = 0x7f01000b; + public static final int useViewLifecycle = 0x7f01000c; + public static final int zOrderOnTop = 0x7f01000d; + } + public static final class color { + public static final int common_action_bar_splitter = 0x7f05000a; + public static final int common_signin_btn_dark_text_default = 0x7f050001; + public static final int common_signin_btn_dark_text_disabled = 0x7f050003; + public static final int common_signin_btn_dark_text_focused = 0x7f050004; + public static final int common_signin_btn_dark_text_pressed = 0x7f050002; + public static final int common_signin_btn_default_background = 0x7f050009; + public static final int common_signin_btn_light_text_default = 0x7f050005; + public static final int common_signin_btn_light_text_disabled = 0x7f050007; + public static final int common_signin_btn_light_text_focused = 0x7f050008; + public static final int common_signin_btn_light_text_pressed = 0x7f050006; + public static final int common_signin_btn_text_dark = 0x7f05000b; + public static final int common_signin_btn_text_light = 0x7f05000c; + } + public static final class drawable { + public static final int common_signin_btn_icon_dark = 0x7f020003; + public static final int common_signin_btn_icon_disabled_dark = 0x7f020004; + public static final int common_signin_btn_icon_disabled_focus_dark = 0x7f020005; + public static final int common_signin_btn_icon_disabled_focus_light = 0x7f020006; + public static final int common_signin_btn_icon_disabled_light = 0x7f020007; + public static final int common_signin_btn_icon_focus_dark = 0x7f020008; + public static final int common_signin_btn_icon_focus_light = 0x7f020009; + public static final int common_signin_btn_icon_light = 0x7f02000a; + public static final int common_signin_btn_icon_normal_dark = 0x7f02000b; + public static final int common_signin_btn_icon_normal_light = 0x7f02000c; + public static final int common_signin_btn_icon_pressed_dark = 0x7f02000d; + public static final int common_signin_btn_icon_pressed_light = 0x7f02000e; + public static final int common_signin_btn_text_dark = 0x7f02000f; + public static final int common_signin_btn_text_disabled_dark = 0x7f020010; + public static final int common_signin_btn_text_disabled_focus_dark = 0x7f020011; + public static final int common_signin_btn_text_disabled_focus_light = 0x7f020012; + public static final int common_signin_btn_text_disabled_light = 0x7f020013; + public static final int common_signin_btn_text_focus_dark = 0x7f020014; + public static final int common_signin_btn_text_focus_light = 0x7f020015; + public static final int common_signin_btn_text_light = 0x7f020016; + public static final int common_signin_btn_text_normal_dark = 0x7f020017; + public static final int common_signin_btn_text_normal_light = 0x7f020018; + public static final int common_signin_btn_text_pressed_dark = 0x7f020019; + public static final int common_signin_btn_text_pressed_light = 0x7f02001a; + } + public static final class id { + public static final int hybrid = 0x7f080004; + public static final int none = 0x7f080000; + public static final int normal = 0x7f080001; + public static final int satellite = 0x7f080002; + public static final int terrain = 0x7f080003; + } + public static final class string { + public static final int auth_client_needs_enabling_title = 0x7f060040; + public static final int auth_client_needs_installation_title = 0x7f060041; + public static final int auth_client_needs_update_title = 0x7f060042; + public static final int auth_client_play_services_err_notification_msg = 0x7f060043; + public static final int auth_client_requested_by_msg = 0x7f060044; + public static final int auth_client_using_bad_version_title = 0x7f06003f; + public static final int common_google_play_services_enable_button = 0x7f060036; + public static final int common_google_play_services_enable_text = 0x7f060035; + public static final int common_google_play_services_enable_title = 0x7f060034; + public static final int common_google_play_services_install_button = 0x7f060033; + public static final int common_google_play_services_install_text_phone = 0x7f060031; + public static final int common_google_play_services_install_text_tablet = 0x7f060032; + public static final int common_google_play_services_install_title = 0x7f060030; + public static final int common_google_play_services_unknown_issue = 0x7f060039; + public static final int common_google_play_services_unsupported_text = 0x7f06003b; + public static final int common_google_play_services_unsupported_title = 0x7f06003a; + public static final int common_google_play_services_update_button = 0x7f06003c; + public static final int common_google_play_services_update_text = 0x7f060038; + public static final int common_google_play_services_update_title = 0x7f060037; + public static final int common_signin_button_text = 0x7f06003d; + public static final int common_signin_button_text_long = 0x7f06003e; + } + public static final class styleable { + public static final int[] MapAttrs = { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d }; + public static final int MapAttrs_cameraBearing = 1; + public static final int MapAttrs_cameraTargetLat = 2; + public static final int MapAttrs_cameraTargetLng = 3; + public static final int MapAttrs_cameraTilt = 4; + public static final int MapAttrs_cameraZoom = 5; + public static final int MapAttrs_mapType = 0; + public static final int MapAttrs_uiCompass = 6; + public static final int MapAttrs_uiRotateGestures = 7; + public static final int MapAttrs_uiScrollGestures = 8; + public static final int MapAttrs_uiTiltGestures = 9; + public static final int MapAttrs_uiZoomControls = 10; + public static final int MapAttrs_uiZoomGestures = 11; + public static final int MapAttrs_useViewLifecycle = 12; + public static final int MapAttrs_zOrderOnTop = 13; + } +} diff --git a/gen/interdroid/swan/cuckoo_station_sensor/BuildConfig.java b/gen/interdroid/swan/cuckoo_station_sensor/BuildConfig.java new file mode 100644 index 0000000..cafd780 --- /dev/null +++ b/gen/interdroid/swan/cuckoo_station_sensor/BuildConfig.java @@ -0,0 +1,6 @@ +/** Automatically generated file. DO NOT MODIFY */ +package interdroid.swan.cuckoo_station_sensor; + +public final class BuildConfig { + public final static boolean DEBUG = true; +} \ No newline at end of file diff --git a/gen/interdroid/swan/cuckoo_station_sensor/Manifest.java b/gen/interdroid/swan/cuckoo_station_sensor/Manifest.java new file mode 100644 index 0000000..edf83e4 --- /dev/null +++ b/gen/interdroid/swan/cuckoo_station_sensor/Manifest.java @@ -0,0 +1,14 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ + +package interdroid.swan.cuckoo_station_sensor; + +public final class Manifest { + public static final class permission { + public static final String C2D_MESSAGE="interdroid.swan.cuckoo_station_sensor.permission.C2D_MESSAGE"; + } +} diff --git a/gen/interdroid/swan/cuckoo_station_sensor/R.java b/gen/interdroid/swan/cuckoo_station_sensor/R.java new file mode 100644 index 0000000..2521c4b --- /dev/null +++ b/gen/interdroid/swan/cuckoo_station_sensor/R.java @@ -0,0 +1,647 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ + +package interdroid.swan.cuckoo_station_sensor; + +public final class R { + public static final class array { + /** train sensor + */ + public static final int train_valuepaths=0x7f090000; + /** types + */ + public static final int types=0x7f090001; + } + public static final class attr { + /**

Must be a floating point value, such as "1.2". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int cameraBearing=0x7f010001; + /**

Must be a floating point value, such as "1.2". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int cameraTargetLat=0x7f010002; + /**

Must be a floating point value, such as "1.2". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int cameraTargetLng=0x7f010003; + /**

Must be a floating point value, such as "1.2". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int cameraTilt=0x7f010004; + /**

Must be a floating point value, such as "1.2". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int cameraZoom=0x7f010005; + /**

Must be one of the following constant values.

+ ++++ + + + + + +
ConstantValueDescription
none0
normal1
satellite2
terrain3
hybrid4
+ */ + public static final int mapType=0x7f010000; + /**

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int uiCompass=0x7f010006; + /**

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int uiRotateGestures=0x7f010007; + /**

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int uiScrollGestures=0x7f010008; + /**

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int uiTiltGestures=0x7f010009; + /**

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int uiZoomControls=0x7f01000a; + /**

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int uiZoomGestures=0x7f01000b; + /**

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int useViewLifecycle=0x7f01000c; + /**

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + */ + public static final int zOrderOnTop=0x7f01000d; + } + public static final class color { + public static final int common_action_bar_splitter=0x7f05000a; + /** Sign-in Button Colors + */ + public static final int common_signin_btn_dark_text_default=0x7f050001; + public static final int common_signin_btn_dark_text_disabled=0x7f050003; + public static final int common_signin_btn_dark_text_focused=0x7f050004; + public static final int common_signin_btn_dark_text_pressed=0x7f050002; + public static final int common_signin_btn_default_background=0x7f050009; + public static final int common_signin_btn_light_text_default=0x7f050005; + public static final int common_signin_btn_light_text_disabled=0x7f050007; + public static final int common_signin_btn_light_text_focused=0x7f050008; + public static final int common_signin_btn_light_text_pressed=0x7f050006; + public static final int common_signin_btn_text_dark=0x7f05000b; + public static final int common_signin_btn_text_light=0x7f05000c; + public static final int invalid_value_background=0x7f050000; + } + public static final class drawable { + public static final int add_button=0x7f020000; + public static final int add_button_normal=0x7f020001; + public static final int add_button_pressed=0x7f020002; + public static final int common_signin_btn_icon_dark=0x7f020003; + public static final int common_signin_btn_icon_disabled_dark=0x7f020004; + public static final int common_signin_btn_icon_disabled_focus_dark=0x7f020005; + public static final int common_signin_btn_icon_disabled_focus_light=0x7f020006; + public static final int common_signin_btn_icon_disabled_light=0x7f020007; + public static final int common_signin_btn_icon_focus_dark=0x7f020008; + public static final int common_signin_btn_icon_focus_light=0x7f020009; + public static final int common_signin_btn_icon_light=0x7f02000a; + public static final int common_signin_btn_icon_normal_dark=0x7f02000b; + public static final int common_signin_btn_icon_normal_light=0x7f02000c; + public static final int common_signin_btn_icon_pressed_dark=0x7f02000d; + public static final int common_signin_btn_icon_pressed_light=0x7f02000e; + public static final int common_signin_btn_text_dark=0x7f02000f; + public static final int common_signin_btn_text_disabled_dark=0x7f020010; + public static final int common_signin_btn_text_disabled_focus_dark=0x7f020011; + public static final int common_signin_btn_text_disabled_focus_light=0x7f020012; + public static final int common_signin_btn_text_disabled_light=0x7f020013; + public static final int common_signin_btn_text_focus_dark=0x7f020014; + public static final int common_signin_btn_text_focus_light=0x7f020015; + public static final int common_signin_btn_text_light=0x7f020016; + public static final int common_signin_btn_text_normal_dark=0x7f020017; + public static final int common_signin_btn_text_normal_light=0x7f020018; + public static final int common_signin_btn_text_pressed_dark=0x7f020019; + public static final int common_signin_btn_text_pressed_light=0x7f02001a; + public static final int drag_handle=0x7f02001b; + public static final int ic_launcher=0x7f02001c; + public static final int icon=0x7f02001d; + public static final int remove_button=0x7f02001e; + public static final int remove_button_pressed=0x7f02001f; + } + public static final class id { + public static final int ButtonLayout=0x7f080014; + public static final int DoneButton=0x7f080016; + public static final int MainLayout=0x7f080010; + public static final int MainLinearLayout=0x7f080011; + public static final int MapView=0x7f080012; + public static final int Panel=0x7f080013; + public static final int ResetButton=0x7f080015; + public static final int StatusTextView=0x7f080017; + public static final int add_button=0x7f08000e; + public static final int array_layout=0x7f080007; + public static final int array_list=0x7f08000a; + public static final int avro_edit_view=0x7f080009; + public static final int drag_handle=0x7f080006; + public static final int drag_label=0x7f08000f; + public static final int empty_text=0x7f08000d; + public static final int field_name=0x7f08000c; + public static final int hybrid=0x7f080004; + public static final int linearLayout1=0x7f08000b; + public static final int none=0x7f080000; + public static final int normal=0x7f080001; + public static final int relativeLayout1=0x7f080005; + public static final int remove_button=0x7f080008; + public static final int satellite=0x7f080002; + public static final int terrain=0x7f080003; + } + public static final class layout { + public static final int avro_array_item=0x7f030000; + public static final int avro_base_editor=0x7f030001; + public static final int avro_edit_view=0x7f030002; + public static final int avro_field_array=0x7f030003; + public static final int avro_field_checkbox=0x7f030004; + public static final int avro_field_dialog=0x7f030005; + public static final int avro_field_enum=0x7f030006; + public static final int avro_field_label=0x7f030007; + public static final int avro_field_map=0x7f030008; + public static final int avro_field_null=0x7f030009; + public static final int avro_field_number=0x7f03000a; + public static final int avro_field_real=0x7f03000b; + public static final int avro_field_record=0x7f03000c; + public static final int avro_field_string=0x7f03000d; + public static final int avro_field_union=0x7f03000e; + public static final int avro_list_item=0x7f03000f; + public static final int draggable_add=0x7f030010; + public static final int draggable_item=0x7f030011; + public static final int draggable_list_view=0x7f030012; + public static final int locationpicker=0x7f030013; + } + public static final class string { + public static final int app_name=0x7f06000b; + /** Title for notification shown when GooglePlayServices needs to be + enabled for a application to work. [CHAR LIMIT=70] + */ + public static final int auth_client_needs_enabling_title=0x7f060040; + /** Title for notification shown when GooglePlayServices needs to be + installed for a application to work. [CHAR LIMIT=70] + */ + public static final int auth_client_needs_installation_title=0x7f060041; + /** Title for notification shown when GooglePlayServices needs to be + udpated for a application to work. [CHAR LIMIT=70] + */ + public static final int auth_client_needs_update_title=0x7f060042; + /** Title for notification shown when GooglePlayServices is unavailable [CHAR LIMIT=42] + */ + public static final int auth_client_play_services_err_notification_msg=0x7f060043; + /** Requested by string saying which app requested the notification. [CHAR LIMIT=42] + */ + public static final int auth_client_requested_by_msg=0x7f060044; + /** Title for notification shown when a bad version of GooglePlayServices + has been installed and needs correction for an application to work. + [CHAR LIMIT=70] + */ + public static final int auth_client_using_bad_version_title=0x7f06003f; + public static final int branch_name_label=0x7f06002c; + public static final int button_add_field=0x7f06000d; + public static final int button_ok=0x7f06000c; + public static final int cancel=0x7f06002a; + /** Button in confirmation dialog to enable Google Play services. Clicking it + will direct user to application settings of Google Play services where they + can enable it [CHAR LIMIT=40] + */ + public static final int common_google_play_services_enable_button=0x7f060036; + /** Message in confirmation dialog informing user they need to enable + Google Play services in application settings [CHAR LIMIT=NONE] + */ + public static final int common_google_play_services_enable_text=0x7f060035; + /** Title of confirmation dialog informing user they need to enable + Google Play services in application settings [CHAR LIMIT=40] + */ + public static final int common_google_play_services_enable_title=0x7f060034; + /** Button in confirmation dialog for installing Google Play services [CHAR LIMIT=40] + */ + public static final int common_google_play_services_install_button=0x7f060033; + /** (For phones) Message in confirmation dialog informing user that + they need to install Google Play services (from Play Store) [CHAR LIMIT=NONE] + */ + public static final int common_google_play_services_install_text_phone=0x7f060031; + /** (For tablets) Message in confirmation dialog informing user that + they need to install Google Play services (from Play Store) [CHAR LIMIT=NONE] + */ + public static final int common_google_play_services_install_text_tablet=0x7f060032; + /** Title of confirmation dialog informing user that they need to install + Google Play services (from Play Store) [CHAR LIMIT=40] + */ + public static final int common_google_play_services_install_title=0x7f060030; + /** Message in confirmation dialog informing user there is an unknown issue in Google Play + services [CHAR LIMIT=NONE] + */ + public static final int common_google_play_services_unknown_issue=0x7f060039; + /** Message in confirmation dialog informing user that Google Play services is not supported on their device [CHAR LIMIT=NONE] + */ + public static final int common_google_play_services_unsupported_text=0x7f06003b; + /** Title of confirmation dialog informing user that Google Play services is not supported on their device [CHAR LIMIT=40] + */ + public static final int common_google_play_services_unsupported_title=0x7f06003a; + /** Button in confirmation dialog for updating Google Play services [CHAR LIMIT=40] + */ + public static final int common_google_play_services_update_button=0x7f06003c; + /** Message in confirmation dialog informing user that they need to update + Google Play services (from Play Store) [CHAR LIMIT=NONE] + */ + public static final int common_google_play_services_update_text=0x7f060038; + /** Title of confirmation dialog informing user that they need to update + Google Play services (from Play Store) [CHAR LIMIT=40] + */ + public static final int common_google_play_services_update_title=0x7f060037; + /** Sign-in button text [CHAR LIMIT=15] + */ + public static final int common_signin_button_text=0x7f06003d; + /** Long form sign-in button text [CHAR LIMIT=30] + */ + public static final int common_signin_button_text_long=0x7f06003e; + public static final int create_copy=0x7f060029; + public static final int error_message=0x7f06000f; + public static final int error_name_required=0x7f060015; + public static final int error_namespace_required=0x7f060016; + public static final int error_no_fields_in_record=0x7f060014; + public static final int error_no_schema=0x7f060011; + public static final int error_opening_camera=0x7f060019; + public static final int error_parsing_schema=0x7f060012; + public static final int error_picking_location=0x7f06001a; + public static final int error_selecting_record_type=0x7f060010; + public static final int error_title=0x7f06000e; + public static final int error_unknown_complex_type=0x7f060018; + public static final int error_unknown_loading_and_creating=0x7f060013; + public static final int error_unknown_primitive_type=0x7f060017; + public static final int label_comment=0x7f06001c; + public static final int label_create=0x7f060020; + public static final int label_edit=0x7f060021; + public static final int label_fields=0x7f06001e; + public static final int label_loading=0x7f060022; + public static final int label_name=0x7f06001b; + public static final int label_namespace=0x7f06001d; + public static final int label_pick=0x7f060024; + public static final int label_pick_location=0x7f060027; + public static final int label_take_photo=0x7f060025; + public static final int label_take_video=0x7f060026; + public static final int label_type=0x7f06001f; + public static final int label_wait=0x7f060023; + public static final int menu_delete=0x7f060000; + public static final int menu_discard=0x7f060003; + public static final int menu_insert=0x7f060001; + public static final int menu_revert=0x7f060002; + public static final int none=0x7f060028; + public static final int not_implemented=0x7f06002e; + public static final int null_text=0x7f06002d; + public static final int save=0x7f06002b; + public static final int title_add_field=0x7f060008; + public static final int title_create=0x7f060004; + public static final int title_create_field=0x7f06000a; + public static final int title_edit=0x7f060005; + public static final int title_edit_field=0x7f060009; + public static final int title_persistencebrowser=0x7f060006; + public static final int title_repomaker=0x7f060007; + public static final int title_this=0x7f06002f; + } + public static final class style { + /** + Base application theme, dependent on API level. This theme is replaced + by AppBaseTheme from res/values-vXX/styles.xml on newer devices. + + + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + + + Base application theme for API 11+. This theme completely replaces + AppBaseTheme from res/values/styles.xml on API 11+ devices. + + API 11 theme customizations can go here. + + Base application theme for API 14+. This theme completely replaces + AppBaseTheme from BOTH res/values/styles.xml and + res/values-v11/styles.xml on API 14+ devices. + + API 14 theme customizations can go here. + */ + public static final int AppBaseTheme=0x7f070004; + /** Application theme. + All customizations that are NOT specific to a particular API-level can go here. + */ + public static final int AppTheme=0x7f070005; + public static final int button=0x7f070000; + public static final int fill=0x7f070002; + public static final int row=0x7f070001; + public static final int wrap=0x7f070003; + } + public static final class xml { + public static final int train_preferences=0x7f040000; + } + public static final class styleable { + /** Attributes that can be used with a MapAttrs. +

Includes the following attributes:

+ + + + + + + + + + + + + + + + + + +
AttributeDescription
{@link #MapAttrs_cameraBearing interdroid.swan.cuckoo_station_sensor:cameraBearing}
{@link #MapAttrs_cameraTargetLat interdroid.swan.cuckoo_station_sensor:cameraTargetLat}
{@link #MapAttrs_cameraTargetLng interdroid.swan.cuckoo_station_sensor:cameraTargetLng}
{@link #MapAttrs_cameraTilt interdroid.swan.cuckoo_station_sensor:cameraTilt}
{@link #MapAttrs_cameraZoom interdroid.swan.cuckoo_station_sensor:cameraZoom}
{@link #MapAttrs_mapType interdroid.swan.cuckoo_station_sensor:mapType}
{@link #MapAttrs_uiCompass interdroid.swan.cuckoo_station_sensor:uiCompass}
{@link #MapAttrs_uiRotateGestures interdroid.swan.cuckoo_station_sensor:uiRotateGestures}
{@link #MapAttrs_uiScrollGestures interdroid.swan.cuckoo_station_sensor:uiScrollGestures}
{@link #MapAttrs_uiTiltGestures interdroid.swan.cuckoo_station_sensor:uiTiltGestures}
{@link #MapAttrs_uiZoomControls interdroid.swan.cuckoo_station_sensor:uiZoomControls}
{@link #MapAttrs_uiZoomGestures interdroid.swan.cuckoo_station_sensor:uiZoomGestures}
{@link #MapAttrs_useViewLifecycle interdroid.swan.cuckoo_station_sensor:useViewLifecycle}
{@link #MapAttrs_zOrderOnTop interdroid.swan.cuckoo_station_sensor:zOrderOnTop}
+ @see #MapAttrs_cameraBearing + @see #MapAttrs_cameraTargetLat + @see #MapAttrs_cameraTargetLng + @see #MapAttrs_cameraTilt + @see #MapAttrs_cameraZoom + @see #MapAttrs_mapType + @see #MapAttrs_uiCompass + @see #MapAttrs_uiRotateGestures + @see #MapAttrs_uiScrollGestures + @see #MapAttrs_uiTiltGestures + @see #MapAttrs_uiZoomControls + @see #MapAttrs_uiZoomGestures + @see #MapAttrs_useViewLifecycle + @see #MapAttrs_zOrderOnTop + */ + public static final int[] MapAttrs = { + 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, + 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, + 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, + 0x7f01000c, 0x7f01000d + }; + /** +

This symbol is the offset where the {@link interdroid.swan.cuckoo_station_sensor.R.attr#cameraBearing} + attribute's value can be found in the {@link #MapAttrs} array. + + +

Must be a floating point value, such as "1.2". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name interdroid.swan.cuckoo_station_sensor:cameraBearing + */ + public static final int MapAttrs_cameraBearing = 1; + /** +

This symbol is the offset where the {@link interdroid.swan.cuckoo_station_sensor.R.attr#cameraTargetLat} + attribute's value can be found in the {@link #MapAttrs} array. + + +

Must be a floating point value, such as "1.2". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name interdroid.swan.cuckoo_station_sensor:cameraTargetLat + */ + public static final int MapAttrs_cameraTargetLat = 2; + /** +

This symbol is the offset where the {@link interdroid.swan.cuckoo_station_sensor.R.attr#cameraTargetLng} + attribute's value can be found in the {@link #MapAttrs} array. + + +

Must be a floating point value, such as "1.2". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name interdroid.swan.cuckoo_station_sensor:cameraTargetLng + */ + public static final int MapAttrs_cameraTargetLng = 3; + /** +

This symbol is the offset where the {@link interdroid.swan.cuckoo_station_sensor.R.attr#cameraTilt} + attribute's value can be found in the {@link #MapAttrs} array. + + +

Must be a floating point value, such as "1.2". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name interdroid.swan.cuckoo_station_sensor:cameraTilt + */ + public static final int MapAttrs_cameraTilt = 4; + /** +

This symbol is the offset where the {@link interdroid.swan.cuckoo_station_sensor.R.attr#cameraZoom} + attribute's value can be found in the {@link #MapAttrs} array. + + +

Must be a floating point value, such as "1.2". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name interdroid.swan.cuckoo_station_sensor:cameraZoom + */ + public static final int MapAttrs_cameraZoom = 5; + /** +

This symbol is the offset where the {@link interdroid.swan.cuckoo_station_sensor.R.attr#mapType} + attribute's value can be found in the {@link #MapAttrs} array. + + +

Must be one of the following constant values.

+ ++++ + + + + + +
ConstantValueDescription
none0
normal1
satellite2
terrain3
hybrid4
+ @attr name interdroid.swan.cuckoo_station_sensor:mapType + */ + public static final int MapAttrs_mapType = 0; + /** +

This symbol is the offset where the {@link interdroid.swan.cuckoo_station_sensor.R.attr#uiCompass} + attribute's value can be found in the {@link #MapAttrs} array. + + +

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name interdroid.swan.cuckoo_station_sensor:uiCompass + */ + public static final int MapAttrs_uiCompass = 6; + /** +

This symbol is the offset where the {@link interdroid.swan.cuckoo_station_sensor.R.attr#uiRotateGestures} + attribute's value can be found in the {@link #MapAttrs} array. + + +

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name interdroid.swan.cuckoo_station_sensor:uiRotateGestures + */ + public static final int MapAttrs_uiRotateGestures = 7; + /** +

This symbol is the offset where the {@link interdroid.swan.cuckoo_station_sensor.R.attr#uiScrollGestures} + attribute's value can be found in the {@link #MapAttrs} array. + + +

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name interdroid.swan.cuckoo_station_sensor:uiScrollGestures + */ + public static final int MapAttrs_uiScrollGestures = 8; + /** +

This symbol is the offset where the {@link interdroid.swan.cuckoo_station_sensor.R.attr#uiTiltGestures} + attribute's value can be found in the {@link #MapAttrs} array. + + +

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name interdroid.swan.cuckoo_station_sensor:uiTiltGestures + */ + public static final int MapAttrs_uiTiltGestures = 9; + /** +

This symbol is the offset where the {@link interdroid.swan.cuckoo_station_sensor.R.attr#uiZoomControls} + attribute's value can be found in the {@link #MapAttrs} array. + + +

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name interdroid.swan.cuckoo_station_sensor:uiZoomControls + */ + public static final int MapAttrs_uiZoomControls = 10; + /** +

This symbol is the offset where the {@link interdroid.swan.cuckoo_station_sensor.R.attr#uiZoomGestures} + attribute's value can be found in the {@link #MapAttrs} array. + + +

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name interdroid.swan.cuckoo_station_sensor:uiZoomGestures + */ + public static final int MapAttrs_uiZoomGestures = 11; + /** +

This symbol is the offset where the {@link interdroid.swan.cuckoo_station_sensor.R.attr#useViewLifecycle} + attribute's value can be found in the {@link #MapAttrs} array. + + +

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name interdroid.swan.cuckoo_station_sensor:useViewLifecycle + */ + public static final int MapAttrs_useViewLifecycle = 12; + /** +

This symbol is the offset where the {@link interdroid.swan.cuckoo_station_sensor.R.attr#zOrderOnTop} + attribute's value can be found in the {@link #MapAttrs} array. + + +

Must be a boolean value, either "true" or "false". +

This may also be a reference to a resource (in the form +"@[package:]type:name") or +theme attribute (in the form +"?[package:][type:]name") +containing a value of this type. + @attr name interdroid.swan.cuckoo_station_sensor:zOrderOnTop + */ + public static final int MapAttrs_zOrderOnTop = 13; + }; +} diff --git a/gen/interdroid/vdb/avro/R.java b/gen/interdroid/vdb/avro/R.java new file mode 100644 index 0000000..9d0aa7f --- /dev/null +++ b/gen/interdroid/vdb/avro/R.java @@ -0,0 +1,121 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ +package interdroid.vdb.avro; + +public final class R { + public static final class color { + public static final int invalid_value_background = 0x7f050000; + } + public static final class drawable { + public static final int add_button = 0x7f020000; + public static final int add_button_normal = 0x7f020001; + public static final int add_button_pressed = 0x7f020002; + public static final int drag_handle = 0x7f02001b; + public static final int icon = 0x7f02001d; + public static final int remove_button = 0x7f02001e; + public static final int remove_button_pressed = 0x7f02001f; + } + public static final class id { + public static final int ButtonLayout = 0x7f080014; + public static final int DoneButton = 0x7f080016; + public static final int MainLayout = 0x7f080010; + public static final int MainLinearLayout = 0x7f080011; + public static final int MapView = 0x7f080012; + public static final int Panel = 0x7f080013; + public static final int ResetButton = 0x7f080015; + public static final int StatusTextView = 0x7f080017; + public static final int add_button = 0x7f08000e; + public static final int array_layout = 0x7f080007; + public static final int array_list = 0x7f08000a; + public static final int avro_edit_view = 0x7f080009; + public static final int drag_handle = 0x7f080006; + public static final int drag_label = 0x7f08000f; + public static final int empty_text = 0x7f08000d; + public static final int field_name = 0x7f08000c; + public static final int linearLayout1 = 0x7f08000b; + public static final int relativeLayout1 = 0x7f080005; + public static final int remove_button = 0x7f080008; + } + public static final class layout { + public static final int avro_array_item = 0x7f030000; + public static final int avro_base_editor = 0x7f030001; + public static final int avro_edit_view = 0x7f030002; + public static final int avro_field_array = 0x7f030003; + public static final int avro_field_checkbox = 0x7f030004; + public static final int avro_field_dialog = 0x7f030005; + public static final int avro_field_enum = 0x7f030006; + public static final int avro_field_label = 0x7f030007; + public static final int avro_field_map = 0x7f030008; + public static final int avro_field_null = 0x7f030009; + public static final int avro_field_number = 0x7f03000a; + public static final int avro_field_real = 0x7f03000b; + public static final int avro_field_record = 0x7f03000c; + public static final int avro_field_string = 0x7f03000d; + public static final int avro_field_union = 0x7f03000e; + public static final int avro_list_item = 0x7f03000f; + public static final int draggable_add = 0x7f030010; + public static final int draggable_item = 0x7f030011; + public static final int draggable_list_view = 0x7f030012; + public static final int locationpicker = 0x7f030013; + } + public static final class string { + public static final int app_name = 0x7f06000b; + public static final int branch_name_label = 0x7f06002c; + public static final int button_add_field = 0x7f06000d; + public static final int button_ok = 0x7f06000c; + public static final int cancel = 0x7f06002a; + public static final int create_copy = 0x7f060029; + public static final int error_message = 0x7f06000f; + public static final int error_name_required = 0x7f060015; + public static final int error_namespace_required = 0x7f060016; + public static final int error_no_fields_in_record = 0x7f060014; + public static final int error_no_schema = 0x7f060011; + public static final int error_opening_camera = 0x7f060019; + public static final int error_parsing_schema = 0x7f060012; + public static final int error_picking_location = 0x7f06001a; + public static final int error_selecting_record_type = 0x7f060010; + public static final int error_title = 0x7f06000e; + public static final int error_unknown_complex_type = 0x7f060018; + public static final int error_unknown_loading_and_creating = 0x7f060013; + public static final int error_unknown_primitive_type = 0x7f060017; + public static final int label_comment = 0x7f06001c; + public static final int label_create = 0x7f060020; + public static final int label_edit = 0x7f060021; + public static final int label_fields = 0x7f06001e; + public static final int label_loading = 0x7f060022; + public static final int label_name = 0x7f06001b; + public static final int label_namespace = 0x7f06001d; + public static final int label_pick = 0x7f060024; + public static final int label_pick_location = 0x7f060027; + public static final int label_take_photo = 0x7f060025; + public static final int label_take_video = 0x7f060026; + public static final int label_type = 0x7f06001f; + public static final int label_wait = 0x7f060023; + public static final int menu_delete = 0x7f060000; + public static final int menu_discard = 0x7f060003; + public static final int menu_insert = 0x7f060001; + public static final int menu_revert = 0x7f060002; + public static final int none = 0x7f060028; + public static final int not_implemented = 0x7f06002e; + public static final int null_text = 0x7f06002d; + public static final int save = 0x7f06002b; + public static final int title_add_field = 0x7f060008; + public static final int title_create = 0x7f060004; + public static final int title_create_field = 0x7f06000a; + public static final int title_edit = 0x7f060005; + public static final int title_edit_field = 0x7f060009; + public static final int title_persistencebrowser = 0x7f060006; + public static final int title_repomaker = 0x7f060007; + public static final int title_this = 0x7f06002f; + } + public static final class style { + public static final int button = 0x7f070000; + public static final int fill = 0x7f070002; + public static final int row = 0x7f070001; + public static final int wrap = 0x7f070003; + } +} diff --git a/ic_launcher-web.png b/ic_launcher-web.png new file mode 100644 index 0000000..d767607 Binary files /dev/null and b/ic_launcher-web.png differ diff --git a/libs/android-support-v4.jar b/libs/android-support-v4.jar new file mode 100644 index 0000000..cf12d28 Binary files /dev/null and b/libs/android-support-v4.jar differ diff --git a/libs/cuckoo-client.jar b/libs/cuckoo-client.jar new file mode 100644 index 0000000..4e63dee Binary files /dev/null and b/libs/cuckoo-client.jar differ diff --git a/libs/swan-sensor.jar b/libs/swan-sensor.jar new file mode 100644 index 0000000..0bc8e35 Binary files /dev/null and b/libs/swan-sensor.jar differ diff --git a/libs/swan-song.jar b/libs/swan-song.jar new file mode 100644 index 0000000..5a83e55 Binary files /dev/null and b/libs/swan-song.jar differ diff --git a/proguard-project.txt b/proguard-project.txt new file mode 100644 index 0000000..f2fe155 --- /dev/null +++ b/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/project.properties b/project.properties new file mode 100644 index 0000000..aec1bec --- /dev/null +++ b/project.properties @@ -0,0 +1,16 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-18 +android.library.reference.1=../../../../android-sdk/extras/google/google_play_services/libproject/google-play-services_lib +android.library.reference.2=../../swan-git/interdroid-vdb-avro diff --git a/res/drawable-hdpi/ic_launcher.png b/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..79e40ac Binary files /dev/null and b/res/drawable-hdpi/ic_launcher.png differ diff --git a/res/drawable-mdpi/ic_launcher.png b/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..24d5202 Binary files /dev/null and b/res/drawable-mdpi/ic_launcher.png differ diff --git a/res/drawable-xhdpi/ic_launcher.png b/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..1481480 Binary files /dev/null and b/res/drawable-xhdpi/ic_launcher.png differ diff --git a/res/drawable-xxhdpi/ic_launcher.png b/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..664ff5f Binary files /dev/null and b/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/res/values-v11/styles.xml b/res/values-v11/styles.xml new file mode 100644 index 0000000..3c02242 --- /dev/null +++ b/res/values-v11/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/res/values-v14/styles.xml b/res/values-v14/styles.xml new file mode 100644 index 0000000..a91fd03 --- /dev/null +++ b/res/values-v14/styles.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/res/values/strings.xml b/res/values/strings.xml new file mode 100644 index 0000000..e9f438f --- /dev/null +++ b/res/values/strings.xml @@ -0,0 +1,5 @@ + + + cuckoo-train-sensor + + diff --git a/res/values/styles.xml b/res/values/styles.xml new file mode 100644 index 0000000..6ce89c7 --- /dev/null +++ b/res/values/styles.xml @@ -0,0 +1,20 @@ + + + + + + + + + diff --git a/res/values/train_values.xml b/res/values/train_values.xml new file mode 100644 index 0000000..3b21fd3 --- /dev/null +++ b/res/values/train_values.xml @@ -0,0 +1,17 @@ + + + + + + departure + + + + + Intercity + Sprinter + Fyra + + + + \ No newline at end of file diff --git a/res/xml/train_preferences.xml b/res/xml/train_preferences.xml new file mode 100644 index 0000000..cb62db2 --- /dev/null +++ b/res/xml/train_preferences.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/interdroid/swan/cuckoo_station_sensor/TrainPoller.java b/src/interdroid/swan/cuckoo_station_sensor/TrainPoller.java new file mode 100644 index 0000000..2bd2ab0 --- /dev/null +++ b/src/interdroid/swan/cuckoo_station_sensor/TrainPoller.java @@ -0,0 +1,116 @@ +package interdroid.swan.cuckoo_station_sensor; + +import interdroid.swan.cuckoo_sensors.CuckooPoller; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Pattern; + +import org.apache.http.HttpResponse; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.params.BasicHttpParams; +import org.apache.http.params.HttpParams; + +/** + * A sensor for departure times of trains in the Netherlands + * + * @author roelof <rkemp@cs.vu.nl> + * + */ +public class TrainPoller implements CuckooPoller { + + /** + * The from configuration. + */ + public static final String FROM_CONFIG = "from"; + + /** + * The to configuration. + */ + public static final String TO_CONFIG = "to"; + + /** + * The type configuration. + */ + public static final String TYPE_CONFIG = "type"; + + /** + * The time configuration. + */ + public static final String TIME_CONFIG = "time"; + + /** + * The departure field. + */ + public static final String DEPARTURE_FIELD = "departure"; + + @Override + public Map poll(String valuePath, + Map configuration) { + Map result = new HashMap(); + String fromStation = (String) configuration.get(FROM_CONFIG); + String toStation = (String) configuration.get(TO_CONFIG); + String time = (String) configuration.get(TIME_CONFIG); + HttpParams httpParams = new BasicHttpParams(); + DefaultHttpClient httpClient = new DefaultHttpClient(httpParams); + String date = new SimpleDateFormat("dd-MM").format(new Date(System + .currentTimeMillis())); + HttpGet httpGet = new HttpGet( + "http://mobiel.ns.nl/planner.action?from=" + fromStation + + "&to=" + toStation + "&date=" + date + "&time=" + + time + "&departure=true&planroute=Journey+advice"); + try { + HttpResponse response = httpClient.execute(httpGet); + BufferedReader reader = new BufferedReader(new InputStreamReader( + response.getEntity().getContent())); + String line = null; + String departureTimeString = ""; + int delay = 0; + while ((line = reader.readLine()) != null) { + if (line.contains("D ")) { + departureTimeString = line.substring("D ".length()) + .replace("", ""); + reader.readLine(); + line = reader.readLine(); + if (line.contains("+ ")) { + Pattern pattern = Pattern.compile(Pattern + .quote("+ ")); + delay = Integer.parseInt(pattern.split(line)[1] + .split(" min")[0]); + } + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.HOUR_OF_DAY, + Integer.parseInt(departureTimeString.split(":")[0])); + calendar.set(Calendar.MINUTE, + Integer.parseInt(departureTimeString.split(":")[1])); + calendar.set(Calendar.MILLISECOND, 0); + calendar.roll(Calendar.MINUTE, delay); + result.put(DEPARTURE_FIELD, calendar.getTimeInMillis()); + break; + } + } + } catch (ClientProtocolException e) { + // ignore + } catch (IOException e) { + // ignore + } + return result; + } + + @Override + public long getInterval(Map configuration, boolean remote) { + if (remote) { + return 10000; // 10 sec + } else { + return 5 * 60 * 1000; // 5 min + } + } +} \ No newline at end of file diff --git a/src/interdroid/swan/cuckoo_station_sensor/TrainSensor.java b/src/interdroid/swan/cuckoo_station_sensor/TrainSensor.java new file mode 100644 index 0000000..7998410 --- /dev/null +++ b/src/interdroid/swan/cuckoo_station_sensor/TrainSensor.java @@ -0,0 +1,170 @@ +package interdroid.swan.cuckoo_station_sensor; + +import interdroid.swan.cuckoo_station_sensor.R; + +import interdroid.swan.sensors.AbstractConfigurationActivity; +import interdroid.swan.sensors.AbstractCuckooSensor; +import interdroid.vdb.content.avro.AvroContentProviderProxy; // link to android library: vdb-avro + +import android.content.ContentValues; +import android.os.Bundle; +import android.app.Activity; +import android.util.Log; +import interdroid.swan.cuckoo_sensors.CuckooPoller; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import com.google.android.gms.gcm.GoogleCloudMessaging; // link to android library: google-play-services_lib + +/** + * A sensor for departure times of trains in the Netherlands + * + * @author roelof <rkemp@cs.vu.nl> + * + */ +public class TrainSensor extends AbstractCuckooSensor { + + /** + * The configuration activity for this sensor. + */ + public static class ConfigurationActivity extends + AbstractConfigurationActivity { + + @Override + public final int getPreferencesXML() { + return R.xml.train_preferences; + } + + } + + /** + * The from configuration. + */ + public static final String FROM_CONFIG = "from"; + + /** + * The to configuration. + */ + public static final String TO_CONFIG = "to"; + + /** + * The type configuration. + */ + public static final String TYPE_CONFIG = "type"; + + /** + * The time configuration. + */ + public static final String TIME_CONFIG = "time"; + + /** + * The departure field. + */ + public static final String DEPARTURE_FIELD = "departure"; + + /** + * The schema for this sensor. + */ + public static final String SCHEME = getSchema(); + + /** + * The provider for this sensor. + */ + public static class Provider extends AvroContentProviderProxy { + + /** + * Construct the provider for this sensor. + */ + public Provider() { + super(SCHEME); + } + + } + + /** + * @return the schema for this sensor. + */ + private static String getSchema() { + String scheme = "{'type': 'record', 'name': 'train', " + + "'namespace': 'interdroid.swan.cuckoo_station_sensor.train'," + + "\n'fields': [" + SCHEMA_TIMESTAMP_FIELDS + "\n{'name': '" + + DEPARTURE_FIELD + "', 'type': 'long'}" + "\n]" + "}"; + return scheme.replace('\'', '"'); + } + + @Override + public final String[] getValuePaths() { + return new String[] { DEPARTURE_FIELD }; + } + + @Override + public void initDefaultConfiguration(final Bundle defaults) { + defaults.putString(TYPE_CONFIG, "Intercity"); + } + + @Override + public final String getScheme() { + return SCHEME; + } + + /** + * Data Storage Helper Method. + * + * @param departure + * value for departure + */ + private void storeReading(long departure) { + long now = System.currentTimeMillis(); + ContentValues values = new ContentValues(); + values.put(DEPARTURE_FIELD, departure); + putValues(values, now); + } + + /** + * =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Sensor Specific Implementation + * =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + */ + + @Override + public final CuckooPoller getPoller() { + return new TrainPoller(); + } + + @Override + public String getGCMSenderId() { + throw new java.lang.RuntimeException(""); + } + + @Override + public String getGCMApiKey() { + throw new java.lang.RuntimeException(""); + } + + public void registerReceiver() { + IntentFilter filter = new IntentFilter( + "com.google.android.c2dm.intent.RECEIVE"); + filter.addCategory(getPackageName()); + registerReceiver(new BroadcastReceiver() { + private static final String TAG = "trainSensorReceiver"; + + @Override + public void onReceive(Context context, Intent intent) { + GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context); + String messageType = gcm.getMessageType(intent); + if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR + .equals(messageType)) { + Log.d(TAG, "Received update but encountered send error."); + } else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED + .equals(messageType)) { + Log.d(TAG, "Messages were deleted at the server."); + } else { + if (intent.hasExtra(DEPARTURE_FIELD)) { + storeReading(intent.getExtras().getLong("departure")); + } + } + setResultCode(Activity.RESULT_OK); + } + }, filter, "com.google.android.c2dm.permission.SEND", null); + } +} \ No newline at end of file diff --git a/train.json b/train.json new file mode 100644 index 0000000..2f4d708 --- /dev/null +++ b/train.json @@ -0,0 +1,43 @@ +{"name": "train", + "cuckoo" : "true", + "namespace": "interdroid.swan.cuckoo_station_sensor", + "doc": "A sensor for departure times of trains in the Netherlands", + "author": "roelof <rkemp@cs.vu.nl>", + "configs": [ + {"name": "from", + "class": "EditTextPreference", + "type": "String", + "android:inputType": "text", + "android:title" : "Departure Station", + "android:summary" : "Set Departure Station", + "android:dialogTitle": "Enter Departure Station"}, + {"name": "to", + "class": "EditTextPreference", + "type": "String", + "android:inputType": "text", + "android:title" : "Destination Station", + "android:summary" : "Set Destination Station", + "android:dialogTitle": "Enter Destination Station"}, + {"name": "type", + "class": "ListPreference", + "type": "String", + "default": "Intercity", + "android:entries": "@array/types", + "android:entryValues": "@array/types", + "android:title": "Type", + "android:summary": "Set Type", + "android:dialogTitle": "Choose Type"}, + {"name": "time", + "class": "EditTextPreference", + "type": "String", + "android:inputType": "text", + "android:title" : "Time (hh:mm)", + "android:summary" : "Set Time (hh:mm)", + "android:dialogTitle": "Enter Time (hh:mm)"}, + ], + "valuePaths": [{"name":"departure", "type":"long"}], + "units": [{"name":"departure", "unit":"ms"}], + "values": [ + {"name": "types", "type": "string-array", "items": ["Intercity", "Sprinter", "Fyra"]}, + ] +} \ No newline at end of file