summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'client/AndroidClients/LightingController/src/com/lightingcontroller/groupSelect.java')
-rwxr-xr-x[-rw-r--r--]client/AndroidClients/LightingController/src/com/lightingcontroller/groupSelect.java81
1 files changed, 6 insertions, 75 deletions
diff --git a/client/AndroidClients/LightingController/src/com/lightingcontroller/groupSelect.java b/client/AndroidClients/LightingController/src/com/lightingcontroller/groupSelect.java
index baa6120..97248ac 100644..100755
--- a/client/AndroidClients/LightingController/src/com/lightingcontroller/groupSelect.java
+++ b/client/AndroidClients/LightingController/src/com/lightingcontroller/groupSelect.java
@@ -205,8 +205,7 @@ public class groupSelect extends Activity {
205 public void onClick(DialogInterface dialoginterface,int i){ 205 public void onClick(DialogInterface dialoginterface,int i){
206 ZigbeeAssistant.newGroup(t.getText().toString() ); 206 ZigbeeAssistant.newGroup(t.getText().toString() );
207 //set selection to the new group, which will be last as this is a new one 207 //set selection to the new group, which will be last as this is a new one
208 currGroup = groupSpinnerAdapter.getCount(); 208 currGroup = groupSpinnerAdapter.getCount();
209 new waitRspTask().execute("Create Group");
210 groupSpinner.setSelection(currGroup); 209 groupSpinner.setSelection(currGroup);
211 //update the spinner 210 //update the spinner
212 addItemsOnGroupSpinner(); 211 addItemsOnGroupSpinner();
@@ -214,75 +213,7 @@ public class groupSelect extends Activity {
214 }) 213 })
215 .setNegativeButton("Cancel", null) 214 .setNegativeButton("Cancel", null)
216 .show(); 215 .show();
217 } 216 }
218
219
220
221 class waitRspTask extends AsyncTask<String , Integer, Void>
222 {
223 private boolean rspSuccess;
224 String param;
225 @Override
226 protected void onPreExecute()
227 {
228 bar = new ProgressDialog(groupSelect.this);
229 bar.setMessage("Processing..");
230 bar.setIndeterminate(true);
231 bar.show();
232 }
233 @Override
234 protected Void doInBackground(String... params)
235 {
236 param = params[0];
237 List<ZigbeeGroup> groupList = ZigbeeAssistant.getGroups();
238 //currGroup = 0;
239 for(int i=0;i<10;i++)
240 {
241 if(currGroup < groupList.size())
242 {
243 //check if group response updated the groupId
244 if (groupList.get(currGroup).getStatus() == ZigbeeGroup.groupStatusActive)
245 {
246 rspSuccess = true;
247 return null;
248 }
249 }
250
251 try
252 {
253 Thread.sleep(500);
254 }
255 catch(Exception e)
256 {
257 System.out.println(e);
258 }
259
260 }
261
262 rspSuccess = false;
263 return null;
264 }
265 @Override
266 protected void onPostExecute(Void result)
267 {
268 bar.dismiss();
269
270 if (rspSuccess == false)
271 {
272 AlertDialog show = new AlertDialog.Builder(groupSelect.this)
273 .setTitle(param)
274 .setMessage("No response from gateway. " + param + " failed.")
275 .setPositiveButton("OK",
276 new DialogInterface.OnClickListener()
277 {
278 public void onClick(DialogInterface dialoginterface,int i){
279 }
280 })
281 .show();
282 }
283
284 }
285 }
286 217
287 218
288 public void addToGroupCmdButton(View view) { 219 public void addToGroupCmdButton(View view) {
@@ -326,11 +257,11 @@ public class groupSelect extends Activity {
326 ToggleButton idLightButton = (ToggleButton) findViewById(R.id.IdLightToggle); 257 ToggleButton idLightButton = (ToggleButton) findViewById(R.id.IdLightToggle);
327 if (idLightButton.isChecked()) 258 if (idLightButton.isChecked())
328 { 259 {
329 //ZigbeeAssistant.Identify(currDevice, (short) 0x80); 260 ZigbeeAssistant.IdentifyDevice(currDevice, (short) 0x80);
330 } 261 }
331 else 262 else
332 { 263 {
333 //ZigbeeAssistant.Identify(currDevice, (short) 0); 264 ZigbeeAssistant.IdentifyDevice(currDevice, (short) 0);
334 } 265 }
335 } 266 }
336 267
@@ -341,11 +272,11 @@ public class groupSelect extends Activity {
341 272
342 if (idGroupButton.isChecked()) 273 if (idGroupButton.isChecked())
343 { 274 {
344 //ZigbeeAssistant.Identify(group, (short) 0xFFFF); 275 ZigbeeAssistant.IdentifyGroup(group, (short) 0xFFFF);
345 } 276 }
346 else 277 else
347 { 278 {
348 //ZigbeeAssistant.Identify(group, (short) 0); 279 ZigbeeAssistant.IdentifyGroup(group, (short) 0);
349 } 280 }
350 } 281 }
351 282