2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-22 18:07:55 +00:00

Rename "signal" function to match the name of the listeners' interface

This commit is contained in:
Albert Vaca Cintora 2023-06-16 19:22:18 +02:00
parent 6d089093e9
commit 12de65f234
6 changed files with 11 additions and 11 deletions

View File

@ -61,7 +61,7 @@ public abstract class BaseLink {
} }
public void disconnect() { public void disconnect() {
linkProvider.connectionLost(this); linkProvider.onConnectionLost(this);
} }
//TO OVERRIDE, should be sync. If sendPayloadFromSameThread is false, it should only block to send the packet but start a separate thread to send the payload. //TO OVERRIDE, should be sync. If sendPayloadFromSameThread is false, it should only block to send the packet but start a separate thread to send the payload.

View File

@ -34,16 +34,16 @@ public abstract class BaseLinkProvider {
} }
//These two should be called when the provider links to a new computer //These two should be called when the provider links to a new computer
protected void connectionAccepted(@NonNull final String deviceId, protected void onConnectionReceived(@NonNull final String deviceId,
@NonNull final Certificate certificate, @NonNull final Certificate certificate,
@NonNull final NetworkPacket identityPacket, @NonNull final NetworkPacket identityPacket,
@NonNull final BaseLink link) { @NonNull final BaseLink link) {
//Log.i("KDE/LinkProvider", "connectionAccepted"); //Log.i("KDE/LinkProvider", "onConnectionReceived");
for(ConnectionReceiver cr : connectionReceivers) { for(ConnectionReceiver cr : connectionReceivers) {
cr.onConnectionReceived(deviceId, certificate, identityPacket, link); cr.onConnectionReceived(deviceId, certificate, identityPacket, link);
} }
} }
public void connectionLost(BaseLink link) { public void onConnectionLost(BaseLink link) {
//Log.i("KDE/LinkProvider", "connectionLost"); //Log.i("KDE/LinkProvider", "connectionLost");
for(ConnectionReceiver cr : connectionReceivers) { for(ConnectionReceiver cr : connectionReceivers) {
cr.onConnectionLost(link); cr.onConnectionLost(link);

View File

@ -65,7 +65,7 @@ public class BluetoothLinkProvider extends BaseLinkProvider {
return; return;
} }
visibleDevices.put(deviceId, link); visibleDevices.put(deviceId, link);
connectionAccepted(deviceId, certificate, identityPacket, link); onConnectionReceived(deviceId, certificate, identityPacket, link);
link.startListening(); link.startListening();
if (oldLink != null) { if (oldLink != null) {
Log.i("BluetoothLinkProvider", "Removing old connection to same device"); Log.i("BluetoothLinkProvider", "Removing old connection to same device");
@ -130,7 +130,7 @@ public class BluetoothLinkProvider extends BaseLinkProvider {
public void disconnectedLink(BluetoothLink link, String deviceId, BluetoothDevice remoteAddress) { public void disconnectedLink(BluetoothLink link, String deviceId, BluetoothDevice remoteAddress) {
sockets.remove(remoteAddress); sockets.remove(remoteAddress);
visibleDevices.remove(deviceId); visibleDevices.remove(deviceId);
connectionLost(link); onConnectionLost(link);
} }
private class ServerRunnable implements Runnable { private class ServerRunnable implements Runnable {

View File

@ -91,7 +91,7 @@ public class LanLink extends BaseLink {
boolean thereIsaANewSocket = (newSocket != socket); boolean thereIsaANewSocket = (newSocket != socket);
if (!thereIsaANewSocket) { if (!thereIsaANewSocket) {
Log.i("LanLink", "Socket closed and there's no new socket, disconnecting device"); Log.i("LanLink", "Socket closed and there's no new socket, disconnecting device");
getLinkProvider().connectionLost(LanLink.this); getLinkProvider().onConnectionLost(LanLink.this);
} }
} }
}); });

View File

@ -68,10 +68,10 @@ public class LanLinkProvider extends BaseLinkProvider {
private boolean listening = false; private boolean listening = false;
public void connectionLost(BaseLink link) { public void onConnectionLost(BaseLink link) {
String deviceId = link.getDeviceId(); String deviceId = link.getDeviceId();
visibleDevices.remove(deviceId); visibleDevices.remove(deviceId);
super.connectionLost(link); super.onConnectionLost(link);
} }
//They received my UDP broadcast and are connecting to me. The first thing they send should be their identity packet. //They received my UDP broadcast and are connecting to me. The first thing they send should be their identity packet.
@ -248,7 +248,7 @@ public class LanLinkProvider extends BaseLinkProvider {
//Let's create the link //Let's create the link
LanLink link = new LanLink(context, deviceId, this, socket); LanLink link = new LanLink(context, deviceId, this, socket);
visibleDevices.put(deviceId, link); visibleDevices.put(deviceId, link);
connectionAccepted(deviceId, certificate, identityPacket, link); onConnectionReceived(deviceId, certificate, identityPacket, link);
} }
} }

View File

@ -34,7 +34,7 @@ public class LoopbackLinkProvider extends BaseLinkProvider {
public void onNetworkChange() { public void onNetworkChange() {
NetworkPacket np = NetworkPacket.createIdentityPacket(context); NetworkPacket np = NetworkPacket.createIdentityPacket(context);
String deviceId = DeviceHelper.getDeviceId(context); String deviceId = DeviceHelper.getDeviceId(context);
connectionAccepted(deviceId, SslHelper.certificate, np, new LoopbackLink(context, this)); onConnectionReceived(deviceId, SslHelper.certificate, np, new LoopbackLink(context, this));
} }
@Override @Override