Package ch.ethz.inf.vs.californium.coap

Examples of ch.ethz.inf.vs.californium.coap.MessageObserverAdapter


      System.out.println("+++++ Sending PUT +++++");
      Request asyncRequest = new Request(Code.PUT, Type.CON);
      asyncRequest.setURI(uri);
      asyncRequest.getOptions().setContentFormat((int) Math.random() * 0xFFFF + 1);
      asyncRequest.setPayload("Random");
      asyncRequest.addMessageObserver(new MessageObserverAdapter() {
        public void onResponse(Response response) {
          if (response != null) {
            checkInt(EXPECTED_RESPONSE_CODE_1.value,
                response.getCode().value, "code");
          }
View Full Code Here


                System.out.println("++++ obs-reset PUT ++++");
                Request asyncRequest = new Request(Code.POST, Type.CON);
                asyncRequest.setPayload("sesame");
                asyncRequest.setURI(serverURI + "/obs-reset");
                asyncRequest.addMessageObserver(new MessageObserverAdapter() {
                    public void onResponse(Response response) {
                        if (response != null) {
                          System.out.println("Received: " + response.getCode());
                          System.out.println("+++++++++++++++++++++++");
                        }
View Full Code Here

        // Delete the /obs resource of the server (either locally or by
        // having another CoAP client perform a DELETE request)
        System.out.println("+++++ Sending DELETE +++++");
        Request asyncRequest = new Request(Code.DELETE, Type.CON);
        asyncRequest.setURI(uri);
        asyncRequest.addMessageObserver(new MessageObserverAdapter() {
          public void onResponse(Response response) {
            if (response != null) {
              checkInt(EXPECTED_RESPONSE_CODE_1.value, response.getCode().value, "code");
            }
          }
View Full Code Here

    dmtRes.removeAllChildren();
    dtmRes.reload();
   
    Request request = new Request(Code.GET);
    request.setURI(COAP_PROTOCOL+getHost()+"/.well-known/core");
    request.addMessageObserver(new MessageObserverAdapter() {
      @SuppressWarnings({ "rawtypes", "unchecked" })
      public void onResponse(Response response) {
        String text = response.getPayloadString();
        Scanner scanner = new Scanner(text);
        Pattern pattern = Pattern.compile("<");
View Full Code Here

TOP

Related Classes of ch.ethz.inf.vs.californium.coap.MessageObserverAdapter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.