summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTonyCave2013-12-10 16:56:12 -0600
committerTonyCave2013-12-10 16:56:12 -0600
commit86e1a045561c24b5bb1e0995ed6b1c7e08b10d90 (patch)
tree0b479b50ff15afc0b1d59a638790be272221a4c8
parent595727bc69037f52ffe502671c58206db4bb871b (diff)
downloadlighting-gateway-86e1a045561c24b5bb1e0995ed6b1c7e08b10d90.tar.gz
lighting-gateway-86e1a045561c24b5bb1e0995ed6b1c7e08b10d90.tar.xz
lighting-gateway-86e1a045561c24b5bb1e0995ed6b1c7e08b10d90.zip
Updated Android App
-rw-r--r--client/AndroidClients/LightingController/bin/LightingController.apkbin90216 -> 90005 bytes
-rwxr-xr-xclient/AndroidClients/LightingController/src/com/lightingcontroller/LightingController.java100
2 files changed, 10 insertions, 90 deletions
diff --git a/client/AndroidClients/LightingController/bin/LightingController.apk b/client/AndroidClients/LightingController/bin/LightingController.apk
index 013770d..faaf8f4 100644
--- a/client/AndroidClients/LightingController/bin/LightingController.apk
+++ b/client/AndroidClients/LightingController/bin/LightingController.apk
Binary files differ
diff --git a/client/AndroidClients/LightingController/src/com/lightingcontroller/LightingController.java b/client/AndroidClients/LightingController/src/com/lightingcontroller/LightingController.java
index 4ee66fd..b35bb9a 100755
--- a/client/AndroidClients/LightingController/src/com/lightingcontroller/LightingController.java
+++ b/client/AndroidClients/LightingController/src/com/lightingcontroller/LightingController.java
@@ -67,95 +67,9 @@ public class LightingController extends Activity{
67 67
68 new ZigbeeAssistant(); 68 new ZigbeeAssistant();
69 69
70 new waitRspTask().execute("Connecting to gateway"); 70 new waitRspTask().execute("Connecting to gateway");
71/*
72 ///Open SRPC
73 if(connectSrcpGateway())
74 {
75 ZigbeeSrpcClient.getDevices();
76 ZigbeeSrpcClient.discoverGroups();
77 ZigbeeSrpcClient.discoverScenes();
78 //wait for responses
79 try { TimeUnit.MILLISECONDS.sleep(200); } catch (InterruptedException e) {e.printStackTrace();}
80
81 startActivity(new Intent(LightingController.this, zllMain.class));
82 finish();
83 }
84*/
85 } 71 }
86 72
87
88 private boolean connectSrcpGateway()
89 {
90 String gatewayIpAddr;
91
92 SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
93 gatewayIpAddr = settings.getString("gatewayIpAddr", null);
94
95 if(gatewayIpAddr != null)
96 {
97 ZigbeeSrpcClient.setGatewayIp(gatewayIpAddr);
98 }
99 else
100 {
101 //get IPAddr from user
102 setSrcpGatewayIpAddress();
103 }
104
105 if( ZigbeeSrpcClient.clientConnect() == 0)
106 {
107 SharedPreferences.Editor editor = settings.edit();
108 editor.putString("gatewayIpAddr", gatewayIpAddr);
109 }
110 else
111 {
112 //get IPAddr from user
113 setSrcpGatewayIpAddress();
114 return false;
115 }
116
117 return true;
118 }
119
120 private void setSrcpGatewayIpAddress()
121 {
122 final EditText t = new EditText(this);
123 t.setText("192.168.1.111");
124
125 new AlertDialog.Builder(this)
126 .setTitle("Gateway Address")
127 .setMessage("Please Enter the HA Gateway IP Address")
128 .setView(t)
129 .setPositiveButton("OK",
130 new DialogInterface.OnClickListener()
131 {
132 public void onClick(DialogInterface dialoginterface,int i){
133 String gatewayIpAddr;
134 gatewayIpAddr = t.getText().toString();
135
136 //retrieve path setting
137 SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
138 settings.getString("gatewayIpAddr", gatewayIpAddr);
139
140 if(gatewayIpAddr != null)
141 {
142 if(connectSrcpGateway())
143 {
144 ZigbeeSrpcClient.getDevices();
145 ZigbeeSrpcClient.discoverGroups();
146 ZigbeeSrpcClient.discoverScenes();
147 //wait for responses
148 try { TimeUnit.MILLISECONDS.sleep(500); } catch (InterruptedException e) {e.printStackTrace();}
149
150 startActivity(new Intent(LightingController.this, zllMain.class));
151 }
152 }
153 }
154 })
155 .show();
156 }
157
158
159 class waitRspTask extends AsyncTask<String , Integer, Void> 73 class waitRspTask extends AsyncTask<String , Integer, Void>
160 { 74 {
161 private boolean rspSuccess = false; 75 private boolean rspSuccess = false;
@@ -212,7 +126,7 @@ public class LightingController extends Activity{
212 .setTitle("Gateway Address") 126 .setTitle("Gateway Address")
213 .setMessage("Please Enter the HA Gateway IP Address") 127 .setMessage("Please Enter the HA Gateway IP Address")
214 .setView(t) 128 .setView(t)
215 .setPositiveButton("OK", 129 .setPositiveButton("Connect",
216 new DialogInterface.OnClickListener() 130 new DialogInterface.OnClickListener()
217 { 131 {
218 public void onClick(DialogInterface dialoginterface,int i){ 132 public void onClick(DialogInterface dialoginterface,int i){
@@ -227,8 +141,14 @@ public class LightingController extends Activity{
227 141
228 new waitRspTask().execute("Connecting to gateway"); 142 new waitRspTask().execute("Connecting to gateway");
229 } 143 }
230 }) 144 })
231 .setNegativeButton("Cancel", null) 145 .setNegativeButton("Demo",
146 new DialogInterface.OnClickListener()
147 {
148 public void onClick(DialogInterface dialoginterface,int i){
149 startActivity(new Intent(LightingController.this, zllMain.class));
150 }
151 })
232 .show(); 152 .show();
233 } 153 }
234 else 154 else