mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-22 09:58:08 +00:00
package -> packet typo fixes
This commit is contained in:
parent
d9e641ae28
commit
01f44f524a
@ -158,7 +158,6 @@
|
||||
<string name="unknown_device">Unknown device</string>
|
||||
<string name="error_not_reachable">Device not reachable</string>
|
||||
<string name="error_already_paired">Device already paired</string>
|
||||
<string name="error_could_not_send_package">Could not send package</string>
|
||||
<string name="error_timed_out">Timed out</string>
|
||||
<string name="error_canceled_by_user">Canceled by user</string>
|
||||
<string name="error_canceled_by_other_peer">Canceled by other peer</string>
|
||||
|
@ -64,8 +64,8 @@ public abstract class BaseLink {
|
||||
receivers.remove(pr);
|
||||
}
|
||||
|
||||
//Should be called from a background thread listening to packages
|
||||
protected void packageReceived(NetworkPacket np) {
|
||||
//Should be called from a background thread listening for packets
|
||||
protected void packetReceived(NetworkPacket np) {
|
||||
for(PacketReceiver pr : receivers) {
|
||||
pr.onPacketReceived(np);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public abstract class BasePairingHandler {
|
||||
}
|
||||
|
||||
/* To be implemented by respective pairing handler */
|
||||
public abstract void packageReceived(NetworkPacket np);
|
||||
public abstract void packetReceived(NetworkPacket np);
|
||||
public abstract void requestPairing();
|
||||
public abstract void acceptPairing();
|
||||
public abstract void rejectPairing();
|
||||
|
@ -89,7 +89,7 @@ public class BluetoothLink extends BaseLink {
|
||||
}
|
||||
}
|
||||
|
||||
packageReceived(np);
|
||||
packetReceived(np);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class BluetoothPairingHandler extends BasePairingHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void packageReceived(NetworkPacket np) {
|
||||
public void packetReceived(NetworkPacket np) {
|
||||
|
||||
boolean wantsPair = np.getBoolean("pair");
|
||||
|
||||
@ -123,7 +123,7 @@ public class BluetoothPairingHandler extends BasePairingHandler {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
mCallback.pairingFailed(mDevice.getContext().getString(R.string.error_could_not_send_package));
|
||||
mCallback.pairingFailed(mDevice.getContext().getString(R.string.runcommand_notreachable));
|
||||
}
|
||||
};
|
||||
mDevice.sendPacket(createPairPacket(), statusCallback);
|
||||
|
@ -153,7 +153,7 @@ public class LanLink extends BaseLink {
|
||||
|
||||
//Log.e("LanLink/sendPacket", np.getType());
|
||||
|
||||
//Send body of the network package
|
||||
//Send body of the network packet
|
||||
try {
|
||||
OutputStream writer = socket.getOutputStream();
|
||||
writer.write(np.serialize().getBytes(Charsets.UTF_8));
|
||||
@ -247,7 +247,7 @@ public class LanLink extends BaseLink {
|
||||
|
||||
}
|
||||
|
||||
packageReceived(np);
|
||||
packetReceived(np);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -88,7 +88,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
|
||||
String message = reader.readLine();
|
||||
networkPacket = NetworkPacket.unserialize(message);
|
||||
//Log.e("TcpListener","Received TCP package: "+networkPacket.serialize());
|
||||
//Log.e("TcpListener", "Received TCP packet: " + networkPacket.serialize());
|
||||
} catch (Exception e) {
|
||||
Log.e("KDE/LanLinkProvider", "Exception while receiving TCP packet", e);
|
||||
return;
|
||||
|
@ -41,7 +41,7 @@ public class LanPairingHandler extends BasePairingHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void packageReceived(NetworkPacket np) {
|
||||
public void packetReceived(NetworkPacket np) {
|
||||
|
||||
boolean wantsPair = np.getBoolean("pair");
|
||||
|
||||
@ -130,7 +130,7 @@ public class LanPairingHandler extends BasePairingHandler {
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
Log.e("LanPairing/onFailure", "Exception", e);
|
||||
mCallback.pairingFailed(mDevice.getContext().getString(R.string.error_could_not_send_package));
|
||||
mCallback.pairingFailed(mDevice.getContext().getString(R.string.runcommand_notreachable));
|
||||
}
|
||||
};
|
||||
mDevice.sendPacket(createPairPacket(), statusCallback);
|
||||
|
@ -35,7 +35,7 @@ public class LoopbackLink extends BaseLink {
|
||||
@WorkerThread
|
||||
@Override
|
||||
public boolean sendPacket(NetworkPacket in, Device.SendPacketStatusCallback callback) {
|
||||
packageReceived(in);
|
||||
packetReceived(in);
|
||||
if (in.hasPayload()) {
|
||||
callback.onProgressChanged(0);
|
||||
in.setPayload(in.getPayload());
|
||||
|
@ -19,7 +19,7 @@ public class LoopbackPairingHandler extends BasePairingHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void packageReceived(NetworkPacket np) {
|
||||
public void packetReceived(NetworkPacket np) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -286,8 +286,8 @@ public class Device implements BaseLink.PacketReceiver {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method does not send an unpair package, instead it unpairs internally by deleting trusted device info. . Likely to be called after sending package from
|
||||
* pairing handler
|
||||
* This method does not send an unpair packet, instead it unpairs internally by deleting trusted device info.
|
||||
* Likely to be called after sending packet from pairing handler
|
||||
*/
|
||||
private void unpairInternal() {
|
||||
|
||||
@ -548,11 +548,11 @@ public class Device implements BaseLink.PacketReceiver {
|
||||
|
||||
if (NetworkPacket.PACKET_TYPE_PAIR.equals(np.getType())) {
|
||||
|
||||
Log.i("KDE/Device", "Pair package");
|
||||
Log.i("KDE/Device", "Pair packet");
|
||||
|
||||
for (BasePairingHandler ph : pairingHandlers.values()) {
|
||||
try {
|
||||
ph.packageReceived(np);
|
||||
ph.packetReceived(np);
|
||||
} catch (Exception e) {
|
||||
Log.e("PairingPacketReceived", "Exception", e);
|
||||
}
|
||||
@ -579,9 +579,9 @@ public class Device implements BaseLink.PacketReceiver {
|
||||
}
|
||||
} else {
|
||||
|
||||
//Log.e("KDE/onPacketReceived","Device not paired, will pass package to unpairedPacketListeners");
|
||||
//Log.e("KDE/onPacketReceived","Device not paired, will pass packet to unpairedPacketListeners");
|
||||
|
||||
// If it is pair package, it should be captured by "if" at start
|
||||
// If it is pair packet, it should be captured by "if" at start
|
||||
// If not and device is paired, it should be captured by isPaired
|
||||
// Else unpair, this handles the situation when one device unpairs, but other dont know like unpairing when wi-fi is off
|
||||
|
||||
@ -647,7 +647,7 @@ public class Device implements BaseLink.PacketReceiver {
|
||||
/**
|
||||
* Send a packet to the device asynchronously
|
||||
* @param np The packet
|
||||
* @param replaceID If positive, replaces all unsent packages with the same replaceID
|
||||
* @param replaceID If positive, replaces all unsent packets with the same replaceID
|
||||
* @param callback A callback for success/failure
|
||||
*/
|
||||
@AnyThread
|
||||
@ -686,8 +686,8 @@ public class Device implements BaseLink.PacketReceiver {
|
||||
|
||||
/*
|
||||
if (!m_outgoingCapabilities.contains(np.getType()) && !NetworkPacket.protocolPacketTypes.contains(np.getType())) {
|
||||
Log.e("Device/sendPacket", "Plugin tried to send an undeclared package: " + np.getType());
|
||||
Log.w("Device/sendPacket", "Declared outgoing package types: " + Arrays.toString(m_outgoingCapabilities.toArray()));
|
||||
Log.e("Device/sendPacket", "Plugin tried to send an undeclared packet: " + np.getType());
|
||||
Log.w("Device/sendPacket", "Declared outgoing packet types: " + Arrays.toString(m_outgoingCapabilities.toArray()));
|
||||
}
|
||||
*/
|
||||
|
||||
@ -701,7 +701,7 @@ public class Device implements BaseLink.PacketReceiver {
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
Log.e("KDE/sendPacket", "No device link (of " + links.size() + " available) could send the package. Packet " + np.getType() + " to " + name + " lost!");
|
||||
Log.e("KDE/sendPacket", "No device link (of " + links.size() + " available) could send the packet. Packet " + np.getType() + " to " + name + " lost!");
|
||||
}
|
||||
|
||||
return success;
|
||||
@ -823,8 +823,8 @@ public class Device implements BaseLink.PacketReceiver {
|
||||
if (pluginEnabled) {
|
||||
boolean success = addPlugin(pluginKey);
|
||||
if (success) {
|
||||
for (String packageType : pluginInfo.getSupportedPacketTypes()) {
|
||||
newPluginsByIncomingInterface.put(packageType, pluginKey);
|
||||
for (String packetType : pluginInfo.getSupportedPacketTypes()) {
|
||||
newPluginsByIncomingInterface.put(packetType, pluginKey);
|
||||
}
|
||||
} else {
|
||||
removePlugin(pluginKey);
|
||||
|
@ -91,7 +91,7 @@ public class FilesHelper {
|
||||
}
|
||||
|
||||
|
||||
//Create the network package from the URI
|
||||
//Create the network packet from the URI
|
||||
public static NetworkPacket uriToNetworkPacket(final Context context, final Uri uri, String type) {
|
||||
|
||||
try {
|
||||
|
@ -276,7 +276,7 @@ public class NetworkPacket {
|
||||
np.mBody.put("incomingCapabilities", new JSONArray(PluginFactory.getIncomingCapabilities()));
|
||||
np.mBody.put("outgoingCapabilities", new JSONArray(PluginFactory.getOutgoingCapabilities()));
|
||||
} catch (Exception e) {
|
||||
Log.e("NetworkPackage", "Exception on createIdentityPacket", e);
|
||||
Log.e("NetworkPacket", "Exception on createIdentityPacket", e);
|
||||
}
|
||||
|
||||
return np;
|
||||
|
@ -142,7 +142,7 @@ public class ContactsPlugin extends Plugin {
|
||||
* The identifiers returned can be used in future requests to get more information
|
||||
* about the contact
|
||||
*
|
||||
* @param np The package containing the request
|
||||
* @param np The packet containing the request
|
||||
* @return true if successfully handled, false otherwise
|
||||
*/
|
||||
@SuppressWarnings("SameReturnValue")
|
||||
|
@ -63,7 +63,7 @@ public abstract class Plugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* To receive the network package from the unpaired device, override
|
||||
* To receive the network packet from the unpaired device, override
|
||||
* listensToUnpairedDevices to return true and this method.
|
||||
*/
|
||||
public boolean onUnpairedDevicePacketReceived(NetworkPacket np) {
|
||||
@ -228,8 +228,8 @@ public abstract class Plugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a plugin receives a package. By convention we return true
|
||||
* when we have done something in response to the package or false
|
||||
* Called when a plugin receives a packet. By convention we return true
|
||||
* when we have done something in response to the packet or false
|
||||
* otherwise, even though that value is unused as of now.
|
||||
*/
|
||||
public boolean onPacketReceived(NetworkPacket np) {
|
||||
|
@ -60,7 +60,7 @@ public class ReceiveNotificationsPlugin extends Plugin {
|
||||
public boolean onPacketReceived(final NetworkPacket np) {
|
||||
|
||||
if (!np.has("ticker") || !np.has("appName") || !np.has("id")) {
|
||||
Log.e("NotificationsPlugin", "Received notification package lacks properties");
|
||||
Log.e("NotificationsPlugin", "Received notification packet lacks properties");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ public class RemoteKeyboardPlugin extends Plugin implements SharedPreferences.On
|
||||
|
||||
if (!np.getType().equals(PACKET_TYPE_MOUSEPAD_REQUEST)
|
||||
|| (!np.has("key") && !np.has("specialKey"))) { // expect at least key OR specialKey
|
||||
Log.e("RemoteKeyboardPlugin", "Invalid package for remotekeyboard plugin!");
|
||||
Log.e("RemoteKeyboardPlugin", "Invalid packet type for remotekeyboard plugin!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user