Exemple #1
0
  public String getConfig(String key) {
    Packet request = CreatePacket(XVDR_GET_CONFIG);
    request.putString(key);

    Packet response = transmitMessage(request);

    if (response == null) {
      return "";
    }

    return response.getString();
  }
Exemple #2
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;
  }