diff --git a/Bluetooth-Communication/app/src/main/java/com/example/user/bluetooth_communication/MainActivity.java b/Bluetooth-Communication/app/src/main/java/com/example/user/bluetooth_communication/MainActivity.java index af878ee..74a601b 100644 --- a/Bluetooth-Communication/app/src/main/java/com/example/user/bluetooth_communication/MainActivity.java +++ b/Bluetooth-Communication/app/src/main/java/com/example/user/bluetooth_communication/MainActivity.java @@ -79,44 +79,6 @@ public void onReceive(Context context, Intent intent) { } }; - /** - * Broadcast Receiver for changes made to bluetooth states such as: - * 1) Discoverability mode on/off or expire. - */ - private final BroadcastReceiver mBroadcastReceiver2 = new BroadcastReceiver() { - - @Override - public void onReceive(Context context, Intent intent) { - final String action = intent.getAction(); - - if (action.equals(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED)) { - - int mode = intent.getIntExtra(BluetoothAdapter.EXTRA_SCAN_MODE, BluetoothAdapter.ERROR); - - switch (mode) { - //Device is in Discoverable Mode - case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE: - Log.d(TAG, "mBroadcastReceiver2: Discoverability Enabled."); - break; - //Device not in discoverable mode - case BluetoothAdapter.SCAN_MODE_CONNECTABLE: - Log.d(TAG, "mBroadcastReceiver2: Discoverability Disabled. Able to receive connections."); - break; - case BluetoothAdapter.SCAN_MODE_NONE: - Log.d(TAG, "mBroadcastReceiver2: Discoverability Disabled. Not able to receive connections."); - break; - case BluetoothAdapter.STATE_CONNECTING: - Log.d(TAG, "mBroadcastReceiver2: Connecting...."); - break; - case BluetoothAdapter.STATE_CONNECTED: - Log.d(TAG, "mBroadcastReceiver2: Connected."); - break; - } - - } - } - }; - diff --git a/LocMessClient/app/src/main/AndroidManifest.xml b/LocMessClient/app/src/main/AndroidManifest.xml index 2195281..e4c6345 100644 --- a/LocMessClient/app/src/main/AndroidManifest.xml +++ b/LocMessClient/app/src/main/AndroidManifest.xml @@ -78,7 +78,6 @@ - \ No newline at end of file diff --git a/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/BluetoothPairingActivity.java b/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/BluetoothPairingActivity.java deleted file mode 100644 index a4a177a..0000000 --- a/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/BluetoothPairingActivity.java +++ /dev/null @@ -1,90 +0,0 @@ -package pt.ulisboa.tecnico.cmu.tg14.locmessclient; - -import android.bluetooth.BluetoothAdapter; -import android.bluetooth.BluetoothDevice; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.support.v7.app.AppCompatActivity; -import android.os.Bundle; -import android.util.Log; -import android.view.View; -import android.widget.ArrayAdapter; -import android.widget.Button; -import android.widget.ListView; -import android.widget.SeekBar; - -import java.util.ArrayList; -import java.util.List; - -import pt.ulisboa.tecnico.cmu.tg14.locmessclient.DataObjects.ServicesDataHolder; -import pt.ulisboa.tecnico.cmu.tg14.locmessclient.Services.BluetoothOperations; - -public class BluetoothPairingActivity extends AppCompatActivity { - private static final String TAG = "Pairing BT"; - private ListView deviceList; - private Button refreshButton; - private ArrayAdapter mDeviceListAdapter; - private List names; - private BluetoothAdapter mBluetoothAdapter; - - private ServicesDataHolder dataHolder; - - private BroadcastReceiver mBroadcastReceiver3 = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - final String action = intent.getAction(); - Log.d(TAG, "onReceive: ACTION FOUND."); - - if (action.equals(BluetoothDevice.ACTION_FOUND)){ - BluetoothDevice device = intent.getParcelableExtra (BluetoothDevice.EXTRA_DEVICE); - dataHolder.addBleContent(device); - names = dataHolder.getBleNames(); - mDeviceListAdapter.notifyDataSetChanged(); - } - } - }; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_bluetooth_pairing); - - dataHolder = ServicesDataHolder.getInstance(); - - refreshButton = (Button) findViewById(R.id.button_refresh); - deviceList = (ListView) findViewById(R.id.list_bt_devices); - - mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); - - // Enable discoverable - Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); - discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 300); - startActivity(discoverableIntent); - - - final ServicesDataHolder dataHolder = ServicesDataHolder.getInstance(); - BluetoothOperations bluetoothOperations = BluetoothOperations.getInstance(this); - bluetoothOperations.stop(); - names = dataHolder.getBleNames(); - mDeviceListAdapter = new ArrayAdapter(this,android.R.layout.simple_list_item_1,names); - deviceList.setAdapter(mDeviceListAdapter); - - } - - - - public void btnDiscover(View view) { - Log.d(TAG, "btnDiscover: Looking for unpaired devices."); - - if(mBluetoothAdapter.isDiscovering()){ - mBluetoothAdapter.cancelDiscovery(); - Log.d(TAG, "btnDiscover: Canceling discovery."); - } - - mBluetoothAdapter.startDiscovery(); - IntentFilter discoverDevicesIntent = new IntentFilter(BluetoothDevice.ACTION_FOUND); - registerReceiver(mBroadcastReceiver3, discoverDevicesIntent); - } -} diff --git a/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/DataObjects/ServicesDataHolder.java b/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/DataObjects/ServicesDataHolder.java index c07fd1e..cf77c00 100644 --- a/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/DataObjects/ServicesDataHolder.java +++ b/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/DataObjects/ServicesDataHolder.java @@ -2,6 +2,7 @@ import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; +import android.widget.ArrayAdapter; import java.util.AbstractMap; import java.util.ArrayList; @@ -36,6 +37,7 @@ public class ServicesDataHolder { private boolean killThread = false; private static final ServicesDataHolder ourInstance = new ServicesDataHolder(); + private ArrayAdapter bleAdapter; public static ServicesDataHolder getInstance() { return ourInstance; @@ -55,6 +57,10 @@ private ServicesDataHolder() { } + public void setBleAdapter(ArrayAdapter bleAdapter) { + this.bleAdapter = bleAdapter; + } + public ArrayList getRemovedLocations() { return removedLocations; } @@ -180,4 +186,7 @@ public void setKillThread(boolean killThread) { this.killThread = killThread; } + public ArrayAdapter getBleAdapter() { + return bleAdapter; + } } diff --git a/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/MainActivity.java b/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/MainActivity.java index 4b45a18..fa468a9 100644 --- a/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/MainActivity.java +++ b/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/MainActivity.java @@ -3,7 +3,6 @@ import android.app.Activity; import android.app.FragmentManager; import android.app.FragmentTransaction; -import android.bluetooth.BluetoothDevice; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; @@ -26,8 +25,6 @@ import android.widget.TextView; import pt.ulisboa.tecnico.cmu.tg14.locmessclient.DataObjects.ServicesDataHolder; -import pt.ulisboa.tecnico.cmu.tg14.locmessclient.Exceptions.PublisherNotFoundException; -import pt.ulisboa.tecnico.cmu.tg14.locmessclient.Services.BluetoothOperations; import pt.ulisboa.tecnico.cmu.tg14.locmessclient.Services.BluetoothService; import pt.ulisboa.tecnico.cmu.tg14.locmessclient.Services.DBService; import pt.ulisboa.tecnico.cmu.tg14.locmessclient.Services.GPSService; @@ -35,7 +32,6 @@ import pt.ulisboa.tecnico.cmu.tg14.locmessclient.Services.WifiService; import pt.ulisboa.tecnico.cmu.tg14.locmessclient.Utils.FeedReaderDbHelper; -import pt.ulisboa.tecnico.cmu.tg14.locmessclient.Utils.Network.ServerActions; import pt.ulisboa.tecnico.cmu.tg14.locmessclient.Utils.ServiceManager; @@ -132,8 +128,6 @@ public boolean onOptionsItemSelected(MenuItem item) { //noinspection SimplifiableIfStatement if (id == R.id.action_connect_mule) { - Intent intent = new Intent(this,BluetoothPairingActivity.class); - startActivity(intent); diff --git a/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/Receivers/BluetoothReceiver.java b/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/Receivers/BluetoothReceiver.java index f5fa11f..606ecfa 100644 --- a/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/Receivers/BluetoothReceiver.java +++ b/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/Receivers/BluetoothReceiver.java @@ -32,7 +32,7 @@ public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if(BluetoothDevice.ACTION_FOUND.equals(action)){ BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); - //Log.d(TAG, "onReceive: addr:"+device.getAddress()); + Log.d(TAG, "onReceive: addr:"+device.getAddress()); mService.onBleReceived(device); }else if(BluetoothAdapter.ACTION_DISCOVERY_STARTED.equals(action)){ mService.clearBluetoothList(); diff --git a/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/Services/BluetoothOperations.java b/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/Services/BluetoothOperations.java deleted file mode 100644 index a9a90bb..0000000 --- a/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/Services/BluetoothOperations.java +++ /dev/null @@ -1,464 +0,0 @@ -package pt.ulisboa.tecnico.cmu.tg14.locmessclient.Services; - -import android.bluetooth.BluetoothAdapter; -import android.bluetooth.BluetoothDevice; -import android.bluetooth.BluetoothServerSocket; -import android.bluetooth.BluetoothSocket; -import android.content.Context; -import android.os.Bundle; -import android.os.Handler; -import android.util.Log; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.UUID; - -import static android.content.ContentValues.TAG; - -/** - * Created by trosado on 5/19/17. - */ - -public class BluetoothOperations { - - private static final UUID LOCMESS_UUID = UUID.fromString("c70f6eff-bef2-44c8-a6d4-82b0e2f0913d"); - - private static final String NAME = "locmess"; - // Constants that indicate the current connection state - public static final int STATE_NONE = 0; // we're doing nothing - public static final int STATE_LISTEN = 1; // now listening for incoming connections - public static final int STATE_CONNECTING = 2; // now initiating an outgoing connection - public static final int STATE_CONNECTED = 3; // now connected to a remote device - - private static Handler mHandler = null; - private ConnectedThread mConnectedThread; - private ConnectThread mConnectThread; - private AcceptThread mAcceptThread; - - - private static BluetoothAdapter mBTAdapter; - - private Context context; - private int mState; - private int mNewState; - - private static BluetoothOperations singleton; - - - - - public static BluetoothOperations getInstance(Context context){ - return (singleton == null) ? new BluetoothOperations(context) : singleton; - } - public static BluetoothOperations getInstance(){ - return singleton; - } - - public BluetoothOperations(Context context) { - mBTAdapter = BluetoothAdapter.getDefaultAdapter(); - this.context = context; - mHandler = new Handler(); - } - - /** - * Return the current connection state. - */ - public synchronized int getState() { - return mState; - } - - /** - * Write to the ConnectedThread in an unsynchronized manner - * - * @param out The bytes to write - * @see ConnectedThread#write(byte[]) - */ - public void write(byte[] out) { - // Create temporary object - ConnectedThread r; - // Synchronize a copy of the ConnectedThread - synchronized (this) { - if (mState != STATE_CONNECTED) return; - r = mConnectedThread; - } - // Perform the write unsynchronized - r.write(out); - } - - - /** - * Indicate that the connection attempt failed and notify the UI Activity. - */ - private void connectionFailed() { - // Send a failure message back to the Activity - android.os.Message msg = mHandler.obtainMessage(Constants.MESSAGE_TOAST); - Bundle bundle = new Bundle(); - bundle.putString(Constants.TOAST, "Unable to connect device"); - msg.setData(bundle); - mHandler.sendMessage(msg); - - mState = STATE_NONE; - - // Start the service over to restart listening mode - BluetoothOperations.this.start(); - } - - /** - * Indicate that the connection was lost and notify the UI Activity. - */ - private void connectionLost() { - // Send a failure message back to the Activity - android.os.Message msg = mHandler.obtainMessage(Constants.MESSAGE_TOAST); - Bundle bundle = new Bundle(); - bundle.putString(Constants.TOAST, "Device connection was lost"); - msg.setData(bundle); - mHandler.sendMessage(msg); - - mState = STATE_NONE; - - // Start the service over to restart listening mode - BluetoothOperations.this.start(); - } - - - public synchronized void start() { - Log.d(TAG, "start"); - - // Cancel any thread attempting to make a connection - if (mConnectThread != null) { - mConnectThread.cancel(); - mConnectThread = null; - } - - // Cancel any thread currently running a connection - if (mConnectedThread != null) { - mConnectedThread.cancel(); - mConnectedThread = null; - } - - // Start the thread to listen on a BluetoothServerSocket - if (mAcceptThread == null) { - mAcceptThread = new AcceptThread(); - mAcceptThread.start(); - } - } - - /** - * Stop all threads - */ - public synchronized void stop() { - Log.d(TAG, "stop"); - - if (mConnectThread != null) { - mConnectThread.cancel(); - mConnectThread = null; - } - - if (mConnectedThread != null) { - mConnectedThread.cancel(); - mConnectedThread = null; - } - - if (mAcceptThread != null) { - mAcceptThread.cancel(); - mAcceptThread = null; - } - mState = STATE_NONE; - } - - /** - * Start the ConnectThread to initiate a connection to a remote device. - * - * @param device The BluetoothDevice to connect - * @param secure Socket Security type - Secure (true) , Insecure (false) - */ - public synchronized void connect(BluetoothDevice device) { - Log.d(TAG, "connect to: " + device); - - // Cancel any thread attempting to make a connection - if (mState == STATE_CONNECTING) { - if (mConnectThread != null) { - mConnectThread.cancel(); - mConnectThread = null; - } - } - - // Cancel any thread currently running a connection - if (mConnectedThread != null) { - mConnectedThread.cancel(); - mConnectedThread = null; - } - - // Start the thread to connect with the given device - mConnectThread = new ConnectThread(device); - mConnectThread.start(); - } - - /** - * Start the ConnectedThread to begin managing a Bluetooth connection - * - * @param socket The BluetoothSocket on which the connection was made - * @param device The BluetoothDevice that has been connected - */ - public synchronized void connected(BluetoothSocket socket, BluetoothDevice - device, final String socketType) { - Log.d(TAG, "connected, Socket Type:" + socketType); - - // Cancel the thread that completed the connection - if (mConnectThread != null) { - mConnectThread.cancel(); - mConnectThread = null; - } - - // Cancel any thread currently running a connection - if (mConnectedThread != null) { - mConnectedThread.cancel(); - mConnectedThread = null; - } - - // Cancel the accept thread because we only want to connect to one device - - if (mAcceptThread != null) { - mAcceptThread.cancel(); - mAcceptThread = null; - } - - // Start the thread to manage the connection and perform transmissions - mConnectedThread = new ConnectedThread(socket, socketType); - mConnectedThread.start(); - - // Send the name of the connected device back to the UI Activity - android.os.Message msg = mHandler.obtainMessage(Constants.MESSAGE_DEVICE_NAME); - Bundle bundle = new Bundle(); - bundle.putString(Constants.DEVICE_NAME, device.getName()); - msg.setData(bundle); - mHandler.sendMessage(msg); - } - - /** - * This thread runs during a connection with a remote device. - * It handles all incoming and outgoing transmissions. - */ - private class ConnectedThread extends Thread { - private final BluetoothSocket mmSocket; - private final InputStream mmInStream; - private final OutputStream mmOutStream; - - public ConnectedThread(BluetoothSocket socket, String socketType) { - Log.d(TAG, "create ConnectedThread: " + socketType); - mmSocket = socket; - InputStream tmpIn = null; - OutputStream tmpOut = null; - - // Get the BluetoothSocket input and output streams - try { - tmpIn = socket.getInputStream(); - tmpOut = socket.getOutputStream(); - } catch (IOException e) { - Log.e(TAG, "temp sockets not created", e); - } - - mmInStream = tmpIn; - mmOutStream = tmpOut; - mState = STATE_CONNECTED; - } - - public void run() { - Log.i(TAG, "BEGIN mConnectedThread"); - byte[] buffer = new byte[1024]; - int bytes; - - // Keep listening to the InputStream while connected - while (mState == STATE_CONNECTED) { - try { - // Read from the InputStream - bytes = mmInStream.read(buffer); - - // Send the obtained bytes to the UI Activity - mHandler.obtainMessage(Constants.MESSAGE_READ, bytes, -1, buffer) - .sendToTarget(); - } catch (IOException e) { - Log.e(TAG, "disconnected", e); - connectionLost(); - break; - } - } - } - - /** - * Write to the connected OutStream. - * - * @param buffer The bytes to write - */ - public void write(byte[] buffer) { - try { - mmOutStream.write(buffer); - - // Share the sent message back to the UI Activity - mHandler.obtainMessage(Constants.MESSAGE_WRITE, -1, -1, buffer) - .sendToTarget(); - } catch (IOException e) { - Log.e(TAG, "Exception during write", e); - } - } - - public void cancel() { - try { - mmSocket.close(); - } catch (IOException e) { - Log.e(TAG, "close() of connect socket failed", e); - } - } - } - /** - * This thread runs while attempting to make an outgoing connection - * with a device. It runs straight through; the connection either - * succeeds or fails. - */ - private class ConnectThread extends Thread { - private final BluetoothSocket mmSocket; - private final BluetoothDevice mmDevice; - private String mSocketType; - - public ConnectThread(BluetoothDevice device) { - mmDevice = device; - BluetoothSocket tmp = null; - mSocketType = "Insecure"; - - // Get a BluetoothSocket for a connection with the - // given BluetoothDevice - try { - tmp = device.createRfcommSocketToServiceRecord( - LOCMESS_UUID); - - } catch (IOException e) { - Log.e(TAG, "Socket Type: " + mSocketType + "create() failed", e); - } - mmSocket = tmp; - mState = STATE_CONNECTING; - } - - public void run() { - Log.i(TAG, "BEGIN mConnectThread SocketType:" + mSocketType); - setName("ConnectThread" + mSocketType); - - // Always cancel discovery because it will slow down a connection - mBTAdapter.cancelDiscovery(); - - // Make a connection to the BluetoothSocket - try { - // This is a blocking call and will only return on a - // successful connection or an exception - mmSocket.connect(); - } catch (IOException e) { - // Close the socket - try { - mmSocket.close(); - } catch (IOException e2) { - Log.e(TAG, "unable to close() " + mSocketType + - " socket during connection failure", e2); - } - connectionFailed(); - return; - } - - // Reset the ConnectThread because we're done - synchronized (BluetoothOperations.this) { - mConnectThread = null; - } - - // Start the connected thread - connected(mmSocket, mmDevice, mSocketType); - } - - public void cancel() { - try { - mmSocket.close(); - } catch (IOException e) { - Log.e(TAG, "close() of connect " + mSocketType + " socket failed", e); - } - } - } - /** - * This thread runs while listening for incoming connections. It behaves - * like a server-side client. It runs until a connection is accepted - * (or until cancelled). - */ - private class AcceptThread extends Thread { - // The local server socket - private final BluetoothServerSocket mmServerSocket; - private String mSocketType; - - public AcceptThread() { - BluetoothServerSocket tmp = null; - mSocketType = "Secure"; - - // Create a new listening server socket - try { - - tmp = mBTAdapter.listenUsingRfcommWithServiceRecord(NAME, - LOCMESS_UUID); - - } catch (IOException e) { - Log.e(TAG, "Socket Type: " + mSocketType + "listen() failed", e); - } - mmServerSocket = tmp; - mState = STATE_LISTEN; - } - - public void run() { - Log.d(TAG, "Socket Type: " + mSocketType + - "BEGIN mAcceptThread" + this); - setName("AcceptThread" + mSocketType); - - BluetoothSocket socket = null; - - // Listen to the server socket if we're not connected - while (mState != STATE_CONNECTED) { - try { - // This is a blocking call and will only return on a - // successful connection or an exception - socket = mmServerSocket.accept(); - } catch (IOException e) { - Log.e(TAG, "Socket Type: " + mSocketType + "accept() failed", e); - break; - } - - // If a connection was accepted - if (socket != null) { - synchronized (BluetoothOperations.this) { - switch (mState) { - case STATE_LISTEN: - case STATE_CONNECTING: - // Situation normal. Start the connected thread. - connected(socket, socket.getRemoteDevice(), - mSocketType); - break; - case STATE_NONE: - case STATE_CONNECTED: - // Either not ready or already connected. Terminate new socket. - try { - socket.close(); - } catch (IOException e) { - Log.e(TAG, "Could not close unwanted socket", e); - } - break; - } - } - } - } - Log.i(TAG, "END mAcceptThread, socket Type: " + mSocketType); - - } - - public void cancel() { - Log.d(TAG, "Socket Type" + mSocketType + "cancel " + this); - try { - mmServerSocket.close(); - } catch (IOException e) { - Log.e(TAG, "Socket Type" + mSocketType + "close() of server failed", e); - } - } - } -} diff --git a/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/Services/BluetoothService.java b/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/Services/BluetoothService.java index dafbb4e..4a137cd 100644 --- a/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/Services/BluetoothService.java +++ b/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/Services/BluetoothService.java @@ -94,9 +94,6 @@ public void run() { mHandler.postDelayed(runnable, 2000); - // Setup Server - BluetoothOperations bluetoothOperations = BluetoothOperations.getInstance(getApplicationContext()); - bluetoothOperations.start(); } diff --git a/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/Services/MasterService.java b/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/Services/MasterService.java index 82d0e75..269aef8 100644 --- a/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/Services/MasterService.java +++ b/LocMessClient/app/src/main/java/pt/ulisboa/tecnico/cmu/tg14/locmessclient/Services/MasterService.java @@ -64,7 +64,8 @@ public void onWifiReceived(String name, String ssid) { @Override public void onBleReceived(BluetoothDevice device) { dataHolder.addBleContent(device); - + if(dataHolder.getBleAdapter() != null) + dataHolder.getBleAdapter().notifyDataSetChanged(); } @Override diff --git a/LocMessClient/app/src/main/res/layout/activity_bluetooth_pairing.xml b/LocMessClient/app/src/main/res/layout/activity_bluetooth_pairing.xml deleted file mode 100644 index 8ba95dd..0000000 --- a/LocMessClient/app/src/main/res/layout/activity_bluetooth_pairing.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - -