public void commandAction(Command c, Displayable d) {
		if (d == remotedeviceui && c.getLabel().equals("Search")) {
			startInquiry(discoveryMode, serviceUUIDs);

		} else if (d == remotedeviceui && c.getLabel().equals("Back")) {
			callback.commandAction(BACK, remotedeviceui);

		} else if (d == remotedeviceui && c.getLabel().equals("Select")) {
			// get selected device
			selectedDevice = remotedeviceui.getSelectedIndex();
			RemoteDevice remoteDevice = (RemoteDevice) devices.elementAt(selectedDevice);

			// remove all existing record first
			services.removeAllElements();

			try {
				agent.searchServices(null,
						serviceUUIDs,
						remoteDevice,
						new Listener());

				// tell callback device selected
				display.callSerially(new Worker(ID_DEVICE_SELECTED));

			} catch (BluetoothStateException ex) {
				ex.printStackTrace();
			}

		}
	}