@Test public void meshStateChanged_successEvent() throws RightMeshException, ClassNotFoundException { spyRightMeshConnector.meshStateChanged(meshId, MeshStateListener.SUCCESS); verify(androidMeshManager).bind(MESH_PORT); verify(spyRightMeshConnector).meshStateChanged(meshId, MeshStateListener.SUCCESS); }
@Override public void meshStateChanged(MeshId meshId, int state) { if (state == SUCCESS) { try { androidMeshManager.bind(meshPort); if (connectSuccessListener != null) { connectSuccessListener.onConnectSuccess(meshId); } androidMeshManager.on(DATA_RECEIVED, event -> { if (dataReceiveListener != null) { dataReceiveListener.onDataReceive(event); } }); androidMeshManager.on(PEER_CHANGED, event -> { if (peerchangedListener != null) { peerchangedListener.onPeerChange(event); } }); } catch (RightMeshException.RightMeshServiceDisconnectedException sde) { Log.e(TAG, "Service disconnected while binding, with message: " + sde.getMessage()); } catch (RightMeshException rme) { Log.e(TAG, "MeshPort already bound, with message: " + rme.getMessage()); } } }
RightMeshConnector implements MeshStateListener { @Override public void meshStateChanged(MeshId meshId, int state) { if (state == SUCCESS) { try { androidMeshManager.bind(meshPort); if (connectSuccessListener != null) { connectSuccessListener.onConnectSuccess(meshId); } androidMeshManager.on(DATA_RECEIVED, event -> { if (dataReceiveListener != null) { dataReceiveListener.onDataReceive(event); } }); androidMeshManager.on(PEER_CHANGED, event -> { if (peerchangedListener != null) { peerchangedListener.onPeerChange(event); } }); } catch (RightMeshException.RightMeshServiceDisconnectedException sde) { Log.e(TAG, "Service disconnected while binding, with message: " + sde.getMessage()); } catch (RightMeshException rme) { Log.e(TAG, "MeshPort already bound, with message: " + rme.getMessage()); } } } }
RightMeshConnector implements MeshStateListener { @Override public void meshStateChanged(MeshId meshId, int state) { if (state == SUCCESS) { try { androidMeshManager.bind(meshPort); if (connectSuccessListener != null) { connectSuccessListener.onConnectSuccess(meshId); } androidMeshManager.on(DATA_RECEIVED, event -> { if (dataReceiveListener != null) { dataReceiveListener.onDataReceive(event); } }); androidMeshManager.on(PEER_CHANGED, event -> { if (peerchangedListener != null) { peerchangedListener.onPeerChange(event); } }); } catch (RightMeshException.RightMeshServiceDisconnectedException sde) { Log.e(TAG, "Service disconnected while binding, with message: " + sde.getMessage()); } catch (RightMeshException rme) { Log.e(TAG, "MeshPort already bound, with message: " + rme.getMessage()); } } } RightMeshConnector(int meshPort); }
RightMeshConnector implements MeshStateListener { @Override public void meshStateChanged(MeshId meshId, int state) { if (state == SUCCESS) { try { androidMeshManager.bind(meshPort); if (connectSuccessListener != null) { connectSuccessListener.onConnectSuccess(meshId); } androidMeshManager.on(DATA_RECEIVED, event -> { if (dataReceiveListener != null) { dataReceiveListener.onDataReceive(event); } }); androidMeshManager.on(PEER_CHANGED, event -> { if (peerchangedListener != null) { peerchangedListener.onPeerChange(event); } }); } catch (RightMeshException.RightMeshServiceDisconnectedException sde) { Log.e(TAG, "Service disconnected while binding, with message: " + sde.getMessage()); } catch (RightMeshException rme) { Log.e(TAG, "MeshPort already bound, with message: " + rme.getMessage()); } } } RightMeshConnector(int meshPort); void connect(Context context); @Override void meshStateChanged(MeshId meshId, int state); void stop(); void setOnDataReceiveListener(OnDataReceiveListener listener); void setOnPeerChangedListener(OnPeerChangedListener listener); void setOnConnectSuccessListener(OnConnectSuccessListener listener); void toRightMeshWalletActivty(); void sendDataReliable(MeshId targetMeshId, String payload); void setAndroidMeshManager(AndroidMeshManager androidMeshManager); }
RightMeshConnector implements MeshStateListener { @Override public void meshStateChanged(MeshId meshId, int state) { if (state == SUCCESS) { try { androidMeshManager.bind(meshPort); if (connectSuccessListener != null) { connectSuccessListener.onConnectSuccess(meshId); } androidMeshManager.on(DATA_RECEIVED, event -> { if (dataReceiveListener != null) { dataReceiveListener.onDataReceive(event); } }); androidMeshManager.on(PEER_CHANGED, event -> { if (peerchangedListener != null) { peerchangedListener.onPeerChange(event); } }); } catch (RightMeshException.RightMeshServiceDisconnectedException sde) { Log.e(TAG, "Service disconnected while binding, with message: " + sde.getMessage()); } catch (RightMeshException rme) { Log.e(TAG, "MeshPort already bound, with message: " + rme.getMessage()); } } } RightMeshConnector(int meshPort); void connect(Context context); @Override void meshStateChanged(MeshId meshId, int state); void stop(); void setOnDataReceiveListener(OnDataReceiveListener listener); void setOnPeerChangedListener(OnPeerChangedListener listener); void setOnConnectSuccessListener(OnConnectSuccessListener listener); void toRightMeshWalletActivty(); void sendDataReliable(MeshId targetMeshId, String payload); void setAndroidMeshManager(AndroidMeshManager androidMeshManager);  }