use of org.kde.kdeconnect.NetworkPackage in project kdeconnect-android by KDE.
the class LanLinkProvider method tcpPackageReceived.
//They received my UDP broadcast and are connecting to me. The first thing they sned should be their identity.
void tcpPackageReceived(Socket socket) throws Exception {
NetworkPackage networkPackage;
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String message = reader.readLine();
networkPackage = NetworkPackage.unserialize(message);
//Log.e("TcpListener","Received TCP package: "+networkPackage.serialize());
} catch (Exception e) {
e.printStackTrace();
return;
}
if (!networkPackage.getType().equals(NetworkPackage.PACKAGE_TYPE_IDENTITY)) {
Log.e("KDE/LanLinkProvider", "Expecting an identity package instead of " + networkPackage.getType());
return;
}
Log.i("KDE/LanLinkProvider", "Identity package received from a TCP connection from " + networkPackage.getString("deviceName"));
identityPackageReceived(networkPackage, socket, LanLink.ConnectionStarted.Locally);
}
use of org.kde.kdeconnect.NetworkPackage in project kdeconnect-android by KDE.
the class MousePadPlugin method sendMouseDelta.
public void sendMouseDelta(float dx, float dy, float sensitivity) {
NetworkPackage np = new NetworkPackage(PACKAGE_TYPE_MOUSEPAD_REQUEST);
if (sensitivity <= 0.0001f) {
sensitivity = 1.0f;
}
np.set("dx", dx * sensitivity);
np.set("dy", dy * sensitivity);
device.sendPackage(np);
}
use of org.kde.kdeconnect.NetworkPackage in project kdeconnect-android by KDE.
the class KeyListenerView method sendChars.
public void sendChars(CharSequence chars) {
final NetworkPackage np = new NetworkPackage(MousePadPlugin.PACKAGE_TYPE_MOUSEPAD_REQUEST);
np.set("key", chars.toString());
sendKeyPressPackage(np);
}
use of org.kde.kdeconnect.NetworkPackage in project kdeconnect-android by KDE.
the class MousePadPlugin method sendRightClick.
public void sendRightClick() {
NetworkPackage np = new NetworkPackage(PACKAGE_TYPE_MOUSEPAD_REQUEST);
np.set("rightclick", true);
device.sendPackage(np);
}
use of org.kde.kdeconnect.NetworkPackage in project kdeconnect-android by KDE.
the class MousePadPlugin method sendScroll.
public void sendScroll(float dx, float dy) {
NetworkPackage np = new NetworkPackage(PACKAGE_TYPE_MOUSEPAD_REQUEST);
np.set("scroll", true);
np.set("dx", dx);
np.set("dy", dy);
device.sendPackage(np);
}
Aggregations