use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.
the class SystemVolumePlugin method sendVolume.
void sendVolume(String name, int volume) {
NetworkPacket np = new NetworkPacket(PACKET_TYPE_SYSTEMVOLUME_REQUEST);
np.set("volume", volume);
np.set("name", name);
device.sendPacket(np);
}
use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.
the class SystemVolumePlugin method sendMute.
void sendMute(String name, boolean mute) {
NetworkPacket np = new NetworkPacket(PACKET_TYPE_SYSTEMVOLUME_REQUEST);
np.set("muted", mute);
np.set("name", name);
device.sendPacket(np);
}
use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.
the class SystemVolumePlugin method requestSinkList.
void requestSinkList() {
NetworkPacket np = new NetworkPacket(PACKET_TYPE_SYSTEMVOLUME_REQUEST);
np.set("requestSinks", true);
device.sendPacket(np);
}
use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.
the class PresenterPlugin method sendFullscreen.
public void sendFullscreen() {
NetworkPacket np = new NetworkPacket(PACKET_TYPE_MOUSEPAD_REQUEST);
np.set("specialKey", SpecialKeysMap.get(KeyEvent.KEYCODE_F5));
device.sendPacket(np);
}
use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.
the class RemoteKeyboardPlugin method onPacketReceived.
@Override
public boolean onPacketReceived(NetworkPacket np) {
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!");
return false;
}
if (RemoteKeyboardService.instance == null) {
Log.i("RemoteKeyboardPlugin", "Remote keyboard is not the currently selected input method, dropping key");
return false;
}
if (!RemoteKeyboardService.instance.visible && PreferenceManager.getDefaultSharedPreferences(context).getBoolean(context.getString(R.string.remotekeyboard_editing_only), true)) {
Log.i("RemoteKeyboardPlugin", "Remote keyboard is currently not visible, dropping key");
return false;
}
if (!handleEvent(np)) {
Log.i("RemoteKeyboardPlugin", "Could not handle event!");
return false;
}
if (np.getBoolean("sendAck")) {
NetworkPacket reply = new NetworkPacket(PACKET_TYPE_MOUSEPAD_ECHO);
reply.set("key", np.getString("key"));
if (np.has("specialKey"))
reply.set("specialKey", np.getInt("specialKey"));
if (np.has("shift"))
reply.set("shift", np.getBoolean("shift"));
if (np.has("ctrl"))
reply.set("ctrl", np.getBoolean("ctrl"));
if (np.has("alt"))
reply.set("alt", np.getBoolean("alt"));
reply.set("isAck", true);
device.sendPacket(reply);
}
return true;
}
Aggregations