@SuppressWarnings("unchecked") @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { HashMap<String, Object> map = (HashMap<String, Object>) lvDeviceAdapter.getItem(arg2); String name = (String) map.get(MainActivity.NAME_STR); UUID uuid = UUID.fromString((String) map.get(MainActivity.UUID_STR)); if (scanCallback != null) { scanCallback.onDevice(uuid, name); } dismiss(); }
@Override public void onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord) { if (!getServiceUuids(scanRecord).contains(JUMA_SERVICE_UUID)) return; if (name == null || name.equals("") || name.equals(device.getName())) { callback.onDiscover( new JumaDevice( context, ScanHelper.this, device.getName(), UUID.fromString(IDEncrypt(device.getAddress(), context))), rssi); } }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.btnStartScan: String name = etInput.getText().toString(); if (scanCallback != null) { scanCallback.onName(name); } etInput.setText("" + name); break; case R.id.btnCancelScan: dismiss(); break; } }
private void updateScanState(int status) { if (callback != null) callback.onScanStateChange(status); }