2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-25 11:27:22 +00:00

package -> packet typo fixes

This commit is contained in:
Albert Vaca Cintora 2023-03-17 18:56:52 +01:00
parent d9e641ae28
commit 01f44f524a
17 changed files with 33 additions and 34 deletions

View File

@ -158,7 +158,6 @@
<string name="unknown_device">Unknown device</string> <string name="unknown_device">Unknown device</string>
<string name="error_not_reachable">Device not reachable</string> <string name="error_not_reachable">Device not reachable</string>
<string name="error_already_paired">Device already paired</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_timed_out">Timed out</string>
<string name="error_canceled_by_user">Canceled by user</string> <string name="error_canceled_by_user">Canceled by user</string>
<string name="error_canceled_by_other_peer">Canceled by other peer</string> <string name="error_canceled_by_other_peer">Canceled by other peer</string>

View File

@ -64,8 +64,8 @@ public abstract class BaseLink {
receivers.remove(pr); receivers.remove(pr);
} }
//Should be called from a background thread listening to packages //Should be called from a background thread listening for packets
protected void packageReceived(NetworkPacket np) { protected void packetReceived(NetworkPacket np) {
for(PacketReceiver pr : receivers) { for(PacketReceiver pr : receivers) {
pr.onPacketReceived(np); pr.onPacketReceived(np);
} }

View File

@ -59,7 +59,7 @@ public abstract class BasePairingHandler {
} }
/* To be implemented by respective pairing handler */ /* 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 requestPairing();
public abstract void acceptPairing(); public abstract void acceptPairing();
public abstract void rejectPairing(); public abstract void rejectPairing();

View File

@ -89,7 +89,7 @@ public class BluetoothLink extends BaseLink {
} }
} }
packageReceived(np); packetReceived(np);
} }
}); });

View File

@ -38,7 +38,7 @@ public class BluetoothPairingHandler extends BasePairingHandler {
} }
@Override @Override
public void packageReceived(NetworkPacket np) { public void packetReceived(NetworkPacket np) {
boolean wantsPair = np.getBoolean("pair"); boolean wantsPair = np.getBoolean("pair");
@ -123,7 +123,7 @@ public class BluetoothPairingHandler extends BasePairingHandler {
@Override @Override
public void onFailure(Throwable e) { 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); mDevice.sendPacket(createPairPacket(), statusCallback);

View File

@ -153,7 +153,7 @@ public class LanLink extends BaseLink {
//Log.e("LanLink/sendPacket", np.getType()); //Log.e("LanLink/sendPacket", np.getType());
//Send body of the network package //Send body of the network packet
try { try {
OutputStream writer = socket.getOutputStream(); OutputStream writer = socket.getOutputStream();
writer.write(np.serialize().getBytes(Charsets.UTF_8)); writer.write(np.serialize().getBytes(Charsets.UTF_8));
@ -247,7 +247,7 @@ public class LanLink extends BaseLink {
} }
packageReceived(np); packetReceived(np);
} }
@Override @Override

View File

@ -88,7 +88,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String message = reader.readLine(); String message = reader.readLine();
networkPacket = NetworkPacket.unserialize(message); networkPacket = NetworkPacket.unserialize(message);
//Log.e("TcpListener","Received TCP package: "+networkPacket.serialize()); //Log.e("TcpListener", "Received TCP packet: " + networkPacket.serialize());
} catch (Exception e) { } catch (Exception e) {
Log.e("KDE/LanLinkProvider", "Exception while receiving TCP packet", e); Log.e("KDE/LanLinkProvider", "Exception while receiving TCP packet", e);
return; return;

View File

@ -41,7 +41,7 @@ public class LanPairingHandler extends BasePairingHandler {
} }
@Override @Override
public void packageReceived(NetworkPacket np) { public void packetReceived(NetworkPacket np) {
boolean wantsPair = np.getBoolean("pair"); boolean wantsPair = np.getBoolean("pair");
@ -130,7 +130,7 @@ public class LanPairingHandler extends BasePairingHandler {
@Override @Override
public void onFailure(Throwable e) { public void onFailure(Throwable e) {
Log.e("LanPairing/onFailure", "Exception", 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); mDevice.sendPacket(createPairPacket(), statusCallback);

View File

@ -35,7 +35,7 @@ public class LoopbackLink extends BaseLink {
@WorkerThread @WorkerThread
@Override @Override
public boolean sendPacket(NetworkPacket in, Device.SendPacketStatusCallback callback) { public boolean sendPacket(NetworkPacket in, Device.SendPacketStatusCallback callback) {
packageReceived(in); packetReceived(in);
if (in.hasPayload()) { if (in.hasPayload()) {
callback.onProgressChanged(0); callback.onProgressChanged(0);
in.setPayload(in.getPayload()); in.setPayload(in.getPayload());

View File

@ -19,7 +19,7 @@ public class LoopbackPairingHandler extends BasePairingHandler {
} }
@Override @Override
public void packageReceived(NetworkPacket np) { public void packetReceived(NetworkPacket np) {
} }

View File

@ -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 * This method does not send an unpair packet, instead it unpairs internally by deleting trusted device info.
* pairing handler * Likely to be called after sending packet from pairing handler
*/ */
private void unpairInternal() { private void unpairInternal() {
@ -548,11 +548,11 @@ public class Device implements BaseLink.PacketReceiver {
if (NetworkPacket.PACKET_TYPE_PAIR.equals(np.getType())) { 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()) { for (BasePairingHandler ph : pairingHandlers.values()) {
try { try {
ph.packageReceived(np); ph.packetReceived(np);
} catch (Exception e) { } catch (Exception e) {
Log.e("PairingPacketReceived", "Exception", e); Log.e("PairingPacketReceived", "Exception", e);
} }
@ -579,9 +579,9 @@ public class Device implements BaseLink.PacketReceiver {
} }
} else { } 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 // 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 // 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 * Send a packet to the device asynchronously
* @param np The packet * @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 * @param callback A callback for success/failure
*/ */
@AnyThread @AnyThread
@ -686,8 +686,8 @@ public class Device implements BaseLink.PacketReceiver {
/* /*
if (!m_outgoingCapabilities.contains(np.getType()) && !NetworkPacket.protocolPacketTypes.contains(np.getType())) { 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.e("Device/sendPacket", "Plugin tried to send an undeclared packet: " + np.getType());
Log.w("Device/sendPacket", "Declared outgoing package types: " + Arrays.toString(m_outgoingCapabilities.toArray())); 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) { 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; return success;
@ -823,8 +823,8 @@ public class Device implements BaseLink.PacketReceiver {
if (pluginEnabled) { if (pluginEnabled) {
boolean success = addPlugin(pluginKey); boolean success = addPlugin(pluginKey);
if (success) { if (success) {
for (String packageType : pluginInfo.getSupportedPacketTypes()) { for (String packetType : pluginInfo.getSupportedPacketTypes()) {
newPluginsByIncomingInterface.put(packageType, pluginKey); newPluginsByIncomingInterface.put(packetType, pluginKey);
} }
} else { } else {
removePlugin(pluginKey); removePlugin(pluginKey);

View File

@ -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) { public static NetworkPacket uriToNetworkPacket(final Context context, final Uri uri, String type) {
try { try {

View File

@ -276,7 +276,7 @@ public class NetworkPacket {
np.mBody.put("incomingCapabilities", new JSONArray(PluginFactory.getIncomingCapabilities())); np.mBody.put("incomingCapabilities", new JSONArray(PluginFactory.getIncomingCapabilities()));
np.mBody.put("outgoingCapabilities", new JSONArray(PluginFactory.getOutgoingCapabilities())); np.mBody.put("outgoingCapabilities", new JSONArray(PluginFactory.getOutgoingCapabilities()));
} catch (Exception e) { } catch (Exception e) {
Log.e("NetworkPackage", "Exception on createIdentityPacket", e); Log.e("NetworkPacket", "Exception on createIdentityPacket", e);
} }
return np; return np;

View File

@ -142,7 +142,7 @@ public class ContactsPlugin extends Plugin {
* The identifiers returned can be used in future requests to get more information * The identifiers returned can be used in future requests to get more information
* about the contact * about the contact
* *
* @param np The package containing the request * @param np The packet containing the request
* @return true if successfully handled, false otherwise * @return true if successfully handled, false otherwise
*/ */
@SuppressWarnings("SameReturnValue") @SuppressWarnings("SameReturnValue")

View File

@ -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. * listensToUnpairedDevices to return true and this method.
*/ */
public boolean onUnpairedDevicePacketReceived(NetworkPacket np) { 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 * Called when a plugin receives a packet. By convention we return true
* when we have done something in response to the package or false * when we have done something in response to the packet or false
* otherwise, even though that value is unused as of now. * otherwise, even though that value is unused as of now.
*/ */
public boolean onPacketReceived(NetworkPacket np) { public boolean onPacketReceived(NetworkPacket np) {

View File

@ -60,7 +60,7 @@ public class ReceiveNotificationsPlugin extends Plugin {
public boolean onPacketReceived(final NetworkPacket np) { public boolean onPacketReceived(final NetworkPacket np) {
if (!np.has("ticker") || !np.has("appName") || !np.has("id")) { 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; return true;
} }

View File

@ -351,7 +351,7 @@ public class RemoteKeyboardPlugin extends Plugin implements SharedPreferences.On
if (!np.getType().equals(PACKET_TYPE_MOUSEPAD_REQUEST) if (!np.getType().equals(PACKET_TYPE_MOUSEPAD_REQUEST)
|| (!np.has("key") && !np.has("specialKey"))) { // expect at least key OR specialKey || (!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; return false;
} }