Search in sources :

Example 21 with NetworkPacket

use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.

the class MprisPlugin method requestPlayerList.

private void requestPlayerList() {
    NetworkPacket np = new NetworkPacket(PACKET_TYPE_MPRIS_REQUEST);
    np.set("requestPlayerList", true);
    device.sendPacket(np);
}
Also used : NetworkPacket(org.kde.kdeconnect.NetworkPacket)

Example 22 with NetworkPacket

use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.

the class MprisPlugin method sendCommand.

private void sendCommand(String player, String method, int value) {
    NetworkPacket np = new NetworkPacket(PACKET_TYPE_MPRIS_REQUEST);
    np.set("player", player);
    np.set(method, value);
    device.sendPacket(np);
}
Also used : NetworkPacket(org.kde.kdeconnect.NetworkPacket)

Example 23 with NetworkPacket

use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.

the class MprisPlugin method askTransferAlbumArt.

public boolean askTransferAlbumArt(String url, String playerName) {
    // First check if the remote supports transferring album art
    if (!supportAlbumArtPayload)
        return false;
    if (url.isEmpty())
        return false;
    MprisPlayer player = getPlayerStatus(playerName);
    if (player == null)
        return false;
    if (player.albumArtUrl.equals(url)) {
        NetworkPacket np = new NetworkPacket(PACKET_TYPE_MPRIS_REQUEST);
        np.set("player", player.getPlayer());
        np.set("albumArtUrl", url);
        device.sendPacket(np);
        return true;
    }
    return false;
}
Also used : NetworkPacket(org.kde.kdeconnect.NetworkPacket)

Example 24 with NetworkPacket

use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.

the class MprisPlugin method sendCommand.

private void sendCommand(String player, String method, String value) {
    NetworkPacket np = new NetworkPacket(PACKET_TYPE_MPRIS_REQUEST);
    np.set("player", player);
    np.set(method, value);
    device.sendPacket(np);
}
Also used : NetworkPacket(org.kde.kdeconnect.NetworkPacket)

Example 25 with NetworkPacket

use of org.kde.kdeconnect.NetworkPacket in project kdeconnect-android by KDE.

the class MprisReceiverPlugin method sendMetadata.

void sendMetadata(MprisReceiverPlayer player) {
    NetworkPacket np = new NetworkPacket(MprisReceiverPlugin.PACKET_TYPE_MPRIS);
    np.set("player", player.getName());
    if (player.getArtist().isEmpty()) {
        np.set("nowPlaying", player.getTitle());
    } else {
        np.set("nowPlaying", player.getArtist() + " - " + player.getTitle());
    }
    np.set("title", player.getTitle());
    np.set("artist", player.getArtist());
    np.set("album", player.getAlbum());
    np.set("isPlaying", player.isPlaying());
    np.set("pos", player.getPosition());
    np.set("length", player.getLength());
    np.set("canPlay", player.canPlay());
    np.set("canPause", player.canPause());
    np.set("canGoPrevious", player.canGoPrevious());
    np.set("canGoNext", player.canGoNext());
    np.set("canSeek", player.canSeek());
    np.set("volume", player.getVolume());
    device.sendPacket(np);
}
Also used : NetworkPacket(org.kde.kdeconnect.NetworkPacket)

Aggregations

NetworkPacket (org.kde.kdeconnect.NetworkPacket)77 IOException (java.io.IOException)6 SSLSocket (javax.net.ssl.SSLSocket)4 SMSHelper (org.kde.kdeconnect.Helpers.SMSHelper)4 BufferedReader (java.io.BufferedReader)3 InputStreamReader (java.io.InputStreamReader)3 ServerSocket (java.net.ServerSocket)3 Socket (java.net.Socket)3 SocketException (java.net.SocketException)3 ArrayList (java.util.ArrayList)3 Timer (java.util.Timer)3 SuppressLint (android.annotation.SuppressLint)2 Uri (android.net.Uri)2 SmsMessage (android.telephony.SmsMessage)2 SpannableString (android.text.SpannableString)2 InputStream (java.io.InputStream)2 OutputStream (java.io.OutputStream)2 DatagramSocket (java.net.DatagramSocket)2 InetAddress (java.net.InetAddress)2 InetSocketAddress (java.net.InetSocketAddress)2