use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.
the class BigscreenPlugin method sendUp.
public void sendUp() {
NetworkPacket np = new NetworkPacket(PACKET_TYPE_MOUSEPAD_REQUEST);
np.set("specialKey", SpecialKeysMap.get(KeyEvent.KEYCODE_DPAD_UP));
device.sendPacket(np);
}
use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.
the class BigscreenPlugin method sendSelect.
public void sendSelect() {
NetworkPacket np = new NetworkPacket(PACKET_TYPE_MOUSEPAD_REQUEST);
np.set("specialKey", SpecialKeysMap.get(KeyEvent.KEYCODE_ENTER));
device.sendPacket(np);
}
use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.
the class BigscreenPlugin method sendHome.
public void sendHome() {
NetworkPacket np = new NetworkPacket(PACKET_TYPE_MOUSEPAD_REQUEST);
np.set("alt", true);
np.set("specialKey", SpecialKeysMap.get(KeyEvent.KEYCODE_F4));
device.sendPacket(np);
}
use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.
the class ReceiveNotificationsPlugin method onCreate.
@Override
public boolean onCreate() {
// request all existing notifications
NetworkPacket np = new NetworkPacket(PACKET_TYPE_NOTIFICATION_REQUEST);
np.set("request", true);
device.sendPacket(np);
return true;
}
use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.
the class SMSPlugin method handleRequestSingleConversation.
private boolean handleRequestSingleConversation(NetworkPacket packet) {
SMSHelper.ThreadID threadID = new SMSHelper.ThreadID(packet.getLong("threadID"));
long rangeStartTimestamp = packet.getLong("rangeStartTimestamp", -1);
Long numberToGet = packet.getLong("numberToRequest", -1);
if (numberToGet < 0) {
numberToGet = null;
}
List<SMSHelper.Message> conversation;
if (rangeStartTimestamp < 0) {
conversation = SMSHelper.getMessagesInThread(this.context, threadID, numberToGet);
} else {
conversation = SMSHelper.getMessagesInRange(this.context, threadID, rangeStartTimestamp, numberToGet, true);
}
// Sometimes when desktop app is kept open while android app is restarted for any reason
// mostRecentTimeStamp must be updated in that scenario too if a user request for a
// single conversation and not the entire conversation list
mostRecentTimestampLock.lock();
for (SMSHelper.Message message : conversation) {
if (message.date > mostRecentTimestamp) {
mostRecentTimestamp = message.date;
}
}
mostRecentTimestampLock.unlock();
NetworkPacket reply = constructBulkMessagePacket(conversation);
device.sendPacket(reply);
return true;
}
Aggregations