Example #1
0
  public boolean login() {
    Packet req = CreatePacket(XVDR_LOGIN);

    req.setProtocolVersion(XVDRPROTOCOLVERSION);
    req.putU8(mCompressionLevel);
    req.putString(mSessionName);
    req.putU8((short) (mEnableStatus ? 1 : 0));
    req.putU8((short) getPriority());

    // read welcome
    Packet resp = transmitMessage(req);

    if (resp == null) {
      Log.e(TAG, "failed to read greeting from server");
      return false;
    }

    int protocolVersion = resp.getProtocolVersion();
    long vdrTime = resp.getU32();
    long vdrTimeOffset = resp.getS32();
    String server = resp.getString();
    String version = resp.getString();

    Log.i(
        TAG,
        "Logged in at '"
            + vdrTime
            + "+"
            + vdrTimeOffset
            + "' to '"
            + server
            + "' Version: '"
            + version
            + "' with protocol version '"
            + protocolVersion
            + "'");
    Log.i(TAG, "Preferred Audio Language: " + mLanguage);

    return true;
  }
Example #2
0
  /**
   * Start streaming of a LiveTV channel
   *
   * @param channelUid the unique id of the channel
   * @param waitForKeyFrame start streaming after the first IFRAME has been received
   * @param priority priority of the received device on the server
   * @return returns the status of the operation
   */
  public int openStream(int channelUid, String language, boolean waitForKeyFrame, int priority) {
    Packet req =
        CreatePacket(Connection.XVDR_CHANNELSTREAM_OPEN, Connection.XVDR_CHANNEL_REQUEST_RESPONSE);

    req.putU32(channelUid);
    req.putS32(priority); // priority 50
    req.putU8((short) (waitForKeyFrame ? 1 : 0)); // start with IFrame
    req.putString(language);

    Packet resp = transmitMessage(req);

    if (resp == null) {
      return STATUS_NORESPONSE;
    }

    return (int) resp.getU32();
  }