Initial checkin
authortcave <t-cave@ti.com>
Wed, 5 Jun 2013 16:40:36 +0000 (17:40 +0100)
committertcave <t-cave@ti.com>
Wed, 5 Jun 2013 16:40:36 +0000 (17:40 +0100)
139 files changed:
Manifest.pdf [new file with mode: 0644]
client/AndroidClients/LightingController/.classpath [new file with mode: 0644]
client/AndroidClients/LightingController/.project [new file with mode: 0644]
client/AndroidClients/LightingController/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
client/AndroidClients/LightingController/AndroidManifest.xml [new file with mode: 0644]
client/AndroidClients/LightingController/bin/AndroidManifest.xml [new file with mode: 0644]
client/AndroidClients/LightingController/bin/LightingController.apk [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/BuildConfig.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/ColourPicker.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/LightingController$1.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/LightingController$waitRspTask$1.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/LightingController$waitRspTask.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/LightingController.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$anim.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$array.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$attr.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$drawable.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$id.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$layout.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$string.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$style.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeAssistant.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeDevice.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeGroup.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification$1.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification$2.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification$3.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification$4.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeScene.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeSrpcClient$1.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeSrpcClient.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect$1.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect$2.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect$3.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect$4.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$1.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$2.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$3.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$4.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$5.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$6.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$waitRspTask$1.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$waitRspTask.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/optionsMenu.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$1.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$2.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$3.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$4.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$5.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$waitRspTask$1.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$waitRspTask.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$1.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$2.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$3.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$4.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$5.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$waitRspTask$1.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$waitRspTask.class [new file with mode: 0644]
client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain.class [new file with mode: 0644]
client/AndroidClients/LightingController/default.properties [new file with mode: 0644]
client/AndroidClients/LightingController/gen/com/lightingcontroller/BuildConfig.java [new file with mode: 0644]
client/AndroidClients/LightingController/gen/com/lightingcontroller/R.java [new file with mode: 0644]
client/AndroidClients/LightingController/lint.xml [new file with mode: 0644]
client/AndroidClients/LightingController/proguard.cfg [new file with mode: 0644]
client/AndroidClients/LightingController/project.properties [new file with mode: 0644]
client/AndroidClients/LightingController/res/anim/animation_enter_l.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/anim/animation_enter_r.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/anim/animation_leave_l.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/anim/animation_leave_r.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/anim/popup_in.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/anim/popup_out.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/drawable-hdpi/ic_menu_bind.png [new file with mode: 0644]
client/AndroidClients/LightingController/res/drawable-hdpi/ic_menu_group.png [new file with mode: 0644]
client/AndroidClients/LightingController/res/drawable-hdpi/ic_menu_list_devices.png [new file with mode: 0644]
client/AndroidClients/LightingController/res/drawable-hdpi/ic_menu_scene.png [new file with mode: 0644]
client/AndroidClients/LightingController/res/drawable-hdpi/layoutborder.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/drawable-hdpi/tizllicon.bmp [new file with mode: 0644]
client/AndroidClients/LightingController/res/drawable-ldpi/layoutborder.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/drawable-ldpi/tizllicon.bmp [new file with mode: 0644]
client/AndroidClients/LightingController/res/drawable-mdpi/background.png [new file with mode: 0644]
client/AndroidClients/LightingController/res/drawable-mdpi/butt_down.9.png [new file with mode: 0644]
client/AndroidClients/LightingController/res/drawable-mdpi/butt_high.9.png [new file with mode: 0644]
client/AndroidClients/LightingController/res/drawable-mdpi/butt_norm.9.png [new file with mode: 0644]
client/AndroidClients/LightingController/res/drawable-mdpi/button9.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/drawable-mdpi/popup.9.png [new file with mode: 0644]
client/AndroidClients/LightingController/res/drawable-mdpi/tilogo.png [new file with mode: 0644]
client/AndroidClients/LightingController/res/drawable-mdpi/tizllicon.bmp [new file with mode: 0644]
client/AndroidClients/LightingController/res/layout/bindview.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/layout/groupview.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/layout/main.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/layout/optionmenu.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/layout/popup.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/layout/sceneview.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/layout/zllmain.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/layout/zllmainportraite.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/values/strings.xml [new file with mode: 0644]
client/AndroidClients/LightingController/res/values/styles.xml [new file with mode: 0644]
client/AndroidClients/LightingController/src/com/lightingcontroller/ColourPicker.java [new file with mode: 0644]
client/AndroidClients/LightingController/src/com/lightingcontroller/LightingController.java [new file with mode: 0644]
client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeAssistant.java [new file with mode: 0644]
client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeDevice.java [new file with mode: 0644]
client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeGroup.java [new file with mode: 0644]
client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeNotification.java [new file with mode: 0644]
client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeScene.java [new file with mode: 0644]
client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeSrpcClient.java [new file with mode: 0644]
client/AndroidClients/LightingController/src/com/lightingcontroller/bindSelect.java [new file with mode: 0644]
client/AndroidClients/LightingController/src/com/lightingcontroller/groupSelect.java [new file with mode: 0644]
client/AndroidClients/LightingController/src/com/lightingcontroller/optionsMenu.java [new file with mode: 0644]
client/AndroidClients/LightingController/src/com/lightingcontroller/sceneSelect.java [new file with mode: 0644]
client/AndroidClients/LightingController/src/com/lightingcontroller/zllMain.java [new file with mode: 0644]
client/CClients/Source/socket_client.c [new file with mode: 0644]
client/CClients/Source/socket_client.c.bak [new file with mode: 0644]
client/CClients/Source/socket_client.h [new file with mode: 0644]
client/CClients/lightFlashCmdLine/Source/flashled.c [new file with mode: 0644]
client/CClients/lightFlashCmdLine/i486-linux-gnu/makefile [new file with mode: 0644]
client/CClients/listDevsCmdLine/Source/listdevs.c [new file with mode: 0644]
client/CClients/listDevsCmdLine/i486-linux-gnu/makefile [new file with mode: 0644]
server/Source/hal_defs.h [new file with mode: 0644]
server/Source/hal_types.h [new file with mode: 0644]
server/Source/interface_devicelist.c [new file with mode: 0644]
server/Source/interface_devicelist.h [new file with mode: 0644]
server/Source/interface_grouplist.c [new file with mode: 0644]
server/Source/interface_grouplist.h [new file with mode: 0644]
server/Source/interface_scenelist.c [new file with mode: 0644]
server/Source/interface_scenelist.h [new file with mode: 0644]
server/Source/interface_srpcserver.c [new file with mode: 0644]
server/Source/interface_srpcserver.h [new file with mode: 0644]
server/Source/socket_server.c [new file with mode: 0644]
server/Source/socket_server.h [new file with mode: 0644]
server/Source/zllSocCmd-TH.c [new file with mode: 0644]
server/Source/zllSocCmd.c [new file with mode: 0644]
server/Source/zllSocCmd.h [new file with mode: 0644]
server/Source/zll_controller.c [new file with mode: 0644]
server/i486-linux-gnu/Makefile [new file with mode: 0644]

diff --git a/Manifest.pdf b/Manifest.pdf
new file mode 100644 (file)
index 0000000..eca850e
Binary files /dev/null and b/Manifest.pdf differ
diff --git a/client/AndroidClients/LightingController/.classpath b/client/AndroidClients/LightingController/.classpath
new file mode 100644 (file)
index 0000000..a4763d1
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="src" path="gen"/>
+       <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+       <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+       <classpathentry kind="output" path="bin/classes"/>
+</classpath>
diff --git a/client/AndroidClients/LightingController/.project b/client/AndroidClients/LightingController/.project
new file mode 100644 (file)
index 0000000..bb70ac8
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>LightingController</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <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>
diff --git a/client/AndroidClients/LightingController/.settings/org.eclipse.jdt.core.prefs b/client/AndroidClients/LightingController/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..543e7e6
--- /dev/null
@@ -0,0 +1,12 @@
+#Thu Jan 12 09:27:43 CST 2012
+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
diff --git a/client/AndroidClients/LightingController/AndroidManifest.xml b/client/AndroidClients/LightingController/AndroidManifest.xml
new file mode 100644 (file)
index 0000000..45fb8cd
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.lightingcontroller"
+    android:versionCode="1"
+    android:versionName="1.0" >
+
+    <uses-sdk android:minSdkVersion="9" />
+    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
+       
+       <supports-screens android:resizeable="true"
+                  android:smallScreens="true"
+                  android:normalScreens="true"
+                  android:largeScreens="true"
+                  android:xlargeScreens="true"
+                  android:anyDensity="true"/>
+        
+    <application
+        android:icon="@drawable/tizllicon"
+        android:label="@string/app_name" >
+        <activity
+            android:label="@string/app_name"
+            android:name=".LightingController" >
+            <intent-filter >
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+           </activity>
+           <activity android:name=".zllMain"
+                         android:launchMode="singleTask"
+                         android:configChanges="keyboardHidden|orientation" >
+                         <!-- android:screenOrientation="portrait" --> 
+           </activity>         
+           <activity android:name=".groupSelect"
+                         android:launchMode="singleTask"
+                         android:configChanges="keyboardHidden|orientation">
+           </activity>
+           <activity android:name=".sceneSelect"
+                         android:launchMode="singleTask"
+                         android:configChanges="keyboardHidden|orientation">
+           </activity>        
+           <activity android:name=".bindSelect"
+                         android:launchMode="singleTask"
+                         android:configChanges="keyboardHidden|orientation">
+           </activity>                 
+    </application>
+
+</manifest>
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/bin/AndroidManifest.xml b/client/AndroidClients/LightingController/bin/AndroidManifest.xml
new file mode 100644 (file)
index 0000000..45fb8cd
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.lightingcontroller"
+    android:versionCode="1"
+    android:versionName="1.0" >
+
+    <uses-sdk android:minSdkVersion="9" />
+    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
+       
+       <supports-screens android:resizeable="true"
+                  android:smallScreens="true"
+                  android:normalScreens="true"
+                  android:largeScreens="true"
+                  android:xlargeScreens="true"
+                  android:anyDensity="true"/>
+        
+    <application
+        android:icon="@drawable/tizllicon"
+        android:label="@string/app_name" >
+        <activity
+            android:label="@string/app_name"
+            android:name=".LightingController" >
+            <intent-filter >
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+           </activity>
+           <activity android:name=".zllMain"
+                         android:launchMode="singleTask"
+                         android:configChanges="keyboardHidden|orientation" >
+                         <!-- android:screenOrientation="portrait" --> 
+           </activity>         
+           <activity android:name=".groupSelect"
+                         android:launchMode="singleTask"
+                         android:configChanges="keyboardHidden|orientation">
+           </activity>
+           <activity android:name=".sceneSelect"
+                         android:launchMode="singleTask"
+                         android:configChanges="keyboardHidden|orientation">
+           </activity>        
+           <activity android:name=".bindSelect"
+                         android:launchMode="singleTask"
+                         android:configChanges="keyboardHidden|orientation">
+           </activity>                 
+    </application>
+
+</manifest>
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/bin/LightingController.apk b/client/AndroidClients/LightingController/bin/LightingController.apk
new file mode 100644 (file)
index 0000000..b9a659e
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/LightingController.apk differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/BuildConfig.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/BuildConfig.class
new file mode 100644 (file)
index 0000000..94c5e5d
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/BuildConfig.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/ColourPicker.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/ColourPicker.class
new file mode 100644 (file)
index 0000000..baa30fb
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/ColourPicker.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/LightingController$1.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/LightingController$1.class
new file mode 100644 (file)
index 0000000..fe1d34f
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/LightingController$1.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/LightingController$waitRspTask$1.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/LightingController$waitRspTask$1.class
new file mode 100644 (file)
index 0000000..2a6a499
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/LightingController$waitRspTask$1.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/LightingController$waitRspTask.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/LightingController$waitRspTask.class
new file mode 100644 (file)
index 0000000..05ccbad
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/LightingController$waitRspTask.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/LightingController.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/LightingController.class
new file mode 100644 (file)
index 0000000..9cdb686
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/LightingController.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$anim.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$anim.class
new file mode 100644 (file)
index 0000000..7c82094
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$anim.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$array.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$array.class
new file mode 100644 (file)
index 0000000..b2d465c
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$array.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$attr.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$attr.class
new file mode 100644 (file)
index 0000000..7b620b3
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$attr.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$drawable.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$drawable.class
new file mode 100644 (file)
index 0000000..a692e54
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$drawable.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$id.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$id.class
new file mode 100644 (file)
index 0000000..9e9ccb6
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$id.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$layout.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$layout.class
new file mode 100644 (file)
index 0000000..4d0f706
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$layout.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$string.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$string.class
new file mode 100644 (file)
index 0000000..568ef69
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$string.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$style.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$style.class
new file mode 100644 (file)
index 0000000..6e491a1
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R$style.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R.class
new file mode 100644 (file)
index 0000000..2762b70
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/R.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeAssistant.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeAssistant.class
new file mode 100644 (file)
index 0000000..dcefaa8
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeAssistant.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeDevice.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeDevice.class
new file mode 100644 (file)
index 0000000..94bd22b
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeDevice.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeGroup.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeGroup.class
new file mode 100644 (file)
index 0000000..8383b43
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeGroup.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification$1.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification$1.class
new file mode 100644 (file)
index 0000000..03d1817
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification$1.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification$2.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification$2.class
new file mode 100644 (file)
index 0000000..57b7301
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification$2.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification$3.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification$3.class
new file mode 100644 (file)
index 0000000..08bcf8e
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification$3.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification$4.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification$4.class
new file mode 100644 (file)
index 0000000..5728e2a
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification$4.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification.class
new file mode 100644 (file)
index 0000000..17a40db
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeNotification.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeScene.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeScene.class
new file mode 100644 (file)
index 0000000..270063d
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeScene.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeSrpcClient$1.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeSrpcClient$1.class
new file mode 100644 (file)
index 0000000..294d077
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeSrpcClient$1.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeSrpcClient.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeSrpcClient.class
new file mode 100644 (file)
index 0000000..6b1a6bd
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/Zigbee/ZigbeeSrpcClient.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect$1.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect$1.class
new file mode 100644 (file)
index 0000000..3fac38e
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect$1.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect$2.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect$2.class
new file mode 100644 (file)
index 0000000..ea283e7
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect$2.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect$3.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect$3.class
new file mode 100644 (file)
index 0000000..daae256
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect$3.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect$4.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect$4.class
new file mode 100644 (file)
index 0000000..bdf92dd
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect$4.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect.class
new file mode 100644 (file)
index 0000000..13c417c
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/bindSelect.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$1.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$1.class
new file mode 100644 (file)
index 0000000..1e5b0ef
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$1.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$2.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$2.class
new file mode 100644 (file)
index 0000000..953fcd2
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$2.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$3.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$3.class
new file mode 100644 (file)
index 0000000..e5da882
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$3.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$4.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$4.class
new file mode 100644 (file)
index 0000000..3ee9217
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$4.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$5.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$5.class
new file mode 100644 (file)
index 0000000..a284f8f
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$5.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$6.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$6.class
new file mode 100644 (file)
index 0000000..b3a3b27
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$6.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$waitRspTask$1.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$waitRspTask$1.class
new file mode 100644 (file)
index 0000000..66df729
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$waitRspTask$1.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$waitRspTask.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$waitRspTask.class
new file mode 100644 (file)
index 0000000..ccf8883
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect$waitRspTask.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect.class
new file mode 100644 (file)
index 0000000..8e54580
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/groupSelect.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/optionsMenu.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/optionsMenu.class
new file mode 100644 (file)
index 0000000..ee6acd3
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/optionsMenu.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$1.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$1.class
new file mode 100644 (file)
index 0000000..b94c549
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$1.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$2.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$2.class
new file mode 100644 (file)
index 0000000..67a9bf5
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$2.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$3.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$3.class
new file mode 100644 (file)
index 0000000..9c9591b
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$3.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$4.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$4.class
new file mode 100644 (file)
index 0000000..1def5cd
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$4.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$5.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$5.class
new file mode 100644 (file)
index 0000000..b2270eb
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$5.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$waitRspTask$1.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$waitRspTask$1.class
new file mode 100644 (file)
index 0000000..d08fab8
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$waitRspTask$1.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$waitRspTask.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$waitRspTask.class
new file mode 100644 (file)
index 0000000..84eb088
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect$waitRspTask.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect.class
new file mode 100644 (file)
index 0000000..35a0da8
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/sceneSelect.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$1.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$1.class
new file mode 100644 (file)
index 0000000..ed819a7
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$1.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$2.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$2.class
new file mode 100644 (file)
index 0000000..c79b064
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$2.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$3.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$3.class
new file mode 100644 (file)
index 0000000..4a45b81
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$3.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$4.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$4.class
new file mode 100644 (file)
index 0000000..55eb520
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$4.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$5.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$5.class
new file mode 100644 (file)
index 0000000..6c06c87
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$5.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$waitRspTask$1.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$waitRspTask$1.class
new file mode 100644 (file)
index 0000000..be8981b
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$waitRspTask$1.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$waitRspTask.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$waitRspTask.class
new file mode 100644 (file)
index 0000000..12496d8
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain$waitRspTask.class differ
diff --git a/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain.class b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain.class
new file mode 100644 (file)
index 0000000..1f0dfad
Binary files /dev/null and b/client/AndroidClients/LightingController/bin/classes/com/lightingcontroller/zllMain.class differ
diff --git a/client/AndroidClients/LightingController/default.properties b/client/AndroidClients/LightingController/default.properties
new file mode 100644 (file)
index 0000000..f049142
--- /dev/null
@@ -0,0 +1,11 @@
+# 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 use,
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-10
diff --git a/client/AndroidClients/LightingController/gen/com/lightingcontroller/BuildConfig.java b/client/AndroidClients/LightingController/gen/com/lightingcontroller/BuildConfig.java
new file mode 100644 (file)
index 0000000..90eed7d
--- /dev/null
@@ -0,0 +1,6 @@
+/** Automatically generated file. DO NOT MODIFY */
+package com.lightingcontroller;
+
+public final class BuildConfig {
+    public final static boolean DEBUG = true;
+}
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/gen/com/lightingcontroller/R.java b/client/AndroidClients/LightingController/gen/com/lightingcontroller/R.java
new file mode 100644 (file)
index 0000000..9a7c7b9
--- /dev/null
@@ -0,0 +1,149 @@
+/* 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.lightingcontroller;
+
+public final class R {
+    public static final class anim {
+        public static final int animation_enter_l=0x7f040000;
+        public static final int animation_enter_r=0x7f040001;
+        public static final int animation_leave_l=0x7f040002;
+        public static final int animation_leave_r=0x7f040003;
+        public static final int popup_in=0x7f040004;
+        public static final int popup_out=0x7f040005;
+    }
+    public static final class array {
+        public static final int BUAD_Rate=0x7f060001;
+        public static final int OSC=0x7f060000;
+        public static final int Parity_Check=0x7f060002;
+    }
+    public static final class attr {
+    }
+    public static final class drawable {
+        public static final int background=0x7f020000;
+        public static final int butt_down=0x7f020001;
+        public static final int butt_high=0x7f020002;
+        public static final int butt_norm=0x7f020003;
+        public static final int button9=0x7f020004;
+        public static final int ic_menu_bind=0x7f020005;
+        public static final int ic_menu_group=0x7f020006;
+        public static final int ic_menu_list_devices=0x7f020007;
+        public static final int ic_menu_scene=0x7f020008;
+        public static final int layoutborder=0x7f020009;
+        public static final int popup=0x7f02000a;
+        public static final int tilogo=0x7f02000b;
+        public static final int tizllicon=0x7f02000c;
+    }
+    public static final class id {
+        public static final int FrameLable03=0x7f080033;
+        public static final int FrameLable04=0x7f080028;
+        public static final int FrameLable06=0x7f08000c;
+        public static final int IdControlledToggle=0x7f080009;
+        public static final int IdControlledToggleText=0x7f08000a;
+        public static final int IdControllingToggle=0x7f080006;
+        public static final int IdControllingToggleText=0x7f080007;
+        public static final int IdGroupToggle=0x7f080018;
+        public static final int IdGroupToggleText=0x7f080019;
+        public static final int IdLightToggle=0x7f080016;
+        public static final int IdLightToggleText=0x7f080017;
+        public static final int addToGroupRadio=0x7f080013;
+        public static final int bindRadio=0x7f08000b;
+        public static final int colourPick=0x7f08002e;
+        public static final int controlFrame=0x7f08002c;
+        public static final int controlledDeviceSpinner=0x7f080004;
+        public static final int controllingDeviceSpinner=0x7f080002;
+        public static final int deviceChangeNameButton=0x7f08000f;
+        public static final int deviceFrame=0x7f08002a;
+        public static final int deviceIdLayout=0x7f080005;
+        public static final int deviceSpinner=0x7f08000e;
+        public static final int groupIdLayout=0x7f080008;
+        public static final int groupSpinner=0x7f080011;
+        public static final int image=0x7f08001f;
+        public static final int lightIdLayout=0x7f080015;
+        public static final int linearLayout1=0x7f08002d;
+        public static final int linearLayout1a=0x7f08002f;
+        public static final int linearLayout3=0x7f08002b;
+        public static final int linearLayout4=0x7f080021;
+        public static final int linearLayout6=0x7f080000;
+        public static final int newGroupRadio=0x7f080012;
+        public static final int newSceneRadio=0x7f080025;
+        public static final int offButton=0x7f080030;
+        public static final int onButton=0x7f080032;
+        public static final int optionMenuBinding=0x7f08001c;
+        public static final int optionMenuGroups=0x7f08001a;
+        public static final int optionMenuListDevices=0x7f08001d;
+        public static final int optionMenuScenes=0x7f08001b;
+        public static final int popup_text_box=0x7f080020;
+        public static final int radioGroup2=0x7f080024;
+        public static final int sceneRadio0=0x7f080014;
+        public static final int sceneRestoreRadio=0x7f080027;
+        public static final int sceneSelectSpinner=0x7f080023;
+        public static final int sceneStoreRadio=0x7f080026;
+        public static final int seekBarLevel=0x7f080031;
+        public static final int textViewControl=0x7f080001;
+        public static final int textViewControlled=0x7f080003;
+        public static final int textViewDev=0x7f08000d;
+        public static final int textViewGroup=0x7f080010;
+        public static final int textViewScene=0x7f080022;
+        public static final int toast_layout_root=0x7f08001e;
+        public static final int zllMainLayout=0x7f080029;
+    }
+    public static final class layout {
+        public static final int bindview=0x7f030000;
+        public static final int groupview=0x7f030001;
+        public static final int main=0x7f030002;
+        public static final int optionmenu=0x7f030003;
+        public static final int popup=0x7f030004;
+        public static final int sceneview=0x7f030005;
+        public static final int zllmain=0x7f030006;
+        public static final int zllmainportraite=0x7f030007;
+    }
+    public static final class string {
+        public static final int SelectDevice=0x7f050018;
+        public static final int SelectGroup=0x7f050019;
+        public static final int app_name=0x7f050001;
+        public static final int bt_ConfigInitial=0x7f05000d;
+        public static final int bt_startrecv=0x7f05000e;
+        public static final int bt_startsend=0x7f050010;
+        public static final int bt_stoprecv=0x7f05000f;
+        public static final int bt_stopsend=0x7f050011;
+        public static final int groupAdd=0x7f05001a;
+        public static final int hello=0x7f050000;
+        public static final int lb_BaudRate=0x7f050004;
+        public static final int lb_SendData=0x7f050003;
+        public static final int lb_osc=0x7f050005;
+        public static final int lb_paritycheck=0x7f050006;
+        public static final int m_about=0x7f05000b;
+        public static final int m_clear=0x7f05000a;
+        public static final int m_configinitial=0x7f050007;
+        public static final int m_quit=0x7f05000c;
+        public static final int m_recvdata=0x7f050009;
+        public static final int m_senddata=0x7f050008;
+        public static final int optionMenuGroupsTitle=0x7f05001c;
+        public static final int optionMenuTitle=0x7f05001b;
+        public static final int optionMuneBindingTitle=0x7f05001d;
+        public static final int optionMuneListDevicesTitle=0x7f05001e;
+        public static final int rbt_0=0x7f050012;
+        public static final int rbt_1=0x7f050013;
+        public static final int rbt_2=0x7f050014;
+        public static final int rbt_3=0x7f050015;
+        public static final int rbt_4=0x7f050016;
+        public static final int str_sendtext=0x7f050017;
+        public static final int textviewMSG=0x7f050002;
+    }
+    public static final class style {
+        public static final int Animation_Popup=0x7f070008;
+        public static final int ApplicationTheme=0x7f070000;
+        public static final int DialogMenuText=0x7f070007;
+        public static final int SideMenuText=0x7f070006;
+        public static final int StdButton=0x7f070001;
+        public static final int StdButtonIcon=0x7f070002;
+        public static final int StdButtonText=0x7f070003;
+        public static final int StdScreen=0x7f070005;
+        public static final int TitleText=0x7f070004;
+    }
+}
diff --git a/client/AndroidClients/LightingController/lint.xml b/client/AndroidClients/LightingController/lint.xml
new file mode 100644 (file)
index 0000000..ee0eead
--- /dev/null
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<lint>
+</lint>
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/proguard.cfg b/client/AndroidClients/LightingController/proguard.cfg
new file mode 100644 (file)
index 0000000..b1cdf17
--- /dev/null
@@ -0,0 +1,40 @@
+-optimizationpasses 5
+-dontusemixedcaseclassnames
+-dontskipnonpubliclibraryclasses
+-dontpreverify
+-verbose
+-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
+
+-keep public class * extends android.app.Activity
+-keep public class * extends android.app.Application
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+-keep public class * extends android.app.backup.BackupAgentHelper
+-keep public class * extends android.preference.Preference
+-keep public class com.android.vending.licensing.ILicensingService
+
+-keepclasseswithmembernames class * {
+    native <methods>;
+}
+
+-keepclasseswithmembers class * {
+    public <init>(android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembers class * {
+    public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclassmembers class * extends android.app.Activity {
+   public void *(android.view.View);
+}
+
+-keepclassmembers enum * {
+    public static **[] values();
+    public static ** valueOf(java.lang.String);
+}
+
+-keep class * implements android.os.Parcelable {
+  public static final android.os.Parcelable$Creator *;
+}
diff --git a/client/AndroidClients/LightingController/project.properties b/client/AndroidClients/LightingController/project.properties
new file mode 100644 (file)
index 0000000..f049142
--- /dev/null
@@ -0,0 +1,11 @@
+# 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 use,
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-10
diff --git a/client/AndroidClients/LightingController/res/anim/animation_enter_l.xml b/client/AndroidClients/LightingController/res/anim/animation_enter_l.xml
new file mode 100644 (file)
index 0000000..2ae2e85
--- /dev/null
@@ -0,0 +1,9 @@
+<set xmlns:android="http://schemas.android.com/apk/res/android"          
+android:shareInterpolator="false">        
+ <translate 
+ android:fromXDelta="100%" 
+ android:toXDelta="0%"           
+ android:fromYDelta="0%" 
+ android:toYDelta="0%"          
+ android:duration="700"/>       
+</set>
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/res/anim/animation_enter_r.xml b/client/AndroidClients/LightingController/res/anim/animation_enter_r.xml
new file mode 100644 (file)
index 0000000..3135e3f
--- /dev/null
@@ -0,0 +1,9 @@
+<set xmlns:android="http://schemas.android.com/apk/res/android"          
+android:shareInterpolator="false">        
+ <translate 
+ android:fromXDelta="-100%"
+ android:toXDelta="0%"          
+ android:fromYDelta="0%" 
+ android:toYDelta="0%"          
+ android:duration="700"/>       
+</set>
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/res/anim/animation_leave_l.xml b/client/AndroidClients/LightingController/res/anim/animation_leave_l.xml
new file mode 100644 (file)
index 0000000..43fc169
--- /dev/null
@@ -0,0 +1,9 @@
+  <set xmlns:android="http://schemas.android.com/apk/res/android"          
+  android:shareInterpolator="false">       
+  <translate        
+  android:fromXDelta="0%" 
+  android:toXDelta="100%"        
+  android:fromYDelta="0%" 
+  android:toYDelta="0%"        
+  android:duration="700" />     
+  </set>
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/res/anim/animation_leave_r.xml b/client/AndroidClients/LightingController/res/anim/animation_leave_r.xml
new file mode 100644 (file)
index 0000000..2ea3679
--- /dev/null
@@ -0,0 +1,9 @@
+  <set xmlns:android="http://schemas.android.com/apk/res/android"          
+  android:shareInterpolator="false">       
+  <translate        
+  android:fromXDelta="0%" 
+  android:toXDelta="-100%"        
+  android:fromYDelta="0%" 
+  android:toYDelta="0%"        
+  android:duration="700" />     
+  </set>
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/res/anim/popup_in.xml b/client/AndroidClients/LightingController/res/anim/popup_in.xml
new file mode 100644 (file)
index 0000000..e4a81a7
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+  <translate android:fromYDelta="100%p" android:toYDelta="0" android:duration="250" /> 
+  <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="250" />
+</set>
+
+ -->
+
+
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+
+  <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="350" />
+  <scale android:duration="300" android:fromXScale="0.5" android:toXScale="1.0" android:fromYScale="0.5" android:toYScale="1.0" android:pivotX="50%p" android:pivotY="50%p" />
+  <set>
+    <translate android:fromYDelta="100%p" android:toYDelta="-5%p" android:duration="250" /> 
+  
+  </set>
+  <set android:startOffset="250">
+    <translate android:fromYDelta="-5%p" android:toYDelta="0" android:duration="50" /> 
+  </set>  
+
+</set>
diff --git a/client/AndroidClients/LightingController/res/anim/popup_out.xml b/client/AndroidClients/LightingController/res/anim/popup_out.xml
new file mode 100644 (file)
index 0000000..c836a1d
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+  <translate android:fromYDelta="100%p" android:toYDelta="0" android:duration="250" /> 
+  <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="250" />
+</set>
+
+ -->
+
+
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+
+  <alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="200" />
+  <scale android:duration="200" android:fromXScale="1.0" android:toXScale="0.5" android:fromYScale="1.0" android:toYScale="0.5" android:pivotX="50%p" android:pivotY="50%p" />
+  <set>
+    <translate android:fromYDelta="0" android:toYDelta="-5%p" android:duration="50" /> 
+  </set>
+  <set android:startOffset="50">
+       <translate android:fromYDelta="-5%p" android:toYDelta="100%p" android:duration="250" />
+  </set>  
+
+</set>
diff --git a/client/AndroidClients/LightingController/res/drawable-hdpi/ic_menu_bind.png b/client/AndroidClients/LightingController/res/drawable-hdpi/ic_menu_bind.png
new file mode 100644 (file)
index 0000000..26f8634
Binary files /dev/null and b/client/AndroidClients/LightingController/res/drawable-hdpi/ic_menu_bind.png differ
diff --git a/client/AndroidClients/LightingController/res/drawable-hdpi/ic_menu_group.png b/client/AndroidClients/LightingController/res/drawable-hdpi/ic_menu_group.png
new file mode 100644 (file)
index 0000000..8a09995
Binary files /dev/null and b/client/AndroidClients/LightingController/res/drawable-hdpi/ic_menu_group.png differ
diff --git a/client/AndroidClients/LightingController/res/drawable-hdpi/ic_menu_list_devices.png b/client/AndroidClients/LightingController/res/drawable-hdpi/ic_menu_list_devices.png
new file mode 100644 (file)
index 0000000..c028b9b
Binary files /dev/null and b/client/AndroidClients/LightingController/res/drawable-hdpi/ic_menu_list_devices.png differ
diff --git a/client/AndroidClients/LightingController/res/drawable-hdpi/ic_menu_scene.png b/client/AndroidClients/LightingController/res/drawable-hdpi/ic_menu_scene.png
new file mode 100644 (file)
index 0000000..24680db
Binary files /dev/null and b/client/AndroidClients/LightingController/res/drawable-hdpi/ic_menu_scene.png differ
diff --git a/client/AndroidClients/LightingController/res/drawable-hdpi/layoutborder.xml b/client/AndroidClients/LightingController/res/drawable-hdpi/layoutborder.xml
new file mode 100644 (file)
index 0000000..c6f17c0
--- /dev/null
@@ -0,0 +1,7 @@
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
+    <stroke android:width="2dp" android:color="#aa808080" /> 
+    <padding android:left="10dp" android:top="10dp" 
+            android:right="10dp" android:bottom="10dp" /> 
+    <corners android:radius="10dp" /> 
+</shape> 
diff --git a/client/AndroidClients/LightingController/res/drawable-hdpi/tizllicon.bmp b/client/AndroidClients/LightingController/res/drawable-hdpi/tizllicon.bmp
new file mode 100644 (file)
index 0000000..4865c01
Binary files /dev/null and b/client/AndroidClients/LightingController/res/drawable-hdpi/tizllicon.bmp differ
diff --git a/client/AndroidClients/LightingController/res/drawable-ldpi/layoutborder.xml b/client/AndroidClients/LightingController/res/drawable-ldpi/layoutborder.xml
new file mode 100644 (file)
index 0000000..5ccef86
--- /dev/null
@@ -0,0 +1,7 @@
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
+    <stroke android:width="4dp" android:color="#FF00FF00" /> 
+    <padding android:left="7dp" android:top="7dp" 
+            android:right="7dp" android:bottom="7dp" /> 
+    <corners android:radius="4dp" /> 
+</shape> 
diff --git a/client/AndroidClients/LightingController/res/drawable-ldpi/tizllicon.bmp b/client/AndroidClients/LightingController/res/drawable-ldpi/tizllicon.bmp
new file mode 100644 (file)
index 0000000..4865c01
Binary files /dev/null and b/client/AndroidClients/LightingController/res/drawable-ldpi/tizllicon.bmp differ
diff --git a/client/AndroidClients/LightingController/res/drawable-mdpi/background.png b/client/AndroidClients/LightingController/res/drawable-mdpi/background.png
new file mode 100644 (file)
index 0000000..6ab5e01
Binary files /dev/null and b/client/AndroidClients/LightingController/res/drawable-mdpi/background.png differ
diff --git a/client/AndroidClients/LightingController/res/drawable-mdpi/butt_down.9.png b/client/AndroidClients/LightingController/res/drawable-mdpi/butt_down.9.png
new file mode 100644 (file)
index 0000000..c9047bb
Binary files /dev/null and b/client/AndroidClients/LightingController/res/drawable-mdpi/butt_down.9.png differ
diff --git a/client/AndroidClients/LightingController/res/drawable-mdpi/butt_high.9.png b/client/AndroidClients/LightingController/res/drawable-mdpi/butt_high.9.png
new file mode 100644 (file)
index 0000000..ba40527
Binary files /dev/null and b/client/AndroidClients/LightingController/res/drawable-mdpi/butt_high.9.png differ
diff --git a/client/AndroidClients/LightingController/res/drawable-mdpi/butt_norm.9.png b/client/AndroidClients/LightingController/res/drawable-mdpi/butt_norm.9.png
new file mode 100644 (file)
index 0000000..3e42a60
Binary files /dev/null and b/client/AndroidClients/LightingController/res/drawable-mdpi/butt_norm.9.png differ
diff --git a/client/AndroidClients/LightingController/res/drawable-mdpi/button9.xml b/client/AndroidClients/LightingController/res/drawable-mdpi/button9.xml
new file mode 100644 (file)
index 0000000..efc7c1e
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:drawable="@drawable/butt_down"
+          android:state_pressed="true" />
+    <item android:drawable="@drawable/butt_high"
+          android:state_focused="true" />
+    <item android:drawable="@drawable/butt_norm" />
+</selector>
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/res/drawable-mdpi/popup.9.png b/client/AndroidClients/LightingController/res/drawable-mdpi/popup.9.png
new file mode 100644 (file)
index 0000000..5f6e24d
Binary files /dev/null and b/client/AndroidClients/LightingController/res/drawable-mdpi/popup.9.png differ
diff --git a/client/AndroidClients/LightingController/res/drawable-mdpi/tilogo.png b/client/AndroidClients/LightingController/res/drawable-mdpi/tilogo.png
new file mode 100644 (file)
index 0000000..1da4b85
Binary files /dev/null and b/client/AndroidClients/LightingController/res/drawable-mdpi/tilogo.png differ
diff --git a/client/AndroidClients/LightingController/res/drawable-mdpi/tizllicon.bmp b/client/AndroidClients/LightingController/res/drawable-mdpi/tizllicon.bmp
new file mode 100644 (file)
index 0000000..4865c01
Binary files /dev/null and b/client/AndroidClients/LightingController/res/drawable-mdpi/tizllicon.bmp differ
diff --git a/client/AndroidClients/LightingController/res/layout/bindview.xml b/client/AndroidClients/LightingController/res/layout/bindview.xml
new file mode 100644 (file)
index 0000000..382791d
--- /dev/null
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="utf-8"?> 
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+android:layout_width="fill_parent" 
+android:layout_height="fill_parent" 
+android:scaleType="fitXY" >
+<RelativeLayout
+    android:layout_width="match_parent" 
+    android:layout_height="match_parent">  
+
+    <LinearLayout
+        android:id="@+id/linearLayout6"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentRight="true"
+        android:layout_alignParentTop="true"
+        android:layout_marginBottom="10dp"
+        android:layout_marginLeft="10dp"
+        android:layout_marginRight="10dp"
+        android:layout_marginTop="20dp"
+        android:background="@drawable/layoutborder"
+        android:gravity="center_vertical"
+        android:orientation="vertical" >
+
+        <TextView
+            android:id="@+id/textViewControl"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="5dip"
+            android:layout_marginTop="5dip"
+            android:layout_weight="1"
+            android:text="Select controlling device:"
+            android:textAppearance="?android:attr/textAppearanceMedium" />
+
+        <Spinner
+            android:id="@+id/controllingDeviceSpinner"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1" />
+
+        <TextView
+            android:id="@+id/textViewControlled"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="5dip"
+            android:layout_marginTop="5dip"
+            android:layout_weight="1"
+            android:text="Select device to be controlled:"
+            android:textAppearance="?android:attr/textAppearanceMedium" />
+
+        <Spinner
+            android:id="@+id/controlledDeviceSpinner"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1" />
+                
+        <LinearLayout
+            android:id="@+id/deviceIdLayout"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"  
+            android:layout_marginTop="5dip"          
+            android:orientation="horizontal" >
+                
+            <ToggleButton
+                android:id="@+id/IdControllingToggle"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginRight="10dp"
+                android:layout_weight="1"
+                android:onClick="IdControllingButton" >
+            </ToggleButton>
+
+            <TextView
+                android:id="@+id/IdControllingToggleText"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="5dip"
+                android:layout_marginTop="5dip"
+                android:layout_weight="1"                
+                android:text="Flash controlling device"
+                android:gravity="center_vertical"
+                android:textAppearance="?android:attr/textAppearanceMedium" />
+
+        </LinearLayout>
+
+        <LinearLayout
+            android:id="@+id/groupIdLayout"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"            
+            android:orientation="horizontal" >
+                    
+            <ToggleButton
+                android:id="@+id/IdControlledToggle"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginRight="10dp"
+                android:layout_weight="1"
+                android:onClick="IdControlledButton" >
+            </ToggleButton>   
+
+            <TextView
+                android:id="@+id/IdControlledToggleText"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="5dip"
+                android:layout_marginTop="5dip"
+                android:layout_weight="1"                
+                android:text="Flash controlled device"
+                android:gravity="center_vertical"
+                android:textAppearance="?android:attr/textAppearanceMedium" />
+        </LinearLayout>   
+
+               <RadioButton
+                   android:id="@+id/bindRadio"
+                   android:layout_width="wrap_content"
+                   android:layout_height="wrap_content"
+                   android:layout_marginRight="10dp"
+                   android:layout_weight="1"
+                   android:onClick="bindButton"
+                   android:text="Bind devices" >
+               </RadioButton>
+                       
+    </LinearLayout>
+                               
+    <TextView 
+        android:layout_marginTop="-10dp" 
+        android:background="#FF000000" 
+        android:textColor="#FFFFFFFF" 
+        android:textAppearance="?android:attr/textAppearanceMedium" 
+        android:layout_width="wrap_content" android:text=" Binding  " 
+        android:layout_height="wrap_content" 
+        android:id="@+id/FrameLable06" 
+        android:layout_alignLeft="@+id/linearLayout6" 
+        android:layout_alignTop="@+id/linearLayout6" 
+        android:layout_marginLeft="32dp">        
+    </TextView>    
+</RelativeLayout>
+</ScrollView>
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/res/layout/groupview.xml b/client/AndroidClients/LightingController/res/layout/groupview.xml
new file mode 100644 (file)
index 0000000..73c93c0
--- /dev/null
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="utf-8"?> 
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+android:layout_width="fill_parent" 
+android:layout_height="fill_parent" 
+android:scaleType="fitXY" >
+<RelativeLayout
+    android:layout_width="match_parent" 
+    android:layout_height="match_parent">  
+
+    <LinearLayout
+        android:id="@+id/linearLayout6"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentRight="true"
+        android:layout_alignParentTop="true"
+        android:layout_marginBottom="10dp"
+        android:layout_marginLeft="10dp"
+        android:layout_marginRight="10dp"
+        android:layout_marginTop="20dp"
+        android:background="@drawable/layoutborder"
+        android:gravity="center_vertical"
+        android:orientation="vertical" >
+
+        <TextView
+            android:id="@+id/textViewDev"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="5dip"
+            android:layout_marginTop="5dip"
+            android:layout_weight="1"
+            android:text="Select Device:"
+            android:textAppearance="?android:attr/textAppearanceMedium" />
+
+        <Spinner
+            android:id="@+id/deviceSpinner"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:prompt="@string/SelectDevice" />
+
+        <RadioButton
+            android:id="@+id/deviceChangeNameButton"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginRight="10dp"
+            android:layout_weight="1"
+            android:onClick="deviceChangeNameButton"
+            android:text="Change Device Name" />
+
+        <TextView
+            android:id="@+id/textViewGroup"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="5dip"
+            android:layout_marginTop="5dip"
+            android:layout_weight="1"
+            android:text="Select Group:"
+            android:textAppearance="?android:attr/textAppearanceMedium" />
+
+        <Spinner
+            android:id="@+id/groupSpinner"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:prompt="@string/SelectGroup" />
+
+               <RadioButton
+                   android:id="@+id/newGroupRadio"
+                   android:layout_width="wrap_content"
+                   android:layout_height="wrap_content"
+                   android:layout_marginRight="10dp"
+                   android:layout_weight="1"
+                   android:onClick="newGroupCmdButton"
+                   android:text="Create New Group" >
+               </RadioButton>
+               
+               <RadioButton
+                   android:id="@+id/addToGroupRadio"
+                   android:layout_width="wrap_content"
+                   android:layout_height="wrap_content"
+                   android:layout_marginRight="10dp"
+                   android:layout_toRightOf="@+id/sceneRadio0"
+                   android:layout_weight="1"
+                   android:onClick="addToGroupCmdButton"
+                   android:text="Add Selected Light to Selected Group" >
+               </RadioButton>
+
+        <LinearLayout
+            android:id="@+id/lightIdLayout"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"            
+            android:orientation="horizontal" >
+                
+            <ToggleButton
+                android:id="@+id/IdLightToggle"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginRight="10dp"
+                android:layout_toRightOf="@+id/sceneRadio0"
+                android:layout_weight="1"
+                android:onClick="IdLightCmdButton"
+                android:text="Flash Selected Light" >
+            </ToggleButton>
+
+            <TextView
+                android:id="@+id/IdLightToggleText"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="5dip"
+                android:layout_marginTop="5dip"
+                android:layout_weight="1"                
+                android:text="Flash Selected Light"
+                android:gravity="center_vertical"
+                android:textAppearance="?android:attr/textAppearanceMedium" />
+
+        </LinearLayout>
+
+        <LinearLayout
+            android:id="@+id/groupIdLayout"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"            
+            android:orientation="horizontal" >
+                    
+            <ToggleButton
+                android:id="@+id/IdGroupToggle"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginRight="10dp"
+                android:layout_toRightOf="@+id/sceneRadio0"
+                android:layout_weight="1"
+                android:onClick="IdGroupCmdButton" >
+            </ToggleButton>   
+
+            <TextView
+                android:id="@+id/IdGroupToggleText"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="5dip"
+                android:layout_marginTop="5dip"
+                android:layout_weight="1"                
+                android:text="Flash Selected Group"
+                android:gravity="center_vertical"
+                android:textAppearance="?android:attr/textAppearanceMedium" />
+        </LinearLayout>            
+    </LinearLayout>
+                               
+    <TextView 
+        android:layout_marginTop="-10dp" 
+        android:background="#FF000000" 
+        android:textColor="#FFFFFFFF" 
+        android:textAppearance="?android:attr/textAppearanceMedium" 
+        android:layout_width="wrap_content" android:text=" Groups  " 
+        android:layout_height="wrap_content" 
+        android:id="@+id/FrameLable06" 
+        android:layout_alignLeft="@+id/linearLayout6" 
+        android:layout_alignTop="@+id/linearLayout6" 
+        android:layout_marginLeft="32dp">        
+    </TextView>    
+</RelativeLayout>
+</ScrollView>
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/res/layout/main.xml b/client/AndroidClients/LightingController/res/layout/main.xml
new file mode 100644 (file)
index 0000000..df10bf5
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?> 
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+</RelativeLayout>
+
+
diff --git a/client/AndroidClients/LightingController/res/layout/optionmenu.xml b/client/AndroidClients/LightingController/res/layout/optionmenu.xml
new file mode 100644 (file)
index 0000000..3a9f65b
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content"    
+    android:maxRows="1"
+    android:maxItemsPerRow="6"   >
+            <item android:id="@+id/optionMenuGroups"
+                  android:icon="@drawable/ic_menu_group" />
+            <item android:id="@+id/optionMenuScenes"
+                  android:icon="@drawable/ic_menu_scene" />            
+            <item android:id="@+id/optionMenuBinding"
+                  android:icon="@drawable/ic_menu_bind" />
+            <item android:id="@+id/optionMenuListDevices"
+                  android:icon="@drawable/ic_menu_list_devices" />
+</menu>
diff --git a/client/AndroidClients/LightingController/res/layout/popup.xml b/client/AndroidClients/LightingController/res/layout/popup.xml
new file mode 100644 (file)
index 0000000..0ac1cdb
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:id="@+id/toast_layout_root"
+              android:orientation="horizontal"
+              android:layout_width="fill_parent"
+              android:layout_height="fill_parent"
+              android:padding="10dp"
+              android:background="@drawable/popup"
+              >
+    <ImageView android:id="@+id/image"
+               android:layout_width="40dp"
+               android:layout_height="40dp"
+               android:layout_marginRight="10dp"
+               android:layout_gravity="center"
+               android:src="@drawable/tilogo"
+               />
+       <LinearLayout
+              android:id="@+id/popup_text_box"
+              android:orientation="vertical"
+              android:layout_width="fill_parent"
+              android:layout_height="fill_parent"
+                         android:layout_gravity="center">
+       </LinearLayout>
+</LinearLayout>
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/res/layout/sceneview.xml b/client/AndroidClients/LightingController/res/layout/sceneview.xml
new file mode 100644 (file)
index 0000000..55c3ac5
--- /dev/null
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="utf-8"?> 
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+android:layout_width="fill_parent" 
+android:layout_height="fill_parent" 
+android:scaleType="fitXY" >
+
+<RelativeLayout
+    android:layout_width="match_parent"
+    android:layout_height="match_parent" >
+
+    <TextView
+        android:id="@+id/FrameLable06"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="32dp"
+        android:layout_marginTop="-10dp"
+        android:background="#FF000000"
+        android:text=" Groups  "
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textColor="#FFFFFFFF" >
+    </TextView>
+
+    <LinearLayout
+        android:id="@+id/linearLayout4"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentRight="true"
+        android:layout_marginBottom="10dp"
+        android:layout_marginLeft="10dp"
+        android:layout_marginRight="10dp"
+        android:layout_marginTop="10dp"
+        android:background="@drawable/layoutborder"
+        android:orientation="vertical" >
+
+        <TextView
+            android:id="@+id/textViewGroup"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="5dip"
+            android:layout_marginTop="5dip"
+            android:layout_weight="1"
+            android:text="Select Group:"
+            android:textAppearance="?android:attr/textAppearanceMedium" />
+
+            <Spinner
+                android:id="@+id/groupSpinner"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:prompt="@string/groupAdd" >
+            </Spinner>
+
+        <TextView
+            android:id="@+id/textViewScene"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="5dp"
+            android:layout_marginTop="10dp"
+            android:text="Select Scene:"
+            android:textAppearance="?android:attr/textAppearanceMedium" />
+
+        <Spinner
+            android:id="@+id/sceneSelectSpinner"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:prompt="@string/SelectGroup" />
+
+        <RadioGroup
+            android:id="@+id/radioGroup2"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:orientation="vertical" >
+
+            <RadioButton
+                android:id="@+id/newSceneRadio"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginRight="10dp"
+                android:layout_weight="1"
+                android:onClick="newSceneButton"
+                android:text="Add new scene to group" />
+                        
+            <RadioButton
+                android:id="@+id/sceneStoreRadio"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginRight="10dp"
+                android:layout_weight="1"
+                android:onClick="sceneStoreButton"
+                android:text="Store selected scene to group" />
+
+            <RadioButton
+                android:id="@+id/sceneRestoreRadio"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginRight="10dp"
+                android:layout_toRightOf="@+id/sceneRadio0"
+                android:layout_weight="1"
+                android:onClick="sceneRestoreButton"
+                android:text="Recall selected scene on group" />
+        </RadioGroup>
+    </LinearLayout>
+
+    <TextView
+        android:id="@+id/FrameLable04"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignLeft="@+id/linearLayout4"
+        android:layout_alignTop="@+id/linearLayout4"
+        android:layout_marginLeft="32dp"
+        android:layout_marginTop="-10dp"
+        android:background="#FF000000"
+        android:text=" Scenes  "
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textColor="#FFFFFFFF" >
+    </TextView>
+</RelativeLayout>
+
+</ScrollView>
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/res/layout/zllmain.xml b/client/AndroidClients/LightingController/res/layout/zllmain.xml
new file mode 100644 (file)
index 0000000..819e783
--- /dev/null
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="utf-8"?> 
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent" 
+    android:layout_height="fill_parent">      
+
+    <LinearLayout
+        android:id="@+id/zllMainLayout"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:orientation="vertical" >
+            
+           <RelativeLayout
+               android:id="@+id/deviceFrame"
+               android:layout_width="wrap_content"
+               android:layout_height="wrap_content"
+               android:orientation="vertical" >
+                       
+                        <LinearLayout
+                            android:id="@+id/linearLayout3"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_alignParentLeft="true"
+                            android:layout_alignParentRight="true"
+                            android:layout_marginBottom="10dp"
+                            android:layout_marginLeft="10dp"
+                            android:layout_marginRight="10dp"
+                            android:layout_marginTop="10dp"
+                            android:background="@drawable/layoutborder"
+                            android:orientation="vertical" >
+                       
+                            <TextView
+                                android:id="@+id/textViewDev"
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:layout_marginLeft="5dip"
+                                android:layout_marginTop="5dip"
+                                android:text="Select Device:"
+                                android:textAppearance="?android:attr/textAppearanceMedium" />
+                       
+                                       <Spinner
+                                           android:id="@+id/deviceSpinner"
+                                           android:layout_width="wrap_content"
+                                           android:layout_height="wrap_content"
+                                           android:prompt="@string/SelectDevice" />
+                                                               
+                       </LinearLayout>         
+               
+                        <TextView
+                            android:id="@+id/FrameLable04"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_alignLeft="@+id/linearLayout3"
+                            android:layout_alignTop="@+id/linearLayout3"
+                            android:layout_marginLeft="32dp"  
+                            android:layout_marginTop="-10dp"      
+                            android:background="#FF000000"
+                            android:text=" Device Selection  "
+                            android:textAppearance="?android:attr/textAppearanceMedium"
+                            android:textColor="#FFFFFFFF" >
+                        </TextView>   
+           
+           </RelativeLayout>           
+
+           <RelativeLayout
+               android:id="@+id/controlFrame"
+               android:layout_width="wrap_content"
+               android:layout_height="wrap_content"
+               android:layout_marginTop="10dp"
+               android:orientation="vertical" >
+                                   
+               <LinearLayout
+                               android:id="@+id/linearLayout1"
+                               android:layout_width="wrap_content"
+                               android:layout_height="wrap_content"
+                               android:layout_alignParentLeft="true"
+                               android:layout_alignParentRight="true"
+                               android:layout_marginBottom="5dp"
+                               android:layout_marginLeft="10dp"
+                               android:layout_marginRight="10dp"
+                               android:layout_marginTop="10dp"
+                               android:background="@drawable/layoutborder"
+                               android:orientation="vertical" >
+       
+               <com.lightingcontroller.ColourPicker
+                   android:id="@+id/colourPick"
+                   android:layout_width="wrap_content"
+                   android:layout_height="wrap_content"
+                   android:layout_gravity="top|center_horizontal"
+                   android:layout_marginTop="15dp" />
+       
+               <LinearLayout
+                   android:id="@+id/linearLayout1a"
+                   android:layout_width="match_parent"
+                   android:layout_height="wrap_content"
+                   android:layout_marginTop="15dp"
+                   android:gravity="center_vertical|center_horizontal"
+                   android:orientation="horizontal" >
+       
+                   <Button
+                       android:id="@+id/offButton"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:onClick="offCmdButton"
+                       android:text="Off" />
+       
+                   <SeekBar
+                       android:id="@+id/seekBarLevel"
+                       android:layout_width="0dip"
+                       android:layout_height="wrap_content"
+                       android:layout_weight="1"
+                       android:progress="20" />
+       
+                   <Button
+                       android:id="@+id/onButton"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:onClick="onCmdButton"
+                       android:text="On" />
+               </LinearLayout>
+           </LinearLayout>
+       
+               
+           <TextView
+               android:id="@+id/FrameLable03"
+               android:layout_width="wrap_content"
+               android:layout_height="wrap_content"
+               android:layout_alignLeft="@+id/linearLayout1"
+               android:layout_alignTop="@+id/linearLayout1"
+               android:layout_marginLeft="32dp"  
+               android:layout_marginTop="-10dp"
+               android:background="#FF000000"
+               android:text=" Device Control  "
+               android:textAppearance="?android:attr/textAppearanceMedium"
+               android:textColor="#FFFFFFFF" >
+           </TextView> 
+       </RelativeLayout>    
+  </LinearLayout>        
+</RelativeLayout>
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/res/layout/zllmainportraite.xml b/client/AndroidClients/LightingController/res/layout/zllmainportraite.xml
new file mode 100644 (file)
index 0000000..f2038fc
--- /dev/null
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?> 
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent" 
+    android:layout_height="fill_parent">      
+
+    <RelativeLayout
+        android:id="@+id/zllMainLayout"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:orientation="horizontal" >            
+                       
+                       
+                            <TextView
+                                android:id="@+id/textViewDev"
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:layout_marginLeft="5dip"
+                                android:layout_marginTop="5dip"
+                                android:text="Select Device:"
+                                android:textAppearance="?android:attr/textAppearanceMedium" />
+
+               <LinearLayout
+                   android:id="@+id/linearLayout1a"
+                   android:layout_width="match_parent"
+                   android:layout_height="wrap_content"
+                   android:layout_alignParentBottom="true"
+                   android:layout_alignParentLeft="true"
+                   android:gravity="center_vertical|center_horizontal"
+                   android:orientation="horizontal" >
+
+                   <Button
+                       android:id="@+id/offButton"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:onClick="offCmdButton"
+                       android:text="Off" />
+
+                   <SeekBar
+                       android:id="@+id/seekBarLevel"
+                       android:layout_width="0dip"
+                       android:layout_height="wrap_content"
+                       android:layout_weight="1"
+                       android:progress="20" />
+
+                   <Button
+                       android:id="@+id/onButton"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:onClick="onCmdButton"
+                       android:text="On" />
+               </LinearLayout>
+
+               <com.lightingcontroller.ColourPicker
+                   android:id="@+id/colourPick"
+                   android:layout_width="wrap_content"
+                   android:layout_height="wrap_content"
+                   android:layout_centerHorizontal="true"
+                   android:layout_centerVertical="true" />
+
+               <Spinner
+                   android:id="@+id/deviceSpinner"
+                   android:layout_width="wrap_content"
+                   android:layout_height="wrap_content"
+                   android:layout_alignParentLeft="true"
+                   android:layout_below="@+id/textViewDev"
+                   android:prompt="@string/SelectDevice" />
+          
+  </RelativeLayout>        
+</RelativeLayout>
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/res/values/strings.xml b/client/AndroidClients/LightingController/res/values/strings.xml
new file mode 100644 (file)
index 0000000..4a3186b
--- /dev/null
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <string name="hello">Hello World, UART_Jni!</string>
+    <string name="app_name">ZllRemote</string>
+    <string-array name="OSC">
+        <item>Internal OSC</item>>
+        <item>External-16M</item>>
+        <item>External-26M</item>>
+        <item>External-32M</item>>
+    </string-array>
+    <string-array name="BUAD_Rate">
+        <item>4800</item>>
+        <item>9600</item>>
+        <item>19200</item>>
+        <item>38400</item>>
+        <item>57600</item>>
+        <item>76800</item>>
+        <item>115200</item>>
+        <item>230400</item>>
+    </string-array>
+    <string-array name="Parity_Check">
+        <item>Disable</item>>
+        <item>Odd</item>>
+        <item>Even</item>>
+    </string-array>
+    
+    <string name="textviewMSG">Ready</string>
+    
+    <string name="lb_SendData">Send Data:</string>
+       <string name="lb_BaudRate">Baud Rate:</string>
+       <string name="lb_osc">OSC:</string>
+       <string name="lb_paritycheck">Parity Check:</string>
+       
+       <string name="m_configinitial">Config Initial</string>
+       <string name="m_senddata">Send data</string>
+       <string name="m_recvdata">Receive data</string>
+       <string name="m_clear">Clear Screen</string>    
+       <string name="m_about">About</string>   
+       <string name="m_quit">Quit</string>             
+       
+    <string name="bt_ConfigInitial">Config Initial</string>    
+    <string name="bt_startrecv">start Recv</string>
+       <string name="bt_stoprecv">Stop Recv</string>           
+    <string name="bt_startsend">Start Send</string>
+       <string name="bt_stopsend">Stop Send</string>           
+       
+       <string name="rbt_0">Flow Control</string>
+       <string name="rbt_1">UART0 Disable</string>
+       <string name="rbt_2">UART0 Handshake:</string>
+       <string name="rbt_3">UART1 Disable</string>
+       <string name="rbt_4">UART0 Handshake:</string>
+       
+       <string name="str_sendtext">254,11,41,0,11,1,0,11,6,0,3,1,1,0,1,39</string>
+       <string name="SelectDevice">Select Device</string>
+       <string name="SelectGroup">Select Group</string>
+       <string name="groupAdd">Add Light to Group</string>
+       <string name="optionMenuTitle">Action Menu</string>
+       <string name="optionMenuGroupsTitle">Groups and Scenes</string>
+       <string name="optionMuneBindingTitle">Binding</string>          
+       <string name="optionMuneListDevicesTitle">List Devices</string>
+</resources>
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/res/values/styles.xml b/client/AndroidClients/LightingController/res/values/styles.xml
new file mode 100644 (file)
index 0000000..37cae65
--- /dev/null
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+       <style name="ApplicationTheme" parent="@android:style/Theme.Black.NoTitleBar.Fullscreen">
+               <item name="android:soundEffectsEnabled">false</item>
+       </style>
+
+    <style name="StdButton" parent="@android:style/Widget.Button">
+        <item name="android:background">@drawable/button9</item>
+        <item name="android:focusable">true</item>
+        <item name="android:clickable">true</item>
+        <item name="android:padding">15dp</item>
+    </style>
+
+    <style name="StdButtonIcon">
+        <item name="android:layout_width">60dip</item>
+               <item name="android:layout_height">60dip</item>
+               <item name="android:paddingBottom">5dip</item>
+               <item name="android:paddingLeft">5dip</item>
+               <item name="android:paddingRight">5dip</item>
+    </style>
+    
+    <style name="StdButtonText" parent="@android:style/TextAppearance.Medium">
+    </style>
+    
+    <style name="TitleText" parent="@android:style/TextAppearance.Large">
+        <item name="android:layout_width">wrap_content</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:textColor">#FFFFFF</item>
+        <item name="android:typeface">monospace</item>
+    </style>
+    
+    <style name="StdScreen">
+       <item name="android:background">@drawable/background</item>
+    </style>
+    
+    <style name="SideMenuText" parent="@android:style/TextAppearance.Large">
+        <item name="android:layout_width">wrap_content</item>
+        <item name="android:layout_height">wrap_content</item>    
+        <item name="android:textSize">25dip</item>
+        <item name="android:padding">5dip</item>       
+        <item name="android:layout_margin">3dip</item>       
+    </style>
+    
+    <style name="DialogMenuText" parent="@android:style/TextAppearance.Large">
+        <item name="android:layout_width">wrap_content</item>
+        <item name="android:layout_height">wrap_content</item>    
+        <item name="android:textSize">25dip</item>
+        <item name="android:padding">5dip</item>
+        <item name="android:textColor">#000000</item>       
+        <item name="android:layout_margin">3dip</item>       
+    </style>    
+    
+       <style name="Animation.Popup" parent="android:Animation">
+        <item name="android:windowEnterAnimation">@anim/popup_in</item>
+        <item name="android:windowExitAnimation">@anim/popup_out</item>
+    </style>
+    
+    
+</resources>
diff --git a/client/AndroidClients/LightingController/src/com/lightingcontroller/ColourPicker.java b/client/AndroidClients/LightingController/src/com/lightingcontroller/ColourPicker.java
new file mode 100644 (file)
index 0000000..b6bbb30
--- /dev/null
@@ -0,0 +1,388 @@
+/**************************************************************************************************
+  Filename:       ColourPicker.java
+  Revised:        $$
+  Revision:       $$
+
+  Description:    ZLL UI
+
+  Copyright (C) 2007 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+  
+        http://www.apache.org/licenses/LICENSE-2.0
+       
+  Unless required by applicable law or agreed to in writing, software  
+  distributed under the License is distributed on an "AS IS" BASIS,    
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.     
+  See the License for the specific language governing permissions and  
+  limitations under the License.       
+
+  Copyright (C) {2012} Texas Instruments Incorporated - http://www.ti.com/
+
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the
+     distribution.
+
+     Neither the name of Texas Instruments Incorporated nor the names of
+     its contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**************************************************************************************************/
+
+package com.lightingcontroller;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.ComposeShader;
+import android.graphics.Paint;
+import android.graphics.PorterDuff;
+import android.graphics.RadialGradient;
+import android.graphics.RectF;
+import android.graphics.Shader;
+import android.graphics.SweepGradient;
+import android.util.AttributeSet;
+import android.util.DisplayMetrics;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.WindowManager;
+
+public class ColourPicker extends View 
+{    
+  private static final float PI = 3.1415926f;
+
+  private int[] mCoord;
+  private float[] mHSV;
+  
+  private zllMain ourContext;
+  
+  private static int CENTER_X;
+  private static int CENTER_Y;
+  private static int HUE_RADIUS;
+  private static int INNER_RADIUS;
+  private static int PALETTE_RADIUS;
+
+  private static int SAT_RADIUS;
+  
+  public boolean colourKnown = false;
+    
+  int[] mSpectrumColorsRev = new int[] {
+    0xFFFF0000, 0xFFFF00FF, 0xFF0000FF, 0xFF00FFFF,
+    0xFF00FF00, 0xFFFFFF00, 0xFFFF0000,
+  };
+  
+  Paint mOvalHue;
+  Paint mOvalHueInner;
+  
+  Paint mOvalSat;
+  RectF mRectSat;
+  Paint mArcSat;
+  Paint mPaintSatTextRect;
+  Paint mPaintSatText;
+    
+  Paint mPosMarker;
+  RectF posMarkerRect1;
+  RectF posMarkerRect2;  
+  
+  Shader shaderA;
+  Shader shaderB;   
+  Shader shaderHue;
+    
+  Shader shaderSat;
+
+  
+  public ColourPicker(Context context, AttributeSet attr) {
+    super(context, attr);
+    
+    ourContext = (zllMain)context;
+  
+    DisplayMetrics metrics = new DisplayMetrics();
+    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+    wm.getDefaultDisplay().getMetrics(metrics);   
+    
+    double scalefactor;
+    
+    if(metrics.widthPixels < metrics.heightPixels)
+    {
+      scalefactor = 2.5;
+    }
+    else
+    {
+      scalefactor = 5.5;
+    }
+  
+    CENTER_X = (int) ( 1 * (metrics.widthPixels/scalefactor));// (metrics.heightPixels / 2);
+    CENTER_Y =  (int) ( 1 * (metrics.widthPixels/scalefactor));// (metrics.heightPixels / 2);
+    HUE_RADIUS = (int) ( 1 * (metrics.widthPixels/scalefactor));//(metrics.heightPixels / 6) - (metrics.heightPixels / 45); //110;
+    INNER_RADIUS =  (int) ( 0.63 * (metrics.widthPixels/scalefactor));// (metrics.heightPixels / 10.5); //70;
+    PALETTE_RADIUS = (int) ( 1 * (metrics.widthPixels/scalefactor));//(metrics.heightPixels / 6) - (metrics.heightPixels / 45); //110;;  
+    SAT_RADIUS = (int) ( 0.60 * (metrics.widthPixels/scalefactor));//(metrics.heightPixels / 10.5) -5; //65;*/
+    
+    mOvalHue = new Paint(Paint.ANTI_ALIAS_FLAG);
+    mOvalHueInner = new Paint(Paint.ANTI_ALIAS_FLAG);
+  
+    mOvalSat = new Paint(Paint.ANTI_ALIAS_FLAG);
+    mRectSat = new RectF( -SAT_RADIUS, -SAT_RADIUS,  SAT_RADIUS, SAT_RADIUS);
+    mArcSat = new Paint();
+      
+    mPosMarker = new Paint(Paint.ANTI_ALIAS_FLAG);
+    
+    shaderA = new SweepGradient(0, 0, mSpectrumColorsRev, null);
+    shaderB = new RadialGradient(CENTER_X, CENTER_Y, HUE_RADIUS, 0xFFFFFFFF, 0xFF000000, Shader.TileMode.CLAMP);   
+    shaderHue = new ComposeShader(shaderA, shaderB, PorterDuff.Mode.SCREEN);
+      
+    shaderSat = new RadialGradient(CENTER_X, CENTER_Y, SAT_RADIUS, 0xFF888888, 0xFFFFFFFF, Shader.TileMode.CLAMP);   
+    
+    // InitialisePaints Paints
+    mOvalHue.setShader(shaderHue);
+    mOvalHue.setStyle(Paint.Style.FILL);
+    mOvalHue.setDither(true);            
+    
+    mOvalSat.setShader(shaderSat);
+    mOvalSat.setStyle(Paint.Style.FILL);
+    mOvalSat.setDither(true);
+    mOvalSat.setColor(0xFFFFFFFF);
+    
+    mArcSat.setAntiAlias(true);            
+    mArcSat.setStyle(Paint.Style.FILL);            
+    mArcSat.setColor(0xFFFFFFFF);                        
+        
+    mPosMarker.setStyle(Paint.Style.STROKE);
+    mPosMarker.setStrokeWidth(2);
+  
+       mPaintSatTextRect = new Paint();
+    mPaintSatTextRect.setAntiAlias(true);            
+    mPaintSatTextRect.setStyle(Paint.Style.FILL);            
+    mPaintSatTextRect.setColor(0XFF000000); 
+  
+    mPaintSatText = new Paint();
+    mPaintSatText.setAntiAlias(true);            
+    mPaintSatText.setStyle(Paint.Style.FILL);            
+    mPaintSatText.setColor(0xFFFFFFFF);  
+    mPaintSatText.setTextSize(25);
+        
+    mCoord = new int[2];
+    mHSV = new float[3];
+    mHSV[1] = 1;    
+    
+    posMarkerRect1 = new RectF(mCoord[0] - 5, mCoord[1] - 5, mCoord[0] + 5, mCoord[1] + 5);
+    posMarkerRect2 = new RectF(mCoord[0] - 3, mCoord[1] - 3, mCoord[0] + 3, mCoord[1] + 3);
+  }
+
+
+  @Override 
+  protected void onDraw(Canvas canvas) {
+            
+    canvas.translate(CENTER_X, CENTER_Y);
+      
+    canvas.drawCircle(0, 0, HUE_RADIUS, mOvalHue);
+    canvas.drawCircle(0, 0, INNER_RADIUS, mOvalHueInner);
+      
+    //Sat up
+    canvas.drawArc(mRectSat, (float)182, (float)176, true, mOvalSat);         
+    canvas.drawArc(mRectSat, (float)182, (float)176, true, mArcSat);
+    
+    //Sat down
+    canvas.drawArc(mRectSat, (float)2, (float)176, true, mOvalSat);
+    canvas.drawArc(mRectSat, (float)2, (float)176, true, mArcSat);        
+    
+    canvas.drawRect(-(SAT_RADIUS-10), 15, (SAT_RADIUS-10), -15, mPaintSatTextRect);                     
+      
+    mPaintSatText.setColor(0xFFFFFFFF);  
+    mPaintSatText.setTextSize(25);
+    String satStr = "Saturation"; 
+    canvas.drawText(satStr, -60, 8, mPaintSatText);           
+      
+    mPaintSatText.setTextSize(35);
+    mPaintSatText.setColor(0xFF000000);
+    satStr = "+"; 
+    canvas.drawText(satStr, -8, -30, mPaintSatText);  
+    satStr = "-"; 
+    canvas.drawText(satStr, -8, 50, mPaintSatText); 
+    
+    if (colourKnown)
+    {
+      posMarkerRect1.set(mCoord[0] - 5, mCoord[1] - 5, mCoord[0] + 5, mCoord[1] + 5);
+      posMarkerRect2.set(mCoord[0] - 3, mCoord[1] - 3, mCoord[0] + 3, mCoord[1] + 3);
+        
+      mPosMarker.setColor(Color.BLACK);      
+      canvas.drawOval(posMarkerRect1, mPosMarker);
+      mPosMarker.setColor(Color.WHITE);
+      canvas.drawOval(posMarkerRect2, mPosMarker);
+    }       
+  }
+  
+  // Currently Fixed size
+  @Override
+  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+    setMeasuredDimension(CENTER_X*2, CENTER_Y*2);
+  }
+  
+  public void drawPortraite()
+  {
+    invalidate();  
+  }
+  
+  
+  // Weighted average between points
+  private int ave(int s, int d, float p) {
+    return s + java.lang.Math.round(p * (d - s));
+  }
+  
+  // Interpolate colour value between points
+  private int interpColor(int colors[], float unit) {
+    if (unit <= 0) {
+        return colors[0];
+    }
+    if (unit >= 1) {
+        return colors[colors.length - 1];
+    }
+    
+    float p = unit * (colors.length - 1);
+    int i = (int)p;
+    p -= i;
+
+    // now p is just the fractional part [0...1] and i is the index
+    int c0 = colors[i];
+    int c1 = colors[i+1];
+    int a = ave(Color.alpha(c0), Color.alpha(c1), p);
+    int r = ave(Color.red(c0), Color.red(c1), p);
+    int g = ave(Color.green(c0), Color.green(c1), p);
+    int b = ave(Color.blue(c0), Color.blue(c1), p);
+    System.out.println("the vaient is"+b);
+    return Color.argb(a, r, g, b);
+  }
+
+private int round(double x) {
+  return (int)Math.round(x);
+}
+  
+public void upDateColorPreivew(byte hue, byte sat)
+{ 
+  //update hue preview
+  float unit = (float) hue / 255;
+  if (unit < 0) {
+    unit += 1;
+  }
+  
+  unit = 1 - unit;
+  
+  int c = interpColor(mSpectrumColorsRev, unit );
+  mArcSat.setColor(c);
+  
+  //update sat preview
+  mArcSat.setAlpha(sat);    
+  
+  colourKnown = true;
+}
+
+  @Override
+  public boolean onTouchEvent(MotionEvent event) {
+      
+    if (!isEnabled())
+        return false;
+
+    float x = event.getX() - CENTER_X;
+    float y = event.getY() - CENTER_Y;
+                
+    float angle = (float)java.lang.Math.atan2(y, x);
+    // need to turn angle [-PI ... PI] into unit [0....1]
+    float unit = angle/(2*PI);
+                
+    if (unit < 0) {
+      unit += 1;
+    }           
+                
+    //Pin the radius
+    float radius = (float)java.lang.Math.sqrt(x * x + y * y);
+    if (radius > PALETTE_RADIUS)
+      radius = PALETTE_RADIUS;
+                
+    if( radius < INNER_RADIUS )
+    {           
+      //User adjusted saturation
+      if(angle < 0)
+      {         
+        //+ Sat 
+        if((mHSV[1]+ 0.10) <= 1)
+        {       
+          mHSV[1] += 0.10;
+        }       
+        else    
+        {       
+          mHSV[1] = 1;
+        }       
+      }         
+      else      
+      {         
+        //- Sat 
+        if((mHSV[1] - 0.10) >= 0)
+        {       
+          mHSV[1] -=0.10;
+        }       
+        else    
+        {       
+          mHSV[1] = 0;
+        }       
+      }         
+                
+      byte hue = (byte) ((mHSV[0]/360)*255);
+      byte sat = (byte) (mHSV[1]*254);
+      ourContext.sendHueSatChange(hue, sat);
+      //update preview
+      mArcSat.setAlpha((byte) (mHSV[1]*254));
+    }           
+    else        
+    {           
+      //User adjusted hue   
+      mCoord[0] = round(Math.cos(angle) * (HUE_RADIUS - (HUE_RADIUS-INNER_RADIUS)/2));
+      mCoord[1] = round(Math.sin(angle) * (HUE_RADIUS - (HUE_RADIUS-INNER_RADIUS)/2));
+                
+      int c = interpColor(mSpectrumColorsRev, unit);
+      float[] hsv = new float[3];
+      Color.colorToHSV(c, hsv);
+      mHSV[0] = hsv[0];
+                
+      colourKnown = true;
+                
+      // Update color
+      byte hue = (byte) ((mHSV[0]/360)*255);
+      byte sat = (byte) (mHSV[1]*254);
+      ourContext.sendHueSatChange(hue, sat);
+                
+      //update preview
+      mArcSat.setColor(c);
+      mArcSat.setAlpha((int)(mHSV[1]*255));
+    }           
+                
+    invalidate();
+                
+    return true;
+  }
+  
+}
+
diff --git a/client/AndroidClients/LightingController/src/com/lightingcontroller/LightingController.java b/client/AndroidClients/LightingController/src/com/lightingcontroller/LightingController.java
new file mode 100644 (file)
index 0000000..8c787fd
--- /dev/null
@@ -0,0 +1,241 @@
+/**************************************************************************************************
+  Filename:       LightingController.java
+  Revised:        $$
+  Revision:       $$
+
+  Description:    ZLL UI
+
+  Copyright (C) {2012} Texas Instruments Incorporated - http://www.ti.com/
+
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the
+     distribution.
+
+     Neither the name of Texas Instruments Incorporated nor the names of
+     its contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**************************************************************************************************/
+
+package com.lightingcontroller;
+
+import java.util.concurrent.TimeUnit;
+
+import android.app.Activity;
+import android.app.ProgressDialog;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.widget.EditText;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.app.AlertDialog;
+
+import com.lightingcontroller.Zigbee.ZigbeeAssistant;
+import com.lightingcontroller.Zigbee.ZigbeeSrpcClient;
+
+public class LightingController extends Activity{
+
+    private static final String PREFS_NAME = "MyPrefsFile";
+    public int selectedDevice = 0;
+    ProgressDialog bar;
+    
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState); 
+        setContentView(R.layout.main);
+       
+        new ZigbeeAssistant();                
+                
+        new waitRspTask().execute("Connecting to gateway");
+/*       
+        ///Open SRPC
+        if(connectSrcpGateway())
+        {              
+          ZigbeeSrpcClient.getDevices();
+          ZigbeeSrpcClient.discoverGroups();
+          ZigbeeSrpcClient.discoverScenes();
+          //wait for responses
+          try { TimeUnit.MILLISECONDS.sleep(200); } catch (InterruptedException e) {e.printStackTrace();}  
+          
+          startActivity(new Intent(LightingController.this, zllMain.class));
+          finish();
+        }
+*/        
+    }
+               
+    
+    private boolean connectSrcpGateway()
+    { 
+       String gatewayIpAddr;
+
+        SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
+        gatewayIpAddr = settings.getString("gatewayIpAddr", null);    
+        
+               if(gatewayIpAddr != null)
+               {
+                       ZigbeeSrpcClient.setGatewayIp(gatewayIpAddr);                   
+               }
+               else
+               {
+                       //get IPAddr from user
+                       setSrcpGatewayIpAddress();
+               }
+               
+               if( ZigbeeSrpcClient.clientConnect() == 0)
+               {
+                       SharedPreferences.Editor editor = settings.edit();      
+                       editor.putString("gatewayIpAddr", gatewayIpAddr);
+               }
+               else
+               {
+                       //get IPAddr from user          
+                       setSrcpGatewayIpAddress();
+                       return false;
+               }
+               
+               return true;
+    } 
+    
+    private void setSrcpGatewayIpAddress()
+    {          
+       final EditText t = new EditText(this);
+       t.setText("192.168.1.111");
+
+       new AlertDialog.Builder(this)
+               .setTitle("Gateway Address")
+               .setMessage("Please Enter the HA Gateway IP Address")
+               .setView(t)
+               .setPositiveButton("OK",             
+               new DialogInterface.OnClickListener()
+               {                       
+                       public void onClick(DialogInterface dialoginterface,int i){     
+                       String gatewayIpAddr;
+                               gatewayIpAddr = t.getText().toString();
+
+                               //retrieve path setting
+                               SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
+                               settings.getString("gatewayIpAddr", gatewayIpAddr);     
+                               
+                               if(gatewayIpAddr != null)
+                               {
+                               if(connectSrcpGateway())
+                               {                               
+                                 ZigbeeSrpcClient.getDevices();
+                                 ZigbeeSrpcClient.discoverGroups();
+                                 ZigbeeSrpcClient.discoverScenes();
+                                 //wait for responses
+                                 try { TimeUnit.MILLISECONDS.sleep(200); } catch (InterruptedException e) {e.printStackTrace();}  
+       
+                                 startActivity(new Intent(LightingController.this, zllMain.class));                            
+                               }
+                               }
+                       }               
+               })
+               .show();                        
+    } 
+    
+    
+    class waitRspTask extends AsyncTask<String , Integer, Void>
+    {
+       private boolean rspSuccess = false;
+       String param;
+       String gatewayIpAddr;
+       
+        @Override
+        protected void onPreExecute()
+        {
+            bar = new ProgressDialog(LightingController.this);
+            bar.setMessage("Finding Gateway");
+            bar.setIndeterminate(true);
+            bar.show();
+        } 
+        @Override
+        protected Void doInBackground(String... params) 
+        {
+               param = params[0];
+               
+                       //retrieve path setting
+                       SharedPreferences preferences = getSharedPreferences(PREFS_NAME, 0);
+               String gatewayIpAddr = preferences.getString("gatewayIpAddr", null);
+                       
+                       if(gatewayIpAddr != null)
+                       {
+                               ZigbeeSrpcClient.setGatewayIp(gatewayIpAddr);                                   
+                               if(ZigbeeSrpcClient.clientConnect() == 0)
+                               {
+                               ZigbeeSrpcClient.getDevices();
+                               ZigbeeSrpcClient.discoverGroups();
+                               ZigbeeSrpcClient.discoverScenes();
+                               //wait for responses
+                               try { TimeUnit.MILLISECONDS.sleep(200); } catch (InterruptedException e) {e.printStackTrace();}  
+                                 
+                               startActivity(new Intent(LightingController.this, zllMain.class));
+                                 
+                                       rspSuccess = true;
+                               }
+                       }
+                       
+                       return null;
+        }
+        @Override
+        protected void onPostExecute(Void result) 
+        {
+            bar.dismiss();
+            
+            if (rspSuccess == false)
+               {
+               final EditText t = new EditText(LightingController.this);
+               t.setText("192.168.1.111");
+
+               new AlertDialog.Builder(LightingController.this)
+                       .setTitle("Gateway Address")
+                       .setMessage("Please Enter the HA Gateway IP Address")
+                       .setView(t)
+                       .setPositiveButton("OK",             
+                       new DialogInterface.OnClickListener()
+                       {                       
+                               public void onClick(DialogInterface dialoginterface,int i){     
+                               String gatewayIpAddr;
+                               gatewayIpAddr = t.getText().toString();
+
+                                       //Store path setting
+                               SharedPreferences preferences = getSharedPreferences(PREFS_NAME, 0);
+                               SharedPreferences.Editor editor = preferences.edit();
+                               editor.putString("gatewayIpAddr", gatewayIpAddr); // value to store
+                               editor.commit();                                                                
+                               
+                                       new waitRspTask().execute("Connecting to gateway");
+                               }               
+                       })
+                       .setNegativeButton("Cancel", null)
+                       .show();                        
+               }
+            else
+            {
+               finish();
+            }
+            
+        }
+    }        
+}
diff --git a/client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeAssistant.java b/client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeAssistant.java
new file mode 100644 (file)
index 0000000..bfe52aa
--- /dev/null
@@ -0,0 +1,507 @@
+/**************************************************************************************************
+  Filename:       ZigBeeAssistant.java
+  Revised:        $$
+  Revision:       $$
+
+  Description:    ZigBee Assistant
+
+    Copyright (C) {2012} Texas Instruments Incorporated - http://www.ti.com/
+
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the
+     distribution.
+
+     Neither the name of Texas Instruments Incorporated nor the names of
+     its contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**************************************************************************************************/
+
+package com.lightingcontroller.Zigbee;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+
+import com.lightingcontroller.Zigbee.ZigbeeScene;
+
+import android.app.Activity;
+import android.graphics.Color;
+import android.util.Log;
+import android.widget.Toast;
+
+public class ZigbeeAssistant implements Runnable {
+
+       //public static final boolean USE_JNI = true;
+       public static final boolean USE_JNI = false;
+
+       public static boolean gateWayConnected = false;
+       public static boolean initializing = true;
+       
+       private static String TAG = "ZigbeeAssistant";
+       public static ZigbeeSrpcClient zigbeeSrpcClient;
+       public static String ZigbeeSrpcClientGatewayIp = "192.168.1.220";
+       
+       static Thread thread;
+       static Activity mainAct;
+       
+       static List<ZigbeeDevice> ourDevices = new ArrayList<ZigbeeDevice>();
+       static List<ZigbeeGroup> ourGroups =  new ArrayList<ZigbeeGroup>();
+       static List<ZigbeeScene> ourScenes =  new ArrayList<ZigbeeScene>();
+       
+       private static int LightDeviceIdx = 0;
+
+       static public int lastTempReading = 65535;
+       static public List<Integer> powerReadings = new ArrayList<Integer>();
+       static public List<Long> powerReadingsTimes = new ArrayList<Long>();
+       static public HashMap<Short,Long> nwrkToIEEE = new HashMap<Short,Long>();
+               
+       public static native int runMain();
+       public static native boolean isRunning();
+       public static native short requestThermostatReading(short networkaddr, char end); // Get ThermostatReading
+       public static native short requestPowerReading(short networkaddr, char end); // Get ThermostatReading
+       public static native void setDeviceState(short networkaddr, char end, boolean state);   // Set device state on/off
+       public static native void setDeviceLevel(short networkaddr, char end, char level, short transitionTime);        // Set device level/dim
+       public static native void setDeviceColour(short networkaddr, char end, char hue, char saturation, short transitionTime);        // Set device Color     
+       
+       public static native void bindDevices(short network_a, char end_a, int ieel_a, int ieeh_a,  
+                                                                                 short network_b, char end_b, int ieel_b, int ieeh_b,
+                                                                                 short clusterId);     // Bind Devices
+       
+       
+       
+       static
+       {
+               if(USE_JNI)                     
+                  System.loadLibrary("zigbee_assistant_jni");                  //Loading native library        
+               
+       }       
+       
+       public static void notifyUser(String s)
+       {
+               ZigbeeNotification.showNotification(s);
+       }
+
+       public static List<ZigbeeDevice> getDevices()
+       {
+               return ourDevices;
+       }       
+       
+       public static void addGroup(ZigbeeDevice d, String groupName )
+       {               
+               //ZigbeeGroup newGroup = new ZigbeeGroup(groupName);
+               //ourGroups.add(newGroup);              
+               
+               ZigbeeSrpcClient.addGroup((short) d.NetworkAddr,d.EndPoint, groupName);
+       }
+       
+       public static void storeScene(String sceneName, int groupId )
+       {                                               
+               ZigbeeSrpcClient.storeScene( sceneName, groupId );
+       }
+       
+       public static void recallScene(String sceneName, int groupId )
+       {                                       
+               ZigbeeSrpcClient.recallScene(sceneName, groupId );
+       }
+
+       public void descoverGroups()
+       {
+               ZigbeeSrpcClient.discoverGroups( );
+       }
+       
+       public static List<ZigbeeGroup> getGroups()
+       {
+               return ourGroups;
+       }               
+
+       public static List<ZigbeeScene> getScenes()
+       {
+               return ourScenes;
+       }
+       
+       public static void deviceAnnounce(int nwrk, long ieee1) 
+       {
+               // TODO Auto-generated method stub
+
+               if (nwrkToIEEE.containsKey(nwrk))
+                       nwrkToIEEE.remove(nwrk);
+               nwrkToIEEE.put((short)nwrk, ieee1);             
+       }
+
+       
+       public static void deviceAnnounce(int nwrk, int ieee1, int ieee2)
+       {
+               long t2;
+               long t = (((long)ieee2))<<32;
+               
+               if(ieee1 < 0)
+               {
+                       long t3 = 2147483647;
+                       t3 = t3 + 2147483647;
+                       t3 = t3 + 2;
+                       t2 = (((long)ieee1));           
+                       t2 = t2+t3;
+               }
+               else
+               {
+                       t2 = ieee1;                     
+               }
+               t = t | t2;
+               if (nwrkToIEEE.containsKey(nwrk))
+                       nwrkToIEEE.remove(nwrk);
+               nwrkToIEEE.put((short)nwrk, t);
+       }
+
+       public static void newDevice(int ProfileId, int DeviceId, int NetworkAddr, char EndPoint, byte ieee[], String deviceName)
+       {
+               ZigbeeDevice oldD = ifDeviceExists(NetworkAddr,EndPoint);
+               if (oldD != null)
+               {
+                       if (oldD.ProfileId == ProfileId)
+                               return;
+                       oldD = new ZigbeeDevice(ProfileId, DeviceId, NetworkAddr, EndPoint, ieee, deviceName, LightDeviceIdx++);
+                       return;
+               }
+               ZigbeeDevice newDevice = new ZigbeeDevice(ProfileId, DeviceId, NetworkAddr, EndPoint,  ieee, deviceName, LightDeviceIdx++);
+               ourDevices.add(newDevice);
+       }
+
+       public static void newGroup( String groupName )
+       {               
+               ZigbeeGroup newGroup = new ZigbeeGroup(groupName);
+               ourGroups.add(newGroup);        
+               
+               //Create new group on gateway (with invalid nwkAddr so not device is added to the group)
+               ZigbeeSrpcClient.addGroup((short) 0xFFFF, (char) 0xFF, groupName);
+       }       
+       
+       public static void newGroup(String groupName, int groupId, int status)
+       {
+               ZigbeeGroup group=null;
+        List<ZigbeeGroup> groupList = ZigbeeAssistant.getGroups();
+
+        //find the group        
+        for(int i=0; i < groupList.size(); i++)
+        {
+               if(groupName.equals(groupList.get(i).getGroupName()))
+               {
+                       group = groupList.get(i);
+                       group.setGroupId(groupId);
+                       group.setStatus(status);
+                       break;
+               }
+        }
+        
+        if(group == null)
+        {              
+               group = new ZigbeeGroup(groupName, groupId, status);   
+               ourGroups.add(group);
+        }
+       }
+
+       public static void newScene(String sceneName, int groupId, byte sceneId, int status)
+       {
+               ZigbeeScene scene=null;
+        List<ZigbeeScene> sceneList = ZigbeeAssistant.getScenes();
+
+        //find the scene        
+        for(int i=0; i < sceneList.size(); i++)
+        {
+               if(sceneName.equals(sceneList.get(i).getSceneName()))
+               {
+                       scene = sceneList.get(i);
+                       scene.setGroupId(groupId);
+                       scene.setSceneId(sceneId);
+                       scene.setStatus(status);
+                       break;
+               }
+        }
+        
+        if(scene == null)
+        {              
+               scene = new ZigbeeScene(sceneName, groupId, sceneId, status);   
+               ourScenes.add(scene);
+        }
+       }
+       
+       public static void newScene(String sceneName, int groupId )
+       {                               
+               ZigbeeScene newScene = new ZigbeeScene(sceneName, groupId);
+               if(ourScenes.contains(newScene) == false)
+               {
+                       ourScenes.add(newScene);
+               }
+               
+               ZigbeeSrpcClient.storeScene( sceneName, groupId );
+       }
+       
+       public static boolean bindDevicesOnOff(ZigbeeDevice a, ZigbeeDevice b)
+       {
+               return bindDevices(a,b,0x0006);
+       }
+       
+       public static boolean bindDevicesAll(ZigbeeDevice a, ZigbeeDevice b)
+       {               
+               bindDevices(a,b,0x0006);
+               bindDevices(a,b,0x0008);
+               bindDevices(a,b,0x0300);
+               bindDevices(a,b,0x0005);
+               bindDevices(a,b,0x0004);
+               
+               return true;
+       }       
+       
+       public static boolean bindDevices(ZigbeeDevice a, ZigbeeDevice b, int cluster)
+       {                       
+               ZigbeeSrpcClient.bindDevices((short)a.NetworkAddr,a.EndPoint, a.Ieee,
+                               (short)b.NetworkAddr,b.EndPoint,b.Ieee,(short)cluster);
+               
+               return true;
+       }
+
+       public static void setDeviceName(String oldName, String newName)
+       {
+               int last = ourDevices.size()-1;
+               int i = last;
+               ZigbeeDevice d = null;
+               for (i = last ; i >= 0 ; i--)
+               {
+                       d = ourDevices.get(i);
+                       if (d.Name == oldName)
+                               break;
+               }
+               
+               if( (d != null) && (newName != null) )
+               {
+                       d.Name = newName;
+                       //Need to push this back to server
+                       ZigbeeSrpcClient.changeDeviceName(d, newName);
+               }
+       }
+       
+       public static ZigbeeDevice ifDeviceExists(int NetworkAddr, char EndPoint)
+       {
+               int last = ourDevices.size()-1;
+               int i = last;
+               ZigbeeDevice ret = null;
+               for (i = last ; i >= 0 ; i--)
+               {
+                       ret = ourDevices.get(i);
+                       if (ret.NetworkAddr == NetworkAddr && ret.EndPoint == EndPoint)
+                               break;
+               }
+               if (i < 0) 
+                       return null;
+               else
+                       return ret;
+       }
+       
+       public static boolean hasAnySwitchers()
+       {
+               for (int i = 0 ; i < ourDevices.size() ; i++)
+               {
+                       ZigbeeDevice d = ourDevices.get(i);     
+                       if (d.hasOutSwitch)
+                               return true;
+               }
+               return false;   
+       }
+       
+       public static void newDeviceCluster(int NetworkAddr, char EndPoint, boolean in, int ClusterId)
+       {
+               ZigbeeDevice toAddto = ifDeviceExists(NetworkAddr, EndPoint);
+               if (toAddto == null) 
+               {
+                       Log.w(TAG, "Couldn't find Device");
+                       return;
+               }
+               
+               toAddto.addCluster(in, ClusterId);      
+       }
+       
+       public ZigbeeAssistant()
+       {
+               ourDevices.clear();
+               LightDeviceIdx = 0;
+       }
+
+       public static String getInfoString()
+       {
+               if (ourDevices.size() == 0)
+                       return "No devices detected.";
+                       
+               String s = "";
+               for (int i = 0 ; i < ourDevices.size() ; i++)
+               {
+                       ZigbeeDevice d = ourDevices.get(i);
+                       s += d.Name + " - 0x" + Integer.toHexString(d.NetworkAddr) + "("+(int)d.EndPoint+")\n";
+                       if (d.hasSwitchable)
+                               s+="\t: Switchable\n";
+                       if (d.hasDimmable)
+                               s+="\t: Dimmable\n";
+                       if (d.hasColourable)
+                               s+="\t: Colourable\n";
+                       if (d.hasThermometer)
+                               s+="\t: Measures Temperature\n";
+                       if (d.hasPowerUsage)
+                               s+="\t: Measures Power Usage\n";                        
+                       if (d.hasOutSwitch)
+                               s+="\t: Switches Others\n";
+                       if (d.hasOutLeveL)
+                               s+="\t: controls level of Others\n";    
+                       if (d.hasOutColor)
+                               s+="\t: controls color of Others\n";
+                       if (d.hasOutScene)
+                               s+="\t: controls scenes of Others\n";
+                       if (d.hasOutGroup)
+                               s+="\t: controls groups of Others\n";                   
+               }
+               return s;
+       }
+       
+       public static ArrayList<ZigbeeDevice> getSwitchers()
+       {
+               ArrayList<ZigbeeDevice> s = new ArrayList<ZigbeeDevice>();
+               for (int i = 0 ; i < ourDevices.size() ; i++)
+               {
+                       ZigbeeDevice d = ourDevices.get(i);     
+                       if (d.hasOutSwitch)
+                               s.add(d);
+               }
+               return s;
+       }       
+
+       public static ArrayList<ZigbeeDevice> getSwitchable()
+       {
+               ArrayList<ZigbeeDevice> s = new ArrayList<ZigbeeDevice>();
+               for (int i = 0 ; i < ourDevices.size() ; i++)
+               {
+                       ZigbeeDevice d = ourDevices.get(i);     
+                       if (d.hasColourable || d.hasSwitchable || d.hasDimmable)
+                               s.add(d);
+               }
+               return s;
+       }       
+       
+       public static void haveTemperature(int NetworkAddr, char EndPoint, int data)
+       {
+               lastTempReading = data;
+       }
+       
+       public static void setDeviceState(ZigbeeDevice d, boolean state)
+       {
+               if(USE_JNI)                     
+                       setDeviceState((short) d.NetworkAddr,d.EndPoint,state);
+               else
+                       ZigbeeSrpcClient.setDeviceState((short) d.NetworkAddr, ZigbeeSrpcClient.Addr16Bit, d.EndPoint,state);                   
+       }
+
+       public static void setDeviceState(ZigbeeGroup g, boolean state)
+       {
+               ZigbeeSrpcClient.setDeviceState((short) g.getGroupId(), ZigbeeSrpcClient.AddrGroup, (char) 0xFF, state);                                
+       }
+       
+       public static void setDeviceColour(ZigbeeDevice d, int colour)
+       {
+               float[] hsv = new float[3];
+               Color.colorToHSV(colour, hsv);
+               if (USE_JNI)
+                       setDeviceColour((short) d.NetworkAddr,d.EndPoint,(char)((hsv[0]/360)*0xFF), (char)(hsv[1]*0xFF),(short)10);
+               else
+                       ZigbeeSrpcClient.setDeviceColor((short) d.NetworkAddr, ZigbeeSrpcClient.Addr16Bit, d.EndPoint,(char)((hsv[0]/360)*0xFF), (char)(hsv[1]*0xFF),(short)10);
+       }
+
+       public static void setDeviceHueSat(ZigbeeDevice d, byte hue, byte sat)
+       {
+               if (USE_JNI)
+                       setDeviceColour((short) d.NetworkAddr,d.EndPoint,(char) hue, (char) sat,(short)10);
+               else
+                       ZigbeeSrpcClient.setDeviceColor((short) d.NetworkAddr, ZigbeeSrpcClient.Addr16Bit, d.EndPoint, (char) hue, (char) sat,(short)10);
+       }
+
+       public static void setDeviceHueSat(ZigbeeGroup g, byte hue, byte sat)
+       {
+                       ZigbeeSrpcClient.setDeviceColor((short) g.getGroupId(), ZigbeeSrpcClient.AddrGroup, (char) 0xFF, (char) hue, (char) sat,(short)10);
+       }       
+       
+       public static void setDeviceLevel(ZigbeeDevice d, int colour)
+       {
+               float[] hsv = new float[3];
+               Color.colorToHSV(colour, hsv);  
+               setDeviceLevel(d,(char)((hsv[2])*0xFF));
+       }
+       
+       public static void setDeviceLevel(ZigbeeDevice d, char level)
+       {
+               if(USE_JNI)     
+                       setDeviceLevel((short) d.NetworkAddr,d.EndPoint,level,(short)10);
+               else
+                       ZigbeeSrpcClient.setDeviceLevel((short) d.NetworkAddr, ZigbeeSrpcClient.Addr16Bit, d.EndPoint,level,(short)10);
+       }
+
+       public static void setDeviceLevel(ZigbeeGroup g, char level)
+       {
+                       ZigbeeSrpcClient.setDeviceLevel((short) g.getGroupId(), ZigbeeSrpcClient.AddrGroup, (char) 0xFF,level,(short)10);
+       }       
+
+       public static void getDeviceState(ZigbeeDevice d)
+       {
+               ZigbeeSrpcClient.getDeviceState((short) d.NetworkAddr, ZigbeeSrpcClient.Addr16Bit, d.EndPoint);                 
+       }
+       
+       public static void getDeviceLevel(ZigbeeDevice d)
+       {
+               ZigbeeSrpcClient.getDeviceLevel((short) d.NetworkAddr, ZigbeeSrpcClient.Addr16Bit, d.EndPoint);                 
+       }       
+
+       public static void getDeviceHue(ZigbeeDevice d)
+       {
+               ZigbeeSrpcClient.getDeviceHue((short) d.NetworkAddr, ZigbeeSrpcClient.Addr16Bit, d.EndPoint);                   
+       }               
+
+       public static void getDeviceSat(ZigbeeDevice d)
+       {
+               ZigbeeSrpcClient.getDeviceSat((short) d.NetworkAddr, ZigbeeSrpcClient.Addr16Bit, d.EndPoint);                   
+       }
+       
+       public void run() {
+               if(USE_JNI)
+               {
+                       Log.d(TAG, "Begin Zigbee");
+                       final int returnvalue = runMain();
+                       mainAct.runOnUiThread(new Runnable() {
+                               public void run() {
+                               Toast.makeText(mainAct, "Zigbee has failed ("+returnvalue+") \n - Is the dongle connected and chmodded?", Toast.LENGTH_LONG).show();
+                       }
+                       });
+               }
+               else
+               {
+                       Log.d(TAG, "Begin Zigbee");             
+                       zigbeeSrpcClient = new ZigbeeSrpcClient();
+               }                       
+       }
+}
diff --git a/client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeDevice.java b/client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeDevice.java
new file mode 100644 (file)
index 0000000..35effb2
--- /dev/null
@@ -0,0 +1,518 @@
+/**************************************************************************************************
+  Filename:       ZigBeeDevice.java
+  Revised:        $$
+  Revision:       $$
+
+  Description:    ZigBee Device Class
+
+    Copyright (C) {2012} Texas Instruments Incorporated - http://www.ti.com/
+
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the
+     distribution.
+
+     Neither the name of Texas Instruments Incorporated nor the names of
+     its contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**************************************************************************************************/
+
+package com.lightingcontroller.Zigbee;
+
+import android.content.Context;
+import android.widget.TextView;
+
+import com.lightingcontroller.zllMain;
+
+
+public class ZigbeeDevice {
+
+       private String TAG = "ZigbeeAssistant";
+       public String Name = "Unknown Device";
+       public String Type = "Unknown Device";
+       public char EndPoint = 0;
+       public int ProfileId = 0;
+       public int DeviceId = 0;
+       public int NetworkAddr = 0;
+       public byte Ieee[] = {};
+       
+       // Prob better to do this as an array of cluster IDS.
+       // Never mind.
+       public boolean hasColourable = false;
+       public boolean hasDimmable = false;
+       public boolean hasSwitchable = false;
+       public boolean hasThermometer = false;
+       public boolean hasPowerUsage = false;
+       public boolean hasOutSwitch = false;
+       public boolean hasOutLeveL = false;
+       public boolean hasOutColor = false;
+       public boolean hasOutScene = false;
+       public boolean hasOutGroup = false;     
+       
+       private byte currentState = 0;
+       private byte currentLevel = 0;
+       private byte currentHue = 0;
+       private byte currentSat = 0;
+       public byte currentColorAttrsUpdated = 0;
+       private static final byte CURRENT_STATE_UPDATED = (byte) 0x01;  
+       private static final byte CURRENT_LEVEL_UPDATED = (byte) 0x02;  
+       private static final byte CURRENT_HUE_UPDATED = (byte) 0x04;    
+       private static final byte CURRENT_SAT_UPDATED = (byte) 0x08;    
+       
+       // Zigbee Home Automation Profile Identification
+       private static final int ZCL_HA_PROFILE_ID = (int) 0x0104;      
+       // Zigbee Home Automation Profile Generic Device IDs
+       private static final int ZCL_HA_DEVICEID_LEVEL_CONTROL_SWITCH            = (int) 0x0001; 
+       private static final int ZCL_HA_DEVICEID_ON_OFF_OUTPUT                   = (int) 0x0002; 
+       private static final int ZCL_HA_DEVICEID_LEVEL_CONTROLLABLE_OUTPUT       = (int) 0x0003; 
+       private static final int ZCL_HA_DEVICEID_SCENE_SELECTOR                  = (int) 0x0004; 
+       private static final int ZCL_HA_DEVICEID_CONFIGURATIOPN_TOOL             = (int) 0x0005; 
+       private static final int ZCL_HA_DEVICEID_REMOTE_CONTROL                  = (int) 0x0006; 
+       private static final int ZCL_HA_DEVICEID_COMBINED_INETRFACE              = (int) 0x0007; 
+       private static final int ZCL_HA_DEVICEID_RANGE_EXTENDER                  = (int) 0x0008; 
+       private static final int ZCL_HA_DEVICEID_MAINS_POWER_OUTLET              = (int) 0x0009;        
+       // Zigbee Home Automation Profile  Lighting Device IDs
+       private static final int ZCL_HA_DEVICEID_ON_OFF_SWITCH          = (int) 0x0000; 
+       private static final int ZCL_HA_DEVICEID_ON_OFF_LIGHT           = (int) 0x0100;
+       private static final int ZCL_HA_DEVICEID_DIMMABLE_LIGHT         = (int) 0x0101;
+       private static final int ZCL_HA_DEVICEID_COLORED_DIMMABLE_LIGHT = (int) 0x0102;
+       private static final int ZCL_HA_DEVICEID_ON_OFF_LIGHT_SWITCH    = (int) 0x0103;
+       private static final int ZCL_HA_DEVICEID_DIMMER_SWITCH          = (int) 0x0104;
+       private static final int ZCL_HA_DEVICEID_COLOR_DIMMER_SWITCH    = (int) 0x0105;
+       private static final int ZCL_HA_DEVICEID_LIGHT_SENSOR           = (int) 0x0106;
+       private static final int ZCL_HA_DEVICEID_OCCUPANCY_SENSOR       = (int) 0x0107; 
+       
+       // Zigbee Light Link Profile Identification
+       private static final int  ZLL_PROFILE_ID                        = (int) 0xc05e;
+       // ZLL Basic Lighting Device IDs
+       private static final int ZLL_DEVICEID_ON_OFF_LIGHT              = (int) 0x0000;
+       private static final int ZLL_DEVICEID_ON_OFF_PLUG_IN_UNIT       = (int) 0x0010;
+       private static final int ZLL_DEVICEID_DIMMABLE_LIGHT            = (int) 0x0100;
+       private static final int ZLL_DEVICEID_DIMMABLE_PLUG_IN_UNIT     = (int) 0x0110;
+       // ZLL Color Lighting Device IDs
+       private static final int ZLL_DEVICEID_COLOR_LIGHT                = (int) 0x0200;
+       private static final int ZLL_DEVICEID_EXTENDED_COLOR_LIGHT       = (int) 0x0210;
+       private static final int ZLL_DEVICEID_COLOR_TEMPERATURE_LIGHT    = (int) 0x0220;
+       // ZLL Lighting Remotes Device IDs
+       private static final int ZLL_DEVICEID_COLOR_CONTORLLER           = (int) 0x0800;
+       private static final int ZLL_DEVICEID_COLOR_SCENE_CONTROLLER     = (int) 0x0810;
+       private static final int ZLL_DEVICEID_NON_COLOR_CONTORLLER       = (int) 0x0820;
+       private static final int ZLL_DEVICEID_NON_COLOR_SCENE_CONTROLLER = (int) 0x0830;
+       private static final int ZLL_DEVICEID_CONTROL_BRIDGE             = (int) 0x0840;
+       private static final int ZLL_DEVICEID_ON_OFF_SENSOR              = (int) 0x0850;        
+       
+       ZigbeeDevice() {}
+       
+       ZigbeeDevice(int _ProfileId, int _DeviceId, int _NetworkAddr, char _EndPoint,  byte _ieee[], String _deviceName, int LightDeviceIdx)
+       {
+               ProfileId = _ProfileId;
+               DeviceId = _DeviceId;
+               EndPoint = _EndPoint;
+               NetworkAddr = _NetworkAddr;
+               Ieee = _ieee;
+               
+               if( ProfileId == ZCL_HA_PROFILE_ID)
+               {                       
+                       // Would be better to get the device name from the device!
+                       switch (DeviceId)
+                       {
+                       
+                       case (ZCL_HA_DEVICEID_ON_OFF_SWITCH):   
+                       {
+                               Type = "Switch";
+                               
+                               //Assume for now it is a Cleode switch, later pass the vindor ID down so we can check
+                       String SwitchButtonFunction;
+                       
+                       if(_EndPoint == 1)
+                       {
+                               SwitchButtonFunction = " EP:1(DOWN)";
+                       }
+                       else if(_EndPoint == 2)
+                       {
+                               SwitchButtonFunction = " EP:2(LEFT)";
+                       }
+                       else if(_EndPoint == 3)
+                       {
+                               SwitchButtonFunction = " EP:3(UP)";
+                       }
+                       else if(_EndPoint == 4)
+                       {
+                               SwitchButtonFunction = " EP:4(RIGHT)";
+                       }            
+                       else if(_EndPoint == 5)
+                       {
+                               SwitchButtonFunction = " EP:5(CENTER)";
+                       }
+                       else
+                       {
+                               SwitchButtonFunction = " EP:" + Integer.toHexString(EndPoint);
+                       }
+                       
+                       Name = "Switch" + SwitchButtonFunction  /*+ " IEEE:" + Integer.toHexString((int)((long)ZigbeeAssistant.nwrkToIEEE.get((short)_NetworkAddr)))*/;
+                       hasOutSwitch = true;
+                       break;
+                       }
+               
+                       case (ZCL_HA_DEVICEID_MAINS_POWER_OUTLET):      
+                       {
+                               Type = "Mains Outlet"; 
+                               Name= (LightDeviceIdx+1) + ": Smart Plug";      
+                               hasSwitchable = true;                           
+                               break;
+                       }
+                       case (ZCL_HA_DEVICEID_DIMMABLE_LIGHT):  
+                       {
+                               Type = "Dimmable Light"; 
+                               Name= (LightDeviceIdx+1) + ": Light";
+                               hasSwitchable = true;
+                               hasDimmable  = true;
+                               break;
+                       }
+                       case (ZCL_HA_DEVICEID_COLORED_DIMMABLE_LIGHT):  
+                       {
+                               Type = "Colour Dimmable Light"; 
+                               Name= (LightDeviceIdx+1) + ": ZLight";  
+                               hasSwitchable = true;
+                               hasDimmable  = true;
+                               hasColourable = true;                                   
+                               break;
+                       }
+                       case (ZCL_HA_DEVICEID_COLOR_DIMMER_SWITCH):     
+                       {
+                               Type = "Colour Dimmer switch"; 
+                               Name="Colour Dimmer switch";
+                               hasOutSwitch= true;
+                               hasOutLeveL = true;
+                               hasOutColor = true;                             
+                               break;  
+                       }
+                       case (ZCL_HA_DEVICEID_OCCUPANCY_SENSOR):        
+                       {
+                               Type = "Occumpancy Sensor"; 
+                               Name="Occumpancy Sensor";
+                               hasOutSwitch = true;
+                               break;
+                       }
+                       //some manufacturers use HA profile ID and ZLL device ID's... 
+                       case (ZLL_DEVICEID_EXTENDED_COLOR_LIGHT):       
+                       {
+                               Type = "ZLL Hue Light"; 
+                               Name= (LightDeviceIdx+1) + ": Hue Light";               
+                               break;
+                       }
+                       default:        Type = "Unknown Device"; Name="Unknown";        
+                       }                       
+               }               
+               else if( ProfileId == ZLL_PROFILE_ID)
+               {
+                       switch (DeviceId)
+                       {
+                       case (ZLL_DEVICEID_ON_OFF_LIGHT):       
+                       {
+                               //An On off Light
+                               Type = "On/Off Light"; 
+                               //set a default name that can be renamed later and stored in the hub
+                               Name= (LightDeviceIdx+1) + ": On/Off Light";    
+                               hasSwitchable = true;
+                               hasDimmable  = false;
+                               hasColourable = false;                  
+                               break;
+                       }
+                       case (ZLL_DEVICEID_ON_OFF_PLUG_IN_UNIT):        
+                       {
+                               //An On Off Plug-In unit
+                               Type = "On/Off Plug"; 
+                               //set a default name that can be renamed later and stored in the hub
+                               Name= (LightDeviceIdx+1) + ": On/Off Plug";     
+                               hasSwitchable = true;                   
+                               break;                  
+                       }               
+                       case (ZLL_DEVICEID_DIMMABLE_LIGHT):     
+                       {
+                               //A Dimmable Light
+                               Type = "Dimmable Light"; 
+                               //set a default name that can be renamed later and stored in the hub
+                               Name= (LightDeviceIdx+1) + ": Dimmable Light";  
+                               hasSwitchable = true;
+                               hasDimmable  = true;
+                               break;                  
+                       }
+                       case (0x0110):  
+                       {
+                               //A Dimmable Plug-In unit
+                               Type = "Dimmable Plug"; 
+                               //set a default name that can be renamed later and stored in the hub
+                               Name= (LightDeviceIdx+1) + ": Dimmable Plug";   
+                               hasSwitchable = true;
+                               hasDimmable  = true;
+                               break;                  
+                       }               
+                       case (0x0200):  
+                       {
+                               //A Color Light
+                               Type = "Color Light"; 
+                               //set a default name that can be renamed later and stored in the hub
+                               Name= (LightDeviceIdx+1) + ": Color Light";     
+                               hasSwitchable = true;
+                               hasDimmable  = true;
+                               hasColourable = true;   
+                               break;                  
+                       }
+                       case (0x0210):  
+                       {
+                               //An Extended Color Light
+                               Type = "Extended Color Light"; 
+                               //set a default name that can be renamed later and stored in the hub
+                               Name= (LightDeviceIdx+1) + ": Extended Color Light";    
+                               hasSwitchable = true;
+                               hasDimmable  = true;
+                               hasColourable = true;   
+                               break;                  
+                       }
+                       case (0x0220):  
+                       {
+                               //An Color Temp Light
+                               Type = "Color Temp Light"; 
+                               //set a default name that can be renamed later and stored in the hub
+                               Name= (LightDeviceIdx+1) + ": Color Temp Light";        
+                               hasSwitchable = true;
+                               hasDimmable  = true;
+                               hasColourable = true;   
+                               break;                  
+                       }               
+                       case (0x0800):  
+                       {
+                               //A Color Controller
+                               Type = "Color Controller"; 
+                               //set a default name that can be renamed later and stored in the hub
+                               Name= (LightDeviceIdx+1) + ": Color Controller";        
+                               hasOutSwitch = true;
+                               hasOutLeveL  = true;
+                               hasOutColor = true;     
+                               break;                  
+                       }
+                       case (0x0810):  
+                       {
+                               //A Color Scene Controller
+                               Type = "Color Scene Controller"; 
+                               //set a default name that can be renamed later and stored in the hub
+                               Name= (LightDeviceIdx+1) + ": Color Scene Controller";  
+                               hasOutSwitch = true;
+                               hasOutLeveL  = true;
+                               hasOutColor = true;     
+                               hasOutScene = true;
+                               hasOutGroup = true; 
+                               break;                  
+                       }               
+                       case (0x0820):  
+                       {
+                               //A Dimmable Scene Controller
+                               Type = "Dimmable Scene Controller"; 
+                               //set a default name that can be renamed later and stored in the hub
+                               Name= (LightDeviceIdx+1) + ": Dimmable Scene Controller";       
+                               hasOutSwitch = true;
+                               hasOutLeveL  = true;
+                               hasOutScene = true;
+                               hasOutGroup = true; 
+                               break;                  
+                       }
+                       case (0x0830):  
+                       {
+                               //A Dimmable Controller
+                               Type = "Dimmable Controller"; 
+                               //set a default name that can be renamed later and stored in the hub
+                               Name= (LightDeviceIdx+1) + ": Dimmable Controller";     
+                               hasOutSwitch = true;
+                               hasOutLeveL  = true;
+                               break;                  
+                       }
+                       case (0x0840):  
+                       {
+                               //A Control Bridge
+                               Type = "Control Bridge"; 
+                               //set a default name that can be renamed later and stored in the hub
+                               Name= (LightDeviceIdx+1) + ": Control Bridge";  
+                               hasOutSwitch = true;
+                               hasOutLeveL  = true;
+                               hasOutColor = true;     
+                               hasOutScene = true;
+                               hasOutGroup = true; 
+                               break;                  
+                       }       
+                       case (0x0850):  
+                       {
+                               //An On/Off Sensor
+                               Type = "On/Off Sensor"; 
+                               //set a default name that can be renamed later and stored in the hub
+                               Name= (LightDeviceIdx+1) + ": On/Off Sensor";   
+                               hasOutSwitch = true;
+                               break;                  
+                       }
+                       
+                       default:        Type = "Unknown Device"; Name="Unknown";        
+                       }
+               }
+
+               //String notification = "New "+Type+" connected!"; 
+               //ZigbeeNotification.showNotification(notification);
+       }
+       
+       public void addCluster(boolean in, int ClusterId)
+       {
+               if (in)
+               {
+                       switch (ClusterId)
+                       {
+                       case (0x0402): hasThermometer = true;                   break;
+                       case (0x0006): hasSwitchable = true;                    break;
+                       case (0x0008): hasDimmable = true;                      break;
+                       case (0x0300): hasColourable = true;                    break;
+                       case (0x0702): hasPowerUsage = true;                    break;
+                       }
+               } else
+               {
+                       switch (ClusterId)
+                       {
+                       case (0x0006): hasOutSwitch = true;                     break;          
+                       case (0x0008): hasOutLeveL = true;                      break;  
+                       case (0x0300): hasOutColor = true;                      break;          
+                       case (0x0005): hasOutScene = true;                      break;  
+                       case (0x0004): hasOutGroup = true;                      break;                          
+                       }                       
+               }
+       }
+
+       public byte getCurrentState() {
+               return this.currentState;
+       }
+
+       public void setCurrentState(byte currentState) {
+               this.currentState = currentState;
+               this.currentColorAttrsUpdated |= CURRENT_STATE_UPDATED;
+       }
+
+       public byte getCurrentLevel() {
+               return this.currentLevel;
+       }
+
+       public void setCurrentLevel(byte currentLevel) {
+               this.currentLevel = currentLevel;
+               this.currentColorAttrsUpdated |= CURRENT_LEVEL_UPDATED;
+       }
+
+       public byte getCurrentHue() {
+               return this.currentHue;
+       }
+
+       public void setCurrentHue(byte currentHue) {
+               this.currentHue = currentHue;
+               this.currentColorAttrsUpdated |= CURRENT_HUE_UPDATED;
+       }
+
+       public byte getCurrentSat() {
+               return this.currentSat;
+       }
+
+       public void setCurrentSat(byte currentSat) {
+               this.currentSat = currentSat;
+               this.currentColorAttrsUpdated |= CURRENT_SAT_UPDATED;
+       }       
+       
+       public void clearCurrentStateUpdated() {
+               currentColorAttrsUpdated &= ~CURRENT_STATE_UPDATED;
+       }               
+       
+       public void clearCurrentLevelUpdated() {
+               currentColorAttrsUpdated &= ~CURRENT_LEVEL_UPDATED;
+       }
+       
+       public void clearCurrentHueUpdated() {
+               currentColorAttrsUpdated &= ~CURRENT_HUE_UPDATED;
+       }
+       
+       public void clearCurrentSatUpdated() {
+               currentColorAttrsUpdated &= ~CURRENT_SAT_UPDATED;
+       }       
+       
+       public boolean getCurrentStateUpdated() {
+               boolean rtn = true;
+               
+               if(hasSwitchable == false)
+               {
+                       rtn = true;                     
+               }               
+               else if ((currentColorAttrsUpdated & CURRENT_STATE_UPDATED) == 0)
+               {
+                       rtn = false;
+               }
+                               
+               return rtn;
+       }
+       
+       public boolean getCurrentLevelUpdated() {
+               boolean rtn = true;
+               
+               if(hasDimmable == false)
+               {
+                       rtn = true;                     
+               }               
+               else if ((currentColorAttrsUpdated & CURRENT_LEVEL_UPDATED) == 0)
+               {
+                       rtn = false;
+               }               
+               
+               return rtn;
+       }
+       
+       public boolean getCurrentHueUpdated() {
+               boolean rtn = true;
+               
+               if(this.hasColourable == false)
+               {
+                       rtn = true;                     
+               }                       
+               else if ((currentColorAttrsUpdated & CURRENT_HUE_UPDATED) == 0)
+               {
+                       rtn = false;
+               }       
+               
+               return rtn;
+       }
+       
+       public boolean getCurrentSatUpdated() {
+               boolean rtn = true;
+               
+               if(this.hasColourable == false)
+               {
+                       rtn = true;                     
+               }               
+               else if ((currentColorAttrsUpdated & CURRENT_SAT_UPDATED) == 0)
+               {
+                       rtn = false;
+               }
+               
+               return rtn;
+       }       
+}
diff --git a/client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeGroup.java b/client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeGroup.java
new file mode 100644 (file)
index 0000000..cb87ac6
--- /dev/null
@@ -0,0 +1,91 @@
+/**************************************************************************************************
+  Filename:       ZigBeeGroup.java
+  Revised:        $$
+  Revision:       $$
+
+  Description:    ZigBee Group Class
+
+    Copyright (C) {2012} Texas Instruments Incorporated - http://www.ti.com/
+
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the
+     distribution.
+
+     Neither the name of Texas Instruments Incorporated nor the names of
+     its contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**************************************************************************************************/
+package com.lightingcontroller.Zigbee;
+
+public class ZigbeeGroup {
+       private int groupId;
+       private int status;
+       private String groupName;
+
+       public static final byte groupStatusNotActive = 0;
+       public static final byte groupStatusActive =    1;
+               
+       ZigbeeGroup() {}
+       
+       ZigbeeGroup(String name)
+       {
+               setGroupId(0);
+               setGroupName(name);
+               setStatus(groupStatusNotActive);
+       }
+       
+       ZigbeeGroup(String name, int groupId, int satus)
+       {
+               setGroupId(groupId);
+               setGroupName(name);
+               setStatus(satus);
+       }
+
+       public int getGroupId() {
+               return groupId;
+       }
+
+       public void setGroupId(int groupId) {
+               this.groupId = groupId;
+       }
+
+       public int getStatus() {
+               return status;
+       }
+
+       public void setStatus(int status) {
+               this.status = status;
+       }
+
+       public String getGroupName() {
+               return groupName;
+       }
+
+       public void setGroupName(String groupName) {
+               this.groupName = groupName;
+       }
+       
+       
+}
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeNotification.java b/client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeNotification.java
new file mode 100644 (file)
index 0000000..88a7c33
--- /dev/null
@@ -0,0 +1,197 @@
+/**************************************************************************************************
+  Filename:       ZigBeeNotification.java
+  Revised:        $$
+  Revision:       $$
+
+  Description:    ZigBee Notification Class
+
+    Copyright (C) {2012} Texas Instruments Incorporated - http://www.ti.com/
+
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the
+     distribution.
+
+     Neither the name of Texas Instruments Incorporated nor the names of
+     its contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**************************************************************************************************/
+
+package com.lightingcontroller.Zigbee;
+
+import java.util.ArrayList;
+
+import com.lightingcontroller.R;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.graphics.Color;
+import android.graphics.drawable.BitmapDrawable;
+import android.os.Handler;
+import android.util.AttributeSet;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.View.OnTouchListener;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.PopupWindow;
+import android.widget.TextView;
+import android.widget.Toast;
+
+public class ZigbeeNotification {
+
+       static Activity acty;
+       static Handler handle = new Handler();          
+       static boolean alive;
+       static PopupWindow popwindow = null;
+       
+       static ArrayList<String> notices = new ArrayList<String>();
+       
+       static int timeout = 5000;
+       
+       public static void init(Activity a, int time_out)
+       {
+               init(a);
+               timeout = time_out;
+       }
+       
+       public static void init(Activity a)
+       {
+               acty = a;
+               if (notices.size() > 0)
+               {
+                       for (int i = 0 ; i < notices.size() ; i++)
+                       {
+                               showNotificationOnScreen(notices.get(i));
+                       }
+                       for (int i = 0 ; i < notices.size() ; i++)
+                       {
+                               notices.remove(i);
+                       }                       
+               }
+       }
+       
+       public static void closing()
+       {
+               if (popwindow != null)
+               {
+                       popwindow.dismiss();
+                       handle.removeCallbacks(closePopupTask);
+               }
+               popwindow = null;
+               acty = null;
+       }
+       
+       public static void showNotification(String text)
+       {
+               if (acty == null)
+               {
+                       notices.add(text);
+               }
+               else
+               {
+                       showNotificationOnScreen(text);
+               }
+       }
+       
+       public static void showNotificationOnScreen(final String text)
+       {
+               final TextView text1 = new TextView(acty);
+               text1.setText(text);
+               text1.setTextColor(Color.WHITE);
+               text1.setTextSize(18);
+               text1.setGravity(Gravity.CENTER);
+                               
+               if (popwindow == null)
+               {
+                       LayoutInflater inflater = (LayoutInflater) acty.getLayoutInflater();
+                       View layout = inflater.inflate(R.layout.popup,
+                                                      (ViewGroup) acty.findViewById(R.id.toast_layout_root));  
+       
+                       ((LinearLayout) layout.findViewById(R.id.popup_text_box)).addView(text1);
+
+                       popwindow = new PopupWindow(layout,400,100,false); 
+                       popwindow.setAnimationStyle(R.style.Animation_Popup);
+                       popwindow.setBackgroundDrawable(new BitmapDrawable());
+                       popwindow.setOutsideTouchable(false);
+                       popwindow.setTouchable(true);
+                       popwindow.setTouchInterceptor(new OnTouchListener() {
+                       public boolean onTouch(View v, MotionEvent event) {
+                               handle.removeCallbacks(closePopupTask);                 
+                               handle.post(closePopupTask);
+                               return false;
+                               }
+                       });
+                       try{
+                               acty.runOnUiThread (new Runnable(){
+                                       public void run() {
+//                                             if (acty!=null && acty.findViewById(R.id.MainMenu_lay)!=null)
+//                                                     popwindow.showAtLocation(acty.findViewById(R.id.MainMenu_lay), Gravity.CENTER_HORIZONTAL|Gravity.BOTTOM, 0, 0);
+//                                             else
+//                                                     notices.add(text);
+                                       }
+                               });
+                       } catch (Exception e)
+                       {
+                               // Dagnabbit.
+                               popwindow = null;
+                       }
+               }
+               else
+               {
+                       
+                       acty.runOnUiThread (new Runnable(){
+                               public void run() {
+                                       LinearLayout l = (LinearLayout)popwindow.getContentView().findViewById(R.id.popup_text_box);
+                                       if (l.getChildCount()>2)
+                                               l.removeViewAt(0);
+                                       l.addView(text1);
+                                       popwindow.update();
+                               }
+                       });
+               }
+                               
+               handle.removeCallbacks(closePopupTask);
+               handle.postDelayed(closePopupTask, timeout);
+               //SoundManager.playSound(SoundManager.NOTIFY, 1);
+       }
+       
+       
+       private static Runnable closePopupTask = new Runnable() {
+                  public void run() {
+                          if (popwindow!=null)
+                          {
+                                  popwindow.dismiss();
+                                  popwindow = null;
+                          }
+                  }
+               };
+       
+       
+}
diff --git a/client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeScene.java b/client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeScene.java
new file mode 100644 (file)
index 0000000..80016c6
--- /dev/null
@@ -0,0 +1,100 @@
+/**************************************************************************************************
+  Filename:       ZigBeeScene.java
+  Revised:        $$
+  Revision:       $$
+
+  Description:    ZigBee Scene Class
+
+    Copyright (C) {2012} Texas Instruments Incorporated - http://www.ti.com/
+
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the
+     distribution.
+
+     Neither the name of Texas Instruments Incorporated nor the names of
+     its contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**************************************************************************************************/
+
+package com.lightingcontroller.Zigbee;
+
+public class ZigbeeScene {
+       private int groupId;
+       private byte sceneId;
+       private String sceneName;
+       private int status;
+
+       public static final byte sceneStatusNotActive = 0;
+       public static final byte sceneStatusActive =    1;
+       
+       ZigbeeScene() {}
+       
+       public ZigbeeScene(String sName, int groupId)
+       {
+               sceneName = sName;
+               this.groupId = groupId; 
+               setStatus(sceneStatusNotActive);
+       }
+
+       public ZigbeeScene(String name, int groupId, byte sceneId, int satus)
+       {
+               setGroupId(groupId);
+               setSceneId(sceneId);
+               setSceneName(name);
+               setStatus(satus);
+       }       
+
+       public int getGroupId() {
+               return groupId;
+       }
+       
+       public void setGroupId(int groupId) {
+               this.groupId = groupId;
+       }
+
+       public String getSceneName() {
+               return sceneName;
+       }
+
+       public void setSceneName(String sceneName) {
+               this.sceneName = sceneName;
+       }
+
+       public int getStatus() {
+               return status;
+       }
+
+       public void setStatus(int status) {
+               this.status = status;
+       }
+
+       public byte getSceneId() {
+               return sceneId;
+       }
+
+       public void setSceneId(byte sceneId) {
+               this.sceneId = sceneId;
+       }       
+}
diff --git a/client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeSrpcClient.java b/client/AndroidClients/LightingController/src/com/lightingcontroller/Zigbee/ZigbeeSrpcClient.java
new file mode 100644 (file)
index 0000000..812aafb
--- /dev/null
@@ -0,0 +1,1063 @@
+/**************************************************************************************************
+  Filename:       ZigBeeSrpcClient.java
+  Revised:        $$
+  Revision:       $$
+
+  Description:    ZigBee SRPC Client Class
+
+    Copyright (C) {2012} Texas Instruments Incorporated - http://www.ti.com/
+
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the
+     distribution.
+
+     Neither the name of Texas Instruments Incorporated nor the names of
+     its contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**************************************************************************************************/
+
+package com.lightingcontroller.Zigbee;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.math.BigInteger;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.net.UnknownHostException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.TimeUnit;
+
+import com.lightingcontroller.Zigbee.ZigbeeScene;
+
+import android.app.Activity;
+import android.app.ProgressDialog;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
+
+import android.graphics.Color;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.os.Parcelable;
+import android.os.SystemClock;
+import android.util.Log;
+import android.widget.Toast;
+
+public class ZigbeeSrpcClient {
+       
+       static Thread thread;
+       static Socket kkSocket;
+       static OutputStream outStream;
+       static InputStream inStream;
+       
+       private static String gatewayIp= "192.168.1.111";
+       static public String gatewayPort= "11235"; //"2be3";
+
+       //SRPC header bit positions
+       private static final int SRPC_CMD_ID_POS = 0;
+       private static final int SRPC_CMD_LEN_POS = 1;
+       
+       //SRPC CMD ID's 
+       //define the outgoing RPSC command ID's
+       private static final byte RPCS_NEW_ZLL_DEVICE     = (byte) 0x0001;
+       private static final byte RPCS_DEV_ANNCE                      = (byte) 0x0002;
+       private static final byte RPCS_SIMPLE_DESC            = (byte) 0x0003;
+       private static final byte RPCS_TEMP_READING       = (byte) 0x0004;
+       private static final byte RPCS_POWER_READING      = (byte) 0x0005;
+       private static final byte RPCS_PING               = (byte) 0x0006;
+       private static final byte RPCS_GET_DEV_STATE_RSP  = (byte) 0x0007;
+       private static final byte RPCS_GET_DEV_LEVEL_RSP  = (byte) 0x0008;
+       private static final byte RPCS_GET_DEV_HUE_RSP    = (byte) 0x0009;
+       private static final byte RPCS_GET_DEV_SAT_RSP    = (byte) 0x000a;
+       private static final byte RPCS_ADD_GROUP_RSP      = (byte) 0x000b;
+       private static final byte RPCS_GET_GROUP_RSP      = (byte) 0x000c;
+       private static final byte RPCS_ADD_SCENE_RSP      = (byte) 0x000d;
+       private static final byte RPCS_GET_SCENE_RSP      = (byte) 0x000e;
+
+
+       //define incoming RPCS command ID's
+       private static final byte RPCS_CLOSE              = (byte) 0x80;
+       private static final byte RPCS_GET_DEVICES        = (byte) 0x81;
+       private static final byte RPCS_SET_DEV_STATE      = (byte) 0x82;        
+       private static final byte RPCS_SET_DEV_LEVEL      = (byte) 0x83;        
+       private static final byte RPCS_SET_DEV_COLOR      = (byte) 0x84;
+       private static final byte RPCS_GET_DEV_STATE      = (byte) 0x85;        
+       private static final byte RPCS_GET_DEV_LEVEL      = (byte) 0x86;        
+       private static final byte RPCS_GET_DEV_HUE        = (byte) 0x87;
+       private static final byte RPCS_GET_DEV_SAT        = (byte) 0x88;
+       private static final byte RPCS_BIND_DEVICES       = (byte) 0x89;
+       private static final byte RPCS_GET_THERM_READING  = (byte) 0x8a;
+       private static final byte RPCS_GET_POWER_READING  = (byte) 0x8b;
+       private static final byte RPCS_DISCOVER_DEVICES   = (byte) 0x8c;
+       private static final byte RPCS_SEND_ZCL           = (byte) 0x8d;
+       private static final byte RPCS_GET_GROUPS         = (byte) 0x8e;        
+       private static final byte RPCS_ADD_GROUP          = (byte) 0x8f;        
+       private static final byte RPCS_GET_SCENES         = (byte) 0x90;        
+       private static final byte RPCS_STORE_SCENE        = (byte) 0x91;        
+       private static final byte RPCS_RECALL_SCENE       = (byte) 0x92;        
+       private static final byte RPCS_IDENTIFY_DEVICE    = (byte) 0x93;        
+       private static final byte RPCS_CHANGE_DEVICE_NAME = (byte) 0x94;   
+
+       //SRPC AfAddr Addr modes ID's   
+       public static final byte AddrNotPresent = 0;
+       public static final byte AddrGroup = 1;
+       public static final byte Addr16Bit = 2;
+       public static final byte Addr64Bit = 3;
+       public static final byte AddrBroadcast = 1;
+                         
+       public static final String PREFS_NAME = "MyPrefsFile";
+       private static Timer ResponseTimer;
+       private static Handler ResponseTimerHandler;
+       
+       static byte[] srpcResponse;             
+       
+       private static int rpcsProcessIncoming(byte[] msg, int msgPtr)
+       {       
+               int msgLen;             
+               
+               switch (msg[msgPtr + SRPC_CMD_ID_POS])
+               {
+
+               case RPCS_NEW_ZLL_DEVICE:
+               {
+                       int profileId=0, deviceId=0, nwkAddr=0; 
+                       char endPoint;
+                       String deviceName = "";
+                       byte[] ieee = new byte[8];
+
+                       msgLen = msg[msgPtr + SRPC_CMD_LEN_POS] + 2;
+                       //index passed len and cmd ID
+                       msgPtr+=2;
+                       
+                       //Get the NwkAddr
+            for (int i=0; i < 2; i++, msgPtr++) 
+            {   
+               //java does not support unsigned so use a bigger container to avoid conversion issues
+               int nwkAddrTemp = (msg[msgPtr] & 0xff);                  
+               nwkAddr += (nwkAddrTemp << (8 * i));                    
+            }                  
+            
+            //Get the EndPoint
+            endPoint = (char) msg[msgPtr++];
+            
+            //Get the ProfileId
+            for (int i=0; i < 2; i++, msgPtr++) 
+            {   
+               //java does not support unsigned so use a bigger container to avoid conversion issues
+               int profileIdTemp = (msg[msgPtr] & 0xff);                
+               profileId += (profileIdTemp << (8 * i));                
+            }  
+            
+            //Get the DeviceId
+            for (int i=0; i < 2; i++, msgPtr++) 
+            {   
+               //java does not support unsigned so use a bigger container to avoid conversion issues
+               int deviceIdTemp = (msg[msgPtr] & 0xff);                 
+               deviceId += (deviceIdTemp << (8 * i));                  
+            }              
+                       
+            //index passed version
+                       msgPtr++;
+                       
+                       //index passed device name
+                       int nameSize = msg[msgPtr++];
+                       for(int i = 0; i < nameSize; i++)
+                       {
+                               deviceName += (char) msg[msgPtr++];
+                       }                       
+                       msgPtr += nameSize;
+                       
+            //index passed status
+                       msgPtr++;
+                       
+                       //copy IEEE Addr
+                       for(int i = 0; i < 8; i++)
+                       {
+                               ieee[i] = msg[msgPtr++];
+                       }                       
+                       
+            ZigbeeAssistant.newDevice(profileId, deviceId, nwkAddr, endPoint, ieee, deviceName);                      
+                                       
+            break;
+               }
+               case RPCS_ADD_GROUP_RSP:
+               {
+                       short groupId = 0;
+                       msgLen = msg[msgPtr + SRPC_CMD_LEN_POS] + 2;
+                         
+                       //index passed len and cmd ID
+                       msgPtr+=2;
+                       
+                       //Get the GroupId
+            for (int i=0; i < 2; i++, msgPtr++) 
+            {   
+               //java does not support unsigned so use a bigger container to avoid conversion issues
+               int groupIdTemp = (msg[msgPtr] & 0xff);                  
+               groupId += (groupIdTemp << (8 * i));                    
+            }                  
+                       
+            String groupNameStr = new String(msg, msgPtr+1, msg[msgPtr], Charset.defaultCharset());
+                       
+            List<ZigbeeGroup> groupList = ZigbeeAssistant.getGroups();
+            //find the group
+            for(int i=0; i < groupList.size(); i++)
+            {
+               if(groupNameStr.equals(groupList.get(i).getGroupName()))
+               {
+                       groupList.get(i).setGroupId(groupId);
+                       groupList.get(i).setStatus(ZigbeeGroup.groupStatusActive);
+                       break;
+               }
+            }
+                       break;
+               }
+                                               
+               case RPCS_GET_GROUP_RSP:
+               {
+                       short groupId = 0;
+                       msgLen = msg[msgPtr + SRPC_CMD_LEN_POS] + 2;
+                         
+                       //index passed len and cmd ID
+                       msgPtr+=2;
+                       
+                       //Get the groupId
+            for (int i=0; i < 2; i++, msgPtr++) 
+            {   
+               //java does not support unsigned so use a bigger container to avoid conversion issues
+               int groupIdTemp = (msg[msgPtr] & 0xff);                  
+               groupId += (groupIdTemp << (8 * i));                    
+            }                  
+                       
+            String groupNameStr = new String(msg, msgPtr+1, msg[msgPtr], Charset.defaultCharset());
+                       
+            ZigbeeAssistant.newGroup(groupNameStr, groupId, ZigbeeGroup.groupStatusActive);
+            
+                       break;
+               }       
+               
+               case RPCS_ADD_SCENE_RSP:
+               {
+                       short groupId = 0;
+                       byte sceneId = 0;
+                       msgLen = msg[msgPtr + SRPC_CMD_LEN_POS] + 2;
+                         
+                       //index passed len and cmd ID
+                       msgPtr+=2;
+                       
+                       //Get the GroupId
+            for (int i=0; i < 2; i++, msgPtr++) 
+            {   
+               //java does not support unsigned so use a bigger container to avoid conversion issues
+               int groupIdTemp = (msg[msgPtr] & 0xff);                  
+               groupId += (groupIdTemp << (8 * i));                    
+            }          
+            
+            //Get the sceneId
+            sceneId = (byte) msg[msgPtr++];
+                       
+            String sceneNameStr = new String(msg, msgPtr+1, msg[msgPtr], Charset.defaultCharset());
+                       
+            List<ZigbeeScene> sceneList = ZigbeeAssistant.getScenes();
+            //find the scene
+            for(int i=0; i < sceneList.size(); i++)
+            {
+               if(sceneNameStr.equals(sceneList.get(i).getSceneName()) && (groupId == sceneList.get(i).getGroupId() ))
+               {
+                       sceneList.get(i).setSceneId(sceneId);
+                       sceneList.get(i).setStatus(ZigbeeScene.sceneStatusActive);
+                       break;
+               }
+            }
+                       break;
+               }
+                                               
+               case RPCS_GET_SCENE_RSP:
+               {
+                       short groupId = 0;
+                       byte sceneId = 0;
+                       msgLen = msg[msgPtr + SRPC_CMD_LEN_POS] + 2;
+                         
+                       //index passed len and cmd ID
+                       msgPtr+=2;
+
+                       //Get the groupId
+            for (int i=0; i < 2; i++, msgPtr++) 
+            {   
+               //java does not support unsigned so use a bigger container to avoid conversion issues
+               int groupIdTemp = (msg[msgPtr] & 0xff);                  
+               groupId += (groupIdTemp << (8 * i));                    
+            }    
+            
+            //Get the sceneId
+            sceneId = (byte) msg[msgPtr++];            
+                       
+            String sceneNameStr = new String(msg, msgPtr+1, msg[msgPtr], Charset.defaultCharset());
+                       
+            ZigbeeAssistant.newScene(sceneNameStr, groupId, sceneId, ZigbeeScene.sceneStatusActive);
+            
+                       break;
+               }
+               case RPCS_GET_DEV_STATE_RSP:
+               {
+                       short nwkAddr = 0;
+                       byte endPoint = 0;
+                       byte state = 0;
+                       msgLen = msg[msgPtr + SRPC_CMD_LEN_POS] + 2;
+                         
+                       //index passed len and cmd ID
+                       msgPtr+=2;
+
+                       //Get the nwkAddr
+            for (int i=0; i < 2; i++, msgPtr++) 
+            {   
+               //java does not support unsigned so use a bigger container to avoid conversion issues
+               int nwkAddrTemp = (msg[msgPtr] & 0xff);                  
+               nwkAddr += (nwkAddrTemp << (8 * i));                    
+            }    
+            
+            //Get the EP
+            endPoint = (byte) msg[msgPtr++]; 
+
+            //Get the state
+            state = (byte) msg[msgPtr++]; 
+            
+            
+            List<ZigbeeDevice> devList = ZigbeeAssistant.getDevices();            
+            //find the device
+            for (int i = 0 ; i < devList.size() ; i++)
+            {          
+               if( ( ((short) devList.get(i).NetworkAddr) == nwkAddr) && (devList.get(i).EndPoint == endPoint) )
+               {
+                       devList.get(i).setCurrentState(state);
+                       break;
+               }               
+            }                                          
+                       break;
+               }
+               case RPCS_GET_DEV_LEVEL_RSP:
+               {
+                       short nwkAddr = 0;
+                       byte endPoint = 0;
+                       byte level = 0;
+                       msgLen = msg[msgPtr + SRPC_CMD_LEN_POS] + 2;
+                         
+                       //index passed len and cmd ID
+                       msgPtr+=2;
+
+                       //Get the nwkAddr
+            for (int i=0; i < 2; i++, msgPtr++) 
+            {   
+               //java does not support unsigned so use a bigger container to avoid conversion issues
+               int nwkAddrTemp = (msg[msgPtr] & 0xff);                  
+               nwkAddr += (nwkAddrTemp << (8 * i));                    
+            }    
+            
+            //Get the EP
+            endPoint = (byte) msg[msgPtr++]; 
+
+            //Get the state
+            level = (byte) msg[msgPtr++]; 
+            
+            
+            List<ZigbeeDevice> devList = ZigbeeAssistant.getDevices();            
+            //find the device
+            for (int i = 0 ; i < devList.size() ; i++)
+            {          
+               if( ( ((short) devList.get(i).NetworkAddr) == nwkAddr) && (devList.get(i).EndPoint == endPoint) )
+               {
+                       devList.get(i).setCurrentLevel(level);
+                       break;
+               }
+            }                                          
+                       break;                  
+               }               
+               case RPCS_GET_DEV_HUE_RSP:
+               {
+                       short nwkAddr = 0;
+                       byte endPoint = 0;
+                       byte hue = 0;
+                       msgLen = msg[msgPtr + SRPC_CMD_LEN_POS] + 2;
+                         
+                       //index passed len and cmd ID
+                       msgPtr+=2;
+
+                       //Get the nwkAddr
+            for (int i=0; i < 2; i++, msgPtr++) 
+            {   
+               //java does not support unsigned so use a bigger container to avoid conversion issues
+               int nwkAddrTemp = (msg[msgPtr] & 0xff);                  
+               nwkAddr += (nwkAddrTemp << (8 * i));                    
+            }    
+            
+            //Get the EP
+            endPoint = (byte) msg[msgPtr++]; 
+
+            //Get the state
+            hue = (byte) msg[msgPtr++]; 
+            
+            
+            List<ZigbeeDevice> devList = ZigbeeAssistant.getDevices();            
+            //find the device
+            for (int i = 0 ; i < devList.size() ; i++)
+            {          
+               if( ( ((short) devList.get(i).NetworkAddr) == nwkAddr) && (devList.get(i).EndPoint == endPoint) )
+               {
+                       devList.get(i).setCurrentHue(hue);
+                       break;
+               }
+            }                                          
+                       break;
+               }
+               case RPCS_GET_DEV_SAT_RSP:
+               {
+                       short nwkAddr = 0;
+                       byte endPoint = 0;
+                       byte sat = 0;
+                       msgLen = msg[msgPtr + SRPC_CMD_LEN_POS] + 2;
+                         
+                       //index passed len and cmd ID
+                       msgPtr+=2;
+
+                       //Get the nwkAddr
+            for (int i=0; i < 2; i++, msgPtr++) 
+            {   
+               //java does not support unsigned so use a bigger container to avoid conversion issues
+               int nwkAddrTemp = (msg[msgPtr] & 0xff);                  
+               nwkAddr += (nwkAddrTemp << (8 * i));                    
+            }    
+            
+            //Get the EP
+            endPoint = (byte) msg[msgPtr++]; 
+
+            //Get the state
+            sat = (byte) msg[msgPtr++]; 
+            
+            
+            List<ZigbeeDevice> devList = ZigbeeAssistant.getDevices();            
+            //find the device
+            for (int i = 0 ; i < devList.size() ; i++)
+            {          
+               if( ( ((short) devList.get(i).NetworkAddr) == nwkAddr) && (devList.get(i).EndPoint == endPoint) )
+               {
+                       devList.get(i).setCurrentSat(sat);
+                       break;
+               }               
+            }                                          
+                       break;
+               }
+               
+               default:
+               {
+                       msgLen = 0;
+               }               
+               }
+               
+               return msgLen;
+       }
+       
+       public static void setDeviceState(short nwkAddr, byte AddrMode, char endPoint, boolean state)
+       {
+               byte[] msg = new byte[15];
+               byte  msgIdx;
+                
+               //set SRPC len and CMD ID
+               msg[SRPC_CMD_ID_POS] = RPCS_SET_DEV_STATE;
+               msg[SRPC_CMD_LEN_POS] = 13;
+               
+               //set ptr to point to data
+               msgIdx=2;
+               
+               //dstAddr.addrMode
+               msg[msgIdx++] = (byte) AddrMode;
+               //set afAddrMode_t nwk address          
+               msg[msgIdx++] = (byte) (nwkAddr & 0xFF);
+               msg[msgIdx++] = (byte) ((nwkAddr & 0xFF00)>>8);         
+               //pad for an ieee addr size;
+               msgIdx += 6;    
+               //set Ep
+               msg[msgIdx++] = (byte) endPoint;
+               //pad out pan ID
+               msgIdx+=2;
+               
+               //set State
+               if(state)
+               {
+                       msg[msgIdx++] = (byte) 1;
+               }
+               else
+               {
+                       msg[msgIdx++] = (byte) 0;
+               }               
+               
+               sendSrpc(msg);
+               
+       }
+
+       public static void setDeviceLevel(short nwkAddr, byte AddrMode, char endPoint, char level, short transitionTime)
+       {
+               byte[] msg = new byte[17];
+               byte  msgIdx;
+                
+               //set SRPC len and CMD ID
+               msg[SRPC_CMD_ID_POS] = RPCS_SET_DEV_LEVEL;
+               msg[SRPC_CMD_LEN_POS] = 15;
+               
+               //set ptr to point to data
+               msgIdx=2;
+               
+               //dstAddr.addrMode
+               msg[msgIdx++] = (byte) AddrMode;
+               //set afAddrMode_t nwk address          
+               msg[msgIdx++] = (byte) (nwkAddr & 0xFF);
+               msg[msgIdx++] = (byte) ((nwkAddr & 0xFF00)>>8);         
+               //pad for an ieee addr size;
+               msgIdx += 6;    
+               //set Ep
+               msg[msgIdx++] = (byte) endPoint;        
+               //pad out pan ID
+               msgIdx+=2;
+
+               //set level
+               msg[msgIdx++] = (byte) level;   
+
+               //set transitionTime
+               msg[msgIdx++] = (byte) transitionTime;          
+               
+               sendSrpc(msg);          
+       }       
+
+       public static void setDeviceColor(short nwkAddr, byte AddrMode, char endPoint, char hue, char saturation, short transitionTime)
+       {
+               byte[] msg = new byte[18];
+               byte  msgIdx;
+                
+               //set SRPC len and CMD ID
+               msg[SRPC_CMD_ID_POS] = RPCS_SET_DEV_COLOR;
+               msg[SRPC_CMD_LEN_POS] = 16;
+               
+               //set ptr to point to data
+               msgIdx=2;
+               
+               //dstAddr.addrMode
+               msg[msgIdx++] = (byte) AddrMode;
+               //set afAddrMode_t nwk address          
+               msg[msgIdx++] = (byte) (nwkAddr & 0xFF);
+               msg[msgIdx++] = (byte) ((nwkAddr & 0xFF00)>>8);         
+               //pad for an ieee addr size;
+               msgIdx += 6;    
+               //set Ep
+               msg[msgIdx++] = (byte) endPoint;                
+               //pad out pan ID
+               msgIdx+=2;
+
+               //set level
+               msg[msgIdx++] = (byte) hue;     
+
+               //set saturation
+               msg[msgIdx++] = (byte) saturation;      
+               
+               //set transitionTime
+               msg[msgIdx++] = (byte) transitionTime;          
+               
+               sendSrpc(msg);          
+       }       
+
+       public static void getDeviceState(short nwkAddr, byte AddrMode, char endPoint)
+       {
+               byte[] msg = new byte[15];
+               byte  msgIdx;
+                
+               //set SRPC len and CMD ID
+               msg[SRPC_CMD_ID_POS] = RPCS_GET_DEV_STATE;
+               msg[SRPC_CMD_LEN_POS] = 13;
+               
+               //set ptr to point to data
+               msgIdx=2;
+               
+               //dstAddr.addrMode
+               msg[msgIdx++] = (byte) AddrMode;
+               //set afAddrMode_t nwk address          
+               msg[msgIdx++] = (byte) (nwkAddr & 0xFF);
+               msg[msgIdx++] = (byte) ((nwkAddr & 0xFF00)>>8);         
+               //pad for an ieee addr size;
+               msgIdx += 6;    
+               //set Ep
+               msg[msgIdx++] = (byte) endPoint;
+               //pad out pan ID
+               msgIdx+=2;              
+               
+               sendSrpc(msg);          
+       }
+
+       public static void getDeviceLevel(short nwkAddr, byte AddrMode, char endPoint)
+       {
+               byte[] msg = new byte[15];
+               byte  msgIdx;
+                
+               //set SRPC len and CMD ID
+               msg[SRPC_CMD_ID_POS] = RPCS_GET_DEV_LEVEL;
+               msg[SRPC_CMD_LEN_POS] = 13;
+               
+               //set ptr to point to data
+               msgIdx=2;
+               
+               //dstAddr.addrMode
+               msg[msgIdx++] = (byte) AddrMode;
+               //set afAddrMode_t nwk address          
+               msg[msgIdx++] = (byte) (nwkAddr & 0xFF);
+               msg[msgIdx++] = (byte) ((nwkAddr & 0xFF00)>>8);         
+               //pad for an ieee addr size;
+               msgIdx += 6;    
+               //set Ep
+               msg[msgIdx++] = (byte) endPoint;
+               //pad out pan ID
+               msgIdx+=2;              
+               
+               sendSrpc(msg);          
+       }       
+
+       public static void getDeviceHue(short nwkAddr, byte AddrMode, char endPoint)
+       {
+               byte[] msg = new byte[15];
+               byte  msgIdx;
+                
+               //set SRPC len and CMD ID
+               msg[SRPC_CMD_ID_POS] = RPCS_GET_DEV_HUE;
+               msg[SRPC_CMD_LEN_POS] = 13;
+               
+               //set ptr to point to data
+               msgIdx=2;
+               
+               //dstAddr.addrMode
+               msg[msgIdx++] = (byte) AddrMode;
+               //set afAddrMode_t nwk address          
+               msg[msgIdx++] = (byte) (nwkAddr & 0xFF);
+               msg[msgIdx++] = (byte) ((nwkAddr & 0xFF00)>>8);         
+               //pad for an ieee addr size;
+               msgIdx += 6;    
+               //set Ep
+               msg[msgIdx++] = (byte) endPoint;
+               //pad out pan ID
+               msgIdx+=2;              
+               
+               sendSrpc(msg);          
+       }
+
+       public static void getDeviceSat(short nwkAddr, byte AddrMode, char endPoint)
+       {
+               byte[] msg = new byte[15];
+               byte  msgIdx;
+                
+               //set SRPC len and CMD ID
+               msg[SRPC_CMD_ID_POS] = RPCS_GET_DEV_SAT;
+               msg[SRPC_CMD_LEN_POS] = 13;
+               
+               //set ptr to point to data
+               msgIdx=2;
+               
+               //dstAddr.addrMode
+               msg[msgIdx++] = (byte) AddrMode;
+               //set afAddrMode_t nwk address          
+               msg[msgIdx++] = (byte) (nwkAddr & 0xFF);
+               msg[msgIdx++] = (byte) ((nwkAddr & 0xFF00)>>8);         
+               //pad for an ieee addr size;
+               msgIdx += 6;    
+               //set Ep
+               msg[msgIdx++] = (byte) endPoint;
+               //pad out pan ID
+               msgIdx+=2;              
+               
+               sendSrpc(msg);          
+       }
+       
+       public static boolean bindDevices(short network_a, char end_a, byte ieee_a[], short network_b, char end_b, byte ieee_b[], short clusterId)
+       {
+               byte[] msg = new byte[24];
+               byte  msgIdx;
+
+               //set SRPC len and CMD ID
+               msg[SRPC_CMD_ID_POS] = RPCS_BIND_DEVICES;
+               msg[SRPC_CMD_LEN_POS] = 22;
+               
+               //set ptr to point to data
+               msgIdx=2;
+               
+               //set src nwk address           
+               msg[msgIdx++] = (byte) (network_a & 0xFF);
+               msg[msgIdx++] = (byte) ((network_a & 0xFF00)>>8);               
+
+               //set Ep
+               msg[msgIdx++] = (byte) end_a;
+
+               //set ieee of a
+               msg[msgIdx++] = ieee_a[0];
+               msg[msgIdx++] = ieee_a[1];
+               msg[msgIdx++] = ieee_a[2];
+               msg[msgIdx++] = ieee_a[3];
+               msg[msgIdx++] = ieee_a[4];
+               msg[msgIdx++] = ieee_a[5];
+               msg[msgIdx++] = ieee_a[6];
+               msg[msgIdx++] = ieee_a[7];
+
+               //set Ep
+               msg[msgIdx++] = (byte) end_b;
+                 
+               //set ieee of b
+               msg[msgIdx++] = ieee_b[0];
+               msg[msgIdx++] = ieee_b[1];
+               msg[msgIdx++] = ieee_b[2];
+               msg[msgIdx++] = ieee_b[3];
+               msg[msgIdx++] = ieee_b[4];
+               msg[msgIdx++] = ieee_b[5];
+               msg[msgIdx++] = ieee_b[6];
+               msg[msgIdx++] = ieee_b[7];
+
+               //set clusterId         
+               msg[msgIdx++] = (byte) (clusterId & 0xFF);
+               msg[msgIdx++] = (byte) ((clusterId & 0xFF00)>>8);       
+               
+               sendSrpc(msg);
+               
+               return true;
+       }                       
+
+       public static void getDevices()
+       {
+               byte[] msg = new byte[2];
+
+               //set SRPC len and CMD ID
+               msg[SRPC_CMD_ID_POS] = RPCS_GET_DEVICES;
+               msg[SRPC_CMD_LEN_POS] = 0;
+               
+               sendSrpc(msg);
+       }
+       
+       public static void discoverGroups()
+       {
+               byte[] msg = new byte[2];
+
+               //set SRPC len and CMD ID
+               msg[SRPC_CMD_ID_POS] = RPCS_GET_GROUPS;
+               msg[SRPC_CMD_LEN_POS] = 0;
+               
+               sendSrpc(msg);
+       }
+
+       public static void discoverScenes()
+       {
+               byte[] msg = new byte[2];
+
+               //set SRPC len and CMD ID
+               msg[SRPC_CMD_ID_POS] = RPCS_GET_SCENES;
+               msg[SRPC_CMD_LEN_POS] = 0;
+               
+               sendSrpc(msg);
+       }       
+       
+       public static void addGroup(short nwkAddr, char endPoint, String groupName)
+       {
+               byte[] msg = new byte[14 + groupName.length() + 1];
+               byte msgIdx;
+
+               //set SRPC len and CMD ID
+               msg[SRPC_CMD_ID_POS] = RPCS_ADD_GROUP;
+               msg[SRPC_CMD_LEN_POS] = (byte) (12 + groupName.length() + 1);
+               
+               //set ptr to point to data
+               msgIdx=2;
+               
+               //dstAddr.addrMode = Addr16Bit
+               msg[msgIdx++] = (byte) Addr16Bit;
+               //set afAddrMode_t nwk address          
+               msg[msgIdx++] = (byte) (nwkAddr & 0xFF);
+               msg[msgIdx++] = (byte) ((nwkAddr & 0xFF00)>>8);         
+               //pad for an ieee addr size;
+               msgIdx += 6;    
+               //set Ep
+               msg[msgIdx++] = (byte) endPoint;                
+               //pad out pan ID
+               msgIdx+=2;
+
+               msg[msgIdx++] = (byte) groupName.length();
+               for(int i = 0; i < groupName.length(); i++)
+               {
+                       msg[msgIdx++] = groupName.getBytes()[i];
+               }
+                               
+               sendSrpc(msg);                          
+       }
+       
+       public static void storeScene(String sceneName, int groupId)
+       {
+               byte[] msg = new byte[2 + 15 + sceneName.length()];
+               byte msgIdx;
+
+               //set SRPC len and CMD ID
+               msg[SRPC_CMD_ID_POS] = RPCS_STORE_SCENE;
+               msg[SRPC_CMD_LEN_POS] = (byte) (15 + sceneName.length());
+               
+               //set ptr to point to data
+               msgIdx=2;               
+
+               //dstAddr.addrMode = Addr16Bit
+               msg[msgIdx++] = (byte) AddrGroup;
+               //set afAddrMode_t nwk address          
+               msg[msgIdx++] = (byte) (groupId & 0xFF);
+               msg[msgIdx++] = (byte) ((groupId & 0xFF00)>>8);         
+               //pad for an ieee addr size;
+               msgIdx += 6;    
+               //set Ep
+               msg[msgIdx++] = (byte) 0xFF;            
+               //pad out pan ID
+               msgIdx+=2;
+               
+               msg[msgIdx++] = (byte) (groupId & 0xFF);
+               msg[msgIdx++] = (byte) ((groupId & 0xFF00)>>8); 
+
+               msg[msgIdx++] = (byte) sceneName.length();
+               for(int i = 0; i < sceneName.length(); i++)
+               {
+                       msg[msgIdx++] = sceneName.getBytes()[i];
+               }
+               
+               sendSrpc(msg);                                  
+       }
+
+       public static void recallScene(String sceneName, int groupId)
+       {
+               byte[] msg = new byte[2 + 15 + sceneName.length()];
+               byte msgIdx;
+
+               //set SRPC len and CMD ID
+               msg[SRPC_CMD_ID_POS] = RPCS_RECALL_SCENE;
+               msg[SRPC_CMD_LEN_POS] = (byte) (15 + sceneName.length());
+               
+               //set ptr to point to data
+               msgIdx=2;               
+
+               //dstAddr.addrMode = Addr16Bit
+               msg[msgIdx++] = (byte) AddrGroup;
+               //set afAddrMode_t nwk address          
+               msg[msgIdx++] = (byte) (groupId & 0xFF);
+               msg[msgIdx++] = (byte) ((groupId & 0xFF00)>>8);         
+               //pad for an ieee addr size;
+               msgIdx += 6;    
+               //set Ep
+               msg[msgIdx++] = (byte) 0xFF;            
+               //pad out pan ID
+               msgIdx+=2;
+               
+               //set groupId
+               msg[msgIdx++] = (byte) (groupId & 0xFF);
+               msg[msgIdx++] = (byte) ((groupId & 0xFF00)>>8); 
+
+               msg[msgIdx++] = (byte) sceneName.length();
+               for(int i = 0; i < sceneName.length(); i++)
+               {
+                       msg[msgIdx++] = sceneName.getBytes()[i];
+               }
+               
+               sendSrpc(msg);                                  
+       }
+       
+
+       public static void IdentifyDevice(short nwkAddr, byte AddrMode, char endPoint, short identifyTime)
+       {
+               byte[] msg = new byte[16];
+               byte  msgIdx;
+                
+               //set SRPC len and CMD ID
+               msg[SRPC_CMD_ID_POS] = RPCS_IDENTIFY_DEVICE;
+               msg[SRPC_CMD_LEN_POS] = 14;
+               
+               //set ptr to point to data
+               msgIdx=2;
+               
+               //dstAddr.addrMode
+               msg[msgIdx++] = (byte) AddrMode;
+               //set afAddrMode_t nwk address          
+               msg[msgIdx++] = (byte) (nwkAddr & 0xFF);
+               msg[msgIdx++] = (byte) ((nwkAddr & 0xFF00)>>8);         
+               //pad for an ieee addr size;
+               msgIdx += 6;    
+               //set Ep
+               msg[msgIdx++] = (byte) endPoint;        
+               //pad out pan ID
+               msgIdx+=2;
+
+               //set transitionTime
+               msg[msgIdx++] = (byte) identifyTime;            
+               
+               sendSrpc(msg);          
+       }       
+       
+       public static void changeDeviceName(ZigbeeDevice device, String deviceName)
+       {
+               byte[] msg = new byte[4 + deviceName.length()];
+               byte msgIdx;
+
+               //set SRPC len and CMD ID
+               msg[SRPC_CMD_ID_POS] = RPCS_CHANGE_DEVICE_NAME;
+               msg[SRPC_CMD_LEN_POS] = (byte) (2 + deviceName.length());
+               
+               //set ptr to point to data
+               msgIdx=2;               
+
+               //set afAddrMode_t nwk address          
+               msg[msgIdx++] = (byte) (device.NetworkAddr & 0xFF);
+               msg[msgIdx++] = (byte) ((device.NetworkAddr & 0xFF00)>>8);      
+
+               msg[msgIdx++] = (byte) deviceName.length();
+               for(int i = 0; i < deviceName.length(); i++)
+               {
+                       msg[msgIdx++] = deviceName.getBytes()[i];
+               }
+               
+               sendSrpc(msg);                                  
+       }       
+       
+       public static int clientConnect( )
+       {
+               int Port;
+               
+               Port = Integer.parseInt(gatewayPort);                                   
+/*             
+               try {                                   
+                       kkSocket = new Socket(gatewayIp, Port);
+                       //kkSocket = new Socket(); 
+            SocketAddress adr = new InetSocketAddress(gatewayIp,Port);
+                       kkSocket.
+            kkSocket.connect(adr, 5000);                       
+               } catch (UnknownHostException e) { 
+                       e.printStackTrace();
+                       return 1;
+                       //errorMessage("Unknown host" + gatewayIp); 
+               } catch (IOException e) {
+                       e.printStackTrace();
+                       return 1;
+               //errorMessage("Couldn't get I/O for the connection to: " + gatewayIp); 
+               }*/
+               
+        SocketAddress sockaddr = new InetSocketAddress(gatewayIp, Port);
+        kkSocket = new Socket();
+        try {
+                       kkSocket.connect(sockaddr, 5000); //5 second connection timeout
+               } catch (IOException e1) {
+                       return 1;
+               } 
+        
+        
+        if (kkSocket.isConnected()) { 
+               
+                       ZigbeeAssistant.gateWayConnected = true;
+                       
+                       try {
+                               outStream = kkSocket.getOutputStream();
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                               return 1;
+                       }
+                       
+                       try {
+                               inStream = kkSocket.getInputStream();
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                               return 1;
+                       }               
+                       
+                       //create Rx thread
+                       new Thread(new Runnable() 
+                       {    
+                               public void run() {   
+                                       Listen();
+                               }  
+                       }).start();
+                       
+                       return 0;
+        }
+        
+        return 1;
+       }
+       
+       public static void Disconnect()
+       {
+               if(kkSocket != null)
+               {
+               try {
+                               kkSocket.close();
+                       } catch (IOException e) {
+                               // TODO Auto-generated catch block
+                               e.printStackTrace();
+                       }
+                   ZigbeeAssistant.gateWayConnected = false;
+               }
+       }
+       
+
+       public static void sendSrpc(byte[] msg)
+       {
+
+               try{            
+                       outStream.write( msg ); 
+               } catch (Exception e){}         
+       }
+       
+       private static void Listen() {
+       //listen for Packets
+               while(true)
+               {               
+                       byte[] RxBuffer = new byte[1024];
+                       try {
+                               int bytesRead = inStream.read(RxBuffer);
+                               int bytesProcessed = 0;
+                               while ( bytesRead > bytesProcessed )
+                               {
+                                       bytesProcessed += rpcsProcessIncoming(RxBuffer, bytesProcessed);
+                               }
+                       } catch (IOException e) {
+                               // TODO Auto-generated catch block
+                               e.printStackTrace();
+                       }
+               }
+       }
+
+       public static String getGatewayIp() {
+               return gatewayIp;
+       }
+
+       public static void setGatewayIp(String gatewayIp) {
+               ZigbeeSrpcClient.gatewayIp = gatewayIp;
+       }
+}
diff --git a/client/AndroidClients/LightingController/src/com/lightingcontroller/bindSelect.java b/client/AndroidClients/LightingController/src/com/lightingcontroller/bindSelect.java
new file mode 100644 (file)
index 0000000..6709d54
--- /dev/null
@@ -0,0 +1,227 @@
+/**************************************************************************************************
+  Filename:       sceneSelect.java
+  Revised:        $$
+  Revision:       $$
+
+  Description:    ZLL UI
+
+  Copyright (C) {2012} Texas Instruments Incorporated - http://www.ti.com/
+
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the
+     distribution.
+
+     Neither the name of Texas Instruments Incorporated nor the names of
+     its contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**************************************************************************************************/
+
+package com.lightingcontroller;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.lightingcontroller.R;
+import com.lightingcontroller.Zigbee.ZigbeeAssistant;
+import com.lightingcontroller.Zigbee.ZigbeeDevice;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.ProgressDialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.RadioButton;
+import android.widget.Spinner;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ToggleButton;
+
+public class bindSelect extends Activity {
+
+       private static ZigbeeDevice currControllingDevice;
+       private Spinner controllingDeviceSpinner;
+       private ArrayAdapter<String> controllingDeviceSpinnerAdapter;
+
+       private static ZigbeeDevice currControlledDevice;
+       private Spinner controlledDeviceSpinner;
+       private ArrayAdapter<String> controlledDeviceSpinnerAdapter;
+       
+       ProgressDialog bar;
+       
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        this.overridePendingTransition(R.anim.animation_enter_l, R.anim.animation_leave_r);  
+                
+        setContentView(R.layout.bindview);        
+
+               List<ZigbeeDevice> controllingDevList = ZigbeeAssistant.getSwitchers();
+        List<String> controllingDevNameList = new ArrayList<String>();
+        for (int i = 0 ; i < controllingDevList.size() ; i++)
+        {
+               controllingDevNameList.add(controllingDevList.get(i).Name);        
+        }                 
+        controllingDeviceSpinner = (Spinner) findViewById(R.id.controllingDeviceSpinner);
+        controllingDeviceSpinnerAdapter = new ArrayAdapter<String>(this,
+                       android.R.layout.simple_spinner_item, controllingDevNameList);
+        controllingDeviceSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+        controllingDeviceSpinner.setAdapter(controllingDeviceSpinnerAdapter);
+        
+        addItemsOnControllingDeviceSpinner();
+        addListenerOnControllingDeviceSpinnerItemSelection(); 
+
+               List<ZigbeeDevice> controlledDevList = ZigbeeAssistant.getSwitchable();
+        List<String> controlledDevNameList = new ArrayList<String>();
+        for (int i = 0 ; i < controlledDevList.size() ; i++)
+        {
+               controlledDevNameList.add(controlledDevList.get(i).Name);        
+        }                 
+        controlledDeviceSpinner = (Spinner) findViewById(R.id.controlledDeviceSpinner);
+        controlledDeviceSpinnerAdapter = new ArrayAdapter<String>(this,
+                       android.R.layout.simple_spinner_item, controlledDevNameList);
+        controlledDeviceSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+        controlledDeviceSpinner.setAdapter(controlledDeviceSpinnerAdapter);
+        
+        addItemsOnControlledDeviceSpinner();
+        addListenerOnControlledDeviceSpinnerItemSelection();         
+    }    
+
+    // add items into spinner dynamically
+    public void addItemsOnControllingDeviceSpinner() {  
+       //add devices
+        List<ZigbeeDevice> devList = ZigbeeAssistant.getSwitchers();
+        controllingDeviceSpinnerAdapter.clear();
+        for (int i = 0 ; i < devList.size() ; i++)
+        {              
+               controllingDeviceSpinnerAdapter.add(devList.get(i).Name);
+        }     
+    }
+   
+    public void addListenerOnControllingDeviceSpinnerItemSelection() {         
+       controllingDeviceSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
+           @Override
+           public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
+               List<ZigbeeDevice> devList = ZigbeeAssistant.getSwitchers();                    
+               currControllingDevice = devList.get(position);
+           }
+        
+         @Override
+         public void onNothingSelected(AdapterView<?> arg0) {
+         }
+       });
+    }        
+
+    // add items into spinner dynamically
+    public void addItemsOnControlledDeviceSpinner() {  
+       //add devices
+        List<ZigbeeDevice> devList = ZigbeeAssistant.getSwitchable();
+        controlledDeviceSpinnerAdapter.clear();
+        for (int i = 0 ; i < devList.size() ; i++)
+        {              
+               controlledDeviceSpinnerAdapter.add(devList.get(i).Name);
+        }     
+    }
+   
+    public void addListenerOnControlledDeviceSpinnerItemSelection() {          
+       controlledDeviceSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
+           @Override
+           public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
+               List<ZigbeeDevice> devList = ZigbeeAssistant.getSwitchable();                   
+               currControlledDevice = devList.get(position);
+           }
+        
+         @Override
+         public void onNothingSelected(AdapterView<?> arg0) {
+         }
+       });
+    }            
+    
+    public void IdControllingButton(View view) {
+       ToggleButton idDeviceButton = (ToggleButton) findViewById(R.id.IdControllingToggle);
+       if ( (idDeviceButton.isChecked()) && (currControllingDevice != null))
+       {
+               //ZigbeeAssistant.Identify(currControllingDevice, (short) 0x80);
+       }
+       else if(currControllingDevice != null)
+       {
+               //ZigbeeAssistant.Identify(currControllingDevice, (short) 0);                   
+       }    
+    }
+    
+    public void IdControlledButton(View view) {
+       ToggleButton idDeviceButton = (ToggleButton) findViewById(R.id.IdControlledToggle);
+       if ( (idDeviceButton.isChecked()) && (currControlledDevice != null))
+       {
+               //ZigbeeAssistant.Identify(currControlledDevice, (short) 0x80);
+       }
+       else if(currControlledDevice != null)
+       {
+               //ZigbeeAssistant.Identify(currControlledDevice, (short) 0);                    
+       }    
+    }
+    
+    public void bindButton(View view) {
+
+       //de-select button
+       RadioButton bindRadio = (RadioButton) findViewById(R.id.bindRadio);
+       bindRadio.setChecked(false);
+       
+       if((currControllingDevice != null) && (currControlledDevice != null))
+       {
+               AlertDialog show = new AlertDialog.Builder(bindSelect.this)
+                       .setTitle("Bind devices")
+                       .setMessage("Bind " + currControllingDevice.Name + " to " + currControlledDevice.Name)
+                       .setPositiveButton("OK",             
+                       new DialogInterface.OnClickListener()
+                       {                       
+                               public void onClick(DialogInterface dialoginterface,int i){             
+                                       //only support on/off for now but can expand to others by adding a spinner 
+                                       //to select cluster and populate controlling and controlled spinners accordingly 
+                               ZigbeeAssistant.bindDevices(currControllingDevice, currControlledDevice, 0x0006); 
+                               }               
+                       })                              
+                       .setNegativeButton("Cancel", null)
+                       .show();                                
+       }
+       else
+       {
+               AlertDialog show = new AlertDialog.Builder(bindSelect.this)
+                       .setTitle("Bind devices")
+                       .setMessage("Select controlling and controlled")
+                       .setPositiveButton("OK",             
+                       new DialogInterface.OnClickListener()
+                       {                       
+                               public void onClick(DialogInterface dialoginterface,int i){                                     
+                               }               
+                       })                              
+                       .show();                                
+       }               
+
+    }    
+       
+}
+
diff --git a/client/AndroidClients/LightingController/src/com/lightingcontroller/groupSelect.java b/client/AndroidClients/LightingController/src/com/lightingcontroller/groupSelect.java
new file mode 100644 (file)
index 0000000..baa6120
--- /dev/null
@@ -0,0 +1,353 @@
+/**************************************************************************************************
+  Filename:       groupSelect.java
+  Revised:        $$
+  Revision:       $$
+
+  Description:    ZLL UI
+
+  Copyright (C) {2012} Texas Instruments Incorporated - http://www.ti.com/
+
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the
+     distribution.
+
+     Neither the name of Texas Instruments Incorporated nor the names of
+     its contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**************************************************************************************************/
+package com.lightingcontroller;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.lightingcontroller.R;
+import com.lightingcontroller.Zigbee.ZigbeeAssistant;
+import com.lightingcontroller.Zigbee.ZigbeeDevice;
+import com.lightingcontroller.Zigbee.ZigbeeGroup;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.ProgressDialog;
+import android.content.DialogInterface;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.EditText;
+import android.widget.RadioButton;
+import android.widget.Spinner;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ToggleButton;
+
+public class groupSelect extends Activity {
+
+       private static ZigbeeDevice currDevice;
+       private Spinner deviceSpinner;
+       private ArrayAdapter<String> deviceSpinnerAdapter;
+       private int currentDeviceSpinnerSelection=0;
+       
+       private static int currGroup = 0;
+       private static Spinner groupSpinner;
+       private static ArrayAdapter<String> groupSpinnerAdapter;        
+       
+       ProgressDialog bar;
+       
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        this.overridePendingTransition(R.anim.animation_enter_l, R.anim.animation_leave_r);  
+                
+        setContentView(R.layout.groupview);        
+
+               List<ZigbeeDevice> devList = ZigbeeAssistant.getSwitchable();
+        List<String> devNameList = new ArrayList<String>();
+        for (int i = 0 ; i < devList.size() ; i++)
+        {
+               devNameList.add(devList.get(i).Name);        
+        }                 
+       deviceSpinner = (Spinner) findViewById(R.id.deviceSpinner);
+       deviceSpinnerAdapter = new ArrayAdapter<String>(this,
+                       android.R.layout.simple_spinner_item, devNameList);
+       deviceSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+       deviceSpinner.setAdapter(deviceSpinnerAdapter);
+        
+        addItemsOnDeviceSpinner();
+        addListenerOnDeviceSpinnerItemSelection(); 
+        
+        List<ZigbeeGroup> groupList = ZigbeeAssistant.getGroups();
+        List<String> groupNameList = new ArrayList<String>();
+        for (int i = 0 ; i < groupList.size() ; i++)
+        {
+               groupNameList.add(groupList.get(i).getGroupName());        
+        }                 
+       groupSpinner = (Spinner) findViewById(R.id.groupSpinner);
+       groupSpinnerAdapter = new ArrayAdapter<String>(this,
+                       android.R.layout.simple_spinner_item, groupNameList);
+       groupSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+        groupSpinner.setAdapter(groupSpinnerAdapter);
+               
+        addItemsOnGroupSpinner();
+        addListenerOnGroupSpinnerItemSelection();           
+    
+    }    
+
+    // add items into spinner dynamically
+    public void addItemsOnDeviceSpinner() {  
+       //add devices
+        List<ZigbeeDevice> devList = ZigbeeAssistant.getSwitchable();
+        deviceSpinnerAdapter.clear();
+        for (int i = 0 ; i < devList.size() ; i++)
+        {              
+               deviceSpinnerAdapter.add(devList.get(i).Name);
+        }     
+    }
+   
+    public void addListenerOnDeviceSpinnerItemSelection() {            
+       deviceSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
+           @Override
+           public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
+               List<ZigbeeDevice> devList = ZigbeeAssistant.getSwitchable();                   
+               currentDeviceSpinnerSelection = position;
+               currDevice = devList.get(currentDeviceSpinnerSelection);
+           }
+        
+         @Override
+         public void onNothingSelected(AdapterView<?> arg0) {
+         }
+       });
+    }
+    
+    // add items into spinner dynamically
+    public void addItemsOnGroupSpinner() {          
+        List<ZigbeeGroup> groupList = ZigbeeAssistant.getGroups();
+        groupSpinnerAdapter.clear();
+        for (int i = 0 ; i < groupList.size() ; i++)
+        {              
+               groupSpinnerAdapter.add(groupList.get(i).getGroupName());
+        }
+    }
+   
+    public void addListenerOnGroupSpinnerItemSelection() {
+       groupSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
+           @Override
+           public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
+               currGroup = position;
+         }
+        
+         @Override
+         public void onNothingSelected(AdapterView<?> arg0) {
+               // TODO Auto-generated method stub
+               currGroup = -1;  
+         }
+       });
+    }
+
+    public void deviceChangeNameButton(View view)
+    { 
+       String Title = "Set Name";
+       String Msg = "Please Enter the name of the device";
+       final EditText t = new EditText(this);
+
+       new AlertDialog.Builder(this)
+               .setTitle(Title)
+               .setMessage(Msg)
+               .setView(t)
+               .setNegativeButton("CANCEL", null)
+               .setPositiveButton("OK",             
+               new DialogInterface.OnClickListener()
+               {                       
+                       public void onClick(DialogInterface dialoginterface,int i){     
+                       ZigbeeAssistant.setDeviceName( currDevice.Name, t.getText().toString());                                        
+                       addItemsOnDeviceSpinner();      
+                       }               
+               })
+               .show();                        
+    }          
+    
+    public void newGroupCmdButton(View view) {
+
+       //de-select button
+       RadioButton newGroupRadio = (RadioButton) findViewById(R.id.newGroupRadio);
+       newGroupRadio.setChecked(false);
+               
+       final EditText t = new EditText(this);
+
+       new AlertDialog.Builder(this)
+               .setTitle("Create Group")
+               .setMessage("Enter the new groups name")
+               .setView(t)
+               .setPositiveButton("OK",          
+               new DialogInterface.OnClickListener()
+               {                       
+                       public void onClick(DialogInterface dialoginterface,int i){                                                                     
+                                       ZigbeeAssistant.newGroup(t.getText().toString() );                                                      
+                               //set selection to the new group, which will be last as this is a new one                                               
+                               currGroup = groupSpinnerAdapter.getCount();                                     
+                               new waitRspTask().execute("Create Group");                                      
+                               groupSpinner.setSelection(currGroup);
+                               //update the spinner
+                               addItemsOnGroupSpinner();                                                                                   
+                       }               
+               })                              
+               .setNegativeButton("Cancel", null)
+               .show();                
+       }
+         
+
+
+    class waitRspTask extends AsyncTask<String , Integer, Void>
+    {
+       private boolean rspSuccess;
+       String param;
+        @Override
+        protected void onPreExecute()
+        {
+            bar = new ProgressDialog(groupSelect.this);
+            bar.setMessage("Processing..");
+            bar.setIndeterminate(true);
+            bar.show();
+        } 
+        @Override
+        protected Void doInBackground(String... params) 
+        {
+               param = params[0];
+               List<ZigbeeGroup> groupList = ZigbeeAssistant.getGroups();
+               //currGroup = 0;
+            for(int i=0;i<10;i++)
+            {
+               if(currGroup < groupList.size())
+               {
+                       //check if group response updated the groupId          
+                       if (groupList.get(currGroup).getStatus() == ZigbeeGroup.groupStatusActive)
+                       {
+                               rspSuccess = true;
+                               return null;
+                       }
+               }
+                       
+                   try
+                   {
+                       Thread.sleep(500);
+                   }
+                   catch(Exception e)
+                   {
+                       System.out.println(e);
+                   }    
+                           
+            }
+                                               
+            rspSuccess = false;    
+            return null;
+        }
+        @Override
+        protected void onPostExecute(Void result) 
+        {
+            bar.dismiss();
+            
+            if (rspSuccess == false)
+               {
+               AlertDialog show = new AlertDialog.Builder(groupSelect.this)
+                       .setTitle(param)
+                       .setMessage("No response from gateway. " + param + " failed.")
+                       .setPositiveButton("OK",             
+                       new DialogInterface.OnClickListener()
+                       {                       
+                               public void onClick(DialogInterface dialoginterface,int i){                                     
+                               }               
+                       })                              
+                       .show();
+               }
+            
+        }
+    }
+        
+
+    public void addToGroupCmdButton(View view) {
+
+       //de-select button
+       RadioButton addToGroupRadio = (RadioButton) findViewById(R.id.addToGroupRadio);
+       addToGroupRadio.setChecked(false);
+       
+       if((currGroup != -1) && (currDevice != null))
+       {
+               AlertDialog show = new AlertDialog.Builder(groupSelect.this)
+                       .setTitle("Add Light to group")
+                       .setMessage("Add Light Selected Light to Group " + currGroup)
+                       .setPositiveButton("OK",             
+                       new DialogInterface.OnClickListener()
+                       {                       
+                               public void onClick(DialogInterface dialoginterface,int i){                                                                     
+                               ZigbeeAssistant.addGroup(currDevice, groupSpinnerAdapter.getItem(currGroup)); 
+                               }               
+                       })                              
+                       .setNegativeButton("Cancel", null)
+                       .show();                                
+       }
+       else
+       {
+               AlertDialog show = new AlertDialog.Builder(groupSelect.this)
+                       .setTitle("Add Light to group")
+                       .setMessage("Select device and group")
+                       .setPositiveButton("OK",             
+                       new DialogInterface.OnClickListener()
+                       {                       
+                               public void onClick(DialogInterface dialoginterface,int i){                                     
+                               }               
+                       })                              
+                       .show();                                
+       }               
+
+    }
+    
+    public void IdLightCmdButton(View view) {
+       ToggleButton idLightButton = (ToggleButton) findViewById(R.id.IdLightToggle);
+       if (idLightButton.isChecked())
+       {
+               //ZigbeeAssistant.Identify(currDevice, (short) 0x80);
+       }
+       else
+       {
+               //ZigbeeAssistant.Identify(currDevice, (short) 0);              
+       }    
+    }
+    
+    public void IdGroupCmdButton(View view) {
+       ToggleButton idGroupButton = (ToggleButton) findViewById(R.id.IdGroupToggle);
+       List<ZigbeeGroup> groupList = ZigbeeAssistant.getGroups();
+       ZigbeeGroup group = groupList.get(currGroup);
+                       
+       if (idGroupButton.isChecked())
+       {
+               //ZigbeeAssistant.Identify(group, (short) 0xFFFF);
+       }
+       else
+       {
+               //ZigbeeAssistant.Identify(group, (short) 0);                   
+       }       
+    }
+       
+}
+
diff --git a/client/AndroidClients/LightingController/src/com/lightingcontroller/optionsMenu.java b/client/AndroidClients/LightingController/src/com/lightingcontroller/optionsMenu.java
new file mode 100644 (file)
index 0000000..74277d5
--- /dev/null
@@ -0,0 +1,54 @@
+/**************************************************************************************************
+  Filename:       optionsMenu.java
+  Revised:        $$
+  Revision:       $$
+
+  Description:    ZLL UI
+  
+  Copyright (C) {2012} Texas Instruments Incorporated - http://www.ti.com/
+
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the
+     distribution.
+
+     Neither the name of Texas Instruments Incorporated nor the names of
+     its contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**************************************************************************************************/
+package com.lightingcontroller;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class optionsMenu extends Activity {
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.optionmenu);
+    }
+    
+}
\ No newline at end of file
diff --git a/client/AndroidClients/LightingController/src/com/lightingcontroller/sceneSelect.java b/client/AndroidClients/LightingController/src/com/lightingcontroller/sceneSelect.java
new file mode 100644 (file)
index 0000000..4b6b2b4
--- /dev/null
@@ -0,0 +1,310 @@
+/**************************************************************************************************
+  Filename:       sceneSelect.java
+  Revised:        $$
+  Revision:       $$
+
+  Description:    ZLL UI
+
+  Copyright (C) {2012} Texas Instruments Incorporated - http://www.ti.com/
+
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the
+     distribution.
+
+     Neither the name of Texas Instruments Incorporated nor the names of
+     its contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**************************************************************************************************/
+package com.lightingcontroller;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.lightingcontroller.R;
+import com.lightingcontroller.Zigbee.ZigbeeAssistant;
+import com.lightingcontroller.Zigbee.ZigbeeGroup;
+import com.lightingcontroller.Zigbee.ZigbeeScene;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.ProgressDialog;
+import android.content.DialogInterface;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.EditText;
+import android.widget.Spinner;
+import android.widget.AdapterView.OnItemSelectedListener;
+
+public class sceneSelect extends Activity {
+
+       private static int currGroup = 0;
+       private static Spinner groupSpinner;
+       private static ArrayAdapter<String> groupSpinnerAdapter;
+       
+       private static int currScene;
+       private Spinner sceneSpinner;
+       private ArrayAdapter<String> sceneSpinnerAdapter;
+       
+       ProgressDialog bar;
+       
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        this.overridePendingTransition(R.anim.animation_enter_l, R.anim.animation_leave_r);  
+                
+        setContentView(R.layout.sceneview);        
+          
+        List<ZigbeeGroup> groupList = ZigbeeAssistant.getGroups();
+        List<String> groupNameList = new ArrayList<String>();
+        for (int i = 0 ; i < groupList.size() ; i++)
+        {
+               groupNameList.add(groupList.get(i).getGroupName());        
+        }                 
+       groupSpinner = (Spinner) findViewById(R.id.groupSpinner);
+       groupSpinnerAdapter = new ArrayAdapter<String>(this,
+                       android.R.layout.simple_spinner_item, groupNameList);
+       groupSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+        groupSpinner.setAdapter(groupSpinnerAdapter);
+               
+        addItemsOnGroupSpinner();
+        addListenerOnGroupSpinnerItemSelection();  
+
+        List<ZigbeeScene> sceneList = ZigbeeAssistant.getScenes();
+        List<String> sceneNameList = new ArrayList<String>();
+        for (int i = 0 ; i < sceneList.size() ; i++)
+        {
+               sceneNameList.add(sceneList.get(i).getSceneName());        
+        }                 
+       sceneSpinner = (Spinner) findViewById(R.id.sceneSelectSpinner);
+       sceneSpinnerAdapter = new ArrayAdapter<String>(this,
+                       android.R.layout.simple_spinner_item, sceneNameList);
+       sceneSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+       sceneSpinner.setAdapter(sceneSpinnerAdapter);        
+
+        addItemsOnSceneSpinner();
+        addListenerOnSceneSpinnerItemSelection();              
+    }    
+
+    // add items into spinner dynamically
+    public void addItemsOnGroupSpinner() {          
+        List<ZigbeeGroup> groupList = ZigbeeAssistant.getGroups();
+        groupSpinnerAdapter.clear();
+        for (int i = 0 ; i < groupList.size() ; i++)
+        {              
+               groupSpinnerAdapter.add(groupList.get(i).getGroupName());
+        }
+    }
+   
+    public void addListenerOnGroupSpinnerItemSelection() {
+       groupSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
+           @Override
+           public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
+               currGroup = position;
+               currScene = 0;
+               //change the scene spinner to reflect the new group 
+               addItemsOnSceneSpinner();
+         }
+        
+         @Override
+         public void onNothingSelected(AdapterView<?> arg0) {
+               // TODO Auto-generated method stub
+               currGroup = -1;  
+         }
+       });
+    }
+    
+    // add items into spinner dynamically
+    public void addItemsOnSceneSpinner() {          
+        List<ZigbeeScene> sceneList = ZigbeeAssistant.getScenes();
+        List<ZigbeeGroup> groupList = ZigbeeAssistant.getGroups();
+        sceneSpinnerAdapter.clear();
+        if(currGroup != -1)
+        {              
+               for (int i = 0 ; i < sceneList.size() ; i++)
+               {    
+                       if(groupList.get(currGroup).getGroupId() == sceneList.get(i).getGroupId())
+                       {
+                               sceneSpinnerAdapter.add(sceneList.get(i).getSceneName());
+                       }
+               }
+        }
+    }
+   
+    public void addListenerOnSceneSpinnerItemSelection() {
+       sceneSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
+           @Override
+           public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
+               currScene = position;
+         }
+        
+         @Override
+         public void onNothingSelected(AdapterView<?> arg0) {
+               // TODO Auto-generated method stub
+               currScene = -1;  
+         }
+       });
+    }    
+
+
+    public void newSceneButton(View view) {
+
+       final EditText t = new EditText(this);
+
+       new AlertDialog.Builder(this)
+               .setTitle("Create Scene")
+               .setMessage("Enter the new scene name")
+               .setView(t)
+               .setPositiveButton("OK",          
+               new DialogInterface.OnClickListener()
+               {                       
+                       public void onClick(DialogInterface dialoginterface,int i){     
+                               List<ZigbeeGroup> groupList = ZigbeeAssistant.getGroups();                              
+                               ZigbeeAssistant.newScene(t.getText().toString(), groupList.get(currGroup).getGroupId() );                                                       
+                       //set selection to the new group, which will be last as this is a new one                                               
+                       currScene = sceneSpinnerAdapter.getCount();                                     
+                       new waitRspTask().execute("Create Scene");                                      
+                       sceneSpinner.setSelection(currScene);
+                       //update the spinner
+                       addItemsOnSceneSpinner();                                                                                   
+                       }               
+               })                              
+               .setNegativeButton("Cancel", null)
+               .show();                
+       }
+         
+
+
+    class waitRspTask extends AsyncTask<String , Integer, Void>
+    {
+       private boolean rspSuccess;
+       String param;
+        @Override
+        protected void onPreExecute()
+        {
+            bar = new ProgressDialog(sceneSelect.this);
+            bar.setMessage("Processing..");
+            bar.setIndeterminate(true);
+            bar.show();
+        } 
+        @Override
+        protected Void doInBackground(String... params) 
+        {
+               param = params[0];
+               List<ZigbeeScene> sceneList = ZigbeeAssistant.getScenes();
+               //currGroup = 0;
+            for(int i=0;i<10;i++)
+            {
+               if(currScene < sceneList.size())
+               {
+                       //check if group response updated the groupId          
+                       if (sceneList.get(currScene).getStatus() == ZigbeeScene.sceneStatusActive)
+                       {
+                               rspSuccess = true;
+                               return null;
+                       }
+               }
+                       
+                   try
+                   {
+                       Thread.sleep(500);
+                   }
+                   catch(Exception e)
+                   {
+                       System.out.println(e);
+                   }    
+                           
+            }
+                                               
+            rspSuccess = false;    
+            return null;
+        }
+        @Override
+        protected void onPostExecute(Void result) 
+        {
+            bar.dismiss();
+            
+            if (rspSuccess == false)
+               {
+               AlertDialog show = new AlertDialog.Builder(sceneSelect.this)
+                       .setTitle(param)
+                       .setMessage("No response from gateway. " + param + " failed.")
+                       .setPositiveButton("OK",             
+                       new DialogInterface.OnClickListener()
+                       {                       
+                               public void onClick(DialogInterface dialoginterface,int i){                                     
+                               }               
+                       })                              
+                       .show();
+               }
+            
+        }
+    }
+        
+
+    public void sceneStoreButton(View view) {
+       
+       if(currGroup != -1)
+       {
+               AlertDialog show = new AlertDialog.Builder(sceneSelect.this)
+                       .setTitle("Store Scene to group")
+                       .setMessage("Add Scene Selected Light to Group " + currGroup)
+                       .setPositiveButton("OK",             
+                       new DialogInterface.OnClickListener()
+                       {                       
+                               public void onClick(DialogInterface dialoginterface,int i){     
+                                       List<ZigbeeScene> sceneList = ZigbeeAssistant.getScenes();
+                                       List<ZigbeeGroup> groupList = ZigbeeAssistant.getGroups();                                                                      
+                                       ZigbeeAssistant.storeScene(sceneList.get(currScene).getSceneName(), groupList.get(currGroup).getGroupId() );                                            
+                               }               
+                       })                              
+                       .setNegativeButton("Cancel", null)
+                       .show();                                
+       }
+       else
+       {
+               AlertDialog show = new AlertDialog.Builder(sceneSelect.this)
+                       .setTitle("Store Scene to group")
+                       .setMessage("No scene selected ")
+                       .setPositiveButton("OK",             
+                       new DialogInterface.OnClickListener()
+                       {                       
+                               public void onClick(DialogInterface dialoginterface,int i){                                     
+                               }               
+                       })                              
+                       .show();                                
+       }               
+
+    }     
+
+    public void sceneRestoreButton(View view) {
+               List<ZigbeeScene> sceneList = ZigbeeAssistant.getScenes();      
+               List<ZigbeeGroup> groupList = ZigbeeAssistant.getGroups();      
+               ZigbeeAssistant.recallScene(sceneList.get(currScene).getSceneName(), groupList.get(currGroup).getGroupId() );
+    }  
+}
+
diff --git a/client/AndroidClients/LightingController/src/com/lightingcontroller/zllMain.java b/client/AndroidClients/LightingController/src/com/lightingcontroller/zllMain.java
new file mode 100644 (file)
index 0000000..79e050f
--- /dev/null
@@ -0,0 +1,501 @@
+/**************************************************************************************************
+  Filename:       zllMain.java
+  Revised:        $$
+  Revision:       $$
+
+  Description:    ZLL UI
+
+  Copyright (C) {2012} Texas Instruments Incorporated - http://www.ti.com/
+
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the
+     distribution.
+
+     Neither the name of Texas Instruments Incorporated nor the names of
+     its contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**************************************************************************************************/
+
+package com.lightingcontroller;
+
+import android.app.Activity;
+import android.app.ProgressDialog;
+import android.os.AsyncTask;
+import android.os.Bundle;