예제 #1
0
  /** Called when the DDM server connects. The handler is allowed to send messages to the server. */
  public void connected() {
    if (false) Log.v("ddm-hello", "Connected!");

    if (false) {
      /* test spontaneous transmission */
      byte[] data = new byte[] {0, 1, 2, 3, 4, -4, -3, -2, -1, 127};
      Chunk testChunk = new Chunk(ChunkHandler.type("TEST"), data, 1, data.length - 2);
      DdmServer.sendChunk(testChunk);
    }
  }
예제 #2
0
  /** Handle a chunk of data. */
  public Chunk handleChunk(Chunk request) {
    if (false) Log.v("ddm-heap", "Handling " + name(request.type) + " chunk");
    int type = request.type;

    if (type == CHUNK_HELO) {
      return handleHELO(request);
    } else if (type == CHUNK_FEAT) {
      return handleFEAT(request);
    } else {
      throw new RuntimeException("Unknown packet " + ChunkHandler.name(type));
    }
  }