mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-22 09:58:08 +00:00
Rename "signal" function to match the name of the listeners' interface
This commit is contained in:
parent
6d089093e9
commit
12de65f234
@ -61,7 +61,7 @@ public abstract class BaseLink {
|
||||
}
|
||||
|
||||
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.
|
||||
|
@ -34,16 +34,16 @@ public abstract class BaseLinkProvider {
|
||||
}
|
||||
|
||||
//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 NetworkPacket identityPacket,
|
||||
@NonNull final BaseLink link) {
|
||||
//Log.i("KDE/LinkProvider", "connectionAccepted");
|
||||
//Log.i("KDE/LinkProvider", "onConnectionReceived");
|
||||
for(ConnectionReceiver cr : connectionReceivers) {
|
||||
cr.onConnectionReceived(deviceId, certificate, identityPacket, link);
|
||||
}
|
||||
}
|
||||
public void connectionLost(BaseLink link) {
|
||||
public void onConnectionLost(BaseLink link) {
|
||||
//Log.i("KDE/LinkProvider", "connectionLost");
|
||||
for(ConnectionReceiver cr : connectionReceivers) {
|
||||
cr.onConnectionLost(link);
|
||||
|
@ -65,7 +65,7 @@ public class BluetoothLinkProvider extends BaseLinkProvider {
|
||||
return;
|
||||
}
|
||||
visibleDevices.put(deviceId, link);
|
||||
connectionAccepted(deviceId, certificate, identityPacket, link);
|
||||
onConnectionReceived(deviceId, certificate, identityPacket, link);
|
||||
link.startListening();
|
||||
if (oldLink != null) {
|
||||
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) {
|
||||
sockets.remove(remoteAddress);
|
||||
visibleDevices.remove(deviceId);
|
||||
connectionLost(link);
|
||||
onConnectionLost(link);
|
||||
}
|
||||
|
||||
private class ServerRunnable implements Runnable {
|
||||
|
@ -91,7 +91,7 @@ public class LanLink extends BaseLink {
|
||||
boolean thereIsaANewSocket = (newSocket != socket);
|
||||
if (!thereIsaANewSocket) {
|
||||
Log.i("LanLink", "Socket closed and there's no new socket, disconnecting device");
|
||||
getLinkProvider().connectionLost(LanLink.this);
|
||||
getLinkProvider().onConnectionLost(LanLink.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -68,10 +68,10 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
|
||||
private boolean listening = false;
|
||||
|
||||
public void connectionLost(BaseLink link) {
|
||||
public void onConnectionLost(BaseLink link) {
|
||||
String deviceId = link.getDeviceId();
|
||||
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.
|
||||
@ -248,7 +248,7 @@ public class LanLinkProvider extends BaseLinkProvider {
|
||||
//Let's create the link
|
||||
LanLink link = new LanLink(context, deviceId, this, socket);
|
||||
visibleDevices.put(deviceId, link);
|
||||
connectionAccepted(deviceId, certificate, identityPacket, link);
|
||||
onConnectionReceived(deviceId, certificate, identityPacket, link);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class LoopbackLinkProvider extends BaseLinkProvider {
|
||||
public void onNetworkChange() {
|
||||
NetworkPacket np = NetworkPacket.createIdentityPacket(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
|
||||
|
Loading…
x
Reference in New Issue
Block a user